Skip to content

refactor(dist): unify fused AR+RMSNorm+quant public API - #4039

Merged
valarLip merged 1 commit into
mainfrom
unify-fused-ar-rmsnorm-quant-api
Jul 2, 2026
Merged

valarLip merged 1 commit into
mainfrom
unify-fused-ar-rmsnorm-quant-api

Conversation

@gbyu-amd

@gbyu-amd gbyu-amd commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Collapse tensor_model_parallel_fused_allreduce_rmsnorm_quant_per_group() into tensor_model_parallel_fused_allreduce_rmsnorm_quant(), dispatching on quant_type (and group_size for the block size) so users have a single entry point.

Per-group quant_type values are normalized via
_normalize_fused_ar_rms_quant_type (same alias table the device communicator uses) and routed to GroupCoordinator.fused_allreduce_rmsnorm_quant_per_group, which dispatches the torch.library-registered op so the fusion stays traceable under torch.compile. Other quant types keep the existing generic path.

No functional change for callers: existing per_group/mxfp4 tests already call the unified function via quant_type=, and the removed per_group wrapper had no other callers.

Motivation

Technical Details

Test Plan

Test Result

Submission Checklist

@gbyu-amd
gbyu-amd requested a review from a team July 1, 2026 10:40
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:triton-300x Run an additional Triton test job on MI300X in PRs; main branch always runs both MI35X and MI300X
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 4039 --add-label <label>

@gbyu-amd
gbyu-amd force-pushed the unify-fused-ar-rmsnorm-quant-api branch 5 times, most recently from 45b943b to e88872d Compare July 1, 2026 14:50
Collapse tensor_model_parallel_fused_allreduce_rmsnorm_quant_per_group()
into tensor_model_parallel_fused_allreduce_rmsnorm_quant(), dispatching on
quant_type (and group_size for the block size) so users have a single entry
point.

The unified public function normalizes quant_type and, for the per-group family,
routes to GroupCoordinator.fused_allreduce_rmsnorm_quant_per_group, which
dispatches the torch.library-registered op so the fusion stays traceable under
torch.compile. Other quant types keep the existing generic path.

quant_type normalization is now single-sourced: _FUSED_AR_RMS_QUANT_ALIASES and
_normalize_fused_ar_rms_quant_type live in communication_op.py, and
communicator_cuda imports the normalizer from there (lazily, inside its eager
device method, to avoid an aiter.dist import cycle). No duplicated alias tables.

Graph-safety notes:
- No import inside the traced call; the branch is on the constant quant_type, so
  Dynamo constant-folds it (matching the existing `if quant_type == "per_token"`
  fast path). The normalizer's try/except is off the taken path for valid inputs.
- No new eager import edge: communication_op does not import the device-specific
  communicator module, and communicator_cuda imports the normalizer lazily.

Verified: all import forms (plain/dotted/from) load cleanly with no cycle; the
normalizer produces identical results for every string alias and QuantType
member; the ValueError path is preserved.

No functional change for callers: existing per_group/mxfp4 tests already call
the unified function via quant_type=, and the removed per_group wrapper had no
other callers.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@valarLip
valarLip merged commit 2f79f1c into main Jul 2, 2026
42 checks passed
@valarLip
valarLip deleted the unify-fused-ar-rmsnorm-quant-api branch July 2, 2026 02:51
@zufayu
zufayu requested a review from junhaha666 July 3, 2026 02:15
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.

2 participants