Skip to content

Align aiter quick reduce prefill and old-CA fused all-reduce rmsnorm decode paths - #14

Merged
sammysun0711 merged 2 commits into
qwen3_5_v0.5.15_dflashfrom
qwen3_5_v0.5.15_dflash_reduce
Aug 10, 2026
Merged

sammysun0711 merged 2 commits into
qwen3_5_v0.5.15_dflashfrom
qwen3_5_v0.5.15_dflash_reduce

Conversation

@apinge

@apinge apinge commented Aug 8, 2026 •

Copy link
Copy Markdown
Owner

Motivation

Align the current branch with the old Qwen3.5_v0.5.9 branch by restoring the reduce optimizations from PR zejunchen-zejun#267 and PR zejunchen-zejun#277: aiter quick reduce for prefill, and old-CA fused all-reduce + rmsnorm for
decode.

The goal of this PR is to align with our legacy branch. Please note that while the legacy code includes the sglang in-tree QR implementation (enabled by ROCM_QUICK_REDUCE_QUANTIZATION), it is not actually utilized in our specific scenario.

Specifically, in python/sglang/srt/distributed/parallel_state.py, the setting outplace_all_reduce_method = "qr" refers to this in-tree QR. However, our setup relies on the aiter-based QR (enabled by AITER_QUICK_REDUCE_QUANTIZATION), where outplace_all_reduce_method is set to aiter_cuda_comm.

Additionally, tensor_model_parallel_fused_allreduce_rmsnorm_quant is not used during the decode phase, even though the corresponding code was imported. Our scenario only utilizes tensor_model_parallel_fused_allreduce_rmsnorm.

Modifications

Accuracy Tests

Speed Tests and Profiling

Before

Prefill

image

Decode

image

After

Prefill

image

Decode

image

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

@apinge apinge changed the title align 2reduce Align aiter quick reduce prefill and old-CA fused all-reduce rmsnorm decode paths Aug 8, 2026
@apinge
apinge marked this pull request as ready for review August 8, 2026 10:25
@sammysun0711
sammysun0711 requested a lite review from Copilot August 8, 2026 12:20

Copilot AI 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.

Pull request overview

This PR restores/aligns AITER-based reduce optimizations with the referenced older Qwen3.5 branch, targeting faster prefill all-reduce (via quick-reduce/cuda communicator) and decode-time fused all-reduce + RMSNorm paths.

Changes:

  • Switch Qwen3.5 MLP preparation to a new communicator path that can fuse TP all-reduce + RMSNorm before the MLP when eligible.
  • Add FP8 “pre-quantized input” plumbing to reuse existing FP8 views/scales in linear paths.
  • Add/restore multiple all-reduce fast paths and toggles (AITER CudaCommunicator for prefill-like forwards, old-CA selection, and first-hit logging).

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
python/sglang/srt/models/qwen3_5.py Routes MLP prep through a norm-fusion-capable communicator method.
python/sglang/srt/models/qwen2_moe.py Ensures gate computations use the BF16 view when hidden states may be a tuple.
python/sglang/srt/layers/quantization/fp8.py Detects tuple inputs carrying BF16/FP8/scale views and forwards pre-quantized metadata.
python/sglang/srt/layers/quantization/fp8_utils.py Adds pre_quantized fast path to reuse FP8 inputs in FP8 linear.
python/sglang/srt/layers/layernorm.py Adds env toggle for old/new CA selection and fixes use_attn_tp_group wiring.
python/sglang/srt/layers/communicator.py Introduces MLP norm-fusion path and refactors AITER fusion gating/logging.
python/sglang/srt/distributed/parallel_state.py Adds prefill-scoped AITER cuda comm AR path and extends fused AR+RMSNorm(±Quant) plumbing.
python/sglang/srt/distributed/device_communicators/quick_all_reduce.py Adds initialization and first-hit logging for QuickAllReduce.
python/sglang/srt/distributed/communication_op.py Extends fused AR+RMSNorm API to carry use_old_ca and adds quant variant wrapper.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@apinge
apinge requested a review from sammysun0711 August 9, 2026 12:36

@sammysun0711 sammysun0711 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, leave minor comments for environment variables, need to be clarified.

@sammysun0711
sammysun0711 merged commit 7fa2bd9 into qwen3_5_v0.5.15_dflash Aug 10, 2026
4 of 5 checks passed
@apinge
apinge deleted the qwen3_5_v0.5.15_dflash_reduce branch October 12, 2026 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants