Pull requests / #2746
#2746 sycl: use packed word expansion for Q2_0 expert down on Battlemage
open · @xiangyuT · 0 comments · View on GitHub
Multi-GPUNVIDIA / CUDAModels & quantsWindowsLinux
Description
## Summary Replace the byte-permute/codebook expansion in Q2_0 expert down with exact packed-word shifts, masks and arithmetic. The decoder stays in the existing Q2_0 format specialization and is selected at compile time for the eligible down path. The existing INT8 DP4A operations, scales, FP32 accumulation and reduction order are preserved. On B70, warmed client TPOT improves by 4.18–4.48%; TTFT has no clear improvement. The change is confined to `sycl/src/kernels/cuda/iq_kernels.dp.cpp`; decoder helpers remain private to that translation unit. It follows upstream `intel_gpu_gen` / `IntelGpuGen::Battlemage` classification and the existing 8-lane, non-legacy, non-split dispatch conditions. There is no model-specific shape whitelist. Other formats and GU keep their existing algorithms and dispatch. Non-Battlemage devices retain the original decoder dispatch; eligible Q2 calls still incur the added cached host device check. ## Dispatch control `STRATA_SYCL_Q2_WORD_EXPAND` controls the entire optimization: - Unset (default) or `1`: use word expansion when the existing dispatch and Battlemage guards allow it. - `0`: use the original Q2_0 down path. There are no child switches. Set it before starting the engine and restart after changing it; the value is cached on first use. Normal operation needs no environment-variable setting. ## B70 validation Intel Arc Pro B70 32 GB, Linux/xe; `intel/omix:0.4.0-devel-ubuntu24.04`, oneAPI DPC++ 2026.1.1, compute runtime 26.31.39395.13, Level Zero loader 1.32.0. Container limits: 128 GiB RAM and 16 CPU quota. Builds and GPU tests ran inside the container, with AOT `bmg-g31`. - Release engine build and `native_grouped_parity` pass with default and fallback dispatch. - All 65,536 packed 16-bit words decode byte-identically to the original GPU implementation and CPU codebook; upper-bit handling is also checked. - Real-GGUF expert tests pass byte-exact down and full-output comparisons with five activation patterns, T=1–8, GU16/GU22, graph replay, mixed host/device weights, empty groups and output guards. - In the endpoint measurements below, corresponding output token IDs match across all arms, including warmups. Actual speculative work and cache capacity match between arms. Timings and endpoint identity checks below were collected at `fe47faa548ea6aba50101987bc255b5ed8eccd03`, before the source cleanup. The current revision rebuilds the engine and parity targets and repeats decoder/down correctness validation. For these B70 AOT builds, executed kernel instructions and resource settings match the measured version; differences are limited to naming and non-executed markers after the final EOT. No new latency run is claimed. ## End-to-end performance Baseline and frontend: upstream `296b59d2f73c8f04a805df29c2fa97655adace78`. The candidate adds only this Q2 down change and uses its default production dispatch. Each input length uses baseline / candidate / baseline, restarting the engine for each arm. Exclude one short request and three full-input warmups, then measure three requests per arm. Changes average the three request-wise percentage changes relative to the mean of the matching before/after baseline samples; negative means faster. All three TPOT pairs improve at every input length. TTFT is request send to the first nonempty SSE text arrival. TPOT is the first-to-last nonempty SSE arrival interval divided by generated tokens minus one. These are warmed, post-readiness measurements; the host page cache was not flushed. | Input / output tokens | TTFT baseline → default (s) | Change | TPOT baseline → default (ms/token) | Change | |---|---:|---:|---:|---:| | 4096 / 128 | 3.500022 → 3.495323 | -0.134% | 14.552169 → 13.920341 | -4.345% | | 8192 / 256 | 7.094365 → 7.104670 | +0.145% | 13.751785 → 13.134993 | -4.477% | | 32768 / 256 | 30.016363 → 30.018130 | +0.006% | 14.223863 → 13.630544 | -4.183% | Baseline before/after TPOT drift: +0.034%, +0.043%, -0.003%; TTFT drift: -0.177%, +0.362%, +0.017%, respectively. <details> <summary>Model and fixed configuration</summary> - Qwen3.8-Flash-Next-GSQ-RCO IQ2_XS, model revision `ed59f92082b1e93c0e96d60a8b11aab089b52f09`. Its routed expert down matrices use Q2_0. - Greedy seed 42, thinking off; INT8 KV, max context 131072, resident KV 32768; prompt cache off. - `--expert-cache auto`, reserve 1536 MiB, mirror budget 32768 MiB; auto prefill, no prefill borrowing. - spec4 / min-p0.5 / suffix3; adapt-every8 / decay1. Actual windows/offered/accepted match for corresponding measured requests. - Actual capacity in every arm: 17758 resident expert slots and 6818 mirrored experts, approximately 9.17 GiB. The 32768 MiB mirror setting is a budget. - Common environment: `STRATA_VERIFY_DEVICE_PLAN=1`, `STRATA_VERIFY_NO_HOST=1`, `STRATA_STAGER_THREADS=12`, `STRATA_MIRROR_MIB=32768`, `STRATA_DECODE_TIMING=1`, `ONEAPI_DEVICE_SELECTOR=level_zero:gpu`, `SYCL_CACHE_PERSISTENT=0`. Normal timing runs have no profiler. </details> ## Down microbenchmark Real GGUF weights at the model's down dimensions, K=640 and N=2560, with deterministic synthetic activations and fixed expert-group replay inputs. T is the token-window size. The probe directly selects the original or word-expansion down implementation in the same binary; end-to-end results above use production dispatch. Three measured samples per baseline / candidate / baseline arm; each sample excludes at least 2 seconds/1000 calls of warmup and measures at least 3 seconds/2000 calls. These are steady graph-replay batched wall times including host submission and the final queue wait. They are not isolated GPU instruction latency, and their percentages are not added to endpoint gains. | K / N / T | Original (µs) | Word expansion (µs) | Change | Baseline drift | |---|---:|---:|---:|---:| | 640 / 2560 / 1 | 40.445 | 22.696 | -43.883% | -0.180% | | 640 / 2560 / 2 | 55.619 | 32.673 | -41.255% | +0.024% | | 640 / 2560 / 3 | 78.320 | 45.022 | -42.515% | +0.011% | | 640 / 2560 / 4 | 81.888 | 44.822 | -45.264% | -0.016% | All three corresponding samples improve for each listed row. These measurements and current validation cover single-card B70 AOT; Windows, multi-GPU operation and JIT paths on other devices were not tested.
Related on this site
Quick links to related pages.