[BugFix] route awq_dequantize through the upstream custom op#321
Open
Lfan-ke wants to merge 1 commit into
Open
[BugFix] route awq_dequantize through the upstream custom op#321Lfan-ke wants to merge 1 commit into
Lfan-ke wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces the awq_dequantize function in vllm_metax/_custom_ops.py, which supports dequantization using either Triton AWQ or a custom C operator depending on the environment configuration. There are no review comments, and I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Lfan-ke
force-pushed
the
fix/awq-dequantize-binding
branch
2 times, most recently
from
July 13, 2026 16:46
3a77ea8 to
d325f3d
Compare
Author
|
@codex review please. read code at pr and repositories. |
auto_awq.py picks the dequantize + matmul path whenever group_size is not a multiple of 32, which includes the per-channel case (-1 % 32 == 31). It called mx_ops.awq_dequantize, and vllm_metax/_custom_ops.py never defined it, so loading any such checkpoint raised AttributeError. The op is not modified on MetaX: torch_bindings.cpp registers it under _C like the rest, and vllm's own wrapper resolves to the same kernel. Per the note at the top of _custom_ops.py, that file only carries ops that MetaX modified or added, so the call now goes to vllm._custom_ops directly, as it already does in five other places in this repository. Signed-off-by: 林晨 (Leo Cheng) <chengkelfan@qq.com>
Lfan-ke
force-pushed
the
fix/awq-dequantize-binding
branch
from
July 14, 2026 06:26
d325f3d to
2172f7b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
vllm_metax/quant_config/auto_awq.pyhas two paths, selected bygroup_size % 32:group_size % 32== 0awq_to_gptq_4bit)awq_gemm!= 0awq_dequantize+torch.matmulThe second path is dead. It called
mx_ops.awq_dequantize(auto_awq.py:140), butvllm_metax/_custom_ops.pynever defined that name, so the call raises:The per-channel case reaches it:
group_size = -1gives-1 % 32 == 31, so every AWQ checkpoint whosegroup_sizeis not a multiple of 32 fails to load.Changes
awq_dequantizeis not modified on MetaX.csrc/libtorch_stable/torch_bindings.cpp:680registers it under_CthroughSTABLE_TORCH_LIBRARY_FRAGMENT(_C, ops), which is the namespace vLLM's own wrapper resolves against, so upstream'svllm._custom_ops.awq_dequantizealready reaches the MetaX kernel.The note at the top of
vllm_metax/_custom_ops.pysays that file only carries ops that are modified or newly added in vllm_metax compared to vllm, and to check upstream first to avoid duplicates. So the call goes tovllm._custom_opsdirectly, as it already does inmodels/deepseek_v2.py,model_executor/layers/attention/mla_attention.pyand the threesparse_attn_indexerbackends.awq_gemmandawq_to_gptq_4bitstay onmx_ops: the former takes two extra MetaX arguments (temp_space,dtype_bf16), the latter has no upstream counterpart.Test Plan
On a MetaX C500 (MACA 3.5.3.20), resolve the op through both modules and call it on a 4-bit AWQ weight.
Test Result
torch.ops._C.awq_dequantizeis present on the MetaX build, andvllm._custom_ops.awq_dequantizedispatches to it.