Repository navigation
Conversation
…6 to 64 Follow-up to flashinfer-ai#181 and flashinfer-ai#163. PR flashinfer-ai#163 widened coalesced compact W4A8 routing to 1024 pairs and lifted the SM120 default heuristic cap `_COMPACT_W4A8_MAX_TOKENS` to 64, while PR flashinfer-ai#181 lifted SM121 (`_COMPACT_W4A8_MAX_TOKENS_SM121`) from 4 to 16 based on initial T<=16 GB10 measurements. Cold-L2 CUDA-graph microbenchmarks on NVIDIA GB10 (SM121, 48 SMs, 0-2350 MHz cap, 128 MiB L2 flush, DeepSeek-V4.1 TP4 shape E=384, H=5120, N=576, top_k=6, csf_inline=True) show coalesced W4A8CompactMicro beats Dynamic M16 at T=24 (-3.4% latency on Zipf1.1: 1602.4 vs 1658.9 us; -1.0% on Uniform: 2133.0 vs 2155.0 us — directly covering batch=4, width=6 MTP=5 decode) and stays at parity-to-slight-win through T=64 (-0.9% at T=32, -0.2% at T=48, -1.0% at T=64 on Zipf1.1; +0.2% at T=32, -0.1% at T=48, -0.1% at T=64 on Uniform), all with 0-ULP parity vs uncoalesced micro and cosine >= 0.99992 vs Dynamic M16. Changes: - Raise `_COMPACT_W4A8_MAX_TOKENS_SM121` from 16 to 64 in `flashinfer/experimental/b12x/moe/fused_moe/_impl.py`, keeping it as a separate SM121 constant bounded by `_COALESCED_MAX_PAIRS` (1024). Autotuning still races both `micro` and `dynamic` backends. - Update SM121 contract assertions in `tests/experimental/b12x/gemm/test_decode_gemm_moe_contracts.py` and `tests/experimental/b12x/moe/test_w4a8_compact_coalesced.py`, including SM121 coverage of the 1024-pair cap (`M=64, top_k=16` vs `top_k=20`), `prequantized_input=True` boundaries (`M=64` vs `65`), and dynamic M16 fallback fields at `M=65`. Verification (NVIDIA GB10, SM121): - `FLARE_RUN_CUDA_TESTS=1 pytest -q tests/experimental/b12x/moe/test_w4a8_compact_coalesced.py tests/experimental/b12x/gemm/test_decode_gemm_moe_contracts.py tests/experimental/b12x/moe/test_compact_w4a8_backend_race.py`: 171 passed, 0 failed in 19.42s. - Combined-stack integration qualification (4x DGX Spark GB10 DeepSeek-V4.1 TP4 export & serving with companion model recipes/kernels and Flare runtime): 24/24 top-1 (0.0200 nats KL), NLL -1.4560 vs -1.4557 ref, 61/61 (32/32 at C32) concurrency clean, cold 32K needle PASS. Signed-off-by: Jonathan Gutierrez <john.gtz@icloud.com>
9 of 11 tasks
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
Follow-up to #181 and #163.
PR #163 widened coalesced compact W4A8 routing to 1024 pairs and lifted
_COMPACT_W4A8_MAX_TOKENSto64on SM120, while PR #181 lifted_COMPACT_W4A8_MAX_TOKENS_SM121from4to16based on initialT <= 16GB10 measurements.This PR raises
_COMPACT_W4A8_MAX_TOKENS_SM121from16to64(aligning SM121's no-tune heuristic cap with SM120 while keeping_COMPACT_W4A8_MAX_TOKENS_SM121as an explicit separate constant so future SM120 cap changes do not silently move SM121 without GB10 validation). All shapes remain guarded by_COALESCED_MAX_PAIRS = 1024, the non-compact SM121 guard (hidden_size=6144, intermediate_size=1024) is unchanged, and autotuning continues to race bothmicroanddynamicbackends.Changes
flashinfer/experimental/b12x/moe/fused_moe/_impl.py:_COMPACT_W4A8_MAX_TOKENS_SM121from16to64and update the adjacent comment in_w4a8_mx_micro_preferred.tests/experimental/b12x/gemm/test_decode_gemm_moe_contracts.py:64across(4, 7, 8, 16, 24, 32, 64, 65)and verifydynamic_tile_m == 16/dynamic_route_mode == "grouped"fallback at65.tests/experimental/b12x/moe/test_w4a8_compact_coalesced.py:64and extend the1024-pair cap (M=64, top_k=16vstop_k=20) andprequantized_input=True(M=64vs65) boundary checks to cover both SM120 and SM121.Isolated PR Evidence (NVIDIA GB10 / SM121)
Cold-L2 CUDA-Graph Microbenchmark (
E=384, H=5120, N=576, top_k=6, csf_inline=True)Hardware: NVIDIA GB10 (SM121, 48 SMs, 0–2350 MHz cap, 128 MiB L2 flush prior to every CUDA-graph replay, median
[p25, p75]IQR; negative latency delta = faster).TuniqEuniqE[457.0, 460.7][508.9, 515.0][456.6, 459.7][513.0, 520.2][594.8, 601.0][629.7, 634.8][663.5, 669.6][710.6, 721.1][716.7, 719.1][750.0, 754.7][875.5, 879.6][910.3, 916.7][945.4, 948.3][983.2, 999.2][1258.5, 1292.0][1282.0, 1295.3][1321.0, 1349.0][1338.3, 1359.0][1598.4, 1610.2][1622.3, 1639.3][1599.3, 1616.0][1644.4, 1681.3][2122.8, 2148.3][2152.4, 2159.6][2059.2, 2079.8][2075.7, 2095.2][2737.1, 2771.9][2741.2, 2750.8][2694.0, 2708.8][2699.5, 2713.5][3557.4, 3579.9][3566.5, 3753.0][2972.6, 2996.1][3004.3, 3028.0][4260.8, 4388.6][4276.3, 4288.4]T=24is a clear win (-3.4%Zipf /-1.0%Uniform, directly matchingbatch=4, width=6MTP=5 decode), whileT=32..64is parity-to-slight-win (-0.2%to-1.0%Zipf;+0.2%to-0.1%Uniform, within noise).0-ULPvs uncoalesced micro andcosine >= 0.99992vs Dynamic M16.csf_inline=Truematching production serving; denser compact N64 shapes (E << 384ortop_k=16) were not separately benchmarked, and autotuning continues to race both backends.GPU Unit & Contract Tests (NVIDIA GB10 / SM121)
Result:
171 passed, 0 failedin19.42s.Combined-Stack Integration Qualification
Verified end-to-end as part of a combined stack (companion model recipes/kernels and Flare runtime) exporting and serving DeepSeek-V4.1-Flash TP4 on 4× DGX Spark GB10 over 200G RoCE:
24/24top-1, mean KL0.0200nats-1.4560vs-1.4557reference1, 4, 8, 16, 32):61/61(32/32at C32) clean, 0 errors / 0 loopscached_tokens=0): PASSbatch=4, width=6(M=24) GPU decode latency:47.08 ms/round(vs49.34 ms/roundon prior TP4 package; combined-stack measurement, not an isolated single-variable toggle).