Skip to content
Merged
Show file tree
Hide file tree
Changes from 95 commits
Commits
Show all changes
236 commits
Select commit Hold shift + click to select a range
c859981
[Feat] [AMD] minimax: gfx950 sparse attention, NVFP4 KV and DSpark ve…
Oct 26, 2026
46afdad
minimax: correct two stale comments and trim two others in the gfx950…
Oct 26, 2026
5b19d49
minimax: name the reference the NVFP4 Gluon decode agrees with
Oct 26, 2026
591d6d0
minimax: annotate the NVFP4 cache on the indexer entry points that ta…
Oct 26, 2026
1991174
minimax qk-norm: make the fp8 cache-store helpers module-private
Oct 26, 2026
6b9b46f
minimax gluon prefill: check for an NVFP4 cache once per request group
Oct 26, 2026
fdb749f
test(dspark): call the kernel pairs directly in the two new parity cases
Oct 26, 2026
5e5244b
test(dspark): give the extra AMD registration its backend-specific re…
Oct 26, 2026
5114021
[Feat] [AMD] minimax: gfx950 MoE, router GEMV, block-fp8 GEMM and fp8…
Oct 26, 2026
3264444
minimax: Make the new kernel comments say what the line cannot
Oct 26, 2026
5c057f7
minimax: Reword four new docstrings so they read right the first time
Oct 26, 2026
dff4dd1
minimax: Bind the repeated sort-eligibility and token-bucket checks once
Oct 26, 2026
4174ef7
[Feat] [AMD] distributed: JIT quick all-reduce for TP4 on gfx950
Oct 26, 2026
d8d8a1e
quick all-reduce: Trim the JIT copy's comments to what the code canno…
Oct 26, 2026
0e558b7
quick all-reduce: Make the JIT docstrings state what holds in this PR
Oct 26, 2026
02f7d51
quick all-reduce: Drop the JIT copy's unused nv_bfloat16 typedef
Oct 26, 2026
db7a6b0
test(quick all-reduce): Open the sgl-kernel / JIT communicator pair i…
Oct 26, 2026
845c606
[Feat] [AMD] minimax: Support MiniMax-M3.1-Flash on MI350X / MI355X (…
Oct 26, 2026
e5c3ce0
minimax: Trim the multi-line comments in the gfx950 M3.1 glue
Oct 26, 2026
2afa507
minimax: Stop calling the JIT quick all-reduce bit-identical at INT4
Oct 26, 2026
269b2b3
[Perf] [AMD] minimax: decode indexer CP for DSpark verify on the NVFP…
Oct 26, 2026
6359810
minimax: Keep benchmark numbers out of the gfx950 M3.1 docstrings
Oct 26, 2026
5493bf7
indexer CP: call the CP kernels by keyword and fold the NVFP4 scale once
Oct 26, 2026
8c95a8d
minimax: Read aiter's ModuleSpec.origin directly in _register_aiter_t…
Oct 26, 2026
83c9003
indexer CP: trim the supports() comment that repeated the threshold r…
Oct 26, 2026
c423786
ci: Name the backend-specific path of each new AMD registration
Oct 26, 2026
e25a0c5
indexer CP: correct the split-config docstring: tuned on MI350X
Oct 26, 2026
eafcff5
minimax: Name the ROCm build the bf16 table's hipBLASLt indices belon…
Oct 26, 2026
269e800
test(indexer CP): reuse get_open_port instead of a local port helper
Oct 26, 2026
3a071fe
dspark: Drop the gfx950 Markov step-bias kernel: it changes the bias …
Oct 27, 2026
a625e12
minimax: Keep VanillaMarkov as the gfx950 DSpark draft's markov head
Oct 27, 2026
b1addd8
dspark: Drop the gfx950 Markov step-bias kernel: it changes the bias …
Oct 27, 2026
fc30d4d
minimax: Keep VanillaMarkov as the gfx950 DSpark draft's markov head
Oct 27, 2026
f63b811
test: Move the Triton NVFP4 KV quantizer into the kernel-test helpers
Oct 27, 2026
fa71a03
minimax: Move the TP4 all-reduce + norm + quant fusion into minimax_c…
Oct 27, 2026
ce52c2d
test: Move the Triton NVFP4 KV quantizer into the kernel-test helpers
Oct 27, 2026
84600ff
minimax: Move the TP4 all-reduce + norm + quant fusion into minimax_c…
Oct 27, 2026
f194d96
minimax: Install the M3.1 aiter tables through the in-tree tuning mec…
Oct 27, 2026
503dcf1
minimax: Install the M3.1 aiter tables through the in-tree tuning mec…
Oct 27, 2026
a98ff3b
test(indexer CP): Import the NVFP4 KV quantizer from the kernel-test …
Oct 27, 2026
6ed8589
test: Quantize the NVFP4 test caches in torch instead of a Triton kernel
Oct 27, 2026
0399b64
test: Quantize the NVFP4 test caches in torch instead of a Triton kernel
Oct 27, 2026
5689741
dspark: Gather the target verify logits on ROCm as on CUDA
Oct 27, 2026
4673161
minimax: Write the DSpark draft's context K/V per layer on gfx950, as…
Oct 27, 2026
9620b57
minimax: Drop the fused TP4 all-reduce + norm + quant decode boundary
Oct 27, 2026
4911d15
minimax: Keep aiter's rowwise fp8 GEMM for the M3.1 decode projections
Oct 27, 2026
2e13545
dspark: Drop the gfx950 TP-shard verify argmax and fused context-K/V …
Oct 27, 2026
22acdcb
minimax: Drop the TP4 all-reduce + norm + quant kernel
Oct 27, 2026
d7f0e84
minimax: Keep only the fused router's M3.1 shape in the small-M fp8 GEMM
Oct 27, 2026
1d45935
dspark: Gather the target verify logits on ROCm as on CUDA
Oct 27, 2026
e8a87db
minimax: Write the DSpark draft's context K/V per layer on gfx950, as…
Oct 27, 2026
219acda
minimax: Drop the fused TP4 all-reduce + norm + quant decode boundary
Oct 27, 2026
2bc8214
minimax: Keep aiter's rowwise fp8 GEMM for the M3.1 decode projections
Oct 27, 2026
d5ba0dd
dspark: Drop the gfx950 TP-shard verify argmax and fused context-K/V …
Oct 27, 2026
59c3ff2
minimax: Drop the TP4 all-reduce + norm + quant kernel
Oct 27, 2026
0c227f4
minimax: Keep only the fused router's M3.1 shape in the small-M fp8 GEMM
Oct 27, 2026
ac61768
test: Keep the NVFP4 KV test quantizer with the other quantization re…
Oct 27, 2026
44b99a4
test: Keep the NVFP4 KV test quantizer with the other quantization re…
Oct 27, 2026
2e899a2
test(indexer CP): Import the NVFP4 KV quantizer from quant_ref_utils
Oct 27, 2026
39b54ef
minimax gluon prefill: Name the two-queries-per-program kernel gfx950…
Oct 27, 2026
b28d721
minimax gluon prefill: Name the two-queries-per-program kernel gfx950…
Oct 27, 2026
a009970
minimax sparse: Keep the gfx950 fp8 O epilogue in common, shared by d…
Oct 27, 2026
2140db6
minimax sparse: Keep the gfx950 fp8 O epilogue in common, shared by d…
Oct 27, 2026
8f0abe6
minimax sparse decode: Import at module level where no cycle or optio…
Oct 27, 2026
0fad764
minimax sparse decode: Import at module level where no cycle or optio…
Oct 27, 2026
4f93773
minimax sparse: One annotation style per file, and hints on the untyp…
Oct 27, 2026
f25005f
minimax sparse: One annotation style per file, and hints on the untyp…
Oct 27, 2026
662206d
minimax sparse: Plain names in comments, a summary line for pair_spar…
Oct 27, 2026
f13837c
minimax sparse: Plain names in comments, a summary line for pair_spar…
Oct 27, 2026
8964c5d
minimax prefill indexer: Name the candidates a merge program holds
Oct 27, 2026
7eef139
minimax prefill indexer: Name the candidates a merge program holds
Oct 27, 2026
bd9bb3e
minimax qk-norm: Annotate the NVFP4 caches on the fused cache-store e…
Oct 27, 2026
93663de
minimax qk-norm: Annotate the NVFP4 caches on the fused cache-store e…
Oct 27, 2026
9a2cae0
minimax: Keep quark_mxfp4's custom all-reduce on gfx950 only, where i…
Oct 28, 2026
b14303f
minimax: Keep quark_mxfp4's custom all-reduce on gfx950 only, where i…
Oct 28, 2026
9ed330c
minimax: Take the JIT quick all-reduce on gfx950 only, where it is va…
Oct 28, 2026
0fc8da8
minimax: Take the JIT quick all-reduce on gfx950 only, where it is va…
Oct 28, 2026
4e56ad3
minimax sparse prefill: Pass the fp8 pool's k/v scales to the Gluon k…
Oct 28, 2026
5c6aba9
minimax prefill indexer: Fall back to Triton when the fused gfx950 in…
Oct 28, 2026
406be7a
minimax sparse: Annotate the cache arguments that take an Nvfp4Cache
Oct 28, 2026
9eaa18a
minimax sparse: Check the layouts the fused gfx950 indexers assume
Oct 28, 2026
47a6d00
test(minimax gfx950 prefill): Build aiter's 1 x 128 quant without SGL…
Oct 28, 2026
8fed23d
minimax moe sort: Keep aiter's sort for batches past the large sort's…
Oct 28, 2026
6c85610
moe_fused_gate: Keep split-K partials off the 2-D fast paths
Oct 28, 2026
9f366a1
test(smallm fp8): Check the M3.1 shared-expert shape against aiter
Oct 28, 2026
e29bf5d
minimax rmsnorm: Accept a zero-token batch with a GEMM output to zero…
Oct 28, 2026
70e1a31
test(minimax kernels): One registration form, and comments that stand…
Oct 28, 2026
6ef9a1a
quick all-reduce JIT: Release peers from the host list, raise teardow…
Oct 28, 2026
49f3d69
quick all-reduce JIT: Name the flag to unset when a float16 model rea…
Oct 28, 2026
08d07a1
test(quick all-reduce): Compare the JIT build on a partial last tile …
Oct 28, 2026
c80a73d
aiter in-tree tune: Add a repeated new shape once
Oct 28, 2026
29913a0
test(aiter in-tree tune): Check the M3.1 rows' kernels on the pinned …
Oct 28, 2026
5427f44
minimax: Raise the M3.1 quick all-reduce to INT4 at TP4 only
Oct 28, 2026
6980607
minimax nvfp4: Say where the tuned lm_head rows come from now
Oct 28, 2026
2f61f1c
aiter in-tree tune: Make IntreeTable a msgspec Struct
Oct 28, 2026
0d0b6ab
minimax sparse prefill: Pass the fp8 pool's k/v scales to the Gluon k…
Oct 28, 2026
2a00229
minimax prefill indexer: Fall back to Triton when the fused gfx950 in…
Oct 28, 2026
d1ec72e
minimax sparse: Annotate the cache arguments that take an Nvfp4Cache
Oct 28, 2026
9cf28ea
minimax sparse: Check the layouts the fused gfx950 indexers assume
Oct 28, 2026
d39f0c2
test(minimax gfx950 prefill): Build aiter's 1 x 128 quant without SGL…
Oct 28, 2026
e081ccf
minimax moe sort: Keep aiter's sort for batches past the large sort's…
Oct 28, 2026
4415773
moe_fused_gate: Keep split-K partials off the 2-D fast paths
Oct 28, 2026
eae65b0
test(smallm fp8): Check the M3.1 shared-expert shape against aiter
Oct 28, 2026
3d41746
minimax rmsnorm: Accept a zero-token batch with a GEMM output to zero…
Oct 28, 2026
451727c
test(minimax kernels): One registration form, and comments that stand…
Oct 28, 2026
b6cfdb1
quick all-reduce JIT: Release peers from the host list, raise teardow…
Oct 28, 2026
eda10fb
quick all-reduce JIT: Name the flag to unset when a float16 model rea…
Oct 28, 2026
336937f
test(quick all-reduce): Compare the JIT build on a partial last tile …
Oct 28, 2026
ef9905b
aiter in-tree tune: Add a repeated new shape once
Oct 28, 2026
e3de86c
test(aiter in-tree tune): Check the M3.1 rows' kernels on the pinned …
Oct 28, 2026
990914d
minimax: Raise the M3.1 quick all-reduce to INT4 at TP4 only
Oct 28, 2026
00e11a2
minimax nvfp4: Say where the tuned lm_head rows come from now
Oct 28, 2026
62910c2
aiter in-tree tune: Make IntreeTable a msgspec Struct
Oct 28, 2026
6719205
minimax: Install the bf16 table's hipBLASLt rows only on the ROCm tha…
Oct 28, 2026
389da44
minimax: Install the bf16 table's hipBLASLt rows only on the ROCm tha…
Oct 28, 2026
ba03bbd
minimax: Trim comments and docstrings to what the code cannot show
Oct 29, 2026
9ecd78b
minimax sparse decode: Fold nvfp4_decode.py into its two callers
Oct 29, 2026
817f1db
minimax sparse: Trim comments and docstrings to what the code cannot …
Oct 29, 2026
c48d4f4
router_gemv: Size the split-K scratch from the weight dtype's own tiles
Oct 29, 2026
d8705e2
minimax kernels: Trim comments and docstrings to what the code cannot…
Oct 29, 2026
d28dca5
quick all-reduce JIT: Trim comments and docstrings to what the code c…
Oct 29, 2026
7e8f4dc
minimax: Trim comments and docstrings to what the code cannot show
Oct 29, 2026
217ba8a
minimax sparse decode: Fold nvfp4_decode.py into its two callers
Oct 29, 2026
d44030a
minimax sparse: Trim comments and docstrings to what the code cannot …
Oct 29, 2026
8f8b648
router_gemv: Size the split-K scratch from the weight dtype's own tiles
Oct 29, 2026
7870003
minimax kernels: Trim comments and docstrings to what the code cannot…
Oct 29, 2026
be5dfb7
quick all-reduce JIT: Trim comments and docstrings to what the code c…
Oct 29, 2026
1f8798c
minimax indexer CP: Trim comments and docstrings to what the code can…
Oct 29, 2026
daa6bb3
verify_mla: Move the M3.1 draft's windowed combine into verify_mla_wi…
Oct 29, 2026
7c522f8
verify_mla: Move the M3.1 draft's windowed combine into verify_mla_wi…
Oct 29, 2026
4b513e1
verify_mla_window: Trim comments and docstrings to what the code cann…
Oct 29, 2026
8d6e406
verify_mla_window: Trim comments and docstrings to what the code cann…
Oct 29, 2026
d534d07
Merge branch 'main' into m31-amd/integration
Oct 29, 2026
e545f44
Merge branch 'main' into m31-amd/indexer-cp
Oct 29, 2026
80d3230
minimax indexer CP: Wrap the IPC exchange's call counters at 510
kevin-mii Nov 1, 2026
6415318
minimax moe sort: Route no pair for an expert id outside [0, E)
kevin-mii Nov 1, 2026
128d8ed
router_gemv, m31_router: Keep one split-K scratch per stream
kevin-mii Nov 1, 2026
5686bb0
test(aiter MoE patches): Skip where the pinned aiter keeps its own code
kevin-mii Nov 1, 2026
2564d72
quick all-reduce JIT: Serve gfx950 only, report the dtypes it takes, …
kevin-mii Nov 1, 2026
f7cb41e
aiter in-tree tune: Skip FlyDSL rows on an aiter that cannot import F…
kevin-mii Nov 1, 2026
dce6ccf
minimax: Keep a quick all-reduce level already set, and route float16…
kevin-mii Nov 1, 2026
6fdd03d
minimax moe sort: Route no pair for an expert id outside [0, E)
kevin-mii Nov 1, 2026
da3a0f9
router_gemv, m31_router: Keep one split-K scratch per stream
kevin-mii Nov 1, 2026
a849be4
test(aiter MoE patches): Skip where the pinned aiter keeps its own code
kevin-mii Nov 1, 2026
fd4ff8d
quick all-reduce JIT: Serve gfx950 only, report the dtypes it takes, …
kevin-mii Nov 1, 2026
b600ca7
aiter in-tree tune: Skip FlyDSL rows on an aiter that cannot import F…
kevin-mii Nov 1, 2026
ebdb564
minimax: Keep a quick all-reduce level already set, and route float16…
kevin-mii Nov 1, 2026
3c3331e
minimax indexer CP: Trap the IPC merge after a bounded wait for its p…
kevin-mii Nov 1, 2026
e3bf768
test(indexer CP): Declare the measured run times
kevin-mii Nov 1, 2026
3fb3853
aiter in-tree tune: Call an aiter mHC config that predates the preshu…
kevin-mii Nov 1, 2026
83b2741
aiter in-tree tune: Call an aiter mHC config that predates the preshu…
kevin-mii Nov 1, 2026
087c47f
Merge branch 'main' into m31-amd/integration
kevin-mii Nov 1, 2026
23014b3
quick all-reduce JIT: Match the ROCm device as kDLGPU
kevin-mii Nov 1, 2026
0d3dd85
Merge branch 'main' into m31-amd/indexer-cp
kevin-mii Nov 1, 2026
4cf5e4f
quick all-reduce JIT: Match the ROCm device as kDLGPU
kevin-mii Nov 1, 2026
03909af
Merge branch 'main' into m31-amd/integration
kevin-mii Nov 2, 2026
6fe4c6f
Merge branch 'main' into m31-amd/indexer-cp
kevin-mii Nov 2, 2026
287f89b
minimax: Drop the asm split-K GEMM launched into the norm's zeroed ou…
kevin-mii Nov 2, 2026
0f6288c
minimax: Drop the fused decode routers, which the FFN monokernel repl…
kevin-mii Nov 2, 2026
8db3fc8
minimax: Drop the asm split-K GEMM launched into the norm's zeroed ou…
kevin-mii Nov 2, 2026
c96c171
minimax: Drop the fused decode routers, which the FFN monokernel repl…
kevin-mii Nov 2, 2026
64d0125
test(minimax m3.1): Keep the cases a plausible change would break
kevin-mii Nov 2, 2026
8eb9efd
test(minimax m3.1): Keep the cases a plausible change would break
kevin-mii Nov 2, 2026
9e01c36
test(minimax rocm verify): Give the stand-in backends main's runner_ids
kevin-mii Nov 2, 2026
153c9f2
test(minimax rocm verify): Give the stand-in backends main's runner_ids
kevin-mii Nov 2, 2026
a18b840
test(minimax rocm verify): Drop the dense-metadata call-order test
kevin-mii Nov 2, 2026
4ecb9de
test(minimax rocm verify): Drop the dense-metadata call-order test
kevin-mii Nov 2, 2026
7579e01
test(minimax m3 rmsnorm): Fold the four-row no-bf16 case into the gro…
kevin-mii Nov 2, 2026
e179bd4
test(minimax m3 rmsnorm): Fold the four-row no-bf16 case into the gro…
kevin-mii Nov 2, 2026
aa0f54c
refactor(amd aiter): One folder of in-tree aiter tuned rows for every…
kevin-mii Nov 2, 2026
c70f9bb
refactor(amd aiter): One folder of in-tree aiter tuned rows for every…
kevin-mii Nov 2, 2026
5866f32
Merge remote-tracking branch 'origin/main' into m31-amd/integration
kevin-mii Nov 2, 2026
3f6eaf5
test(scheduler running reqs): Give the stand-in future map FutureMap'…
kevin-mii Nov 2, 2026
0aa909e
Merge commit '3f6eaf538a599dfe1996e7121a7e63f2fe111624' into m31-amd/…
kevin-mii Nov 2, 2026
cf506b7
Merge remote-tracking branch 'origin/main' into m31-amd/integration
kevin-mii Nov 2, 2026
d74b95c
Merge branch 'm31-amd/integration' into m31-amd/indexer-cp
kevin-mii Nov 2, 2026
4cf5d96
[AMD] aiter: One folder of in-tree aiter tuned rows for every model
kevin-mii Nov 2, 2026
4e21d27
Merge branch 'm31-amd/aiter-tuned-tables' into m31-amd/integration
kevin-mii Nov 2, 2026
98c1dee
Merge branch 'm31-amd/integration' into m31-amd/indexer-cp
kevin-mii Nov 2, 2026
65a9fce
[AMD] aiter: Tidy the in-tree table installer and test a user's table
kevin-mii Nov 2, 2026
1f90081
[AMD] MiniMax-M3.1: Build the indexer CP exchange only for the NVFP4 …
kevin-mii Nov 2, 2026
878673e
[AMD] MiniMax-M3.1: Reject NVFP4 on ROCm GPUs other than gfx950
kevin-mii Nov 2, 2026
64b5fa1
Merge branch 'm31-amd/aiter-tuned-tables' into m31-amd/integration
kevin-mii Nov 2, 2026
e3e3480
Merge branch 'm31-amd/integration' into m31-amd/indexer-cp
kevin-mii Nov 2, 2026
950caba
[AMD] aiter: Keep only the in-tree table tests behind an observed fai…
kevin-mii Nov 2, 2026
739487e
[AMD] MiniMax-M3.1: Keep only the tests behind an observed failure
kevin-mii Nov 2, 2026
65152b3
[AMD] MiniMax-M3.1: Keep only the indexer CP numerics tests
kevin-mii Nov 2, 2026
850aa31
[AMD] MiniMax-M3.1: One block-id selection for the three verify top-k…
kevin-mii Nov 2, 2026
512425e
Merge branch 'm31-amd/aiter-tuned-tables' into m31-amd/integration
kevin-mii Nov 2, 2026
0fbdd74
Merge branch 'm31-amd/integration' into m31-amd/indexer-cp
kevin-mii Nov 2, 2026
15c9f43
[AMD] MiniMax-M3.1: Drop the deferred host seq-lens pull
kevin-mii Nov 2, 2026
a3fa631
Merge branch 'm31-amd/integration' into m31-amd/indexer-cp
kevin-mii Nov 2, 2026
a9099d6
Merge remote-tracking branch 'origin/main' into m31-amd/aiter-tuned-t…
kevin-mii Nov 5, 2026
121add3
Merge branch 'm31-amd/aiter-tuned-tables' into m31-amd/integration
kevin-mii Nov 5, 2026
b1ed4a2
triton_backend_hip: Admit Quark MXFP4 M3.1 targets to the DSpark draf…
kevin-mii Nov 5, 2026
d0fa412
Merge branch 'm31-amd/integration' into m31-amd/indexer-cp
kevin-mii Nov 5, 2026
cc1b800
aiter tables: Trim docstrings to the contract
kevin-mii Nov 5, 2026
2798fea
Merge branch 'm31-amd/integration' into m31-amd/indexer-cp
kevin-mii Nov 5, 2026
3afad9e
Merge branch 'm31-amd/aiter-tuned-tables' into m31-amd/integration
kevin-mii Nov 5, 2026
4738e0a
Merge branch 'm31-amd/integration' into m31-amd/indexer-cp
kevin-mii Nov 5, 2026
fac3e69
Merge remote-tracking branch 'origin/main' into m31-amd/aiter-tuned-t…
kevin-mii Nov 5, 2026
23aec1c
Merge branch 'm31-amd/aiter-tuned-tables' into m31-amd/integration
kevin-mii Nov 5, 2026
de15620
Merge branch 'm31-amd/integration' into m31-amd/indexer-cp
kevin-mii Nov 5, 2026
b082af5
test(aiter tables): Keep only the cases a plausible change would break
kevin-mii Nov 5, 2026
2ad6c64
Merge branch 'm31-amd/aiter-tuned-tables' into m31-amd/integration
kevin-mii Nov 5, 2026
cfb12c5
Merge branch 'm31-amd/integration' into m31-amd/indexer-cp
kevin-mii Nov 5, 2026
5b3849d
test(aiter tables): Let the pinned-aiter stats carry the per-row check
kevin-mii Nov 5, 2026
7f1ad71
Merge branch 'm31-amd/aiter-tuned-tables' into m31-amd/integration
kevin-mii Nov 5, 2026
39bc4c1
Merge branch 'm31-amd/integration' into m31-amd/indexer-cp
kevin-mii Nov 5, 2026
73e2d26
test(dsv4 aiter): Drop the GPU lookup and mHC bit-identity tests
kevin-mii Nov 5, 2026
c0654a5
Merge branch 'm31-amd/aiter-tuned-tables' into m31-amd/integration
kevin-mii Nov 5, 2026
6c9a906
test(indexer CP): Compare the NVFP4 verify rows with the fused select…
kevin-mii Nov 6, 2026
73b70c6
Merge remote-tracking branch 'origin/main' into m31-amd/aiter-tuned-t…
kevin-mii Nov 6, 2026
9325f76
aiter tables: Import get_hip_version and is_hip from utils.device
kevin-mii Nov 6, 2026
49cfee0
Merge branch 'm31-amd/aiter-tuned-tables' into m31-amd/integration
kevin-mii Nov 6, 2026
3bf592f
Merge branch 'm31-amd/integration' into m31-amd/indexer-cp
kevin-mii Nov 6, 2026
cef125d
Merge remote-tracking branch 'origin/main' into m31-amd/aiter-tuned-t…
kevin-mii Nov 7, 2026
cf3d865
Merge branch 'm31-amd/aiter-tuned-tables' into m31-amd/integration
kevin-mii Nov 7, 2026
849e72f
Merge branch 'm31-amd/integration' into m31-amd/indexer-cp
kevin-mii Nov 7, 2026
51f87f9
Merge remote-tracking branch 'origin/main' into m31-amd/aiter-tuned-t…
kevin-mii Nov 7, 2026
1e23641
Merge branch 'm31-amd/aiter-tuned-tables' into m31-amd/integration
kevin-mii Nov 7, 2026
2d55cca
Merge branch 'm31-amd/integration' into m31-amd/indexer-cp
kevin-mii Nov 7, 2026
0880f35
Merge remote-tracking branch 'origin/main' into m31-amd/aiter-tuned-t…
kevin-mii Nov 7, 2026
a5e4e83
Merge branch 'm31-amd/aiter-tuned-tables' into m31-amd/integration
kevin-mii Nov 7, 2026
2aa9a32
Merge branch 'm31-amd/integration' into m31-amd/indexer-cp
kevin-mii Nov 7, 2026
1d8a4e5
test(minimax_m3): Keep custom all-reduce on for the M3.1 Quark export…
kevin-mii Nov 8, 2026
891945f
Merge remote-tracking branch 'origin/main' into m31-amd/indexer-cp
kevin-mii Nov 8, 2026
337f390
Keep #46693's shared-code changes off CUDA
kevin-mii Nov 8, 2026
92d29c2
test(indexer CP): Trim the NVFP4 and IPC cases to what can fail
kevin-mii Nov 8, 2026
34987b3
router_gemv: Keep #46693's single scratch buffer
kevin-mii Nov 8, 2026
3050b07
indexer CP: Always exchange NVFP4 candidates over IPC
kevin-mii Nov 8, 2026
302597a
test(minimax_m3): Run the Quark scale-name test on the HIP loader path
kevin-mii Nov 8, 2026
0c00fbd
verify_topk_gfx950: Trim the indexer CP docstrings to the contract
kevin-mii Nov 8, 2026
494580f
Merge remote-tracking branch 'origin/main' into m31-amd/indexer-cp
kevin-mii Nov 8, 2026
1593356
indexer CP: Read the ragged verify mode through its reader, and test …
kevin-mii Nov 8, 2026
022c268
Say why the Quark and save_kv_cache paths are ROCm-only
kevin-mii Nov 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
// JIT copy of sgl-kernel's kernels/aot/csrc/allreduce/quick_all_reduce.h: the same DeviceComms and
// buffers, launching the INT4 / INT8 TP4 two-shot of quick_all_reduce.cuh.
#pragma once

#include <hip/hip_runtime.h>

#include "quick_all_reduce.cuh"
#include <algorithm>
#include <cstdio>
#include <limits>
#include <optional>
#include <stdexcept>
#include <vector>

#define HIP_CHECK(err) \
do { \
hipError_t err_ = (err); \
if (err_ != hipSuccess) { \
std::printf("HIP error %d at %s:%d. %s\n", err_, __FILE__, __LINE__, hipGetErrorString(err_)); \
throw std::runtime_error("HIP error"); \
} \
} while (0)

namespace quickreduce {

template <typename AllReduceKernel, typename T>
__global__ __quickreduce_launch_bounds_two_shot__ static void allreduce_prototype_twoshot(
T const* A,
T* B,
uint32_t N,
uint32_t num_blocks,
int rank,
uint8_t** dbuffer_list,
uint32_t data_offset,
uint32_t* d_flag_counters,
int64_t data_size_per_phase) {
int block = blockIdx.x;
int grid = gridDim.x;

// Kept in device memory, not a launch argument, so every CUDA-graph replay sees a fresh color.
uint32_t flag_color = d_flag_counters[blockIdx.x];

// Loaded once, before any remote store: on CDNA one vmcnt covers loads and stores, so a pointer
// load between remote stores would wait for their acknowledgment.
uint8_t* peer[AllReduceKernel::kWorldSize];
for (int r = 0; r < AllReduceKernel::kWorldSize; r++) {
peer[r] = dbuffer_list[r];
}
while (block < num_blocks) {
AllReduceKernel::run(A, B, N, block, rank, peer, data_offset, flag_color, data_size_per_phase);
block += grid;
flag_color++;
}
// The whole block ends up with the same value, so a single writer suffices.
if (threadIdx.x == 0 && threadIdx.y == 0) {
d_flag_counters[blockIdx.x] = flag_color;
}
}

struct DeviceComms {
// Max problem size is 2GB (in bytes) or half of uint32_t max value.
int64_t kMaxProblemSize = static_cast<int64_t>(std::numeric_limits<int32_t>::max()) + 1;

bool initialized = false;
uint32_t* d_flag_counters = nullptr;
int world_size;
int rank;

uint8_t* dbuffer;
uint8_t** dbuffer_list;
hipIpcMemHandle_t buffer_ipc_handle;
std::vector<hipIpcMemHandle_t> all_buffer_ipc_handles;
std::vector<uint8_t*> buffer_list;
uint32_t data_offset;

DeviceComms() : initialized(false), world_size(1), rank(0) {}
~DeviceComms() {
destroy();
}

void init(int world_size, int rank, std::optional<int64_t> max_problem_size = std::nullopt) {
destroy();
this->world_size = world_size;
this->rank = rank;
if (max_problem_size.has_value() && max_problem_size.value() > 0) {
this->kMaxProblemSize = max_problem_size.value();
}
// Allocate buffer size for worst case: F16 2-stage buffer.
uint32_t flags_buffer_size = 2 * world_size * kMaxNumBlocks * sizeof(uint32_t);
int64_t data_buffer_size = 2 * this->kMaxProblemSize;
int64_t total_buffer_size = flags_buffer_size + data_buffer_size;
data_offset = flags_buffer_size;
HIP_CHECK(hipExtMallocWithFlags((void**)&dbuffer, total_buffer_size, hipDeviceMallocUncached));

HIP_CHECK(hipMemset(dbuffer, 0, flags_buffer_size));

// Seeded with 1 so the first color never matches the zeroed flags.
HIP_CHECK(hipMalloc(&d_flag_counters, kMaxNumBlocks * sizeof(uint32_t)));
{
std::vector<uint32_t> init_color(kMaxNumBlocks, 1u);
HIP_CHECK(hipMemcpy(d_flag_counters, init_color.data(), kMaxNumBlocks * sizeof(uint32_t), hipMemcpyHostToDevice));
}

buffer_list.assign(world_size, nullptr);
HIP_CHECK(hipMalloc(&dbuffer_list, world_size * sizeof(uint8_t*)));

all_buffer_ipc_handles.resize(world_size);
HIP_CHECK(hipIpcGetMemHandle(&buffer_ipc_handle, dbuffer));

initialized = true;
}
int get_world_size() {
return world_size;
}
hipIpcMemHandle_t const get_handle() {
return buffer_ipc_handle;
}

void destroy() {
// Allocated before initialized is set, so freed on its own check after a failed init.
if (d_flag_counters) {
HIP_CHECK(hipFree(d_flag_counters));
d_flag_counters = nullptr;
}
if (initialized) {
// The host copy: dbuffer_list is device memory, and a peer may never have been opened.
for (int i = 0; i < world_size; i++) {
if (i != rank && buffer_list[i] != nullptr) {
HIP_CHECK(hipIpcCloseMemHandle(buffer_list[i]));
}
}

HIP_CHECK(hipFree(dbuffer));
HIP_CHECK(hipFree(dbuffer_list));

initialized = false;
}
}

void open_ipc_handles(std::vector<hipIpcMemHandle_t> const& ipc_handles) {
assert(ipc_handles.size() == all_buffer_ipc_handles.size());
for (int i = 0; i < world_size; i++) {
all_buffer_ipc_handles[i] = ipc_handles[i];
}

for (int i = 0; i < world_size; i++) {
if (i != rank) {
HIP_CHECK(
hipIpcOpenMemHandle((void**)&buffer_list[i], all_buffer_ipc_handles[i], hipIpcMemLazyEnablePeerAccess));
} else {
buffer_list[i] = dbuffer;
}
}

HIP_CHECK(hipMemcpy(dbuffer_list, buffer_list.data(), world_size * sizeof(uint8_t*), hipMemcpyHostToDevice));
}

// bf16 data, reduced in the fp16 kernels at Codec's level.
template <class Codec>
void allreduce(half const* A, half* B, uint32_t N, hipStream_t stream) {
using AllReduceKernel = AllReduceTwoshot<Codec>;
uint32_t num_blocks = divceil(N * sizeof(half), Codec::kTileSize);
uint32_t grid = std::min<uint32_t>(kMaxNumBlocks, num_blocks);
hipLaunchKernelGGL(
(allreduce_prototype_twoshot<AllReduceKernel, half>),
dim3(grid),
dim3(kBlockTwoShot),
0,
stream,
A,
B,
N,
num_blocks,
rank,
dbuffer_list,
data_offset,
d_flag_counters,
this->kMaxProblemSize);
HIP_CHECK(hipGetLastError());
}
};

} // namespace quickreduce
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
// JIT copy of sgl-kernel's kernels/aot/csrc/allreduce/quick_all_reduce_base.h, cut to what the INT4 / INT8
// two-shot of quick_all_reduce.cuh uses: fp16 arithmetic on bf16 data cast at load and store. Keep the
// arithmetic in step with the AOT copy: the outputs are bit-identical to it.
#pragma once

#include <hip/hip_bf16.h>
#include <hip/hip_fp16.h>
#include <hip/hip_runtime.h>

#include <cstdint>

#define __quickreduce_device_inline__ __device__ __forceinline__
#define __quickreduce_launch_bounds_two_shot__ __launch_bounds__(256, 4)

namespace quickreduce {

typedef __hip_bfloat162 nv_bfloat162;

using int32x2_t = __attribute__((__vector_size__(2 * sizeof(int)))) int;
using int32x4_t = __attribute__((__vector_size__(4 * sizeof(int)))) int;

#if !defined(QR_MAX_BLOCKS)
#error "QR_MAX_BLOCKS is set by the JIT loader"
#endif

static constexpr int kBlockSize = 256;
static constexpr int kAtomStride = kBlockSize;

// Max number of resident blocks; also sizes the flag buffer.
static constexpr int kMaxNumBlocks = QR_MAX_BLOCKS;

// Standard CDNA wavefront size.
static constexpr int kWavefront = 64;

static dim3 constexpr kBlockTwoShot = {kWavefront, kBlockSize / kWavefront, 1};

// Threads in a quantization group; each of its block scales covers 32 fp16 values.
static constexpr int kThreadGroupSize = 8;

__quickreduce_device_inline__ __host__ unsigned long divceil(unsigned long x, unsigned long y) {
return ((x + y - 1) / y);
}

union BufferResource {
__quickreduce_device_inline__ constexpr BufferResource() : config(0x00020000U) {}

__quickreduce_device_inline__ constexpr BufferResource(void* buffer_address, uint32_t buffer_size)
: address(buffer_address), range(buffer_size), config(0x00020000U) {}

int32x4_t descriptor;
struct {
void* address; // 8B: a 48b address and a 16b stride (unused)
uint32_t range; // Byte range for the buffer resource
uint32_t config; // Constant, DFMT=32b
};
};

__quickreduce_device_inline__ static int32x4_t buffer_load_dwordx4(
int32x4_t srsrc, int32_t voffset, int32_t soffset, int32_t aux) __asm("llvm.amdgcn.raw.buffer.load.v4i32");

__quickreduce_device_inline__ static void
buffer_store_dwordx4(int32x4_t data, int32x4_t srsrc, int32_t voffset, int32_t soffset, int32_t aux) __asm(
"llvm.amdgcn.raw.buffer.store.v4i32");
// MODE.FP16_OVFL clamps overflowing fp16 results to +/-MAX_FP16 instead of inf, the f32 -> f16
// conversion (v_cvt_pk_f16_f32) included. The memory clobber is load-bearing: without it the
// compiler may hoist a conversion above the s_setreg, and that conversion still produces inf.
__quickreduce_device_inline__ static void set_fp16_ovfl(bool const value) {
#if defined(__gfx942__) || defined(__gfx950__)
if (value) {
asm volatile("s_setreg_imm32_b32 0x5c1, 1;" ::: "memory");
} else {
asm volatile("s_setreg_imm32_b32 0x5c1, 0;" ::: "memory");
}
#endif
}
template <typename T>
__quickreduce_device_inline__ void packed_assign_add(int32x4_t* A, int32x4_t* B);

template <>
__quickreduce_device_inline__ void packed_assign_add<half>(int32x4_t* A, int32x4_t* B) {
int32x4_t& tR_fragment = A[0];
int32x4_t& tA_fragment = B[0];

asm volatile("v_pk_add_f16 %0, %1, %2" : "=v"(tR_fragment[0]) : "v"(tR_fragment[0]), "v"(tA_fragment[0]));
asm volatile("v_pk_add_f16 %0, %1, %2" : "=v"(tR_fragment[1]) : "v"(tR_fragment[1]), "v"(tA_fragment[1]));
asm volatile("v_pk_add_f16 %0, %1, %2" : "=v"(tR_fragment[2]) : "v"(tR_fragment[2]), "v"(tA_fragment[2]));
asm volatile("v_pk_add_f16 %0, %1, %2" : "=v"(tR_fragment[3]) : "v"(tR_fragment[3]), "v"(tA_fragment[3]));
}

template <typename T>
__quickreduce_device_inline__ int packed_max(int a, int b);

template <>
__quickreduce_device_inline__ int packed_max<half>(int a, int b) {
int result;
asm volatile("v_pk_max_f16 %0, %1, %2" : "=v"(result) : "v"(a), "v"(b));
return result;
}

template <typename T>
__quickreduce_device_inline__ int packed_min(int a, int b);

template <>
__quickreduce_device_inline__ int packed_min<half>(int a, int b) {
int result;
asm volatile("v_pk_min_f16 %0, %1, %2" : "=v"(result) : "v"(a), "v"(b));
return result;
}

template <typename T>
__quickreduce_device_inline__ int packed_abs_max(int a, int b);

template <>
__quickreduce_device_inline__ int packed_abs_max<half>(int a, int b) {
half2 wmaxh2 = __builtin_bit_cast(half2, a);
half2 wminh2 = __builtin_bit_cast(half2, b);
half2 wblockmaxh2;

wblockmaxh2.x = __hgt(__habs(wmaxh2.x), __habs(wminh2.x)) ? wmaxh2.x : wminh2.x;
wblockmaxh2.y = __hgt(__habs(wmaxh2.y), __habs(wminh2.y)) ? wmaxh2.y : wminh2.y;
return __builtin_bit_cast(int, wblockmaxh2);
}

template <typename T>
__quickreduce_device_inline__ int packed_add(int a, int b);

template <>
__quickreduce_device_inline__ int packed_add<half>(int a, int b) {
int result;
asm volatile("v_pk_add_f16 %0, %1, %2" : "=v"(result) : "v"(a), "v"(b));
return result;
}

template <>
__quickreduce_device_inline__ int packed_add<int16_t>(int a, int b) {
int result;
asm volatile("v_pk_add_i16 %0, %1, %2" : "=v"(result) : "v"(a), "v"(b));
return result;
}

template <typename T>
__quickreduce_device_inline__ int packed_mul(int a, int b);

template <>
__quickreduce_device_inline__ int packed_mul<half>(int a, int b) {
int result;
asm volatile("v_pk_mul_f16 %0, %1, %2" : "=v"(result) : "v"(a), "v"(b));
return result;
}

template <typename T>
__quickreduce_device_inline__ int packed_rcp(int a);

template <>
__quickreduce_device_inline__ int packed_rcp<half>(int a) {
return __builtin_bit_cast(int, h2rcp(__builtin_bit_cast(half2, a)));
}

__quickreduce_device_inline__ float T2float_cast(half a) {
return __half2float(a);
}

// Max and min over each 8-lane group, combined by packed_abs_max, in every lane of the group.
// DPP lane moves (pairs, quads, then the two halves of each 8-lane half-row); max and min are
// exact, so the result equals the AOT reduce-to-leader-and-broadcast.
template <typename T>
__quickreduce_device_inline__ int group_abs_max(int32x4_t atom) {
int a = packed_max<T>(atom[0], atom[1]);
int b = packed_max<T>(atom[2], atom[3]);
int wmax = packed_max<T>(a, b);
a = packed_min<T>(atom[0], atom[1]);
b = packed_min<T>(atom[2], atom[3]);
int wmin = packed_min<T>(a, b);
// DPP controls: quad_perm [1,0,3,2], quad_perm [2,3,0,1], row_half_mirror.
wmax = packed_max<T>(wmax, __builtin_amdgcn_mov_dpp(wmax, 0xB1, 0xF, 0xF, false));
wmin = packed_min<T>(wmin, __builtin_amdgcn_mov_dpp(wmin, 0xB1, 0xF, 0xF, false));
wmax = packed_max<T>(wmax, __builtin_amdgcn_mov_dpp(wmax, 0x4E, 0xF, 0xF, false));
wmin = packed_min<T>(wmin, __builtin_amdgcn_mov_dpp(wmin, 0x4E, 0xF, 0xF, false));
wmax = packed_max<T>(wmax, __builtin_amdgcn_mov_dpp(wmax, 0x141, 0xF, 0xF, false));
wmin = packed_min<T>(wmin, __builtin_amdgcn_mov_dpp(wmin, 0x141, 0xF, 0xF, false));
return packed_abs_max<T>(wmax, wmin);
}

// Global-address-space view of a communication buffer (local or peer: both plain GPU VAs). FLAT
// accesses also count in lgkmcnt, and their waits are imprecise: with remote FLAT stores in
// flight, an LDS wait or a wait for an earlier load also waits for those stores.
#define QR_GLOBAL(T, p) ((__attribute__((address_space(1))) T*)(p))

// s_waitcnt vmcnt(0) (gfx9 encoding; expcnt and lgkmcnt left at their maxima). The flag release on
// one lane covers only its own wave's stores, so every wave waits for its own before the barrier.
__quickreduce_device_inline__ void wait_own_stores() {
__builtin_amdgcn_s_waitcnt(0x0F70);
}

__quickreduce_device_inline__ void set_sync_flag(uint32_t* flag_ptr, uint32_t flag) {
__atomic_store_n(QR_GLOBAL(uint32_t, flag_ptr), flag, __ATOMIC_RELEASE);
}

__quickreduce_device_inline__ void wait_sync_flag(uint32_t* flag_ptr, uint32_t flag) {
while (__atomic_load_n(QR_GLOBAL(uint32_t, flag_ptr), __ATOMIC_RELAXED) != flag) {
}
}

} // namespace quickreduce
Loading
Loading