[Bugfix][Quantization][XPU] Fix moe_wna16 linear weight loading - #52651
jikunshang merged 3 commits into
Conversation
|
@afierka-intel Why do we need to add |
|
@yma11 Thank you for your review! You are right and thank you for the finding. I'll update the PR description accordingly. For They are still needed for two real cases:
I hope this explains better the bug fix PR motivation. I'll update the description to keep the PR clear at first glance :) |
|
This pull request has merge conflicts that must be resolved before it can be |
fe9065b to
f00258a
Compare
6e8ffc7 to
384e3aa
Compare
`--quantization moe_wna16` cannot load a GPTQ MoE checkpoint.
`MoeWNA16Config.get_quant_method` rebuilds the linear delegate from
`self.full_config` -- the raw HF quantization dict, which lists shard
names and never fused ones. The delegate matches nothing for
`qkv_proj`/`gate_up_proj`, returns `UnquantizedLinearMethod`, and
loading dies in `linear.py` with:
AttributeError: 'MergedColumnParallelLinear' object has no attribute 'data'
Forward `packed_modules_mapping` to the delegate so fused layers resolve
to the quantized method.
On XPU the flag is rejected even earlier, in `Platform.verify_quantization`,
because `moe_wna16` is missing from `XPUPlatform.supported_quantization`;
add it.
No backend selection and no weight layout change: `--quantization auto`
behaves identically on every platform.
Signed-off-by: Artur Fierka <artur.fierka@intel.com>
8c3b62b to
c367d2f
Compare
|
LGTM to me. @jikunshang PTAL, thanks. |
|
/ci run |
|
✅ Triggered Buildkite CI #87513 for commit |
…-project#52651) Signed-off-by: Artur Fierka <artur.fierka@intel.com> Signed-off-by: Jyotirmoy Roy <jyotirmoyroy649@gmail.com>

Bug
--quantization moe_wna16cannot load a GPTQ MoE checkpoint.MoeWNA16Config.get_quant_methodrebuilds the linear delegate fromself.full_config— the raw HF quantization dict, which lists shard names and never fused ones. The delegate matches nothing forqkv_proj/gate_up_proj, returnsUnquantizedLinearMethod, and loading dies inlinear.py:Same failure as #53107. On XPU the flag is rejected even earlier, in
Platform.verify_quantization, becausemoe_wna16is missing fromXPUPlatform.supported_quantization.Fix
moe_wna16.py— forwardpacked_modules_mappingto the linear delegate.xpu.py— addmoe_wna16toXPUPlatform.supported_quantization.Two production files, +12/-6. No backend selection and no weight layout change:
--quantization autobehaves identically on every platform, so the native XPU kernel keeps serving GPTQ MoE checkpoints exactly as it does today.CudaPlatformdefines nosupported_quantization, so on CUDA only the mapping hunk applies.Scope
The bug only occurs when
MoeWNA16Configis the top-level resolved config, because only then does it handleLinearBaselayers:auto, Marlin-eligible shardAutoGPTQConfig— native kernel, unchangedauto, Marlin-ineligible shard (AutoGPTQConfig.get_quant_methodfalls back per layer)AutoGPTQConfig; the per-layerMoeWNA16Configis built forRoutedExpertsonly, so it never sees a linear layer--quantization moe_wna16MoeWNA16ConfigThat is why this is a fix for the explicit flag and not for auto-detection: on the
autopaths the delegate is never asked to build a linear method, sopacked_modules_mappingis not consulted there.Test
pytest tests/quantization/test_moe_wna16.py— 2 new tests, both CPU-only (no GPU needed to review).A/B on Intel Arc Pro B70,
Qwen/Qwen1.5-MoE-A2.7B-Chat-GPTQ-Int4,--quantization moe_wna16 --moe-backend triton, one variable added at a time:mainmoe_wna16 quantization is currently not supported in xpu.AttributeError: ... has no attribute 'data'Using 'TRITON' WNA16 MoE backendBoth hunks are therefore necessary, and together sufficient, to reach the Triton WNA16 MoE kernel for this checkpoint at TP=1.
Changed since the previous revision
The previous revision also changed WNA16 backend selection on XPU (
_get_priority_backendsplus a layout rejection in_backend_incompatibility_reason). Both hunks are dropped: they are not needed for the loading fix, and backend selection deserves its own change.