Repository navigation
[Quantization][XPU] Enable int8_w8a8 MoE on the Triton backend for XPU - #53162
Conversation
c774080 to
3d996a7
Compare
…r XPU `TritonExperts._supports_quant_scheme` gated every int8_w8a8 scheme on `(is_cuda() and cap >= 7.5) or is_rocm()`, so XPU was excluded by omission even though it reaches the same `fused_moe_kernel`: `TritonExperts` already reports `_supports_current_device()` true for XPU, and `oracle/int8.py`'s priority list has no platform branch at all. The int8 dequant path in the kernel is plain Triton (`tl.load` of the scales, then `tl.dot`), so nothing in it is CUDA-specific. Only the per-token scheme is enabled. Its activation quantization is a Triton kernel (`per_token_quant_int8`), whereas the per-tensor schemes go through `ops.scaled_int8_quant`, a custom op with no XPU implementation -- enabling those would fail later, in the prepare step, so the oracle should keep refusing them. Validated on Intel Arc Pro B70 (triton-xpu 3.7.2): - before: both int8 pairs raise (`auto` -> NotImplementedError, `--moe-backend triton` -> ValueError) - after: per-token selects TRITON/TritonExperts; per-tensor still refused - numerics: 2/2 kernel launches with `use_int8_w8a8=True`, max relative error 1.6e-2 vs a dequantized bf16 reference, no NaN/Inf -- i.e. Triton-XPU int8 `tl.dot` is correct, which was the open question behind the original gate - `tests/quantization/test_int8_moe_oracle.py`: 2 passed / 4 skipped on XPU No CUDA regression: same file on an H200 goes 4 passed -> 5 passed (the extra one is the new cross-device test), with the XPU-specific case skipped. Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Artur Fierka <artur.fierka@intel.com>
3d996a7 to
31452a6
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughThe change enables Intel XPU for Triton INT8 MoE quantization. The oracle tests now select the active device, include XPU in support checks, identify parameterized schemes, and validate XPU scaled INT8 quantization. ChangesXPU INT8 MoE support
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This enables XPU INT8 Triton MoE support and updates its oracle coverage without an identified correctness, runtime, or compatibility issue. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
/ci run |
|
✅ Triggered Buildkite CI #89488 for commit |
|
/ci retry |
|
✅ Queued 1 failed job(s) for retry in Buildkite CI #89488. |
|
@jikunshang CI is green now and ready for merge. Thanks! |
vllm-project#53162) Signed-off-by: Artur Fierka <artur.fierka@intel.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Kunshang Ji <kunshang.ji@intel.com>
Replaces #52712 (withdrawn before review; the branch was rebased since, so GitHub would not reopen it).
Bug
int8_w8a8MoE is unsupported on XPU by omission.TritonExperts._supports_quant_schemegates every int8 scheme on(is_cuda() and capability >= (7,5)) or is_rocm(), so CUDA and ROCm get both dynamic-activation schemes and XPU gets neither — even though the kernel, the launcher andTritonExperts._supports_current_device()are all already XPU-capable, andoracle/int8.pyhas no platform branch at all ([TRITON, HUMMING, CPU]everywhere).Fix
Add
or current_platform.is_xpu()to that gate, so XPU declares the same two schemes CUDA and ROCm do. Both activation paths work there: per-token uses the Tritonper_token_quant_int8; per-tensor resolves to the XPU branch ofops.scaled_int8_quant(_custom_ops.py, added by #47205), which is plain elementwise arithmetic — what XPU actually lacks istorch.ops._C.static_scaled_int8_quant/dynamic_scaled_int8_quant, which that wrapper doesn't call. A test pins the XPU branch so it cannot be removed silently.Reproduce
On
main, Intel Arc Pro B70:ValueError: Int8 MoE backend TRITON does not support the deployment configuration since kernel does not support quantization scheme QuantKey(i8, scale(f32, static, per_channel), ...).Config fetched 2026-08-20: weights
{num_bits: 8, strategy: channel, group_size: null}, activations{num_bits: 8, strategy: token, dynamic: true},ignore: ["lm_head"]only — all 64 routed experts carry the scheme.--trust-remote-codeis needed for the repo'sauto_map; its two remote files are byte-identical (SHA-256) todeepseek-ai/deepseek-moe-16b-chat.Test
pytest tests/quantization/test_int8_moe_oracle.py— controlled A/B on one tree, only the production diff applied:No pre-existing test changes state on either CUDA generation. The B70 row now covers both schemes; the remaining skip is the XPU-only
scaled_int8_quantpin, which skips off XPU.Runtime, B70: engine starts,
Using TRITON Int8 MoE backend out of potential backends: ['TRITON', 'HUMMING', 'CPU'],"What is 15 plus 27?"→"15 plus 27 is 42.", and a spy ontriton_moe.invoke_fused_moe_triton_kernelcounts 918/918 launches withuse_int8_w8a8=True.lm_eval==0.4.12gsm8k 5-shot, 1319 questions, seed 42, per-token scheme:v0.27.0The CUDA row is a control, not an A/B — no A/B is possible on XPU because
maincannot start this config. It shows the low score and the zerostrict-matchcome from the checkpoint (its tokenizer emits raw BPE markers, breaking the#### Nformat), not from XPU.pre-commitgreen includingmypy-3.10; ruff 0.14.0 clean.Gaps
fused_experts_impl(max rel err 0.0265 against a bf16-dequant reference, versus 0.0175 for per-token), but no published MoE checkpoint usesweights.strategy: tensor— of 115 compressed-tensors / W8A8 MoE candidates on the Hub, 32 arestrategy: channeland none isstrategy: tensor. It is enabled for parity with CUDA/ROCm rather than for a checkpoint I can point at.Duplicate check
No open PR touches
TritonExperts._supports_quant_scheme. Nearest related work is #45776, which makes the same widening for XPU FP8 inXPUExpertsFp8._supports_quant_scheme; #51515 touchesTritonWNA16Experts.apply, no overlap. Re-checked 2026-09-07 againstorigin/mainat58ad1f3b: still no competing PR, diff still applies with no drift,_supports_current_device()/oracle/int8.pyunchanged.AI assistance was used (Claude Code); every changed line reviewed, all numbers produced on Intel Arc Pro B70, NVIDIA H200, NVIDIA B200 and NVIDIA L40S on 2026-08-20/21.