Repository navigation
[AMD][MXFP4] Online MXFP4 quantization 1/N - dense and MOE models w. original BF16 weight - #18005
Conversation
Summary of ChangesHello @fxmarty-amd, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly extends the quantization capabilities by introducing online MXFP4 quantization, primarily aimed at AMD Instinct MI350X/MI355X. This feature enables the system to quantize model weights on-the-fly from standard higher-precision checkpoints, eliminating the need for pre-quantized models. The changes involve updating core configuration and weight loading logic to dynamically apply MXFP4 quantization, ensuring compatibility and proper handling of biases in the quantized operations. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
| "1", | ||
| "--log-level", | ||
| "debug", | ||
| "--disable-cuda-graph", # See https://github.com/sgl-project/sglang/issues/18002 |
There was a problem hiding this comment.
Check if can be removed
There was a problem hiding this comment.
Code Review
This pull request introduces support for online MXFP4 quantization, primarily targeting AMD Instinct hardware. The implementation correctly integrates the new quantization method by creating a synthetic configuration for online schemes and wrapping the weight loader to perform quantization on-the-fly. The addition of bias support in the apply_weights function is a good enhancement. I have identified a couple of areas for improvement regarding code clarity and maintainability, which I've detailed in the review comments. Overall, the changes are well-structured, and the inclusion of new tests is a great addition.
… add informative counter for online quantization
|
@amd-bot ci-status |
CI Status for PR #18005PR: [AMD][MXFP4] Support online MXFP4 quantization of dense and MOE models, from original BF16 models AMD: 1 failure (0 likely related) | Others: 12 failures (0 related) AMD CI Failures
Other CI Failures
DetailsVerdict: No failures are likely caused by this PR. The PR adds AMD/ROCm-only online MXFP4 quantization (Quark + MOE/dense weight conversion paths) and a new test (
Recommendation: safe to ignore these for PR-correlation purposes; retry once for the AMD eagle3 timeout and the HiCache accuracy test in case they're flakes. The NPU breakage is a runner-wide infrastructure issue and needs to be fixed in CI environment, not in this PR.Generated by amd-bot using Claude Code CLI |
|
@amd-bot ci-status |
CI Status for PR #18005PR: [AMD][MXFP4] Support online MXFP4 quantization of dense and MOE models, from original BF16 models AMD: 4 failures (0 likely related) | Others: 4 failures (0 likely related) AMD CI Failures
Other CI Failures
DetailsNone of the failures touch code paths exercised by this PR:
Recommendation: these failures appear to be pre-existing/infra/flake issues on AMD + NPU runners. A rerun is reasonable; no PR code changes appear required to address them. If a maintainer wants high confidence, the CI Monitor task can bisect the AMD perf/VLM timeouts against
|
|
@amd-bot ci-status |
CI Status for PR #18005PR: [AMD][MXFP4] Support online MXFP4 quantization of dense and MOE models, from original BF16 models AMD: 3 failures (0 likely related) | Others: 8 failures (0 related — all cascade-skips from 1 infra failure) AMD CI Failures
Other CI Failures
Aggregator jobs DetailsNone of the failures touch code paths added by this PR (
Verdict: safe to retry the failing jobs. None of the red signals appear to be caused by changes in this PR.Generated by amd-bot using Claude Code CLI |
…original BF16 weight (sgl-project#18005) Co-authored-by: Bowen Bao <[email protected]> Co-authored-by: Colin Zeng <[email protected]>
As per title. This PR implements online MXFP4 quantization (targeting Instinct MI350X/MI355X).
For both dense and MOE layers, online MXFP4 quantization is run in weight loaders by wrapping the original
weight_loaderwith the online quantization step, before eventually calling it.Example:
sglang serve --model-path Qwen/Qwen3.5-397B-A17B \ --tensor-parallel-size 4 --trust-remote-code \ --mem-fraction-static 0.85 --attention-backend aiter \ --model-loader-extra-config '{"enable_multithread_load": true}' --quantization quark_mxfp4Eval:
and
Reference BF16:

With online mxfp4 with

--quantization quark_mxfp4:Left to do:
--quantization--context-lengthis not specifiedTest Plan
CI States
Latest PR Test (Base): ✅ Run #26847060150
Latest PR Test (Extra): ❌ Run #26847059993