STRA-338 size: engine slice: GemmRef alias keeps the dyn-trait ratchet falling; tighten baselines
This commit is contained in:
@@ -49,7 +49,7 @@
|
||||
"dyn-trait:leleka-deploy": 17,
|
||||
"dyn-trait:leleka-engine-core": 18,
|
||||
"dyn-trait:leleka-engine-fake": 1,
|
||||
"dyn-trait:leleka-engine-qwen35-cuda": 52,
|
||||
"dyn-trait:leleka-engine-qwen35-cuda": 51,
|
||||
"dyn-trait:leleka-experimental-ref": 3,
|
||||
"dyn-trait:leleka-gateway-domain": 5,
|
||||
"dyn-trait:leleka-gptoss": 10,
|
||||
|
||||
@@ -21,6 +21,9 @@ const ALPHA_BETA: usize = 96;
|
||||
const BATCH_RESERVE: usize = 128 * 1024 * 1024;
|
||||
const EAGER_TOKENS: usize = 64;
|
||||
/// Largest dequantized GDN matrix (attn_qkv, 10240 x 2560) in FP16 bytes.
|
||||
/// The shared exclusively loaned GEMM adapter every batched step receives.
|
||||
type GemmRef<'a> = &'a dyn GdnGemm;
|
||||
|
||||
pub(in crate::qwen_forward) const BATCH_SCRATCH_BYTES: usize = CHANNELS * MIXED * 2;
|
||||
|
||||
/// BF16 alpha/beta GEMM profile. `HighOnly` is the original default
|
||||
|
||||
@@ -26,7 +26,7 @@ impl GdnStage {
|
||||
cache: &DenseWeightCache<'ctx>,
|
||||
owner: &mut GdnChunkDevice<'ctx>,
|
||||
resources: &mut GdnBatchResources<'ctx>,
|
||||
gemm: &dyn GdnGemm,
|
||||
gemm: GemmRef<'_>,
|
||||
) -> Result<Vec<ChunkReady>> {
|
||||
#[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
|
||||
let _owner_wall_scope =
|
||||
|
||||
@@ -155,7 +155,7 @@ pub(super) fn window_bytes<'a, 'ctx>(
|
||||
/// Upload, run the closed GDN program and read back the next history and the Out projection.
|
||||
pub(super) fn run_gdn_program<'ctx>(
|
||||
resources: &mut GdnBatchResources<'ctx>,
|
||||
gemm: &dyn GdnGemm,
|
||||
gemm: GemmRef<'_>,
|
||||
tokens: usize,
|
||||
ops: &GdnOperands<'_, 'ctx>,
|
||||
bytes: &WindowBytes<'_, 'ctx>,
|
||||
|
||||
@@ -21,6 +21,9 @@ use leleka_cuda_driver::{
|
||||
MoeRouteBatch,
|
||||
};
|
||||
|
||||
/// The shared exclusively loaned GEMM adapter every batched step receives.
|
||||
type GemmRef<'a> = &'a dyn GdnGemm;
|
||||
|
||||
const MIXED: usize = 2560;
|
||||
const EXPERTS: usize = 512;
|
||||
const SELECTED: usize = 10;
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ impl MoePrefillStage {
|
||||
weights: SharedWeights<'_, 'ctx>,
|
||||
combine: Option<CombineInput<'_, 'ctx>>,
|
||||
resources: &mut MoePrefillResources<'ctx>,
|
||||
gemm: &dyn GdnGemm,
|
||||
gemm: GemmRef<'_>,
|
||||
) -> Result<MoeMicroProducts<'ctx>> {
|
||||
resources.validate_context(current)?;
|
||||
let plan = validate_micro(binding, layer, reads, router, &weights, combine.as_ref())?;
|
||||
@@ -64,7 +64,7 @@ impl MoePrefillStage {
|
||||
products: &mut MoeMicroProducts<'ctx>,
|
||||
combine: CombineInput<'_, 'ctx>,
|
||||
resources: &mut MoePrefillResources<'ctx>,
|
||||
gemm: &dyn GdnGemm,
|
||||
gemm: GemmRef<'_>,
|
||||
) -> Result<()> {
|
||||
resources.validate_context(current)?;
|
||||
let tokens = check_combine_window(binding, layer, expected, products, &combine)?;
|
||||
|
||||
@@ -123,7 +123,7 @@ fn check_shared(weights: &SharedWeights<'_, '_>, layer: LayerId) -> Result<[GdnN
|
||||
pub(super) fn route_on_device<'ctx>(
|
||||
mut buffers: Buffers<'ctx>,
|
||||
resources: &mut MoePrefillResources<'ctx>,
|
||||
gemm: &dyn GdnGemm,
|
||||
gemm: GemmRef<'_>,
|
||||
inputs: &MicroInputs<'_, 'ctx>,
|
||||
mixed_bytes: &[u8],
|
||||
) -> Result<(Buffers<'ctx>, MoeRouteBatch)> {
|
||||
@@ -139,7 +139,7 @@ pub(super) fn route_on_device<'ctx>(
|
||||
fn launch_route<'ctx>(
|
||||
buffers: &mut Buffers<'ctx>,
|
||||
resources: &mut MoePrefillResources<'ctx>,
|
||||
gemm: &dyn GdnGemm,
|
||||
gemm: GemmRef<'_>,
|
||||
inputs: &MicroInputs<'_, 'ctx>,
|
||||
mixed_bytes: &[u8],
|
||||
) -> Result<MoeRouteBatch> {
|
||||
@@ -267,7 +267,7 @@ pub(super) fn combine_on_device<'ctx>(
|
||||
resources: &mut MoePrefillResources<'ctx>,
|
||||
products: &MoeMicroProducts<'ctx>,
|
||||
tokens: usize,
|
||||
gemm: &dyn GdnGemm,
|
||||
gemm: GemmRef<'_>,
|
||||
combine: &CombineInput<'_, 'ctx>,
|
||||
bo: &DeviceBuffer<'ctx>,
|
||||
) -> Result<()> {
|
||||
|
||||
Reference in New Issue
Block a user