Expand description
Pre-allocated GPU buffer arena for intermediate tensors.
All buffer sizes derive from ModelConfig (SSOT). The arena is
allocated once during initialization and reused across decode steps.
Re-exports§
pub use decode_meta::DECODE_META_MAX_ROWS;pub use decode_meta::DECODE_META_MIN_ROWS;pub use decode_meta::DecodeMetaLayout;
Modules§
- decode_
meta - Fixed-stride batched-decode metadata layout, derived from the serve
max_batch_size(SSOT — consumed bysizes.rsfor the scratch envelope and byspark-model’supload_batch_metadata_fixed/_atfor the upload offsets, replacing the former hardcoded 0/128/256/512/768 gaps that fit exactly 32 rows).
Structs§
- Buffer
Arena - Pre-allocated GPU buffers for a single forward pass.
- Buffer
Sizes - Byte sizes of each buffer, derived from ModelConfig.
Constants§
- Q12_
SIZING_ STREAMS - Streams assumed when provisioning scratch for the Q12 kernel-batched
prefill path. The per-stream metadata region scales with N, so the
scratch buffer must be sized for a realistic max concurrent batched
streams. Beyond this,
check_kernel_batched_eligiblefalls the dispatch back to the per-stream path (which respects the same arena cap), so this bound only governs how often the fast path is available — never safety.
Functions§
- q2_
dequant_ scratch_ bytes - Bytes for the native keep-packed Q2_0 prefill transient-dequant scratch: the
LARGEST keep-packed projection
[N, K]expanded to BF16 (2 bytes/elem). The prefill dequant writesN*KBF16 elements into this buffer, which is then consumed by the same-stream GEMM and reused by the next projection. - q12_
batched_ scratch_ bytes - Exact scratch footprint (bytes) of the Q12 kernel-batched prefill staging
for
nstreams ofchunk_lentokens each. SSOT for both scratch sizing (BufferSizes::from_config) and the pre-flight eligibility check (check_kernel_batched_eligible), so the two can never disagree about whether a batch fits. Mirrors the staging layout inbatch_kernel.rs(MoE topk area + N per-stream meta blocks) andstage_batched.rs(stacked positions ×(3 if MRoPE) + slots + block/seq_len pointer arrays) plus the per-SSM-layerh_state_ptrsJIT slot. - q12_
batched_ scratch_ bytes_ varlen - Exact scratch footprint for a ragged Q12 batch.