Repository navigation
[Feat] [AMD] distributed: JIT quick all-reduce for TP4 on gfx950 - #46692
Merged
Merged
Conversation
A JIT build of sgl-kernel's quick all-reduce, restructured for latency and cut to the INT4 / INT8 codecs at TP4 on bf16 data; same buffers, flags and arithmetic, so outputs are bitwise equal to sgl-kernel's. No callers yet. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t show The base header still said the copy serves the INT4 two-shot only; it serves INT8 as well. Its note that the grid cap comes from the loader repeats the QR_MAX_BLOCKS #error two lines below, so it goes. The entry-point header chained four clauses into one sentence; it keeps the provenance (sgl-kernel's qr_* calls) and the cut (INT4 / INT8, TP4, bf16 cast to fp16), and leaves the bitwise claim to the kernel headers that make it. raise_flags' comment restated its four-line body; the reason every wave waits for its own stores already sits on wait_own_stores. In the test, the grid-stride note now says which sizes exceed the grid, and the fallback cases note lists the INT4-at-TP2 case it left out. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The module docstring said the JIT build keeps sgl-kernel's buffer layout; the per-tile wire layout is wave-major now, and what it keeps is the buffer sizes, flags and arithmetic, as the kernel header says. It is now a summary line plus one paragraph. jit_serves' docstring ran three noun phrases together; it now names the argument and the two environment settings it reads. The fallback test's docstring named SGLANG_ROCM_QUICK_ALL_REDUCE_JIT, which this PR does not define (the integration PR adds it), and said a group raises at its first all-reduce, while TP2 would raise already at init. The bitwise test's docstring dropped the design note and keeps the contract. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Only the bf16 packed_* specializations used it, and the JIT copy dropped them with the bf16 kernels; nv_bfloat162 stays for the load/store casts. gfx950 device assembly of both codecs is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n one helper Both JIT workers defined the same nested open_comm and repeated the argument-order lambda, with the comment that explains it on only one of them. _open_comms now opens the pair in the same order (sgl-kernel first, then JIT), so each worker makes one call. The quant levels were a local 1, 2, 3 in one worker and bare 1 / 3 next to a named int6 in the other; both now read QuickReduceRegime, whose values QuickAllReduce passes as the level. The values are unchanged. No case was added or removed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
kevin-mii
requested review from
BBuf,
DarkSharpness,
HaiShaw,
HydraQYH,
celve and
yuan-luo
as code owners
October 27, 2026 00:28
This was referenced Oct 27, 2026
Merged
Collaborator
Author
|
/tag-and-rerun-ci |
…n errors, cap the size destroy() closed peer handles read from dbuffer_list, a device allocation, and closed every peer even when open_handles never ran; it now walks the host buffer_list and skips unopened peers, which init resets. The wrapper's destroy runs the teardown before delete, so a HIP error raises instead of terminating from the noexcept destructor. init rejects max sizes past 2 GiB, beyond which the 32-bit phase offsets wrap. All three were inherited from sgl-kernel's copy. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ches the bf16 build init cannot see the dtype, so a float16 model at TP4 with the JIT flag set got a generic tensor-dtype error at its first large all-reduce. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…and past fp16's range Every size was a whole number of 32 KiB tiles and |x| stayed near 350, so the JIT build's tail handling and its reordered load / FP16_OVFL convert were never compared with sgl-kernel's. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…annot show Drop comments that restate the code or narrate how the copy diverged from sgl-kernel's, the latency numbers in the INT8 threshold comment, first person and inline backticks; fold the wrapper's \param/\return lines into its briefs and correct the Phase-2 and grid-stride test comments. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Picks up sgl-project#47127, which fixes main's test_gdn_prefill_graph that pr-test-finish fails on. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…and name the INT8 cut - jit_serves() now also requires gfx950, where the build and its 256-block grid were validated, instead of leaving that check to the caller. - qr_supports(fa, dtype) says whether a handle reduces a dtype (a JIT handle takes bf16 only), so a communicator can hand float16 to another all-reduce instead of hitting the ValueError mid-forward. - The size below which an INT4 request runs INT8 is now SGLANG_ROCM_QUICK_REDUCE_INT8_BELOW_MB (default 64, 0 runs INT4 at every size), read per handle at init and logged once on rank 0. - The error messages no longer name SGLANG_ROCM_QUICK_ALL_REDUCE_JIT, which the integration PR defines. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main's TensorMatcher (sgl-project#47300) now holds a bound device to its options and names the platform GPU kDLGPU; this ROCm-only entry point still asked for kDLCUDA, so every all-reduce on a rocm device failed the match. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
jit/csrc/distributed/quick_all_reduce/,quick_all_reduce_hip.cuh,ops/communication/quick_all_reduce_hip.py), restructured for latency (the per-tile wire layout is wave-major) and cut to the INT4 / INT8 codecs at TP4 on bf16 data. It keeps sgl-kernel's buffer sizes, flags and arithmetic, so at the level it runs its outputs are bitwise equal to sgl-kernel's, including a partial last tile and bf16 values past fp16's range. Asked for INT4, it runs all-reduces belowSGLANG_ROCM_QUICK_REDUCE_INT8_BELOW_MB(default 64 MiB; 0 keeps INT4 at every size) in INT8, about 1/16 of INT4's error, and logs that once at init; the JIT INT4 column below 64 MB in the table is the kernel called at INT4 directly.jit_serves()takes only gfx950, andqr_supports(fa, dtype)tells a caller that a JIT handle reduces bf16 only.custom_all_reduce_opsbehindSGLANG_ROCM_QUICK_ALL_REDUCE_JIT, on gfx950 only, the GPU it is validated on;QuickAllReduceasksqr_supports()so float16 goes to the next all-reduce). Review it here as a kernel; the serving numbers below come from [Feat] [AMD] minimax: Support MiniMax-M3.1-Flash on MI350X / MI355X (gfx950) #46693.Changes to existing kernels
None; every source file is new and HIP-only. The existing
test_quick_allreduce_bf16_rangegains the JIT cases.Not in this PR
quick_all_reduce.hkeepsdata_buffer_sizefunction-static, so the first communicator's size sticks process-wide; this JIT copy sizes it per communicator and leaves the original untouched.Verification
acf8fdf93), this branch alone onmain:test_quick_allreduce_bf16_range3 passed (8 GPUs). pre-commit clean.qr_all_reducethis replaces):The JIT INT8 beats aiter's bf16 custom all-reduce from 1 MB, where sgl-kernel's INT8 does not until about 16 MB; that is what lets the integration PR lower aiter's custom-AR cutoff to 2.4 MiB. One run; single-size outliers in other columns (RCCL at 8 MB, sgl-kernel INT4 at 16 and 256 MB) were left out.
SGLANG_ROCM_QUICK_ALL_REDUCE_JIT=0) at the same 2.4 MiB custom-AR cutoff, decode TPOT grows 4.0% at 32 concurrent requests and 2.6% at 64, and 32K-token prefill 1.9%. With main's 64 MiB cutoff as well: 3.6%, 6.7% and 4.3%. At 1 and 8 requests every all-reduce stays under the cutoff, on aiter's custom all-reduce.🤖 Generated with Claude Code
CI States
Latest PR Test (Base): ⏳ Run #41356558931
Latest PR Test (Extra): ❌ Run #41356558741
Latest PR Test (AMD ROCm 10): ⏳ Run #41356558860
Tip
Base CI only covers the core cases, and its workload may not exercise your change. Use
/rerun-testto run the tests your change touches, or copy this prompt for an agent: