Skip to content

[MoE] Disable FlashInfer fused finalize by default for numerical accuracy - #40105

Merged
Fridge003 merged 1 commit into
sgl-project:mainfrom
zianglih:codex/flashinfer-unfused-finalize-default
Sep 18, 2026
Merged

Fridge003 merged 1 commit into
sgl-project:mainfrom
zianglih:codex/flashinfer-unfused-finalize-default

Conversation

@zianglih

@zianglih zianglih commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

@HumansAnd

Default to unfused FlashInfer MoE finalize for better numerical accuracy. Users can opt in to fused atomic finalize with SGLANG_FLASHINFER_MOE_FUSED_FINALIZE=1 when they prefer more aggressive performance.

Modifications

  • Default: change SGLANG_FLASHINFER_MOE_FUSED_FINALIZE from EnvBool(True) to EnvBool(False).
  • Documentation: update the default and explain the performance opt-in.
  • Existing paths: CUTLASS and CuTe DSL callers continue to read the same flag; deterministic inference continues to force it off. No kernel changes or new tests.

Accuracy Tests

  • Static validation: changed-file pre-commit checks and git diff --check passed at e3bcc8f7b4337565baea1d2b44fd4f0f838b1953 (base: 6e1d9c14647e3e16f2a103b89dead95f1400ea48).
  • Environment: macOS 26.4.1, arm64, Python 3.14.6, pre-commit 4.6.1; local CPU checks only, no container or GPUs used.
  • Not run: model accuracy tests; no tests added for this default-only runtime change. Mintlify build/link checks were not run because mint is unavailable locally.
pre-commit run --files python/sglang/srt/environ.py docs/docs/references/environment_variables.mdx
git diff --check HEAD^ HEAD
Complete pre-commit output
check for broken symlinks..............................(no files to check)Skipped
detect destroyed symlinks..................................................Passed
trim trailing whitespace...................................................Passed
fix end of files...........................................................Passed
check yaml.............................................(no files to check)Skipped
check toml.............................................(no files to check)Skipped
check python ast...........................................................Passed
check for added large files................................................Passed
check for merge conflicts..................................................Passed
check that scripts with shebangs are executable............................Passed
detect private key.........................................................Passed
debug statements (python)..................................................Passed
don't commit to branch.....................................................Passed
isort......................................................................Passed
ruff (legacy alias)........................................................Passed
ruff format................................................................Passed
codespell..................................................................Passed
clang-format...........................................(no files to check)Skipped
nbstripout.............................................(no files to check)Skipped
forbid docs_new/ (renamed to docs/)....................(no files to check)Skipped
check chinese characters in multimodal_gen.............(no files to check)Skipped
sort CI_PERMISSIONS.json...............................(no files to check)Skipped
check for duplicate workflow job names.................(no files to check)Skipped
check rust-ext cache key prefix defaults match.........(no files to check)Skipped
reject bare pytest.main calls in __main__ blocks...........................Passed
unit tests for lint checkers...........................(no files to check)Skipped
validate registered test CI registries.................(no files to check)Skipped
reject CI-registered tests inside the sglang package.......................Passed
rustfmt sgl-model-gateway (nightly)....................(no files to check)Skipped
rustfmt experimental/sgl-router........................(no files to check)Skipped
clippy rust/ workspace (auto-fix)......................(no files to check)Skipped
rustfmt rust/ workspace................................(no files to check)Skipped

git diff --check HEAD^ HEAD: exit 0, no output.

Speed Tests and Profiling

  • Result: Disabling fused finalize has a measurable W4A4 cost in this EP8 sweep. CuTe W4A4 per-tensor latency increases 21.75% at 1 token. At 16,384 tokens, latency changes by +7.82% for CUTLASS, +12.55% for CuTe W4A4 per-tensor, +10.70% for CuTe W4A4 per-token, and -9.20% for CuTe W4A16. These single sweeps do not support a blanket claim of negligible regression. Users can retain SGLANG_FLASHINFER_MOE_FUSED_FINALIZE=1 when this performance tradeoff matters.
  • Scope: benchmarks/bench_moe_deepseek.py at official release v0.6.18.post1, commit 8bc3b578027791336c6ae87db5c9d76f82cef8bc. All four configurations were measured with simulated EP=8 using the benchmark-only patch below: forward the existing finalize option to CUTLASS and add a W4A4-only selector. No FlashInfer runtime/kernel changes. This directly compares the FlashInfer flag used by SGLang PR head e3bcc8f7b4337565baea1d2b44fd4f0f838b1953.
  • Hardware/image: 1× NVIDIA B300 SXM6 AC (SM103; GPU 0 of an allocated 8-GPU node), 275,040 MiB reported memory, 1,100 W power limit, driver 590.48.01. Image lmsysorg/sglang:nightly-dev-cu13-20260918-20518d85, runtime digest sha256:d46a59f4b98658f728a1e006c003ad5ee0628e999fd8b2bef71ac1bb61b814da. Run date: 2026-09-18 UTC.
  • Software: Python 3.12.3, PyTorch 2.13.0+cu130, CUDA toolkit 13.0.88, flashinfer-python==0.6.18.post1, flashinfer-cubin==0.6.18.post1, flashinfer-jit-cache==0.6.18.post1+cu130, nvidia-cutlass-dsl==4.6.2, apache-tvm-ffi==0.1.11, cupti-python==13.4.0 (nvidia-cuda-cupti==13.4.92). The image shipped FlashInfer 0.6.18; all three FlashInfer packages were updated to the matched official post1 release before measurement.
  • Workload: DeepSeek-V3 MoE: hidden 7,168, intermediate 2,048, 256 experts, top-8, 8 routing groups/top-4 groups, routed scale 2.5, random seed 42, routing bias scale 0.01; simulated EP=8, TP=1: rank 0 holds experts 0–31 of 256. The token count is the global input batch routed across all 256 experts; this single-GPU benchmark computes the local expert contribution. Powers of two from 1 through 16,384 tokens. CUTLASS uses NVFP4 W4A4 per-tensor activation scaling. CuTe DSL covers NVFP4 W4A4 per-tensor, NVFP4 W4A4 per-token, and NVFP4 W4A16 with BF16 input, using its wrapper API.
  • Timing: one complete flag-True sweep followed by one flag-False sweep for each configuration; no repeated or reverse-order sweeps. Independent autotuning caches per backend/activation/finalize mode; 10 warmups, 100 measured iterations per case, native median GPU latency, CUDA graphs and CUPTI with cold-L2 flushing. Routing, input activation quantization (--include-activation-quant, for W4A4), both expert GEMMs, and finalize are included. Weight preparation, compilation, and autotuning are excluded. W4A16 consumes BF16 input directly. All six commands exited 0, yielding all 120 requested latency rows with no CUPTI fallback warnings.
  • Build/provenance: all EP8 runs used the same physical GPU (UUID GPU-aa4e94df-96de-22b9-87c2-9960d6b27cb8), image, and package versions. JIT was left enabled. The release wheel provides fused_moe_103.so and fp4_quantization_103.so for CUTLASS MoE and FP4 quantization; no CUTLASS build was needed.
  • Limits: single sweeps provide no repeat/order-variation statistics. This covers local MoE only: no inter-GPU communication, other EP/TP layouts, model accuracy checks, or end-to-end serving. No numerical-error reduction is measured here.

Speedup = latency with use_fused_finalize=True (old default) / latency with False (proposed default); greater than 1 means disabling fused finalize is faster. CUTLASS True permits eligible fused-finalize tactics; autotuning can still choose an unfused tactic.

Tokens CUTLASS CuTe W4A4 per-tensor CuTe W4A4 per-token CuTe W4A16
1 1.0179× 0.8213× 1.1639× 1.0896×
2 0.9361× 0.8579× 0.9269× 1.0104×
4 0.9408× 0.9225× 0.9248× 1.0291×
8 0.9454× 0.9426× 0.9621× 1.0719×
16 0.9693× 0.9452× 0.9458× 1.0230×
32 0.9707× 0.9467× 0.9637× 1.0227×
64 0.9554× 0.9467× 0.9491× 1.0123×
128 0.9441× 0.9511× 0.9633× 1.0200×
256 0.9456× 0.9429× 0.9449× 0.9861×
512 0.9416× 0.9455× 0.9608× 1.0242×
1024 0.9587× 0.9555× 0.9466× 1.0260×
2048 0.9550× 0.9785× 0.9438× 1.0538×
4096 0.9604× 0.9447× 0.9349× 1.1145×
8192 0.9404× 0.9058× 0.9158× 1.1457×
16384 0.9275× 0.8885× 0.9033× 1.1013×
Environment setup, benchmark-only patch, and reproduction commands
# Inside lmsysorg/sglang:nightly-dev-cu13-20260918-20518d85
set -euo pipefail
python -m pip install --no-deps flashinfer-python==0.6.18.post1
python -m pip install --no-deps \
  flashinfer-cubin==0.6.18.post1 \
  flashinfer-jit-cache==0.6.18.post1+cu130 \
  --index-url https://flashinfer.ai/whl \
  --extra-index-url https://flashinfer.ai/whl/cu130
python -m pip install cupti-python==13.4.0

git clone --depth 1 --branch v0.6.18.post1 \
  https://github.com/flashinfer-ai/flashinfer.git flashinfer-bench
cd flashinfer-bench
test "$(git rev-parse HEAD)" = 8bc3b578027791336c6ae87db5c9d76f82cef8bc
unset PYTHONPATH FLASHINFER_DISABLE_JIT
export CUDA_VISIBLE_DEVICES=0 PYTHONUNBUFFERED=1
TOKENS=1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384
COMMON=(--num-tokens "$TOKENS" --ep 8 --tp 1 --warmup 10 --iters 100 --include-activation-quant)
mkdir -p finalize-results

# Local benchmark-only changes: forward finalize to CUTLASS and select only W4A4.
cat > finalize-results/bench-finalize.patch <<'PATCH'
diff --git a/benchmarks/bench_moe_deepseek.py b/benchmarks/bench_moe_deepseek.py
index a779b94..a90e5ec 100644
--- a/benchmarks/bench_moe_deepseek.py
+++ b/benchmarks/bench_moe_deepseek.py
@@ -579,6 +579,7 @@ def bench_cutlass(
     use_cupti=True,
     do_autotune=True,
     include_activation_quant=False,
+    use_fused_finalize=True,
     profile_cuda=False,
     profile_iters=10,
     autotune_cache=None,
@@ -663,6 +664,7 @@ def bench_cutlass(
             output=output,
             ep_size=ep_size,
             ep_rank=0,  # Simulating rank 0 of EP
+            use_fused_finalize=use_fused_finalize,
         )
         return output
 
@@ -1115,7 +1117,7 @@ def _benchmark_single(
     histogram_record = _collect_expert_histogram(inputs, num_local, local_offset)
 
     selected = set(backends or ("cutedsl", "cutlass", "trtllm"))
-    run_cute_dsl_w4a4 = "cutedsl" in selected and profile_backend in (
+    run_cute_dsl_w4a4 = bool(selected & {"cutedsl", "cutedsl-w4a4"}) and profile_backend in (
         None,
         "cute-dsl",
     )
@@ -1176,6 +1178,7 @@ def _benchmark_single(
             use_cupti,
             do_autotune=do_autotune,
             include_activation_quant=include_activation_quant,
+            use_fused_finalize=use_fused_finalize,
             profile_cuda=profile_cuda,
             profile_iters=profile_iters,
             autotune_cache=autotune_cache,
@@ -1470,7 +1473,7 @@ def main():
     parser.add_argument(
         "--backends",
         type=str,
-        help="Comma-separated subset of cutedsl,cutlass,trtllm",
+        help="Comma-separated subset of cutedsl,cutedsl-w4a4,cutlass,trtllm",
     )
     parser.add_argument(
         "--distributions",
@@ -1568,7 +1571,7 @@ def main():
         backends = tuple(
             item.strip() for item in args.backends.split(",") if item.strip()
         )
-        unknown = sorted(set(backends) - {"cutedsl", "cutlass", "trtllm"})
+        unknown = sorted(set(backends) - {"cutedsl", "cutedsl-w4a4", "cutlass", "trtllm"})
         if unknown:
             parser.error(f"unknown --backends value(s): {', '.join(unknown)}")
     distributions = tuple(
PATCH
git apply finalize-results/bench-finalize.patch

# CuTe W4A4 per-tensor + W4A16, simulated EP8.
for MODE in fused unfused; do
  FLAGS=()
  [[ "$MODE" == unfused ]] && FLAGS+=(--no-fused-finalize)
  python benchmarks/bench_moe_deepseek.py \
    --backends cutedsl "${COMMON[@]}" "${FLAGS[@]}" \
    --cache "$PWD/finalize-results/cutedsl-${MODE}-tactics.json" \
    2>&1 | tee "finalize-results/cutedsl-${MODE}.log"
done

# Additional sweeps: one per mode for each new column. JIT uses normal defaults.
for BACKEND in cutlass cutedsl-w4a4; do
  EXTRA=()
  [[ "$BACKEND" == cutedsl-w4a4 ]] && EXTRA+=(--use-per-token-activation)
  for MODE in fused unfused; do
    FLAGS=()
    [[ "$MODE" == unfused ]] && FLAGS+=(--no-fused-finalize)
    python benchmarks/bench_moe_deepseek.py \
      --backends "$BACKEND" "${COMMON[@]}" "${EXTRA[@]}" "${FLAGS[@]}" \
      --cache "$PWD/finalize-results/${BACKEND}-${MODE}-tactics.json" \
      2>&1 | tee "finalize-results/${BACKEND}-${MODE}.log"
  done
done

These are direct FlashInfer benchmarks; no SGLang environment override is needed. --no-fused-finalize controls the API argument. Each backend/activation configuration runs exactly once per flag value. The first pair measures both CuTe per-tensor W4A4 and W4A16; the later pairs add CUTLASS and per-token W4A4.

Complete native benchmark result tables (120 rows; raw ms and TFLOPS)

CuTe W4A4 per-tensor and W4A16, use_fused_finalize=True

backend,tokens,latency_ms,tflops
CuteDSL W4A4,1,0.032433,2.715806
CuteDSL W4A16,1,0.042817,2.057160
CuteDSL W4A4,2,0.042496,4.145301
CuteDSL W4A16,2,0.048369,3.642056
CuteDSL W4A4,4,0.058305,6.042785
CuteDSL W4A16,4,0.064481,5.463959
CuteDSL W4A4,8,0.075425,9.342363
CuteDSL W4A16,8,0.082817,8.508435
CuteDSL W4A4,16,0.083665,16.844393
CuteDSL W4A16,16,0.086913,16.214999
CuteDSL W4A4,32,0.115632,24.375260
CuteDSL W4A16,32,0.122321,23.042424
CuteDSL W4A4,64,0.148929,37.851222
CuteDSL W4A16,64,0.154385,36.513551
CuteDSL W4A4,128,0.151714,74.313025
CuteDSL W4A16,128,0.159442,70.711133
CuteDSL W4A4,256,0.159234,141.607000
CuteDSL W4A16,256,0.166017,135.820491
CuteDSL W4A4,512,0.161601,279.064836
CuteDSL W4A16,512,0.172385,261.607197
CuteDSL W4A4,1024,0.168193,536.254857
CuteDSL W4A16,1024,0.191634,470.659242
CuteDSL W4A4,2048,0.183858,981.132814
CuteDSL W4A16,2048,0.236114,763.989541
CuteDSL W4A4,4096,0.218065,1654.444435
CuteDSL W4A16,4096,0.365762,986.370262
CuteDSL W4A4,8192,0.290978,2479.756221
CuteDSL W4A16,8192,0.713574,1011.183852
CuteDSL W4A4,16384,0.454260,3176.838374
CuteDSL W4A16,16384,1.369260,1053.933905

CUTLASS W4A4 per-tensor, use_fused_finalize=True

backend,tokens,latency_ms,tflops
CUTLASS,1,0.052705,1.671196
CUTLASS,2,0.057889,3.043105
CUTLASS,4,0.070689,4.984142
CUTLASS,8,0.086369,8.158518
CUTLASS,16,0.098546,14.300868
CUTLASS,32,0.129313,21.796511
CUTLASS,64,0.159842,35.267090
CUTLASS,128,0.163602,68.913116
CUTLASS,256,0.173777,129.755827
CUTLASS,512,0.181249,248.813271
CUTLASS,1024,0.200417,450.033247
CUTLASS,2048,0.224834,802.319162
CUTLASS,4096,0.280258,1287.301733
CUTLASS,8192,0.432900,1666.792575
CUTLASS,16384,0.715830,2015.994037

CuTe W4A4 per-token, use_fused_finalize=True

backend,tokens,latency_ms,tflops
CuteDSL W4A4,1,0.054080,1.628705
CuteDSL W4A4,2,0.057217,3.078846
CuteDSL W4A4,4,0.074593,4.723252
CuteDSL W4A4,8,0.091281,7.719536
CuteDSL W4A4,16,0.099457,14.169803
CuteDSL W4A4,32,0.135201,20.847274
CuteDSL W4A4,64,0.166610,33.834371
CuteDSL W4A4,128,0.173233,65.081460
CuteDSL W4A4,256,0.180930,124.625979
CuteDSL W4A4,512,0.186594,241.686643
CuteDSL W4A4,1024,0.193586,465.913409
CuteDSL W4A4,2048,0.214882,839.477604
CuteDSL W4A4,4096,0.270035,1336.041331
CuteDSL W4A4,8192,0.373779,1930.428249
CuteDSL W4A4,16384,0.611429,2360.223364

CuTe W4A4 per-tensor and W4A16, use_fused_finalize=False

backend,tokens,latency_ms,tflops
CuteDSL W4A4,1,0.039488,2.230561
CuteDSL W4A16,1,0.039296,2.241431
CuteDSL W4A4,2,0.049537,3.556145
CuteDSL W4A16,2,0.047872,3.679829
CuteDSL W4A4,4,0.063200,5.574708
CuteDSL W4A16,4,0.062656,5.623109
CuteDSL W4A4,8,0.080017,8.806222
CuteDSL W4A16,8,0.077265,9.119822
CuteDSL W4A4,16,0.088513,15.921798
CuteDSL W4A16,16,0.084960,16.587545
CuteDSL W4A4,32,0.122145,23.075626
CuteDSL W4A16,32,0.119601,23.566461
CuteDSL W4A4,64,0.157313,35.833826
CuteDSL W4A16,64,0.152513,36.961610
CuteDSL W4A4,128,0.159521,70.675893
CuteDSL W4A16,128,0.156321,72.122678
CuteDSL W4A4,256,0.168881,133.517556
CuteDSL W4A16,256,0.168353,133.936302
CuteDSL W4A4,512,0.170913,263.860307
CuteDSL W4A16,512,0.168305,267.949001
CuteDSL W4A4,1024,0.176017,512.418194
CuteDSL W4A16,1024,0.186770,482.916492
CuteDSL W4A4,2048,0.187889,960.078272
CuteDSL W4A16,2048,0.224050,805.128449
CuteDSL W4A4,4096,0.230818,1563.037774
CuteDSL W4A16,4096,0.328195,1099.278790
CuteDSL W4A4,8192,0.321252,2246.073577
CuteDSL W4A16,8192,0.622806,1158.555128
CuteDSL W4A4,16384,0.511269,2822.604975
CuteDSL W4A16,16384,1.243291,1160.717476

CUTLASS W4A4 per-tensor, use_fused_finalize=False

backend,tokens,latency_ms,tflops
CUTLASS,1,0.051776,1.701182
CUTLASS,2,0.061840,2.848631
CUTLASS,4,0.075137,4.689055
CUTLASS,8,0.091360,7.712818
CUTLASS,16,0.101665,13.862058
CUTLASS,32,0.133217,21.157752
CUTLASS,64,0.167298,33.695230
CUTLASS,128,0.173282,65.063245
CUTLASS,256,0.183778,122.694655
CUTLASS,512,0.192497,234.273986
CUTLASS,1024,0.209041,431.467096
CUTLASS,2048,0.235426,766.220567
CUTLASS,4096,0.291810,1236.340889
CUTLASS,8192,0.460356,1567.383733
CUTLASS,16384,0.771799,1869.800228

CuTe W4A4 per-token, use_fused_finalize=False

backend,tokens,latency_ms,tflops
CuteDSL W4A4,1,0.046464,1.895649
CuteDSL W4A4,2,0.061728,2.853800
CuteDSL W4A4,4,0.080657,4.368146
CuteDSL W4A4,8,0.094881,7.426598
CuteDSL W4A4,16,0.105152,13.402371
CuteDSL W4A4,32,0.140289,20.091185
CuteDSL W4A4,64,0.175553,32.110693
CuteDSL W4A4,128,0.179826,62.695545
CuteDSL W4A4,256,0.191489,117.753602
CuteDSL W4A4,512,0.194210,232.208211
CuteDSL W4A4,1024,0.204514,441.017794
CuteDSL W4A4,2048,0.227682,792.283213
CuteDSL W4A4,4096,0.288850,1249.012473
CuteDSL W4A4,8192,0.408131,1767.950461
CuteDSL W4A4,16384,0.676853,2132.084729

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

CI States

Latest PR Test (Base): ❌ Run #35312124927
Latest PR Test (Extra): ❌ Run #35312124789
Latest PR Test (AMD ROCm 10): ❌ Run #35312124842

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Sep 18, 2026
@Fridge003
Fridge003 merged commit c46bf5e into sgl-project:main Sep 18, 2026
103 of 119 checks passed
aleozlx added a commit to flashinfer-ai/flashinfer that referenced this pull request Oct 2, 2026
<!-- .github/pull_request_template.md -->

## 📌 Description

@humansand

Reduce the cost of deterministic CuTe DSL MoE finalize for W4A4
per-tensor/per-token NVFP4 activation scaling and W4A16 BF16 activations
when `use_fused_finalize=False`.

- **Reduction:** replace the native standalone finalizer with a shared
CuTe kernel. Reduce top-k slots in ascending order using FP32
round-to-nearest FMA with flush-to-zero behavior matching native
`--use_fast_math`, then convert once to BF16. Negative routes are
skipped before loading expert output; all-masked tokens write zero.
- **Layouts:** preserve W4A4 expanded rows (`token * top_k + slot`) and
W4A16 permuted rows selected by the routing map. `input_is_expanded`
specializes address selection at compile time; permuted row zero remains
valid. Both paths use contiguous, aligned BF16 vectors of eight
elements.
- **PDL:** issue FC2's dependent-launch hint after its input dependency
wait, allowing the standalone finalizer to prepare early. It preloads
already-completed routing metadata, then waits before all FC2-output
reads. W4A16's previous FC2 tail hint moves to this point for unfused
output; the fused hint remains unchanged.
- **Launch geometry:** 32 threads for at most eight tokens, otherwise
128; four vectors per thread above 1024 tokens, otherwise one. The
private helper accepts FP32/BF16/FP16 routing scales and int32 maps;
input/output are separate contiguous BF16 matrices with hidden size
divisible by eight and 16-byte-aligned storage. Zero tokens return
without a kernel launch.
- **Benchmark fix:** forward `--no-fused-finalize` to CUTLASS, where it
was previously ignored. `True` permits fused tactics; it does not force
one. The historical performance campaign below measured CuTe DSL only.
- **Scope:** five CuTe DSL files plus benchmark flag wiring; no C++
changes or new tests. Public MoE defaults and fused-finalize arithmetic
remain unchanged.

### September 30 rebase

- **Source:** base `82e8eb1410c0e55f738b63f3638950a30726e863`; head
`b42dddd80322e180426d9eea5ac30884180fbefc`.
- **Resolution:** retain #5682's dependency wait before routing reads
and our unfused launch hint after cluster synchronization. Update the
metadata-readiness comment for #5497's PDL-enabled W4A4 sort. Six-file
scope unchanged.
- **Validation:** changed-file pre-commit, `git diff --check`, eight
mocked CUTLASS wiring cases and CLI help pass. No GPU tests or
benchmarks rerun for this rebase; all evidence below retains its
recorded revisions.

### September 28 rebase and CI follow-up

- **September 28 source:** base
`a31c72523ae37d82fd657de36ce2b35156c3c559`; candidate
`9c39a45529c4bbffd866f7ae6255b19eaf835aa7`. All four PR commits remain
`=` in `git range-diff` against the previous `07e519fc..bde42729` stack.
The six-file PR scope is unchanged; upstream W4A16 transform
tracing/stage-completion changes are retained.
- **CI cause and fix:** the earlier H100 run at `bde42729` completed
with 1703 passed, four failed, and 11033 skipped. Three failures
expected the old SiTU error text; the fourth found Cake's generated
activation documentation missing SiTU. These pre-existing
test/documentation mismatches are fixed upstream by
[#5628](https://github.com/flashinfer-ai/flashinfer/pull/5628), commit
`8b7ab98acdc6e125229c0165cdde9d6a1ab007b1`, now included in the base.
The PR adds no test or documentation workaround; exact failure records
appear below.
- **Runtime constraint:** validation uses full pinned Python/JIT/native
source. The September 23 nightly packages are built from
`b395280a5bc9430244f19be5b905407d5756c1eb`; their old shared routing
helper ABI lacks six dual-tile arguments, so current `csrc`/`include`
must compile the shared MoE helpers. Only unchanged vendor headers are
reused. Upstream `skip_unpermute` and prepared-launch callbacks remain
intact.
- **Evidence status:** fresh C2 validation at `9c39a455` passed **64
W4A16 GPU cases and eight host regression cases**, with zero
failures/errors/skips. Changed-file pre-commit (including mypy/Ruff),
`git diff --check`, eight mocked CUTLASS wiring cases and CLI help also
pass. The 155 pytest / 214 standalone executions / 96 W4A8
native-reduction comparisons below remain evidence for **`bde42729`
only**. All performance tables, raw rows, and benchmark commands remain
**historical `f9dd3c1` versus `eb5f05be`**; performance is not rerun for
either September 28 rebase.

### Historical pre-rebase performance comparison

- **Historical source (all tables/rows below):** base CuTe files
`eb5f05be1f8e3ef8aa017a66dcbd5d80119b1095`; head CuTe files
`f9dd3c10541e087b716772245a9d033499745048`. Both are overlays on
official nightly `0.7.0.dev20260917`, source
`d233e27ddddbcfdc24eec38ab4dffda1f43ff49c`, with the same `f9dd3c1`
benchmark source. These are source overlays on the pinned runtime, not
whole-repository builds. The baseline includes the PR-base W4A16
host/kernel files so unrelated nightly-to-base changes are held fixed.
- **Matrix:** W4A4 per-tensor, W4A4 per-token, W4A16 × base/head ×
fused/unfused: 12 independent forward sweeps, 15 token counts each, 180
rows. Each arm uses its own autotune cache. There is no reverse sweep or
aggregation across sweeps.
- **Workload:** H7168/I2048, 256 global experts, top-k8,
groups8/top-groups4, routed scaling2.5, SwiGLU, seed42 and routing-bias
scale0.01; simulated EP8 (32 local experts, offset0), TP1. Routing and
W4A4 input activation quantization are timed; W4A16 consumes BF16
directly. Inter-GPU communication is excluded.
- **Timing:** native benchmark medians from 10 warmups and 100
CUDA-graph CUPTI samples, cold L2, PDL enabled, ordinary autotuning,
`FLASHINFER_DIST_AWARE_AUTOTUNE=0`, JIT enabled. Compilation,
allocations and tuning are outside measured latency.
- **Environment:** `nvcr.io/nvidia/pytorch:26.05-py3`; one NVIDIA B300
SXM6 AC (SM103) GPU0 of an eight-GPU devbox, UUID
`GPU-e32ead05-f360-d139-903a-f38cf17eecb8`, 275040 MiB, 1100 W power
limit; driver 590.48.01, CUDA toolkit 13.2.78, Python 3.12.3, Torch
`2.12.0a0+5aff3928d8.nv26.05`. Matching FlashInfer python/cubin
`0.7.0.dev20260917` and jit-cache/SM103 cache `0.7.0.dev20260917+cu130`;
CuTe DSL 4.6.2, TVM FFI 0.1.11, cupti-python 13.4.0 and CUDA CUPTI
13.4.92. All 180 rows used native CUPTI without fallback. Native helpers
absent from the nightly cache were built once and shared across both
overlays; subsequent kernel specialization uses CuTe DSL JIT.
- **Historical result:** W4A4 per-tensor: 15/15 token counts improve;
W4A4 per-token: 15/15 token counts improve; W4A16: 15/15 token counts
improve. No measured unfused regression in that pre-rebase single sweep;
this is not a result for either September 28 rebased head.

**Optimization speedup = base unfused latency / head unfused latency.**
Values above 1 mean historical head `f9dd3c1` is faster than historical
base `eb5f05be`. All values below are ratios, not latency units.

| Tokens | W4A4 per-tensor | W4A4 per-token | W4A16 |
| ---: | ---: | ---: | ---: |
| 1 | 1.1118× | 1.0745× | 1.0783× |
| 2 | 1.1396× | 1.0644× | 1.0519× |
| 4 | 1.0606× | 1.0414× | 1.0356× |
| 8 | 1.0432× | 1.0353× | 1.0228× |
| 16 | 1.0428× | 1.0383× | 1.0363× |
| 32 | 1.0409× | 1.0366× | 1.0209× |
| 64 | 1.0421× | 1.0347× | 1.0198× |
| 128 | 1.0400× | 1.0350× | 1.0203× |
| 256 | 1.0403× | 1.0355× | 1.0202× |
| 512 | 1.0371× | 1.0321× | 1.0122× |
| 1024 | 1.0244× | 1.0223× | 1.0065× |
| 2048 | 1.0390× | 1.0321× | 1.0211× |
| 4096 | 1.0473× | 1.0374× | 1.0201× |
| 8192 | 1.0468× | 1.0394× | 1.0194× |
| 16384 | 1.0472× | 1.0349× | 1.0506× |

**Historical finalize comparison = `f9dd3c1` fused latency / `f9dd3c1`
unfused latency.** Values above 1 mean historical head unfused is
faster. This compares finalize modes, not the optimization against base.

| Tokens | W4A4 per-tensor | W4A4 per-token | W4A16 |
| ---: | ---: | ---: | ---: |
| 1 | 0.9465× | 0.9576× | 1.0757× |
| 2 | 1.0249× | 1.0931× | 1.0619× |
| 4 | 0.9738× | 0.9699× | 1.0601× |
| 8 | 0.9772× | 0.9865× | 1.0536× |
| 16 | 0.9755× | 0.9777× | 1.0298× |
| 32 | 0.9802× | 0.9867× | 1.0267× |
| 64 | 0.9832× | 0.9822× | 1.0226× |
| 128 | 0.9823× | 0.9865× | 1.0330× |
| 256 | 0.9791× | 0.9849× | 1.0241× |
| 512 | 0.9766× | 0.9780× | 1.0143× |
| 1024 | 0.9676× | 0.9702× | 1.0169× |
| 2048 | 0.9801× | 0.9688× | 1.0710× |
| 4096 | 0.9834× | 0.9653× | 1.0533× |
| 8192 | 0.9525× | 0.9395× | 1.1070× |
| 16384 | 0.9205× | 0.9329× | 1.0907× |

<details>
<summary>Historical fused controls: eb5f05be fused / f9dd3c1
fused</summary>

Values above 1 mean historical head fused is faster. These historical
controls retain independent autotuning and expose run/tactic variation;
the patch does not change fused-finalize arithmetic.

In the historical sweep at two tokens, head fused W4A4 latency increases
by 6.68% per-tensor and 10.52% per-token. The saved caches show
different FC1/FC2 tactics. W4A16 at 16384 tokens also selects different
tiles in both fused and unfused comparisons. The reported gains
therefore include tactic selection; fused-control ratios cannot be
subtracted to infer a fixed-tactic kernel gain.

| Tokens | W4A4 per-tensor | W4A4 per-token | W4A16 |
| ---: | ---: | ---: | ---: |
| 1 | 0.9989× | 0.9996× | 1.0024× |
| 2 | 0.9373× | 0.9048× | 0.9924× |
| 4 | 1.0029× | 0.9991× | 0.9853× |
| 8 | 0.9960× | 1.0041× | 1.0125× |
| 16 | 0.9996× | 1.0000× | 1.0000× |
| 32 | 1.0009× | 1.0002× | 1.0009× |
| 64 | 1.0000× | 0.9998× | 0.9967× |
| 128 | 0.9988× | 0.9993× | 0.9998× |
| 256 | 1.0003× | 1.0004× | 1.0009× |
| 512 | 0.9999× | 1.0003× | 0.9989× |
| 1024 | 0.9989× | 1.0007× | 0.9992× |
| 2048 | 0.9988× | 0.9998× | 1.0009× |
| 4096 | 1.0001× | 0.9996× | 1.0004× |
| 8192 | 1.0000× | 0.9997× | 1.0141× |
| 16384 | 1.0018× | 0.9998× | 1.0199× |

</details>

<details>
<summary>All 180 historical native benchmark rows: base=eb5f05be,
head=f9dd3c1</summary>

```csv
arm,mode,finalize,backend,tokens,latency_ms,tflops
base,w4a4-per-tensor,fused,CuteDSL W4A4,1,0.028544,3.085776
base,w4a4-per-tensor,fused,CuteDSL W4A4,2,0.038304,4.599018
base,w4a4-per-tensor,fused,CuteDSL W4A4,4,0.054945,6.412317
base,w4a4-per-tensor,fused,CuteDSL W4A4,8,0.071073,9.914357
base,w4a4-per-tensor,fused,CuteDSL W4A4,16,0.080193,17.573680
base,w4a4-per-tensor,fused,CuteDSL W4A4,32,0.111265,25.332066
base,w4a4-per-tensor,fused,CuteDSL W4A4,64,0.143969,39.155267
base,w4a4-per-tensor,fused,CuteDSL W4A4,128,0.147025,76.682803
base,w4a4-per-tensor,fused,CuteDSL W4A4,256,0.155569,144.942153
base,w4a4-per-tensor,fused,CuteDSL W4A4,512,0.157249,286.787281
base,w4a4-per-tensor,fused,CuteDSL W4A4,1024,0.163009,553.310491
base,w4a4-per-tensor,fused,CuteDSL W4A4,2048,0.175121,1030.079924
base,w4a4-per-tensor,fused,CuteDSL W4A4,4096,0.211906,1702.538409
base,w4a4-per-tensor,fused,CuteDSL W4A4,8192,0.293346,2459.738690
base,w4a4-per-tensor,fused,CuteDSL W4A4,16384,0.445395,3240.061948
base,w4a4-per-tensor,unfused,CuteDSL W4A4,1,0.033569,2.623900
base,w4a4-per-tensor,unfused,CuteDSL W4A4,2,0.045440,3.876777
base,w4a4-per-tensor,unfused,CuteDSL W4A4,4,0.059664,5.905045
base,w4a4-per-tensor,unfused,CuteDSL W4A4,8,0.076176,9.250198
base,w4a4-per-tensor,unfused,CuteDSL W4A4,16,0.085761,16.432812
base,w4a4-per-tensor,unfused,CuteDSL W4A4,32,0.118049,23.876291
base,w4a4-per-tensor,unfused,CuteDSL W4A4,64,0.152593,36.942354
base,w4a4-per-tensor,unfused,CuteDSL W4A4,128,0.155857,72.337394
base,w4a4-per-tensor,unfused,CuteDSL W4A4,256,0.165234,136.464932
base,w4a4-per-tensor,unfused,CuteDSL W4A4,512,0.167009,270.028302
base,w4a4-per-tensor,unfused,CuteDSL W4A4,1024,0.172754,522.098326
base,w4a4-per-tensor,unfused,CuteDSL W4A4,2048,0.185858,970.574911
base,w4a4-per-tensor,unfused,CuteDSL W4A4,4096,0.225650,1598.835599
base,w4a4-per-tensor,unfused,CuteDSL W4A4,8192,0.322371,2238.273622
base,w4a4-per-tensor,unfused,CuteDSL W4A4,16384,0.505780,2853.237451
head,w4a4-per-tensor,fused,CuteDSL W4A4,1,0.028576,3.082320
head,w4a4-per-tensor,fused,CuteDSL W4A4,2,0.040864,4.310851
head,w4a4-per-tensor,fused,CuteDSL W4A4,4,0.054784,6.431103
head,w4a4-per-tensor,fused,CuteDSL W4A4,8,0.071361,9.874344
head,w4a4-per-tensor,fused,CuteDSL W4A4,16,0.080225,17.566671
head,w4a4-per-tensor,fused,CuteDSL W4A4,32,0.111169,25.354055
head,w4a4-per-tensor,fused,CuteDSL W4A4,64,0.143969,39.155267
head,w4a4-per-tensor,fused,CuteDSL W4A4,128,0.147201,76.591118
head,w4a4-per-tensor,fused,CuteDSL W4A4,256,0.155521,144.986888
head,w4a4-per-tensor,fused,CuteDSL W4A4,512,0.157266,286.758104
head,w4a4-per-tensor,fused,CuteDSL W4A4,1024,0.163185,552.712034
head,w4a4-per-tensor,fused,CuteDSL W4A4,2048,0.175329,1028.857898
head,w4a4-per-tensor,fused,CuteDSL W4A4,4096,0.211874,1702.791531
head,w4a4-per-tensor,fused,CuteDSL W4A4,8192,0.293346,2459.738690
head,w4a4-per-tensor,fused,CuteDSL W4A4,16384,0.444579,3246.012545
head,w4a4-per-tensor,unfused,CuteDSL W4A4,1,0.030192,2.917342
head,w4a4-per-tensor,unfused,CuteDSL W4A4,2,0.039872,4.418157
head,w4a4-per-tensor,unfused,CuteDSL W4A4,4,0.056256,6.262826
head,w4a4-per-tensor,unfused,CuteDSL W4A4,8,0.073025,9.649406
head,w4a4-per-tensor,unfused,CuteDSL W4A4,16,0.082241,17.136053
head,w4a4-per-tensor,unfused,CuteDSL W4A4,32,0.113409,24.853162
head,w4a4-per-tensor,unfused,CuteDSL W4A4,64,0.146433,38.496540
head,w4a4-per-tensor,unfused,CuteDSL W4A4,128,0.149857,75.233650
head,w4a4-per-tensor,unfused,CuteDSL W4A4,256,0.158833,141.963618
head,w4a4-per-tensor,unfused,CuteDSL W4A4,512,0.161042,280.034380
head,w4a4-per-tensor,unfused,CuteDSL W4A4,1024,0.168642,534.827108
head,w4a4-per-tensor,unfused,CuteDSL W4A4,2048,0.178881,1008.428097
head,w4a4-per-tensor,unfused,CuteDSL W4A4,4096,0.215458,1674.466731
head,w4a4-per-tensor,unfused,CuteDSL W4A4,8192,0.307971,2342.933839
head,w4a4-per-tensor,unfused,CuteDSL W4A4,16384,0.482980,2987.927060
base,w4a4-per-token,fused,CuteDSL W4A4,1,0.039057,2.255204
base,w4a4-per-token,fused,CuteDSL W4A4,2,0.050657,3.477521
base,w4a4-per-token,fused,CuteDSL W4A4,4,0.068993,5.106627
base,w4a4-per-token,fused,CuteDSL W4A4,8,0.085825,8.210231
base,w4a4-per-token,fused,CuteDSL W4A4,16,0.093985,14.994799
base,w4a4-per-token,fused,CuteDSL W4A4,32,0.128192,21.987030
base,w4a4-per-token,fused,CuteDSL W4A4,64,0.161425,34.921137
base,w4a4-per-token,fused,CuteDSL W4A4,128,0.166849,67.571811
base,w4a4-per-token,fused,CuteDSL W4A4,256,0.175217,128.689077
base,w4a4-per-token,fused,CuteDSL W4A4,512,0.178801,252.219823
base,w4a4-per-token,fused,CuteDSL W4A4,1024,0.189474,476.026005
base,w4a4-per-token,fused,CuteDSL W4A4,2048,0.209697,860.232604
base,w4a4-per-token,fused,CuteDSL W4A4,4096,0.265282,1359.973812
base,w4a4-per-token,fused,CuteDSL W4A4,8192,0.368930,1955.800634
base,w4a4-per-token,fused,CuteDSL W4A4,16384,0.607012,2377.395872
base,w4a4-per-token,unfused,CuteDSL W4A4,1,0.043840,2.009133
base,w4a4-per-token,unfused,CuteDSL W4A4,2,0.054512,3.231566
base,w4a4-per-token,unfused,CuteDSL W4A4,4,0.074145,4.751791
base,w4a4-per-token,unfused,CuteDSL W4A4,8,0.089697,7.855815
base,w4a4-per-token,unfused,CuteDSL W4A4,16,0.099808,14.119972
base,w4a4-per-token,unfused,CuteDSL W4A4,32,0.134640,20.934060
base,w4a4-per-token,unfused,CuteDSL W4A4,64,0.170097,33.140764
base,w4a4-per-token,unfused,CuteDSL W4A4,128,0.175170,64.361986
base,w4a4-per-token,unfused,CuteDSL W4A4,256,0.184161,122.439154
base,w4a4-per-token,unfused,CuteDSL W4A4,512,0.188642,239.062755
base,w4a4-per-token,unfused,CuteDSL W4A4,1024,0.199522,452.051970
base,w4a4-per-token,unfused,CuteDSL W4A4,2048,0.223457,807.261454
base,w4a4-per-token,unfused,CuteDSL W4A4,4096,0.285202,1264.988509
base,w4a4-per-token,unfused,CuteDSL W4A4,8192,0.408259,1767.393997
base,w4a4-per-token,unfused,CuteDSL W4A4,16384,0.673509,2142.672201
head,w4a4-per-token,fused,CuteDSL W4A4,1,0.039072,2.254310
head,w4a4-per-token,fused,CuteDSL W4A4,2,0.055984,3.146627
head,w4a4-per-token,fused,CuteDSL W4A4,4,0.069056,5.101968
head,w4a4-per-token,fused,CuteDSL W4A4,8,0.085473,8.244043
head,w4a4-per-token,fused,CuteDSL W4A4,16,0.093985,14.994799
head,w4a4-per-token,fused,CuteDSL W4A4,32,0.128161,21.992434
head,w4a4-per-token,fused,CuteDSL W4A4,64,0.161457,34.914216
head,w4a4-per-token,fused,CuteDSL W4A4,128,0.166961,67.526281
head,w4a4-per-token,fused,CuteDSL W4A4,256,0.175154,128.735731
head,w4a4-per-token,fused,CuteDSL W4A4,512,0.178753,252.287551
head,w4a4-per-token,fused,CuteDSL W4A4,1024,0.189345,476.349062
head,w4a4-per-token,fused,CuteDSL W4A4,2048,0.209746,860.035741
head,w4a4-per-token,fused,CuteDSL W4A4,4096,0.265378,1359.484407
head,w4a4-per-token,fused,CuteDSL W4A4,8192,0.369027,1955.291844
head,w4a4-per-token,fused,CuteDSL W4A4,16384,0.607124,2376.959256
head,w4a4-per-token,unfused,CuteDSL W4A4,1,0.040800,2.158833
head,w4a4-per-token,unfused,CuteDSL W4A4,2,0.051216,3.439532
head,w4a4-per-token,unfused,CuteDSL W4A4,4,0.071200,4.948336
head,w4a4-per-token,unfused,CuteDSL W4A4,8,0.086640,8.132953
head,w4a4-per-token,unfused,CuteDSL W4A4,16,0.096129,14.660440
head,w4a4-per-token,unfused,CuteDSL W4A4,32,0.129889,21.699854
head,w4a4-per-token,unfused,CuteDSL W4A4,64,0.164386,34.292225
head,w4a4-per-token,unfused,CuteDSL W4A4,128,0.169249,66.613427
head,w4a4-per-token,unfused,CuteDSL W4A4,256,0.177841,126.790663
head,w4a4-per-token,unfused,CuteDSL W4A4,512,0.182770,246.743339
head,w4a4-per-token,unfused,CuteDSL W4A4,1024,0.195169,462.134423
head,w4a4-per-token,unfused,CuteDSL W4A4,2048,0.216498,833.213439
head,w4a4-per-token,unfused,CuteDSL W4A4,4096,0.274914,1312.330071
head,w4a4-per-token,unfused,CuteDSL W4A4,8192,0.392771,1837.087019
head,w4a4-per-token,unfused,CuteDSL W4A4,16384,0.650789,2217.476035
base,w4a16,fused,CuteDSL W4A16,1,0.045824,1.922145
base,w4a16,fused,CuteDSL W4A16,2,0.052320,3.366955
base,w4a16,fused,CuteDSL W4A16,4,0.076145,4.627012
base,w4a16,fused,CuteDSL W4A16,8,0.098752,7.135445
base,w4a16,fused,CuteDSL W4A16,16,0.106208,13.269052
base,w4a16,fused,CuteDSL W4A16,32,0.155553,18.119691
base,w4a16,fused,CuteDSL W4A16,64,0.205249,27.464840
base,w4a16,fused,CuteDSL W4A16,128,0.210881,53.462802
base,w4a16,fused,CuteDSL W4A16,256,0.216929,103.944269
base,w4a16,fused,CuteDSL W4A16,512,0.222818,202.394585
base,w4a16,fused,CuteDSL W4A16,1024,0.237138,380.346058
base,w4a16,fused,CuteDSL W4A16,2048,0.290403,621.167609
base,w4a16,fused,CuteDSL W4A16,4096,0.395891,911.304508
base,w4a16,fused,CuteDSL W4A16,8192,0.755494,955.076421
base,w4a16,fused,CuteDSL W4A16,16384,1.483531,972.752852
base,w4a16,unfused,CuteDSL W4A16,1,0.045825,1.922103
base,w4a16,unfused,CuteDSL W4A16,2,0.052224,3.373176
base,w4a16,unfused,CuteDSL W4A16,4,0.075489,4.667221
base,w4a16,unfused,CuteDSL W4A16,8,0.094688,7.441696
base,w4a16,unfused,CuteDSL W4A16,16,0.106880,13.185686
base,w4a16,unfused,CuteDSL W4A16,32,0.154529,18.239763
base,w4a16,unfused,CuteDSL W4A16,64,0.205345,27.452066
base,w4a16,unfused,CuteDSL W4A16,128,0.208321,54.119792
base,w4a16,unfused,CuteDSL W4A16,256,0.215906,104.437016
base,w4a16,unfused,CuteDSL W4A16,512,0.222625,202.570047
base,w4a16,unfused,CuteDSL W4A16,1024,0.234898,383.972248
base,w4a16,unfused,CuteDSL W4A16,2048,0.276626,652.102935
base,w4a16,unfused,CuteDSL W4A16,4096,0.383219,941.438845
base,w4a16,unfused,CuteDSL W4A16,8192,0.685990,1051.844825
base,w4a16,unfused,CuteDSL W4A16,16384,1.401035,1030.030664
head,w4a16,fused,CuteDSL W4A16,1,0.045713,1.926834
head,w4a16,fused,CuteDSL W4A16,2,0.052720,3.341441
head,w4a16,fused,CuteDSL W4A16,4,0.077280,4.559026
head,w4a16,fused,CuteDSL W4A16,8,0.097537,7.224367
head,w4a16,fused,CuteDSL W4A16,16,0.106209,13.268990
head,w4a16,fused,CuteDSL W4A16,32,0.155409,18.136480
head,w4a16,fused,CuteDSL W4A16,64,0.205921,27.375278
head,w4a16,fused,CuteDSL W4A16,128,0.210913,53.454564
head,w4a16,fused,CuteDSL W4A16,256,0.216737,104.036350
head,w4a16,fused,CuteDSL W4A16,512,0.223073,202.163223
head,w4a16,fused,CuteDSL W4A16,1024,0.237329,380.038357
head,w4a16,fused,CuteDSL W4A16,2048,0.290130,621.751030
head,w4a16,fused,CuteDSL W4A16,4096,0.395715,911.709824
head,w4a16,fused,CuteDSL W4A16,8192,0.744965,968.575041
head,w4a16,fused,CuteDSL W4A16,16384,1.454523,992.152762
head,w4a16,unfused,CuteDSL W4A16,1,0.042496,2.072650
head,w4a16,unfused,CuteDSL W4A16,2,0.049648,3.548159
head,w4a16,unfused,CuteDSL W4A16,4,0.072897,4.833142
head,w4a16,unfused,CuteDSL W4A16,8,0.092577,7.611468
head,w4a16,unfused,CuteDSL W4A16,16,0.103137,13.664281
head,w4a16,unfused,CuteDSL W4A16,32,0.151361,18.621523
head,w4a16,unfused,CuteDSL W4A16,64,0.201361,27.995215
head,w4a16,unfused,CuteDSL W4A16,128,0.204177,55.218213
head,w4a16,unfused,CuteDSL W4A16,256,0.211634,106.545411
head,w4a16,unfused,CuteDSL W4A16,512,0.219938,205.045327
head,w4a16,unfused,CuteDSL W4A16,1024,0.233377,386.474731
head,w4a16,unfused,CuteDSL W4A16,2048,0.270898,665.892548
head,w4a16,unfused,CuteDSL W4A16,4096,0.375683,960.324883
head,w4a16,unfused,CuteDSL W4A16,8192,0.672949,1072.227622
head,w4a16,unfused,CuteDSL W4A16,16384,1.333562,1082.145765
```

Native TFLOPS is an estimate using the workload's uniform local-routing
fraction; it is not a measurement of actual local route counts.

</details>

### Reproduce the historical pre-rebase performance campaign

The commands below reproduce only the historical `eb5f05be`/`f9dd3c1`
campaign. Do not substitute the rebased head into this old overlay
recipe; use the full-source runtime described in the rebase note for
fresh validation. Run in Bash inside the historical image above. Keep
one pinned installed runtime, construct fresh base/head overlays from
the four/five changed CuTe files, and use one canonical unchanged
nightly `flashinfer/jit` directory for both arms. Use the historical
`f9dd3c1` benchmark for both. The normal CLI cannot select an individual
CuTe precision for timing, so the external launcher calls the unmodified
native `run_benchmark` with `profile_cuda=False` and the appropriate
`profile_backend` selector.

```bash
#!/usr/bin/env bash
set -euo pipefail
# Run inside nvcr.io/nvidia/pytorch:26.05-py3; use a fresh task directory.
export TASK_ROOT=${TASK_ROOT:-$PWD/fi-finalize-rerun}
export BASE_REV=eb5f05be1f8e3ef8aa017a66dcbd5d80119b1095
export HEAD_REV=${HEAD_REV:-f9dd3c10541e087b716772245a9d033499745048}
export NIGHTLY_REV=d233e27ddddbcfdc24eec38ab4dffda1f43ff49c
mkdir -p "$TASK_ROOT/artifacts"
cd "$TASK_ROOT"
export TASK_ROOT=$PWD
git clone --filter=blob:none https://github.com/flashinfer-ai/flashinfer.git source-repo
git -C source-repo fetch origin "$BASE_REV" "$HEAD_REV" "$NIGHTLY_REV"
unset PIP_CONSTRAINT PYTHONPATH FLASHINFER_DISABLE_JIT FLASHINFER_DISABLE_VERSION_CHECK
python -m pip install --no-deps \
  flashinfer-python==0.7.0.dev20260917 flashinfer-cubin==0.7.0.dev20260917 \
  flashinfer-jit-cache==0.7.0.dev20260917+cu130 \
  flashinfer-jit-cache-sm103a==0.7.0.dev20260917+cu130 \
  --index-url https://flashinfer.ai/whl/nightly \
  --extra-index-url https://flashinfer.ai/whl/nightly/cu130
python -m pip install nvidia-cutlass-dsl==4.6.2 apache-tvm-ffi==0.1.11 \
  cupti-python==13.4.0 nvidia-cuda-cupti==13.4.92 pytest==9.1.1
python - <<'PYSETUP'
import os, shutil, subprocess
from pathlib import Path
import flashinfer
from flashinfer import _build_meta
root = Path(os.environ['TASK_ROOT']).resolve()
assert flashinfer.__version__ == '0.7.0.dev20260917'
assert _build_meta.__git_commit__ == os.environ['NIGHTLY_REV']
installed = Path(flashinfer.__file__).resolve().parent
files = [
    'flashinfer/fused_moe/cute_dsl/fused_moe.py',
    'flashinfer/fused_moe/cute_dsl/blackwell/blockscaled_contiguous_grouped_gemm_finalize_fusion.py',
    'flashinfer/fused_moe/cute_dsl/blackwell/moe_w4a16.py',
    'flashinfer/fused_moe/cute_dsl/blackwell/moe_w4a16_kernel.py',
    'flashinfer/fused_moe/cute_dsl/blackwell/moe_finalize.py',
]
for arm in ('shared-nightly', 'base', 'head'):
    target = root / 'overlays' / arm / 'flashinfer'
    shutil.copytree(installed, target, symlinks=True,
                    ignore=shutil.ignore_patterns('__pycache__', '*.pyc'))
    if arm == 'shared-nightly':
        continue
    shutil.rmtree(target / 'jit')
    (target / 'jit').symlink_to(root / 'overlays/shared-nightly/flashinfer/jit')
    rev = os.environ['BASE_REV' if arm == 'base' else 'HEAD_REV']
    for path in files[:4 if arm == 'base' else 5]:
        data = subprocess.check_output(['git', '-C', str(root / 'source-repo'), 'show', f'{rev}:{path}'])
        (root / 'overlays' / arm / path).write_bytes(data)
data = subprocess.check_output(['git', '-C', str(root / 'source-repo'), 'show',
                                os.environ['HEAD_REV'] + ':benchmarks/bench_moe_deepseek.py'])
(root / 'bench_moe_deepseek.py').write_bytes(data)
PYSETUP
export CUDA_VISIBLE_DEVICES=0 PYTHONUNBUFFERED=1 FLASHINFER_DIST_AWARE_AUTOTUNE=0
for MODE in w4a4-per-tensor w4a4-per-token w4a16; do
  for ARM in base head; do
    export MODE ARM PYTHONPATH="$TASK_ROOT/overlays/$ARM"
    mkdir -p "artifacts/$ARM"
    for FINALIZE in fused unfused; do
      export FINALIZE
      python - <<'PYBENCH' 2>&1 | tee "artifacts/$ARM/$MODE-$FINALIZE.log"
import dataclasses, inspect, json, math, os, runpy, warnings
from pathlib import Path
from cupti import cupti
from flashinfer import CuteDslMoEWrapper
import torch
assert torch.cuda.get_device_capability(0) == (10, 3)
assert inspect.signature(CuteDslMoEWrapper.__init__).parameters['enable_pdl'].default is True
warnings.filterwarnings('error', message=r'.*Falling back to CUDA events for benchmarking.*')
root, arm, mode, finalize = (os.environ[k] for k in ('TASK_ROOT', 'ARM', 'MODE', 'FINALIZE'))
bench = runpy.run_path(root + '/bench_moe_deepseek.py')
results = bench['run_benchmark'](
    token_counts=[2**i for i in range(15)], warmup=10, iters=100,
    ep_config=8, tp_config=1, do_autotune=True, verbose=True,
    use_cuda_graph=True, use_cupti=True, use_wrapper=True,
    routing_bias_scale=0.01, include_activation_quant=True,
    use_per_token_activation=(mode == 'w4a4-per-token'),
    use_fused_finalize=(finalize == 'fused'), profile_cuda=False,
    profile_backend='cute-dsl-w4a16' if mode == 'w4a16' else 'cute-dsl',
    backends=('cutedsl',),
    autotune_cache=f'{root}/artifacts/{arm}/{mode}-{finalize}-tactics.json',
)
assert [r.tokens for r in results] == [2**i for i in range(15)]
assert all(r.backend == ('CuteDSL W4A16' if mode == 'w4a16' else 'CuteDSL W4A4') for r in results)
assert all(math.isfinite(r.latency_ms) and r.latency_ms > 0 for r in results)
Path(f'{root}/artifacts/{arm}/{mode}-{finalize}.json').write_text(
    json.dumps([dataclasses.asdict(r) for r in results], indent=2) + '\n')
PYBENCH
    done
  done
done
```

<details>
<summary>Historical measured source and benchmark identity</summary>

```text
benchmark 9561d42c798eecbdbc2e3edd31889c0475ff1a56dcd6be7b164ffa7068a86371
base eb5f05be1f8e3ef8aa017a66dcbd5d80119b1095
cb33bed8e28e5bd2d75e045f6fe804ea568a7fe30138ebcb92214613033b8bb4  base/flashinfer/fused_moe/cute_dsl/fused_moe.py
f5186f9bd34c8b3a836cbc99ceacff4f899b3385b92422c867a849b7af2105a0  base/flashinfer/fused_moe/cute_dsl/blackwell/blockscaled_contiguous_grouped_gemm_finalize_fusion.py
aa446d91adfd1335d59bf30acb8ed240f6b592bd78724d02f230cde7806fd90d  base/flashinfer/fused_moe/cute_dsl/blackwell/moe_w4a16.py
1fe29f6f802508034c2fc5daaf7a24271e35bf98a0ca1b052548bfc955f5f97b  base/flashinfer/fused_moe/cute_dsl/blackwell/moe_w4a16_kernel.py
head f9dd3c10541e087b716772245a9d033499745048
3164cb56821230abbf10188967186da8e6b138ad0d39b7f93117fbbf127434dd  head/flashinfer/fused_moe/cute_dsl/fused_moe.py
84c5fcbdfd909ecf9d72f140aedeb7d417311b8fb4793fe047b3dacf7bb83cd0  head/flashinfer/fused_moe/cute_dsl/blackwell/blockscaled_contiguous_grouped_gemm_finalize_fusion.py
09771708151bfda13c7654a79d7143bb16851555d1b5e8d6dfb3595ad6f6658e  head/flashinfer/fused_moe/cute_dsl/blackwell/moe_w4a16.py
d872288ae5f58a6938b3d98726982b0b6d64e9f38a375b5fab84c55722a0c4cc  head/flashinfer/fused_moe/cute_dsl/blackwell/moe_w4a16_kernel.py
59cb5e85b62e24153f73ebef79c913add65db5d87b64c703d3a5e3e32e27005e  head/flashinfer/fused_moe/cute_dsl/blackwell/moe_finalize.py
```

</details>

- **Historical performance limits:** one sweep per configuration gives
no statistical uncertainty estimate. Each arm autotunes independently,
so this measures the complete selected path; selected tactics can
differ. Base/head fused controls are retained to expose run/tactic
variation; small differences are not automatically attributed to the
patch. The campaign is one-GPU simulated EP8 and does not establish
distributed, SM100, or Rubin performance. No prior Nsight intervals are
used to explain these historical timings. These tables do not measure
the September 28 rebase.

## 🔍 Related Issues

- Context:
[sgl-project/sglang#40105](https://github.com/sgl-project/sglang/pull/40105),
which defaults FlashInfer fused finalize off for numerical accuracy.

## 🚀 Pull Request Checklist

Thank you for contributing to FlashInfer! Before we review your pull
request, please make sure the following items are complete.

### ✅ Pre-commit Checks

- [x] I have installed `pre-commit` by running `pip install pre-commit`
(or used your preferred method).
- [x] I have installed the hooks with `pre-commit install`.
- [ ] I have run the hooks manually with `pre-commit run --all-files`
and fixed any reported issues.

> If you are unsure about how to set up `pre-commit`, see [the
pre-commit documentation](https://pre-commit.com/).

Changed-file hooks pass at `9c39a455`, including mypy and Ruff;
`--all-files` was not run. Earlier `bde42729` host output is retained
under its revision label below.

## 🧪 Tests

- [ ] Tests have been added or updated as needed.
- [ ] All tests are passing (`unittest`, etc.).

No new upstream tests were added. The full repository suite was not run.
Evidence is separated below by tested revision; previous passes are not
claimed as fresh checks of `9c39a455`.

### H100 CI failure and upstream resolution (`bde42729` → `9c39a455`)

The [completed H100
job](https://github.com/flashinfer-ai/flashinfer/actions/runs/36472070843/job/109096727606)
has **1703 passed, 4 failed, 11033 skipped**. It supersedes the earlier
authorization-blocked summary. All four failures concern upstream
expectations/documentation unchanged by this PR. The rebased base
includes #5628's three corrected regexes and Cake SiTU documentation
entry; all eight selected regression cases, including the four
previously failing nodes, pass on `9c39a455` in the C2 environment
below.

<details>
<summary>H100 raw totals and all four failing node IDs</summary>

```text
Planned nodes: 12740
Finalized nodes: 12740
Passed: 1703
Failed: 4
Skipped: 11033
Unknown: 0
Pending: 0
Synthetic: 0

tests/moe/test_cute_dsl_bf16_gather_grouped_gemm.py::test_cute_dsl_bf16_gather_grouped_gemm_rejects_bad_activation_config
tests/moe/test_cute_dsl_bf16_moe.py::test_sm90_moe_runner_rejects_bad_activation_config
tests/moe/test_cute_dsl_fused_moe.py::test_invalid_situ_config[ActivationType.GegluTanh-1.0-None-require ActivationType.Swiglu]
Expected regex: 'require ActivationType.Swiglu'
Actual message: 'SiTU parameters require ActivationType.Situ or Swiglu'

tests/moe/test_unified_moe_activation_matrix.py::test_documented_activation_matrix_matches_runner_registry
AssertionError: docs/design_docs/flashinfer_moe_api.md is stale; run: python scripts/generate_moe_activation_matrix.py --write
```

</details>

### September 28 C2 follow-up (`9c39a455`)

- **Result:** 72 existing upstream cases passed (8 CI regressions + 64
W4A16), zero failures/errors/skips. Original assertions/tolerances
retained; no upstream tests added.
- **Source:** `9c39a45529c4bbffd866f7ae6255b19eaf835aa7`, base
`a31c72523ae37d82fd657de36ce2b35156c3c559`. Full Python/JIT/native
checkout; current `csrc`/`include`, unchanged nightly vendor headers.
Source archive SHA256
`c5abb6a5e58ca945d54fdf91dded36810e4742bc539977eb2c20acb02bcbbd6b`.
- **Environment:** c2, `nvcr.io/nvidia/pytorch:26.05-py3` (CUDA 13.2);
one NVIDIA B300 SXM6 AC / SM103 GPU0 of 8 allocated, driver 590.48.01;
Python 3.12.3, Torch `2.12.0a0+5aff3928d8.nv26.05`. Official FlashInfer
Python/cubin `0.7.0.dev20260923`, JIT/SM103a `0.7.0.dev20260923+cu130`;
CuTe DSL 4.7.1, TVM FFI 0.1.11, pytest 9.1.1, cuda-bindings 13.2.0.
Source version `0.0.0+unknown`; JIT enabled, no version-check override.
- **Coverage:** corrected SiTU rejection regexes and generated
activation matrix; W4A16 deterministic accuracy, route-tile boundaries,
wrapper CUDA graphs and simulated EP8, with fused/unfused controls.
Inter-GPU transport and the full repository suite were not tested.
Earlier 155/214/96 evidence remains pinned to `bde42729`; **no new
benchmark** was run.
- **GitHub CI:** the initial [run
36480641864](https://github.com/flashinfer-ai/flashinfer/actions/runs/36480641864)
skipped GPU jobs pending authorization. The authorized replacement [run
36482176398](https://github.com/flashinfer-ai/flashinfer/actions/runs/36482176398)
**passed** at `9c39a455`, including AOT builds and A10G/T4/H100 tests.
The C2 results below are independent executions. Neither run validates
the September 30 head.

<details>
<summary>Exact native test commands</summary>

Use the full-source/nightly setup below with
`TASK_ROOT=/hai-workspace/fi5319-ci` and both Git fetch/checkout
revisions set to `9c39a45529c4bbffd866f7ae6255b19eaf835aa7`. After
preparing that fresh checkout and its native-source links:

```bash
export PYTHONPATH=/hai-workspace/fi5319-ci/repo
export FLASHINFER_WORKSPACE_BASE=/hai-workspace/fi5319-ci/cache
export CUDA_VISIBLE_DEVICES=0 MAX_JOBS=16 PYTHONUNBUFFERED=1
unset FLASHINFER_DISABLE_JIT FLASHINFER_DISABLE_VERSION_CHECK FLASHINFER_DIST_AWARE_AUTOTUNE
cd /hai-workspace/fi5319-ci/repo
mkdir -p /hai-workspace/fi5319-ci/artifacts/tests
python -m pytest -v --tb=short --durations=10 --junitxml=/hai-workspace/fi5319-ci/artifacts/tests/ci-regressions.xml tests/moe/test_cute_dsl_fused_moe.py::test_invalid_situ_config tests/moe/test_cute_dsl_bf16_gather_grouped_gemm.py::test_cute_dsl_bf16_gather_grouped_gemm_rejects_bad_activation_config tests/moe/test_cute_dsl_bf16_moe.py::test_sm90_moe_runner_rejects_bad_activation_config tests/moe/test_unified_moe_activation_matrix.py
python -m pytest -v --tb=short --durations=10 --junitxml=/hai-workspace/fi5319-ci/artifacts/tests/w4a16.xml -k w4a16 tests/moe/test_cute_dsl_fused_moe.py::TestCuteDslFusedMoeFunctional::test_deterministic_finalize_numerical_accuracy tests/moe/test_cute_dsl_fused_moe.py::TestCuteDslMoeW4A16::test_route_tile_boundary_accuracy tests/moe/test_cute_dsl_fused_moe.py::TestCuteDslMoEWrapper::test_wrapper_cuda_graph tests/moe/test_cute_dsl_fused_moe.py::TestExpertParallelism::test_functional_with_ep
```

</details>

<details>
<summary>All 72 per-case results and raw pytest summaries</summary>

Append `[Parameter ID]` to each exact method prefix; `(none)` means
unparameterized. No case durations are shown.

**ci-regressions: 8 cases**

`tests/moe/test_cute_dsl_fused_moe.py::test_invalid_situ_config`

| Parameter ID | Status |
|---|---|
| 3-None-1.0-requires situ_beta | PASS |
| 3-0.0-None-positive and finite | PASS |
| 8-1.0-None-require ActivationType&#92;&#92;.Situ or Swiglu | PASS |


`tests/moe/test_cute_dsl_bf16_gather_grouped_gemm.py::test_cute_dsl_bf16_gather_grouped_gemm_rejects_bad_activation_config`

| Parameter ID | Status |
|---|---|
| (none) | PASS |


`tests/moe/test_cute_dsl_bf16_moe.py::test_sm90_moe_runner_rejects_bad_activation_config`

| Parameter ID | Status |
|---|---|
| (none) | PASS |


`tests/moe/test_unified_moe_activation_matrix.py::test_activation_matrix_rows_are_unique_and_complete`

| Parameter ID | Status |
|---|---|
| (none) | PASS |


`tests/moe/test_unified_moe_activation_matrix.py::test_documented_activation_matrix_matches_runner_registry`

| Parameter ID | Status |
|---|---|
| (none) | PASS |


`tests/moe/test_unified_moe_activation_matrix.py::test_quant_specific_activation_mapping_must_cover_exact_variants`

| Parameter ID | Status |
|---|---|
| (none) | PASS |

**w4a16: 64 cases**


`tests/moe/test_cute_dsl_fused_moe.py::TestCuteDslFusedMoeFunctional::test_deterministic_finalize_numerical_accuracy`

| Parameter ID | Status |
|---|---|
| w4a16-swiglu | PASS |
| w4a16-relu2 | PASS |


`tests/moe/test_cute_dsl_fused_moe.py::TestCuteDslMoeW4A16::test_route_tile_boundary_accuracy`

| Parameter ID | Status |
|---|---|
| False-2-tail1-route8-1cta | PASS |
| False-2-tail1-route16-1cta | PASS |
| False-2-tail1-route32-mixed | PASS |
| False-2-tail1-route64-mixed | PASS |
| False-2-tail1-route128-2cta | PASS |
| False-2-tail1-route192 | PASS |
| False-2-tail-half-plus1-route8-1cta | PASS |
| False-2-tail-half-plus1-route16-1cta | PASS |
| False-2-tail-half-plus1-route32-mixed | PASS |
| False-2-tail-half-plus1-route64-mixed | PASS |
| False-2-tail-half-plus1-route128-2cta | PASS |
| False-2-tail-half-plus1-route192 | PASS |
| False-3-tail1-route8-1cta | PASS |
| False-3-tail1-route16-1cta | PASS |
| False-3-tail1-route32-mixed | PASS |
| False-3-tail1-route64-mixed | PASS |
| False-3-tail1-route128-2cta | PASS |
| False-3-tail1-route192 | PASS |
| False-3-tail-half-plus1-route8-1cta | PASS |
| False-3-tail-half-plus1-route16-1cta | PASS |
| False-3-tail-half-plus1-route32-mixed | PASS |
| False-3-tail-half-plus1-route64-mixed | PASS |
| False-3-tail-half-plus1-route128-2cta | PASS |
| False-3-tail-half-plus1-route192 | PASS |
| True-2-tail1-route8-1cta | PASS |
| True-2-tail1-route16-1cta | PASS |
| True-2-tail1-route32-mixed | PASS |
| True-2-tail1-route64-mixed | PASS |
| True-2-tail1-route128-2cta | PASS |
| True-2-tail1-route192 | PASS |
| True-2-tail-half-plus1-route8-1cta | PASS |
| True-2-tail-half-plus1-route16-1cta | PASS |
| True-2-tail-half-plus1-route32-mixed | PASS |
| True-2-tail-half-plus1-route64-mixed | PASS |
| True-2-tail-half-plus1-route128-2cta | PASS |
| True-2-tail-half-plus1-route192 | PASS |
| True-3-tail1-route8-1cta | PASS |
| True-3-tail1-route16-1cta | PASS |
| True-3-tail1-route32-mixed | PASS |
| True-3-tail1-route64-mixed | PASS |
| True-3-tail1-route128-2cta | PASS |
| True-3-tail1-route192 | PASS |
| True-3-tail-half-plus1-route8-1cta | PASS |
| True-3-tail-half-plus1-route16-1cta | PASS |
| True-3-tail-half-plus1-route32-mixed | PASS |
| True-3-tail-half-plus1-route64-mixed | PASS |
| True-3-tail-half-plus1-route128-2cta | PASS |
| True-3-tail-half-plus1-route192 | PASS |


`tests/moe/test_cute_dsl_fused_moe.py::TestCuteDslMoEWrapper::test_wrapper_cuda_graph`

| Parameter ID | Status |
|---|---|
| 256-64-w4a16-False | PASS |
| 256-64-w4a16-True | PASS |
| 256-128-w4a16-False | PASS |
| 256-128-w4a16-True | PASS |
| 256-256-w4a16-False | PASS |
| 256-256-w4a16-True | PASS |
| 384-64-w4a16-False | PASS |
| 384-64-w4a16-True | PASS |
| 384-128-w4a16-False | PASS |
| 384-128-w4a16-True | PASS |
| 384-256-w4a16-False | PASS |
| 384-256-w4a16-True | PASS |


`tests/moe/test_cute_dsl_fused_moe.py::TestExpertParallelism::test_functional_with_ep`

| Parameter ID | Status |
|---|---|
| 8-w4a16-False | PASS |
| 8-w4a16-True | PASS |

Raw summary lines (verbatim):

```text
# ci-regressions.log
======================== 8 passed, 4 warnings in 0.56s =========================
# w4a16.log
========= 64 passed, 30 deselected, 1069 warnings in 388.62s (0:06:28) =========
```

</details>

### Earlier September 28 C2 validation (`bde42729`)

- **Result at `bde42729`:** 155 existing upstream pytest cases passed,
with zero failures/errors/skips: 129 core MoE cases, 15 prepared MXFP4
controls, and 11 prepared two-stage cases. Original
assertions/tolerances were retained. Both layouts also passed 107
task-local standalone cases each; a task-local W4A8 unfused check passed
12 pipeline configurations / 48 phases / 96 exact native-reduction
comparisons.
- **Tested source:** `bde427290b33c55489e39c75d7e2a25365358ca0`, based
on `07e519fcc149f39e6dd00264149c092c2e37767e`. Full Python/JIT/native
source at `bde42729` was used, not the historical overlay. All six
changed-file SHA256 values matched that clean checkout. Source archive
SHA256:
`022699934e7d31eb56a70ceab156555edc839fddc60138921c14b326916f2095`;
built `bde42729` `moe_utils.so`:
`556cbd35d8680662b6505df465d23d84d2ba919247bcfd0e7630db2312a83819`.
- **Environment:** c2, `nvcr.io/nvidia/pytorch:26.05-py3`, B300 SXM6 AC
/ SM103, driver 590.48.01, CUDA toolkit 13.2.78, Python 3.12.3, Torch
`2.12.0a0+5aff3928d8.nv26.05`. Eight GPUs allocated; native tests use
GPU0, supplemental correctness uses GPU1 independently. EP8 is simulated
within each single GPU, without inter-GPU communication. Official
FlashInfer Python/cubin `0.7.0.dev20260923`, JIT-cache/SM103a
`0.7.0.dev20260923+cu130` (all build `b395280a`); CuTe DSL 4.7.1, TVM
FFI 0.1.11, pytest 9.1.1, cuda-bindings 13.2.0. JIT enabled; no
package-version-check override. The full-source install reports
`0.0.0+unknown` by design, without stale nightly build metadata.
- **Coverage:** deterministic W4A4 per-tensor/per-token and W4A16
accuracy; fused controls; cluster padding, route boundaries, wrapper
graphs, simulated EP8, K tails, poisoned maps, and odd tile counts. New
upstream prepared dual-tile routing and graph replay are tested in both
ordinary and `MXFP4_DENSE_TWO_STAGE=1` modes; the latter preserves
`skip_unpermute` and its separate finalizer.
- **Exact-reduction checks:** expanded/permuted rows; N=0/8/9/1024/1025,
H264, top-k3; FP32/BF16/FP16 routing scales;
random/cancellation/subnormal-input/subnormal-output/tiny-FP32-weight
patterns; random EP8/all-masked routes, poisoned unused rows, PDL
off/on, changed-input eager/graph execution. FP16 scales use exact FP32
promotion for the native oracle; zero-token checks exercise only the
candidate no-op. W4A8 uses fixed tactics, H256/I128, top-k8, 256
global/32 local experts, N1/17/1025, offsets0/128,
mixed/all-nonlocal/restored routing and three graph replays per phase.
Native reduction consumes the same FC2 rows, so this is an exact
reduction/synchronization check, not an independent W4A8 GEMM accuracy
oracle.
- **Host checks at `bde42729`:** changed-file pre-commit, including
mypy/Ruff, and `git diff --check` pass. Eight mocked CUTLASS
CLI-to-backend wiring cases and CLI help pass; these are not CUTLASS GPU
tests.
- **Limits:** no full-suite, multi-GPU transport, other-architecture,
exhaustive concurrency, or >2 GiB offset campaign. No performance rerun
for this rebase; all performance tables above retain their pre-rebase
revisions. The audit at `bde42729` found no introduced numeric,
indexing, synchronization, or integration blocker; it does not establish
`9c39a455` correctness or new performance gains.

<details>
<summary>Reproduce the 155 upstream tests at bde42729</summary>

Run in Bash inside the image above. Install matching wheel packages for
available prebuilt components, then use the entire pinned source. Only
unchanged CUTLASS/CCCL/spdlog headers come from the nightly; the changed
native routing ABI requires the pinned source's `csrc`/`include` and a
first-use build.

```bash
set -euo pipefail
export TASK_ROOT=${TASK_ROOT:-$PWD/fi5319-rebase-validation}
mkdir -p "$TASK_ROOT"
cd "$TASK_ROOT"
export TASK_ROOT=$PWD
unset PIP_CONSTRAINT PYTHONPATH FLASHINFER_DISABLE_JIT FLASHINFER_DISABLE_VERSION_CHECK
python -m pip install --no-deps \
  flashinfer-python==0.7.0.dev20260923 flashinfer-cubin==0.7.0.dev20260923 \
  flashinfer-jit-cache==0.7.0.dev20260923+cu130 \
  flashinfer-jit-cache-sm103a==0.7.0.dev20260923+cu130 \
  --index-url https://flashinfer.ai/whl/nightly \
  --extra-index-url https://flashinfer.ai/whl/nightly/cu130
python -m pip install 'nvidia-cutlass-dsl[cu13]==4.7.1' \
  apache-tvm-ffi==0.1.11 cupti-python==13.4.0 pytest==9.1.1
git clone --filter=blob:none https://github.com/flashinfer-ai/flashinfer.git repo
git -C repo fetch origin bde427290b33c55489e39c75d7e2a25365358ca0
git -C repo checkout --detach bde427290b33c55489e39c75d7e2a25365358ca0
python - <<'PY'
import importlib.metadata as m
from pathlib import Path
repo = Path('repo').resolve()
wheel_data = Path(m.distribution('flashinfer-python').locate_file('flashinfer/data'))
data = repo / 'flashinfer/data'
data.mkdir(exist_ok=True)
for name in ('csrc', 'include', 'cutlass', 'cccl', 'spdlog'):
    target = repo / name if name in ('csrc', 'include') else wheel_data / name
    (data / name).symlink_to(target, target_is_directory=True)
assert not (repo / 'flashinfer/_build_meta.py').exists()
PY
export PYTHONPATH=$TASK_ROOT/repo FLASHINFER_WORKSPACE_BASE=$TASK_ROOT/cache
export CUDA_VISIBLE_DEVICES=0 MAX_JOBS=16 PYTHONUNBUFFERED=1
unset FLASHINFER_DIST_AWARE_AUTOTUNE
cd "$TASK_ROOT/repo"
MAIN=tests/moe/test_cute_dsl_fused_moe.py
SITU=tests/moe/test_cute_dsl_mxfp4_situ.py
export MXFP4_DENSE_TWO_STAGE=0
python -m pytest -v --tb=short --durations=20 \
  "$MAIN::TestCuteDslFusedMoeFunctional::test_deterministic_finalize_numerical_accuracy" \
  "$MAIN::TestCuteDslFusedMoeFunctional::test_finalize_handles_cluster_padding_and_partial_tiles" \
  "$MAIN::TestCuteDslMoeW4A16::test_route_tile_boundary_accuracy" \
  "$MAIN::TestCuteDslMoEWrapper::test_wrapper_cuda_graph" \
  "$MAIN::TestExpertParallelism::test_functional_with_ep" \
  "$MAIN::test_gather_gemm_k_tail" \
  "$MAIN::test_w4a8_fused_moe_tactics_and_apis" \
  "$MAIN::TestMoeSortBufferInitPoisoned" \
  "$MAIN::TestOddTileCountBoundsContract"
python -m pytest -v --tb=short --durations=20 \
  "$SITU::test_dense_dual_tile_routing_follows_rows_per_expert" \
  "$SITU::test_dense_dual_tile_keeps_128_where_256_pads" \
  "$SITU::test_dense_route_preprocess_pdl_matches_torch" \
  "$SITU::test_dense_gemm1_cluster_split_k_matches_plain"
export MXFP4_DENSE_TWO_STAGE=1
python -m pytest -v --tb=short --durations=20 \
  "$SITU::test_dense_dual_tile_routing_follows_rows_per_expert" \
  "$SITU::test_dense_dual_tile_keeps_128_where_256_pads" \
  "$SITU::test_dense_gemm1_cluster_split_k_matches_plain"
```

The fused memset-policy test is intentionally excluded from the
two-stage phase: its assertions require the fused output-clearing
contract. No assertions were changed to make tests pass.

</details>

Supplemental scripts are task-local validation artifacts, not new
upstream tests. Complete logs, JUnit XML, environment/source hashes, and
scripts are preserved in `c2-evidence.tar.gz`, SHA256
`ed21f540e4768e398be4727fc70e773049fba90cf36f14b02576973476e0a39f`.
Complete per-case outcomes follow; deprecation-warning text and
JIT-download chatter are omitted from the presentation.

<details>
<summary>Complete bde42729 per-case outcomes and raw summary
lines</summary>

### Complete C2 per-case test results at `bde42729`

Source `bde427290b33c55489e39c75d7e2a25365358ca0`. All **155 pytest
executions pass** (129 core, 15 prepared, 11 prepared-unfused); zero
failures, errors, or skips. Tables retain every executed parameter ID.
`(none)` denotes an unparameterized method; append `[ID]` to the exact
method prefix otherwise. `—` means not selected in that suite, not a
skipped test. Full logs/XML/reports are archived locally in
`c2-evidence.tar.gz`; no external upload is implied.

#### Core native tests (`core.xml`, 129 cases)


`tests/moe/test_cute_dsl_fused_moe.py::TestCuteDslFusedMoeFunctional::test_deterministic_finalize_numerical_accuracy`

| Parameter ID | Status |
|---|---|
| swiglu-per-tensor | PASS |
| relu2-per-token | PASS |
| w4a16-swiglu | PASS |
| w4a16-relu2 | PASS |


`tests/moe/test_cute_dsl_fused_moe.py::TestCuteDslFusedMoeFunctional::test_finalize_handles_cluster_padding_and_partial_tiles`

| Parameter ID | Status |
|---|---|
| w4a4-per-tensor | PASS |
| w4a4-per-token | PASS |
| w4a16-ordinary | PASS |
| w4a16-fused | PASS |


`tests/moe/test_cute_dsl_fused_moe.py::TestCuteDslMoeW4A16::test_route_tile_boundary_accuracy`

| Parameter ID | Status |
|---|---|
| False-2-tail1-route8-1cta | PASS |
| False-2-tail1-route16-1cta | PASS |
| False-2-tail1-route32-mixed | PASS |
| False-2-tail1-route64-mixed | PASS |
| False-2-tail1-route128-2cta | PASS |
| False-2-tail1-route192 | PASS |
| False-2-tail-half-plus1-route8-1cta | PASS |
| False-2-tail-half-plus1-route16-1cta | PASS |
| False-2-tail-half-plus1-route32-mixed | PASS |
| False-2-tail-half-plus1-route64-mixed | PASS |
| False-2-tail-half-plus1-route128-2cta | PASS |
| False-2-tail-half-plus1-route192 | PASS |
| False-3-tail1-route8-1cta | PASS |
| False-3-tail1-route16-1cta | PASS |
| False-3-tail1-route32-mixed | PASS |
| False-3-tail1-route64-mixed | PASS |
| False-3-tail1-route128-2cta | PASS |
| False-3-tail1-route192 | PASS |
| False-3-tail-half-plus1-route8-1cta | PASS |
| False-3-tail-half-plus1-route16-1cta | PASS |
| False-3-tail-half-plus1-route32-mixed | PASS |
| False-3-tail-half-plus1-route64-mixed | PASS |
| False-3-tail-half-plus1-route128-2cta | PASS |
| False-3-tail-half-plus1-route192 | PASS |
| True-2-tail1-route8-1cta | PASS |
| True-2-tail1-route16-1cta | PASS |
| True-2-tail1-route32-mixed | PASS |
| True-2-tail1-route64-mixed | PASS |
| True-2-tail1-route128-2cta | PASS |
| True-2-tail1-route192 | PASS |
| True-2-tail-half-plus1-route8-1cta | PASS |
| True-2-tail-half-plus1-route16-1cta | PASS |
| True-2-tail-half-plus1-route32-mixed | PASS |
| True-2-tail-half-plus1-route64-mixed | PASS |
| True-2-tail-half-plus1-route128-2cta | PASS |
| True-2-tail-half-plus1-route192 | PASS |
| True-3-tail1-route8-1cta | PASS |
| True-3-tail1-route16-1cta | PASS |
| True-3-tail1-route32-mixed | PASS |
| True-3-tail1-route64-mixed | PASS |
| True-3-tail1-route128-2cta | PASS |
| True-3-tail1-route192 | PASS |
| True-3-tail-half-plus1-route8-1cta | PASS |
| True-3-tail-half-plus1-route16-1cta | PASS |
| True-3-tail-half-plus1-route32-mixed | PASS |
| True-3-tail-half-plus1-route64-mixed | PASS |
| True-3-tail-half-plus1-route128-2cta | PASS |
| True-3-tail-half-plus1-route192 | PASS |


`tests/moe/test_cute_dsl_fused_moe.py::TestCuteDslMoEWrapper::test_wrapper_cuda_graph`

| Parameter ID | Status |
|---|---|
| 256-64-w4a4-per-tensor-False | PASS |
| 256-64-w4a4-per-tensor-True | PASS |
| 256-64-w4a4-per-token-False | PASS |
| 256-64-w4a4-per-token-True | PASS |
| 256-64-w4a16-False | PASS |
| 256-64-w4a16-True | PASS |
| 256-128-w4a4-per-tensor-False | PASS |
| 256-128-w4a4-per-tensor-True | PASS |
| 256-128-w4a4-per-token-False | PASS |
| 256-128-w4a4-per-token-True | PASS |
| 256-128-w4a16-False | PASS |
| 256-128-w4a16-True | PASS |
| 256-256-w4a4-per-tensor-False | PASS |
| 256-256-w4a4-per-tensor-True | PASS |
| 256-256-w4a4-per-token-False | PASS |
| 256-256-w4a4-per-token-True | PASS |
| 256-256-w4a16-False | PASS |
| 256-256-w4a16-True | PASS |
| 384-64-w4a4-per-tensor-False | PASS |
| 384-64-w4a4-per-tensor-True | PASS |
| 384-64-w4a4-per-token-False | PASS |
| 384-64-w4a4-per-token-True | PASS |
| 384-64-w4a16-False | PASS |
| 384-64-w4a16-True | PASS |
| 384-128-w4a4-per-tensor-False | PASS |
| 384-128-w4a4-per-tensor-True | PASS |
| 384-128-w4a4-per-token-False | PASS |
| 384-128-w4a4-per-token-True | PASS |
| 384-128-w4a16-False | PASS |
| 384-128-w4a16-True | PASS |
| 384-256-w4a4-per-tensor-False | PASS |
| 384-256-w4a4-per-tensor-True | PASS |
| 384-256-w4a4-per-token-False | PASS |
| 384-256-w4a4-per-token-True | PASS |
| 384-256-w4a16-False | PASS |
| 384-256-w4a16-True | PASS |


`tests/moe/test_cute_dsl_fused_moe.py::TestExpertParallelism::test_functional_with_ep`

| Parameter ID | Status |
|---|---|
| 8-w4a4-per-tensor-False | PASS |
| 8-w4a4-per-tensor-True | PASS |
| 8-w4a4-per-token-False | PASS |
| 8-w4a4-per-token-True | PASS |
| 8-w4a16-False | PASS |
| 8-w4a16-True | PASS |

`tests/moe/test_cute_dsl_fused_moe.py::test_gather_gemm_k_tail`

| Parameter ID | Status |
|---|---|
| 128-1-128 | PASS |
| 128-1-256 | PASS |
| 128-1-384 | PASS |
| 128-1-512 | PASS |
| 128-17-128 | PASS |
| 128-17-256 | PASS |
| 128-17-384 | PASS |
| 128-17-512 | PASS |
| 256-1-128 | PASS |
| 256-1-256 | PASS |
| 256-1-384 | PASS |
| 256-1-512 | PASS |
| 256-17-128 | PASS |
| 256-17-256 | PASS |
| 256-17-384 | PASS |
| 256-17-512 | PASS |


`tests/moe/test_cute_dsl_fused_moe.py::test_w4a8_fused_moe_tactics_and_apis`

| Parameter ID | Status |
|---|---|
| n128-bias-off | PASS |
| n64-custom-bias | PASS |
| n192-2cta-oai | PASS |
| n128-2cta-oai | PASS |
| n192-1cta | PASS |
| n64-2cta-custom-bias | PASS |
| n192-partial-oai | PASS |


`tests/moe/test_cute_dsl_fused_moe.py::TestMoeSortBufferInitPoisoned::test_wrapper_with_poisoned_moe_sort_buffers`

| Parameter ID | Status |
|---|---|
| 1-256 | PASS |
| 8-256 | PASS |
| 16-256 | PASS |
| 32-256 | PASS |
| 8-1280 | PASS |


`tests/moe/test_cute_dsl_fused_moe.py::TestOddTileCountBoundsContract::test_odd_tile_count_with_poisoned_buffers`

| Parameter ID | Status |
|---|---|
| 9 | PASS |
| 11 | PASS |


`tests/moe/test_cute_dsl_fused_moe.py::TestOddTileCountBoundsContract::test_cuda_graph_replay_with_changed_routing`

| Parameter ID | Status |
|---|---|
| (none) | PASS |

#### Prepared controls (26 executions)

`prepared.xml`: `MXFP4_DENSE_TWO_STAGE=0`, 15 cases.
`prepared-unfused.xml`: `MXFP4_DENSE_TWO_STAGE=1`, 11 cases. A shared
parameter row below represents two separate executions when both cells
contain a status.


`tests/moe/test_cute_dsl_mxfp4_situ.py::test_dense_dual_tile_routing_follows_rows_per_expert`

| Parameter ID | Prepared | Prepared-unfused |
|---|---|---|
| (none) | PASS | PASS |


`tests/moe/test_cute_dsl_mxfp4_situ.py::test_dense_dual_tile_keeps_128_where_256_pads`

| Parameter ID | Prepared | Prepared-unfused |
|---|---|---|
| 73 | PASS | PASS |
| 293 | PASS | PASS |


`tests/moe/test_cute_dsl_mxfp4_situ.py::test_dense_route_preprocess_pdl_matches_torch`

| Parameter ID | Prepared | Prepared-unfused |
|---|---|---|
| False-False | PASS | — |
| False-True | PASS | — |
| True-False | PASS | — |
| True-True | PASS | — |


`tests/moe/test_cute_dsl_mxfp4_situ.py::test_dense_gemm1_cluster_split_k_matches_plain`

| Parameter ID | Prepared | Prepared-unfused |
|---|---|---|
| 256-False-256 | PASS | PASS |
| 256-False-384 | PASS | PASS |
| 256-True-256 | PASS | PASS |
| 256-True-384 | PASS | PASS |
| 584-False-256 | PASS | PASS |
| 584-False-384 | PASS | PASS |
| 584-True-256 | PASS | PASS |
| 584-True-384 | PASS | PASS |

#### Standalone finalizer (107 configuration rows, two layouts each)

H=264, top-k=3, BF16 input/output. Each layout passes 104 nonempty
comparisons plus **three zero-token no-ops** (one per scale dtype): 107
cases/layout, 214 total executions. `PASS` means byte-exact native
comparison in eager and graphs with PDL off/on, plus changed-input
replay (two replays/phase). `NOOP` means candidate-only eager/graph
PDL-off/on validation; native's invalid zero-grid launch is not called.

Scales: `f32`=FP32, `f16`=FP16, `bf16`=BF16. FP16's native oracle
receives exactly promoted FP32 scales; there is no native FP16 binding
or timing claim. Patterns: `R`=random, `C`=cancellation,
`SI`=subnormal_input, `SO`=subnormal_output, `TW`=tiny_weights. Routes:
`E`=random_ep8, `A`=all_masked. `TW` runs only with FP32 scales.
Expanded rows ignore positive mapping values; permuted rows use them as
row addresses, including zero, with unused rows poisoned by NaNs. These
standalone checks do not establish overlap with a live FC2 producer.

| Tokens | Scale | Pattern | Routes | Expanded | Permuted |
|---:|---|---|---|---|---|
| 0 | f32 | R | E | NOOP | NOOP |
| 0 | f16 | R | E | NOOP | NOOP |
| 0 | bf16 | R | E | NOOP | NOOP |
| 8 | f32 | R | E | PASS | PASS |
| 8 | f32 | R | A | PASS | PASS |
| 8 | f32 | C | E | PASS | PASS |
| 8 | f32 | C | A | PASS | PASS |
| 8 | f32 | SI | E | PASS | PASS |
| 8 | f32 | SI | A | PASS | PASS |
| 8 | f32 | SO | E | PASS | PASS |
| 8 | f32 | SO | A | PASS | PASS |
| 8 | f32 | TW | E | PASS | PASS |
| 8 | f32 | TW | A | PASS | PASS |
| 8 | f16 | R | E | PASS | PASS |
| 8 | f16 | R | A | PASS | PASS |
| 8 | f16 | C | E | PASS | PASS |
| 8 | f16 | C | A | PASS | PASS |
| 8 | f16 | SI | E | PASS | PASS |
| 8 | f16 | SI | A | PASS | PASS |
| 8 | f16 | SO | E | PASS | PASS |
| 8 | f16 | SO | A | PASS | PASS |
| 8 | bf16 | R | E | PASS | PASS |
| 8 | bf16 | R | A | PASS | PASS |
| 8 | bf16 | C | E | PASS | PASS |
| 8 | bf16 | C | A | PASS | PASS |
| 8 | bf16 | SI | E | PASS | PASS |
| 8 | bf16 | SI | A | PASS | PASS |
| 8 | bf16 | SO | E | PASS | PASS |
| 8 | bf16 | SO | A | PASS | PASS |
| 9 | f32 | R | E | PASS | PASS |
| 9 | f32 | R | A | PASS | PASS |
| 9 | f32 | C | E | PASS | PASS |
| 9 | f32 | C | A | PASS | PASS |
| 9 | f32 | SI | E | PASS | PASS |
| 9 | f32 | SI | A | PASS | PASS |
| 9 | f32 | SO | E | PASS | PASS |
| 9 | f32 | SO | A | PASS | PASS |
| 9 | f32 | TW | E | PASS | PASS |
| 9 | f32 | TW | A | PASS | PASS |
| 9 | f16 | R | E | PASS | PASS |
| 9 | f16 | R | A | PASS | PASS |
| 9 | f16 | C | E | PASS | PASS |
| 9 | f16 | C | A | PASS | PASS |
| 9 | f16 | SI | E | PASS | PASS |
| 9 | f16 | SI | A | PASS | PASS |
| 9 | f16 | SO | E | PASS | PASS |
| 9 | f16 | SO | A | PASS | PASS |
| 9 | bf16 | R | E | PASS | PASS |
| 9 | bf16 | R | A | PASS | PASS |
| 9 | bf16 | C | E | PASS | PASS |
| 9 | bf16 | C | A | PASS | PASS |
| 9 | bf16 | SI | E | PASS | PASS |
| 9 | bf16 | SI | A | PASS | PASS |
| 9 | bf16 | SO | E | PASS | PASS |
| 9 | bf16 | SO | A | PASS | PASS |
| 1024 | f32 | R | E | PASS | PASS |
| 1024 | f32 | R | A | PASS | PASS |
| 1024 | f32 | C | E | PASS | PASS |
| 1024 | f32 | C | A | PASS | PASS |
| 1024 | f32 | SI | E | PASS | PASS |
| 1024 | f32 | SI | A | PASS | PASS |
| 1024 | f32 | SO | E | PASS | PASS |
| 1024 | f32 | SO | A | PASS | PASS |
| 1024 | f32 | TW | E | PASS | PASS |
| 1024 | f32 | TW | A | PASS | PASS |
| 1024 | f16 | R | E | PASS | PASS |
| 1024 | f16 | R | A | PASS | PASS |
| 1024 | f16 | C | E | PASS | PASS |
| 1024 | f16 | C | A | PASS | PASS |
| 1024 | f16 | SI | E | PASS | PASS |
| 1024 | f16 | SI | A | PASS | PASS |
| 1024 | f16 | SO | E | PASS | PASS |
| 1024 | f16 | SO | A | PASS | PASS |
| 1024 | bf16 | R | E | PASS | PASS |
| 1024 | bf16 | R | A | PASS | PASS |
| 1024 | bf16 | C | E | PASS | PASS |
| 1024 | bf16 | C | A | PASS | PASS |
| 1024 | bf16 | SI | E | PASS | PASS |
| 1024 | bf16 | SI | A | PASS | PASS |
| 1024 | bf16 | SO | E | PASS | PASS |
| 1024 | bf16 | SO | A | PASS | PASS |
| 1025 | f32 | R | E | PASS | PASS |
| 1025 | f32 | R | A | PASS | PASS |
| 1025 | f32 | C | E | PASS | PASS |
| 1025 | f32 | C | A | PASS | PASS |
| 1025 | f32 | SI | E | PASS | PASS |
| 1025 | f32 | SI | A | PASS | PASS |
| 1025 | f32 | SO | E | PASS | PASS |
| 1025 | f32 | SO | A | PASS | PASS |
| 1025 | f32 | TW | E | PASS | PASS |
| 1025 | f32 | TW | A | PASS | PASS |
| 1025 | f16 | R | E | PASS | PASS |
| 1025 | f16 | R | A | PASS | PASS |
| 1025 | f16 | C | E | PASS | PASS |
| 1025 | f16 | C | A | PASS | PASS |
| 1025 | f16 | SI | E | PASS | PASS |
| 1025 | f16 | SI | A | PASS | PASS |
| 1025 | f16 | SO | E | PASS | PASS |
| 1025 | f16 | SO | A | PASS | PASS |
| 1025 | bf16 | R | E | PASS | PASS |
| 1025 | bf16 | R | A | PASS | PASS |
| 1025 | bf16 | C | E | PASS | PASS |
| 1025 | bf16 | C | A | PASS | PASS |
| 1025 | bf16 | SI | E | PASS | PASS |
| 1025 | bf16 | SI | A | PASS | PASS |
| 1025 | bf16 | SO | E | PASS | PASS |
| 1025 | bf16 | SO | A | PASS | PASS |

#### Additional W4A8 unfused pipeline results (all six report rows)

H256/I128, 256 global/32 local experts, top-k8. Each row runs PDL off
and on, four phases, and three graph replays/phase: 12 pipeline
configurations, 48 phases, 96 native-oracle comparisons. The fixed
tactic is `(128, ((128,128),(1,1),False), ((128,128),(1,1),False))`.

| Tokens | Expert offset | Native oracle | Graph/eager | PDL off/on |
Restored inputs |
|---:|---:|---|---|---|---|
| 1 | 0 | bitwise_equal | bitwise_equal | bitwise_equal | bitwise_equal
|
| 1 | 128 | bitwise_equal | bitwise_equal | bitwise_equal |
bitwise_equal |
| 17 | 0 | bitwise_equal | bitwise_equal | bitwise_equal | bitwise_equal
|
| 17 | 128 | bitwise_equal | bitwise_equal | bitwise_equal |
bitwise_equal |
| 1025 | 0 | bitwise_equal | bitwise_equal | bitwise_equal |
bitwise_equal |
| 1025 | 128 | bitwise_equal | bitwise_equal | bitwise_equal |
bitwise_equal |

#### Raw summary lines

```text
# native-tests/core.log
================ 129 passed, 3016 warnings in 349.30s (0:05:49) ================
# native-tests/prepared.log
====================== 15 passed, 713 warnings in 25.03s =======================
# native-tests/prepared-unfused.log
====================== 11 passed, 470 warnings in 16.55s =======================
# standalone-expanded.log
PASS: 107 cases; 0 timing rows
# standalone-permuted.log
PASS: 107 cases; 0 timing rows
# w4a8-unfused.log
PASS: 12 pipeline configurations, 48 phases, 96 native-oracle comparisons
```

</details>

<details>
<summary>Earlier host validation output at bde42729</summary>

```text
check for added large files..............................................Passed
check for case conflicts.................................................Passed
check for merge conflicts................................................Passed
check for broken symlinks............................(no files to check)Skipped
fix end of files.........................................................Passed
mixed line ending........................................................Passed
fix requirements.txt.................................(no files to check)Skipped
trim trailing whitespace.................................................Passed
Tabs remover.............................................................Passed
CRLF end-lines remover...................................................Passed
clang-format.........................................(no files to check)Skipped
mypy.....................................................................Passed
ruff check...............................................................Passed
ruff check (SM12x import order)......................(no files to check)Skipped
ruff format..............................................................Passed
experimental test scope selftest.....................(no files to check)Skipped

PASS fused=True activation_quant=False profile=False: CLI -> prewarm + measured callback
PASS fused=True activation_quant=False profile=True: CLI -> prewarm + measured callback
PASS fused=True activation_quant=True profile=False: CLI -> prewarm + measured callback
PASS fused=True activation_quant=True profile=True: CLI -> prewarm + measured callback
PASS fused=False activation_quant=False profile=False: CLI -> prewarm + measured callback
PASS fused=False activation_quant=False profile=True: CLI -> prewarm + measured callback
PASS fused=False activation_quant=True profile=False: CLI -> prewarm + measured callback
PASS fused=False activation_quant=True profile=True: CLI -> prewarm + measured callback
PASS: 8 wiring cases and CLI help; GPU operations mocked, no GPU performance claim.
```

</details>


## 🔬 Experimental Track

<!-- Only for PRs submitted under the experimental policy
(CONTRIBUTING.md → "Experimental APIs and Backends").
     Leave this section untouched for normal PRs. -->

- [ ] This PR is **experimental**: it adds or changes code under
`flashinfer/experimental/` and/or an `@flashinfer_experimental_api`.
Tracking issue: #
- [ ] The tracking issue names an owner, the reason for the experimental
path, and a graduation plan with a target release.
- [ ] Core changes are limited to a thin entry point (signature, shared
validation, feature-gate check, backend selection, handoff).
- [ ] Tests live in `tests/experimental/` and were validated on the
intended hardware; a runnable example is included.
- [ ] Nothing is registered in `flashinfer/aot.py`, and no experimental
backend is reachable from `backend="auto"` without
`FLASHINFER_ALLOW_EXPERIMENTAL_AUTO_BACKENDS=1`. (Calling an
`@flashinfer_experimental_api` or naming a backend explicitly is itself
the opt-in and needs no environment variable.)
- [ ] **Test scope declared below.** The experimental CI lane runs
exactly these targets, so keep them as narrow as the change allows.

<!-- Required for experimental PRs. Replace the commented lines below
with your targets.
Do not delete the fence or change its `experimental-tests` tag — the
experimental-track
watcher reads it verbatim to decide which targets to ask CI for. -->

```experimental-tests
# One target per line: a directory or a file. (A pytest ::selector is not
# supported -- the sharding runner cannot consume one.) Must be under
# tests/experimental/ and must exist. Delete these comment lines and add yours, e.g.
#
#   tests/experimental/test_my_backend.py
#   tests/experimental/my_backend/
#
# Declaring the whole tree (tests/experimental/) is allowed but means every
# experimental PR pays for every other feature's tests, in every matrix cell.
```

## Reviewer Notes

- Review the finalizer's 8/1024-token launch boundaries,
expanded/permuted row selection, PDL metadata precondition, and
preservation of upstream bypass/prepared-launch paths. The performance
tables are historical. Earlier C2 results validate `bde42729`; the
`9c39a455` follow-up passed 72 focused cases. The September 30 rebase
has host checks only.

---------

Co-authored-by: Alex Yang <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
aleozlx pushed a commit to flashinfer-ai/flashinfer that referenced this pull request Oct 26, 2026
…SL fused MoE (#6950)

## 📌 Description

The Rubin (SM107) CuTe DSL fused-MoE finalize grouped GEMM only
implemented the fused atomic scatter-add, so `cute_dsl_fused_moe(...,
use_fused_finalize=False)` raised `NotImplementedError` on SM107. SGLang
now defaults to the unfused finalize (sgl-project/sglang#40105) and its
`--enable-deterministic-inference` mode forces it, so the
`flashinfer_cutedsl` MoE runner failed at autotune warmup on every rank
on Rubin (Qwen3.5 NVFP4, 2x Vera Rubin NVL72).

This adds the unfused path to the SM107 finalize kernel, mirroring the
Blackwell kernel:

- `Sm107BlockScaledContiguousGroupedGemmFinalizeFusionKernel` takes
`use_fused_finalize` (default `True`). When `False`, the epilogue writes
each unscaled permuted row to its expanded `(token, top-k slot)` row
with a `cp.async.bulk` store instead of the bf16 atomic reduce into the
token row, and the output tensor is sized `num_tokens * top_k`. The
fused path is unchanged.
- The dispatcher passes the flag through instead of raising. The caller
already allocates the expanded output and runs the fixed-order
`moe_unpermute` reduction for any arch, so the deterministic contract of
#3976 now holds on SM107.
- The locality-domain (two-die) path remains fused-only, as before.
- The SM107 test skips for the unfused path are removed, so
`test_deterministic_finalize_numerical_accuracy` runs on Rubin.

Not changed: the SM107 kernel still has no PDL path, Float32-only router
scales and no per-token activation scale.

## Validation on Rubin (CUTLASS DSL 4.8)

- `tests/moe/test_cute_dsl_fused_moe.py`, deterministic-finalize /
route-tile-boundary / cluster-padding / wrapper accuracy / CUDA graph /
EP subsets: 106 passed, 0 failed. Remaining skips are the pre-existing
per-token-scale and custom-SwiGLU gaps.
- `tests/moe/test_cute_dsl_moe_can_implement.py`: 18 passed.
- NVFP4 SwiGLU, hidden 4096, intermediate 1536, 128 local experts, top-k
8, at 1 / 64 / 1024 tokens: the unfused output matches the float
reference within tolerance, is within one bf16 ulp of the fused output,
and is bit-identical across repeated runs (the fused output is not, as
expected for atomics).
- Whole-op time, unfused relative to fused, default tactic: 1.00x at 1
and 1024 tokens.

## 🔍 Related Issues

- #3976 (deterministic CuTe DSL NVFP4 finalize mode, Blackwell)
- sgl-project/sglang#40105

## 🚀 Pull Request Checklist

- [x] pre-commit hooks run
- [x] Existing tests cover the change (SM107 skips removed)

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Added support for choosing fused or unfused finalization on Rubin
hardware. Unfused finalization preserves expanded token outputs, while
fused finalization combines scaled results into token outputs.
* **Bug Fixes**
* Corrected output handling across both finalization modes on Rubin
hardware.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Vincent Tombari <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants