STRA-338 params r03: GdnStage::step_chunk_batch takes the PromptLayer

binding, layer, cache and the lent device context are the existing PromptLayer (8 -> 5 parameters).

Files:
crates/engine-qwen35-cuda/src/qwen_forward/executor_prefill_chunk/prepare_micro_ffn_rows_fn/gdn_native.rs
This commit is contained in:
Pavlo Ratushnyi
2026-11-08 01:57:22 +01:00
parent 3bd4589873
commit 27433ac8aa
2 changed files with 6 additions and 7 deletions
@@ -2,6 +2,7 @@
#[allow(unused_imports)]
use super::*;
use crate::qwen_forward::gdn::PromptLayer;
use crate::qwen_forward::gdn::chunk_device::ChunkEdge;
use crate::qwen_forward::gdn::chunk_producer::ChunkReady;
use crate::qwen_forward::session::chunk::GdnChunkMicro;
@@ -47,7 +48,8 @@ fn gdn_window_step<'ctx>(
let gemm = workspace.gdn_gemm().map_err(crate::qwen_forward::gdn::driver_error)?;
// Keep both real owners and the exclusive shared stream loan
// alive until the whole producer's complete finite drain.
GdnStage::step_chunk_batch(binding, env.layer, window, current, cache, owner, &mut resources, &gemm)
let prompt = PromptLayer { binding, layer: env.layer, cache, current };
GdnStage::step_chunk_batch(prompt, window, owner, &mut resources, &gemm)
}
/// The attention block of one row of the completed GDN window, with the row's chunk edge.
@@ -11,24 +11,21 @@ impl GdnStage {
/// The batched Strata-prefill GDN step over one genuine current causal
/// micro-window (`prepare_attention_micro_gdn`'s `execute` callback). Rows,
/// residual-ready inputs and the cursor come only from `micro`, which is
/// validated against this chunk device; `current` is the actual device
/// validated against this chunk device; `prompt.current` is the actual device
/// context the callback lends; `gemm` is the exclusively loaned shared
/// workspace adapter, retained through the final drain of this call.
/// Returns one `ChunkReady` per row, in order, each carrying its host copy
/// of the Out projection and its genuine journal edge. All edges are minted
/// only after the whole batch drained finite and the chunk device adopted
/// the final state.
#[allow(clippy::too_many_arguments)] // Genuine micro, context, caches and loans.
pub(in crate::qwen_forward) fn step_chunk_batch<'ctx>(
binding: &ModelBinding,
layer: LayerId,
prompt: PromptLayer<'_, '_, 'ctx>,
micro: &GdnChunkMicro,
current: &Context<'_>,
cache: &DenseWeightCache<'ctx>,
owner: &mut GdnChunkDevice<'ctx>,
resources: &mut GdnBatchResources<'ctx>,
gemm: GemmRef<'_>,
) -> Result<Vec<ChunkReady>> {
let PromptLayer { binding, layer, cache, current } = prompt;
#[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
let _owner_wall_scope =
crate::qwen_forward::owner_wall_profile::Scope::begin(crate::qwen_forward::owner_wall_profile::Stage::Gdn);