Skip to content

[Quantization] Remove the dead ocp_mx_scheme branch from moe_kernel_quantize_input - #52603

Merged
AndreasKaratzas merged 1 commit into
vllm-project:mainfrom
xuebwang-amd:xuebin_remove_dead_ocp_mx_scheme
Aug 18, 2026
Merged

AndreasKaratzas merged 1 commit into
vllm-project:mainfrom
xuebwang-amd:xuebin_remove_dead_ocp_mx_scheme

Conversation

@xuebwang-amd

@xuebwang-amd xuebwang-amd commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Purpose

Shortly, remove dead code.

moe_kernel_quantize_input() in vllm/model_executor/layers/fused_moe/utils.py carries an ocp_mx_scheme: str | None = None parameter and opens its body with a block that short-circuits *_a_fp8 OCP MX schemes into _fp8_quantize_dequantize before the normal quant_dtype dispatch ever runs. Nothing reaches that block. This PR removes the parameter and the block.

This is the follow-up @fxmarty-amd asked for when introduced the quantization_emulation path that superseded the block, in #46142 (e368415daa):

r3452957212:
"Yes I don't think this code block is needed"
r3453008225:
"Let's address in an other PR."

This is the left TODO:

# TODO: Remove this `ocp_mx_scheme is not None` block and rely solely
# on `quantization_emulation`.

and reconfirmed the ask in review on #43983 (review 4904664996), linking utils.py#L288-L301 — exactly the lines removed here.

Why deleting it changes no behavior

The only arm with behavior was .endswith("a_fp8"), and the only reachable a_fp8 scheme is w_mxfp4_a_fp8w_mxfp6_e3m2_a_fp8 and w_mxfp6_e2m3_a_fp8, both raise NotImplementedError earlier, in QuarkOCP_MX_MoEMethod.get_fused_moe_quant_config.

For w_mxfp4_a_fp8 the two paths are identical:

deleted arm surviving dispatch
condition ocp_mx_scheme.endswith("a_fp8") quant_dtype == current_platform.fp8_dtype() and quantization_emulation
action return _fp8_quantize_dequantize(A, A_scale) return _fp8_quantize_dequantize(A, A_scale)

_fp8_quantize_dequantize takes only A and A_scale, so nothing else was being bypassed. OCP_MXQuantizationEmulationTritonExperts.__init__ sets both inputs (quantization_emulation = True, _quant_dtype = current_platform.fp8_dtype()), and TritonExperts.apply forwards them.

Test Plan

Unit test

python -m pytest tests/kernels/moe/test_ocp_mx_moe.py -q
python -m pytest tests/kernels/moe/test_cutlass_moe.py -q
pre-commit run --files vllm/model_executor/layers/fused_moe/utils.py

End-to-end test

Same as what tested in #43983

  • ROCm, MI325
  • Model: amd/gpt-oss-120b-w-mxfp4-a-fp8
  • MXFP4 emulation MoE backend --moe-backend emulation

Test Result

Coming soon.


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

…l_quantize_input`

`moe_kernel_quantize_input` carries an `ocp_mx_scheme` parameter and a
leading branch that short-circuits `*_a_fp8` schemes into
`_fp8_quantize_dequantize`. Nothing reaches it: of the 26 call sites in
the tree, none supplies `ocp_mx_scheme=`, the maximum positional arity at
any of them is 5 against a parameter at positional index 6, and there is
no `**kwargs` splat, aliased import, `functools.partial` or `getattr`
reference anywhere.

The one arm with behavior was `.endswith("a_fp8")`, and the only
reachable a_fp8 scheme is `w_mxfp4_a_fp8` -- `w_mxfp6_e3m2_a_fp8` and
`w_mxfp6_e2m3_a_fp8` raise `NotImplementedError` earlier in
`QuarkOCP_MX_MoEMethod.get_fused_moe_quant_config`. For that scheme the
emulation experts set `quantization_emulation = True` and
`quant_dtype = current_platform.fp8_dtype()`, so the surviving dispatch
reaches the identical `_fp8_quantize_dequantize(A, A_scale)`. The other
two arms were a bare `pass` and a comment.

Remove both, per the in-code TODO and @fxmarty-amd's review on vllm-project#43983:
"`moe_kernel_quantize_input` should rely solely on `quant_dtype` now".

`FusedMoEQuantConfig.ocp_mx_scheme` and its other consumers
(`OCP_MXQuantizationEmulationTritonExperts`, the `fused_batched_moe`
NYI asserts, the deprecation guard in `fused_experts_impl`) are
untouched.

Signed-off-by: xuebwang-amd <xuebwang@amd.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@mergify mergify Bot added the quantization label Aug 17, 2026
@xuebwang-amd xuebwang-amd changed the title [Quantization] Remove the dead ocp_mx_scheme branch from `moe_kerne… [Quantization] Remove the dead ocp_mx_scheme branch from moe_kernel_quantize_input Aug 17, 2026
@xuebwang-amd

Copy link
Copy Markdown
Contributor Author

@fxmarty-amd

@fxmarty-amd fxmarty-amd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks a lot for the cleanup!

@AndreasKaratzas

Copy link
Copy Markdown
Member

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #84394 for commit 3ccd0d4392df.

@AndreasKaratzas
AndreasKaratzas merged commit d3fafe0 into vllm-project:main Aug 18, 2026
116 checks passed
wenhuach21 pushed a commit to wenhuach21/vllm that referenced this pull request Aug 19, 2026
…uantize_input (vllm-project#52603)

Signed-off-by: xuebwang-amd <xuebwang@amd.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Wenhua Cheng <wenhua.cheng@intel.com>
zufangzhu pushed a commit to zufangzhu/vllm that referenced this pull request Aug 24, 2026
…uantize_input (vllm-project#52603)

Signed-off-by: xuebwang-amd <xuebwang@amd.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Zhu, Zufang <zufang.zhu@intel.com>
am-cohere pushed a commit to am-cohere/vllm that referenced this pull request Sep 1, 2026
…uantize_input (vllm-project#52603)

Signed-off-by: xuebwang-amd <xuebwang@amd.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants