pub struct HyperDecodeWs {
pub mixes: CudaSlice<f32>,
pub pre: CudaSlice<f32>,
pub post: CudaSlice<f32>,
pub comb: CudaSlice<f32>,
pub y: CudaSlice<f32>,
pub h: CudaSlice<f32>,
pub z: CudaSlice<f32>,
pub xb: CudaSlice<f32>,
/* private fields */
}Expand description
Persistent T=1 decode workspace for the hc glue (lane/glm5-decode-diet lever 2,
MEMRA_HC_DECODE_WS). One per engine (pp stage), pooled on the Engine like
fa_part_pool/router_stage: the launch-diet census measured 2,358
cuMemAllocAsync+Free calls/token (~2.5 ms of host time feeding the sync-serialized
drain cycles), and the hc glue chain — mixes, gates, comb, collapse y, the two norm
scratches and the two per-site post outputs — re-allocated all of it every token. Every
buffer here is FULLY OVERWRITTEN before any read on every step (GEMV beta=0, block-per-
token kernels, rms_norm, hc_post), which is what makes reuse byte-identical: the same
kernels read and write the same values, only the allocator calls disappear.
The stream-state ping-pong deliberately has ONE slot (xb): the walk swaps the owned
in-flight state x with xb after each site’s hc_post, so the pair rotates without a
copy and the walk still returns an owned buffer to the caller (no signature churn at the
stage boundary — the ppN transport consumes it exactly as before).
Fields§
§mixes: CudaSlice<f32>§pre: CudaSlice<f32>§post: CudaSlice<f32>§comb: CudaSlice<f32>§y: CudaSlice<f32>§h: CudaSlice<f32>Attention-site rms_norm scratch (the walk’s h).
z: CudaSlice<f32>MLP-site rms_norm scratch (the walk’s z).
xb: CudaSlice<f32>The hc_post output slot the walk ping-pongs with the in-flight stream state.
Implementations§
Source§impl HyperDecodeWs
impl HyperDecodeWs
pub fn new( e: &Engine, topology: &HyperTopology, hidden: usize, ) -> Result<Self, Box<dyn Error>>
Sourcepub fn matches(&self, topology: &HyperTopology, hidden: usize) -> bool
pub fn matches(&self, topology: &HyperTopology, hidden: usize) -> bool
A pooled workspace is only reusable for the same trunk geometry; anything else is rebuilt (one engine serves one loaded model in practice, this is a guard, not a path).