Skip to main content

Module qwen_batched

Module qwen_batched 

Source
Expand description

════════════════════════════════════════════════════════════════════════════════════════════════ BATCHED Qwen3-30B decode — the lane where “beat llama” is a landslide, not a 4% wall.

The batch-1 decode is memory-wall bound (each weight byte read once, serves one token). The batched decode runs B sequences in lockstep: every weight kernel is launched with a batch dimension (grid.y = B), so a weight row read once serves B tokens (reused through L2) — llama itself scales 7× this way. Per-token order is IDENTICAL to the batch-1 kernels ⇒ every sequence is byte-exact to the batch-1 golden (token-exact per sequence), while aggregate throughput (S_TG = B·steps/time) scales toward — and past — llama-batched-bench.

The lane is written by hand from the batch-1 lane’s kernels, not compiled from qwen30b.lg; only the execution is batched. Correctness gate: every one of the B sequences emits the golden token stream. Speed gate: aggregate S_TG > llama-batched-bench at the same B. ════════════════════════════════════════════════════════════════════════════════════════════════

Functions§

emit_qwen30b_generate_batched
Emit a self-contained CUDA program that runs the real Qwen3-30B-A3B decode over batch parallel sequences and reports aggregate S_TG plus the golden token stream for every sequence. Weights fopen from wdir.