The iGPU streams a 1 GiB buffer at about 40 GB/s (CPU: about 36 GB/s) and accepted 14 GiB of storage buffers, so the whole model fits in device memory. The README records both results and the decision to build a phased iGPU prefill backend with the CPU keeping decode. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
iGPU int8 matmul spike (STRA-207)
EXPERIMENT. Not part of the workspace (own [workspace]), not built by CI, safe to delete once the
decision below is made. Run: cargo run --release -- [M] [N] [K] [dispatches] (builds with wgpu 26 from
crates.io; no other downloads, no shader compiler: the kernels are WGSL generated as text).
Question: can the integrated GPU of the reference laptop (Intel Graphics, Core Ultra 7 265U, driver 32.0.101.8860, visible through Vulkan and DX12) multiply int8 matrices fast enough to be worth using for prefill, which is compute-bound on the CPU (about 17-20 tokens/s)?
Result (2026-10-14, one run each, machine not isolated)
- wgpu 25's shader translator rejects
dot4I8Packed; wgpu 26 accepts it and the driver runs it natively. - Instruction ceiling (register-only loop of packed dot products): 2.74 TOPS int8.
- A naive tiled matmul reached 0.21-0.30 TOPS. The cause was dynamically indexed private arrays (accumulators and operands) that the driver spilled to scratch memory; removing the global loads or the dot products alone changed almost nothing, which exposed it. With every accumulator and operand a named scalar (the shader text is generated), the 8x8-outputs-per-thread kernel reaches:
| M x N x K | int8 throughput |
|---|---|
| 256 x 4096 x 2880 (k-step 4 words) | 1.28 TOPS |
| 512 x 2880 x 2880 | 0.98 TOPS |
| 128 x 5760 x 2880 | 0.93 TOPS |
| 64 x 5760 x 2880 | 0.81 TOPS |
| 32 x 2880 x 2880 | 0.47-0.64 TOPS |
All results were checked against the CPU on sampled outputs. The CPU's practical rate for the same product in the decoder is about 0.25 TOPS (prefill measured 17-20 tokens/s), so the GPU is roughly 3-5x faster on the matrix products before any further tuning (subgroup operations, wider loads, f16 accumulation of the block scales are untried).
Memory and bandwidth (same day)
- Streaming read of a 1 GiB buffer: about 40 GB/s (best 40.6), against about 36 GB/s for the CPU on the same DRAM: the GPU is not a faster decoder, its value is compute for prefill.
- The device accepted 14 GiB of 1 GiB storage buffers (
CAPACITY_GIB=14; the cap was mine) with 19 GB of RAM free, so the whole 12 GB model can live in device buffers. Unified memory: the buffers are ordinary system RAM and count against the 31.5 GB.
What this does not show
- Only the integer product. MXFP4 weights must be decoded in the shader (a table lookup per nibble) and every 32-element block needs its float scale applied; that costs ALU and was not measured.
- No attention, routing, or MoE gather/scatter; no weight upload; no end-to-end token rate.
- Memory: wgpu cannot use the memory-mapped model file, so the GPU needs its own copy of the weights (11.3 GB of experts plus 1.3 GB of dense tensors) in addition to the CPU's page-cache copy. The machine has 32 GB (about 19 GB free with a browser open). Options: GPU-resident weights for prefill and decode (one copy, CPU runtime unused for this model), or both copies (about 24 GB, tight), or GPU for the dense and attention parts only.
Decision (made by the agent under the owner's "any idea that speeds up the pipeline" direction)
Build an iGPU prefill backend as a separate crate (pure Rust wgpu, WGSL kernels, no unsafe) in phases:
GEMM kernels checked against the CPU kernels on real weights, then a full prefill layer, then export of the
KV cache to the CPU decoder, which stays the decode engine (the GPU reads memory no faster). Weights live in
device buffers (about 12 GB) next to the CPU's mapped copy; that needs close to 24 GB of the 31.5 GB, so the
backend must stay optional and refuse to start when free RAM is short. Tracked as STRA-219. Bionic's Vulkan
engine reaches about 90 tokens/s prefill on this machine; a 4,000-token first prompt takes about 4 minutes on
the CPU runtime.