Skip to content

[HIP] perf(custom_ar): gfx1250 LL all-gather for messages up to 4 MiB a rank - #7265

Merged
XiaobingSuper merged 4 commits into
mainfrom
xiaobing/gfx1250-ll-allgather
Nov 3, 2026
Merged

XiaobingSuper merged 4 commits into
mainfrom
xiaobing/gfx1250-ll-allgather

Conversation

@XiaobingSuper

@XiaobingSuper XiaobingSuper commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Ready for review. No blocking issues.

On gfx1250 every custom all-gather pays a start barrier, a remote read of each peer's input and an end barrier: 12.8 us for 24 floats. The LM-head logits of a MiniMax-M3 decode step (12 x 50016 bf16 a rank at TP4) take 61 us on the 37 CTAs the last-dim kernel launches for them. An all-gather of up to 4 MiB a rank now pushes its input into the peers' existing LL scratch instead.

Dev record

  • Found: on MI455X, the logits gather plus the EAGLE3 drafter's three argmax gathers cost about 0.1 ms of a 5.2 ms MiniMax-M3 decode step.
  • Decided: ag_ll_gfx1250 shares ar_ll_gfx1250's epoch (d_ll_block_flags_) and scratch banks, so LL all-gathers and LL all-reduces can interleave. Only size and row bytes route to LL, so every rank takes the same protocol; misaligned pointers pick a byte-wise build of the kernel. Check use_ll_ag and all_gather's LL branch.
  • Surprised: none
  • Left undone: messages above 4 MiB a rank, or not in whole 8-byte packets, keep the existing kernels.

Named result

MI455X TP4, MiniMax-M3 MXFP4 with EAGLE3 (3 draft tokens), 3 requests of 4096 prompt tokens: the decode step drops from 5.226 to 5.118 ms. That is the median GPU period over 250 steps, 2 interleaved runs of each build.

Gates

  • op_tests/multigpu_tests/test_allgather.py at TP4 and TP2, including the new shapes and rank_offset (odd ranks' input one element in): every case err 0; c774e6a hangs on rank_offset.
  • The aligned build of ag_ll_gfx1250 (2, 4, 8 ranks) is instruction-identical to c774e6a's.
  • 4-rank graph replay (20 ops a replay, 30 replays) is bit-exact against torch.cat for last-dim, dim-0 and an LL all-gather, LL AR + RMSNorm, LL all-gather sequence.
  • ruff, black clean.
Evidence

Per-op time on 4 x MI455X, 20 back-to-back ops captured in one graph (us an op, median of 25 replays):

all-gather before this PR
12 x 50016 bf16, last dim 61.1 17.0
12 x 2 fp32, dim 0 12.8 6.2
3 x 2 fp32, dim 0 12.5 6.3
1024 x 512 bf16, dim 0 37.2 12.6
LL AG, LL AR + RMSNorm (12 x 6144), LL AG 93.4 43.2

test_allgather.py, TP4, custom path, min us (dim 0 / last dim):

shape before this PR
(128, 7168) 39.9 / 64.5 19.8 / 19.8
(65, 7168) 26.0 / 62.7 12.6 / 12.9
(12, 50016) 29.5 / 63.1 17.0 / 16.9

(1345,), (4097, 8192) and (65, 32320) stay on the existing kernels and time the same.

Decode step on MI455X (median of 250 steps, ms):

build run 1 run 2 target forward + LM head sampling + drafter
before 5.223 5.228 4.639 / 4.646 0.552 / 0.552
this PR 5.109 5.127 4.553 / 4.567 0.527 / 0.529

… a rank

An all-gather of up to kLLArMaxBytes a rank (whole 8-byte packets, the
output clear of the input) now takes ag_ll_gfx1250: ar_ll_gfx1250's
flag-in-data publish into every peer's LL scratch, then each peer's lines
polled from this rank's scratch and written to their place along dim 0 or
the last dim. No start/end barrier and no registered copy of the input. It
shares the LL epoch and banks with the LL all-reduce kernels, so the two
interleave. AITER_CUSTOM_AR_DISABLE_LL=1 turns it off with them.
@XiaobingSuper
XiaobingSuper requested review from a team and a balanced review from Copilot November 1, 2026 07:48
@github-actions

github-actions Bot commented Nov 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:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the gfx1201 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
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: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
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 7265 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

@github-actions github-actions Bot added the HIP label Nov 1, 2026
@aiter-bot

aiter-bot commented Nov 1, 2026 •

Copy link
Copy Markdown

NOT READY FOR HUMAN REVIEW

PR Self-Review

Revision de290aaa6f41 · mode shadow

Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision.

Questions to answer in the PR description

  1. What behavior does this PR change, and why is the existing behavior insufficient?
  2. What did you validate, and what remains unverified? Include commands, hardware/configuration and results.
  3. Which architecture, dtype and shape boundaries select the changed kernel path, and what invariant prevents unsupported inputs from reaching it?
  4. For every changed op_tests/ file, what behavior does it cover and why is it not redundant? Write None if no op test changed.

Edit the PR Self-Review section in the PR description. Include the current revision SHA; this comment refreshes automatically.

Missing or invalid answers

  • FAIL — missing ### Reviewed revision in the PR description
  • FAIL — missing ### Behavior and intent in the PR description
  • FAIL — missing ### Validation and unverified scope in the PR description
  • FAIL — missing ### PR-specific question in the PR description
  • FAIL — missing ### Changed op tests in the PR description
  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA
  • FAIL — Behavior and intent has no substantive answer
  • FAIL — Validation and unverified scope has no substantive answer
  • FAIL — PR-specific question has no substantive answer
  • FAIL — changed op test not explained in Changed op tests: op_tests/multigpu_tests/test_allgather.py
  • FAIL — Changed op tests must explain why each changed op test is necessary and non-redundant

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

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

🟡 Changes recommended

Rank-local alignment and overlap checks can select different all-reduce protocols across gfx1250 TP2 ranks, causing the collective to deadlock.

1 open issue
What changed in this PR

Adds a low-latency (LL) all-gather path on gfx1250 for eligible messages up to 4 MiB per rank, reducing communication overhead for decode workloads.

Changes:

  • Adds an LL kernel supporting dim-0 and last-dimension gathers, sharing scratch buffers and epochs with LL all-reduce.
  • Routes eligible inputs to LL before the registered-buffer copy, retaining existing kernels as fallbacks.
  • Adds LM-head logits and eight-byte-row test shapes.
File Description
op_tests/​multigpu_tests/​test_allgather.py Adds (12, 50016) and (12, 4) cases.
csrc/​kernels/​custom_all_reduce_gfx1250.cu Dispatches eligible all-gathers before input staging.
csrc/​include/​custom_all_reduce_gfx1250.cuh Implements the LL kernel, eligibility checks, and launch helper.

Review effort: Balanced

The LL route also required an 8-byte aligned input and output clear of each
other, checked on each rank's own pointers, so ranks passing differently
offset views picked different protocols and waited on each other. Only the
size and row bytes decide now. A rank whose input or output is not 8-byte
aligned launches the byte-wise build of the same kernel (same packets, same
flags); the aligned build's instructions are unchanged. A dim-0 gather into
the output's own slice reads in place, and any other overlap stages the
input through the copy-in buffer.

test_allgather.py: the odd ranks gather a view one element into its storage.
Copilot AI balanced review requested due to automatic review settings November 2, 2026 06:07

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

🟡 Changes recommended

Zero-byte gathers advance the LL epoch without publishing or polling packets, allowing rank skew to overwrite unconsumed flags and hang a peer.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity bf16 dim=-1 regression bypasses the custom LL dispatch path

op_tests/​multigpu_tests/​test_allgather.py:322

For bf16 with dim=-1, (12, 4) falls back to RCCL even with use_custom=True, so it does not test the new eight-byte-row LL path. The public dispatch requires 16-byte rows in both aiter/dist/parallel_state.py:1183–1186 and aiter/dist/device_communicators/communicator_cuda.py:867–870. Exercise the gfx1250 custom communicator directly, or update both dispatch gates for eligible LL inputs while preserving legacy restrictions, and verify that the regression selects the custom path.

1 resolved since last review

Review effort: Balanced

@TennyWang1223 TennyWang1223 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

Copilot AI balanced review requested due to automatic review settings November 2, 2026 14:32

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 3, 2026 01:42

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@XiaobingSuper
XiaobingSuper merged commit 5139375 into main Nov 3, 2026
@XiaobingSuper
XiaobingSuper deleted the xiaobing/gfx1250-ll-allgather branch November 3, 2026 05:39
TennyWang1223 pushed a commit that referenced this pull request Nov 5, 2026
Resolve the conflict in csrc/include/custom_all_reduce_gfx1250.cuh: both
sides added new CustomAllreduce members after allreduce_ll(). Keep both,
the Lamport fused AR + RMSNorm entry points (init_lamport_ar_rms,
fused_allreduce_rmsnorm_lamport) followed by the LL all-gather ones from
#7265 (use_ll_ag, ll_ag_reads_in_place, allgather_ll), each closing its
own brace.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
shantipriya-amd pushed a commit to shantipriya-amd/aiter that referenced this pull request Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants