Repository navigation
Conversation
…e mid forward on SM107 With deterministic=False, on sm_107a the mid forward (from 800 rows per SM up to the long forward's) now runs the program sm_100a and sm_103a run there, whose thread 0 also warms in L2, with one bulk prefetch per tensor where x and z hold their rows packed, the CTA's next row block and the first row block of the CTA one wave later. The sm_107a grid and threshold, every other route and every other program are unchanged, and y stays bitwise equal to the deterministic forward (a prefetch writes no register and no memory). cake_jit: the mid forward record ships on sm_107a too (from 800 rows per SM there) and the sm_107a mid forward program without the prefetch is removed; the docs name the prefetch on every architecture.
|
@flashinfer-bot run tests/norm/test_cake_rmsnorm_silu_gate_det_train.py tests/norm/test_cake_rmsnorm_silu_gate_det_train_aliases.py tests/norm/test_cake_rmsnorm_silu_gate_det_train_api.py tests/norm/test_cake_rmsnorm_silu_gate_det_train_stall.py tests/norm/test_cake_rmsnorm_silu_gate_train.py tests/norm/test_cake_rmsnorm_silu_gate_train_api.py tests/norm/test_cake_rmsnorm_silu_gate_train_stall.py |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
… on SM103 (#8673) This PR adds an extra-long forward tier on sm_103a to the non-deterministic package of Cake's SiLU-gated RMSNorm training kernel (`flashinfer.cake_rmsnorm_silu_gate_train` with `deterministic=False`). From 3000 rows per SM, the sm_103a forward now runs `cake_rmsnorm_silu_gate_train_7f014401d5cc855ab883`, and this route is tried before the long forward's. The new module is a 256-thread forward with the packed gate. In it, thread 0 also warms the CTA's next row block in L2, the same way the mid forward warms its later blocks: one bulk prefetch per tensor wherever the inputs x and z hold their rows packed. All nine changed shapes in Table 1 are at or above 3000 rows per SM on the 152-SM GB300. The previous Cake baseline below is the long forward, `cake_rmsnorm_silu_gate_train_7b7fac905aff1ddaa258`. It ran these inputs before this PR, and it still runs sm_103a inputs from 2400 up to 3000 rows per SM. This PR removes no module. Every other module and route runs the same code as before, including the backward, the short, mid and long forwards, and every sm_100a and sm_107a route. The PR is one commit on FlashInfer main after PR #8656. The A/B compared two FlashInfer trees. In the first, there is no extra-long route, so the long forward also serves 3000 rows per SM and up. The second is the same tree plus this PR's sm_103a route. Both trees predate PR #8656, which changed only the sm_107a mid forward. In the measured tree, the new module's sources are byte-identical to this PR's. A speedup is baseline us / new us, so a value above 1 means this PR is faster. The table gives ranges (min-max) over the nine changed shapes of Table 1 on GB300 (sm_103a, 152 SMs), CUDA 13.4. | op | det Cake / new | strongest non-Cake / new | previous Cake / new (A/B) | |---|---|---|---| | fwd | 1.134-1.164 | 1.061-1.133 | 1.039-1.050 | | fwdg | 1.134-1.165 | 1.053-1.134 | 1.039-1.049 | | bwdg | 1.114-1.147 | 1.091-1.115 | 0.9999-1.0002 | | ckptg | 1.123-1.144 | 1.093-1.121 | 1.017-1.022 | | stepg_f32 | 1.125-1.145 (A/B) | - | 1.017-1.021 | | fwd + bwd | 1.129-1.143 (A/B) | - | 1.014-1.018 | In the pre-registered A/B, the code changes in 36 cells (fwd, fwdg, ckptg and stepg_f32 at the nine shapes), and new is faster than the previous Cake route in all 36. bwdg and bwdg_f32 run the same code in both trees. Neither the strongest non-Cake kernel (Table 1) nor the deterministic Cake kernel (Tables 1 and 2) is faster than new on any row. Every cell below 1x is a same-code cell against the previous Cake route and is within 0.1 % of parity. "Cells below 1x" lists each one. The kernel's other Cake variants are the deterministic package `flashinfer.cake_rmsnorm_silu_gate_det_train` (the same API with `deterministic=True`) and the FP32 weight-gradient output of the non-deterministic package; both packages ship on sm_100a, sm_103a and sm_107a, and this PR changes only the non-deterministic package's forward on sm_103a from 3000 rows per SM. ## How the tables were measured - Latency: CUPTI kernel time with cold L2, taken with FlashInfer's GPU timer in `flashinfer.testing`. Inputs are BF16, and all times are in us. - Table 1: the deterministic Cake kernel, the strongest non-Cake kernel and new were measured in the same process. Each value is the median of the per-round medians over 10 rounds. - A/B values: the previous Cake and new (A/B) columns and all of Table 2 are medians of the pre-registered interleaved A/B, which ran 16 sequences and 160 processes. stepg_f32 has no same-process measurement, so its deterministic Cake values also come from the A/B. - Strongest non-Cake kernel per row: the fastest of the following, with torch 2.14.1+cu130 and Triton 3.8.0. - FLA 0.6.0 `rms_norm_gated` (`fla.modules.fused_norm_gate`). - mamba_ssm v2.3.2 `rmsnorm_fn` (`layernorm_gated`). - torch.compile in default and max-autotune-no-cudagraphs modes, best of 5 fresh compiles each. `#k` names the fastest compile. - The inductor-generated persistent-reduction Triton kernel of the FP32 formula, launched directly. - Deterministic Cake: `flashinfer.cake_rmsnorm_silu_gate_det_train`, unchanged by this PR. - Operations: - `fwd` is one eager forward call, and `fwdg` is the forward replayed from a CUDA graph. - `bwdg` is the backward replayed from a CUDA graph, and `bwdg_f32` is the same backward with an FP32 dw. - `ckptg` is the checkpointed step (2 x forward + backward) in one CUDA graph, and `stepg_f32` is the same step with an FP32 dw. - `fwd + bwd` is fwdg + bwdg, derived. - In Table 2, the forward at the first nine shapes runs the new module. 7600x48, 9120x48 and 9499x48 are below 3000 rows per SM and run the same code in both trees. ## Cells below 1x - vs the strongest non-Cake kernel (Table 1): none. - vs the deterministic Cake kernel (Tables 1 and 2): none. - vs the previous Cake route (A/B), only at cells that run the same code in both trees: - Table 1, bwdg: 9500x48 0.99996, 9975x48 0.9999 - Table 2, changed shapes (backward cells): 9500x48 bwdg 0.99996, 9975x48 bwdg 0.9999, 9975x48 bwdg_f32 0.9998, 19000x48 bwdg_f32 0.99996 - Table 2, same-code shapes: 7600x48 fwd 0.9999, 7600x48 ckptg 0.9995, 7600x48 bwdg_f32 0.9998, 7600x48 stepg_f32 0.9998, 9120x48 fwd 0.9999, 9120x48 ckptg 0.99996, 9120x48 stepg_f32 0.9998, 9499x48 fwdg 0.99999, 9499x48 bwdg_f32 0.9999 - The same-process run behind Table 1 also timed the previous Cake route. Those times are not in the tables. Its bwdg previous / new, where both routes run the same backward module, is below 1 at 9975x48 0.9997 (107.361 / 107.392 us), 11400x48 0.999 (118.688 / 118.752 us), 14250x48 0.9998 (146.497 / 146.529 us), 19000x48 0.999 (189.217 / 189.312 us) and 32737x48 0.9999 (316.057 / 316.097 us). ## Results on GB300 (sm_103a, 152 SMs) - GPU: NVIDIA GB300, sm_103a, compute capability 10.3, 152 SMs, driver 580.159.03. - CUDA: 13.4 (nvcc Build cuda_13.4.r13.4/compiler.38855100_0); PyTorch 2.14.1+cu130 (CUDA 13.0); Triton 3.8.0; Python 3.14.8. ### Table 1 (GB300, sm_103a, CUDA 13.4): new vs the deterministic Cake kernel, the strongest non-Cake kernel and the previous Cake route | T x H | op | det Cake us | strongest non-Cake us | strongest non-Cake kernel | new us | previous Cake us (A/B) | new us (A/B) | det / new | non-Cake / new | previous / new (A/B) | |---|---|---|---|---|---|---|---|---|---|---| | 9500x48 | fwd | 63.937 | 59.712 | torch.compile max-autotune-no-cudagraphs #1 | 56.256 | 59.088 | 56.592 | 1.137 | 1.061 | 1.044 | | 9500x48 | fwdg | 64.001 | 59.328 | torch.compile max-autotune-no-cudagraphs #1 | 56.320 | 59.177 | 56.608 | 1.136 | 1.053 | 1.045 | | 9500x48 | bwdg | 116.144 | 111.921 | FLA rms_norm_gated | 101.873 | 102.476 | 102.481 | 1.140 | 1.099 | 0.99996 | | 9500x48 | ckptg | 238.009 | 231.377 | FLA rms_norm_gated | 211.617 | 215.305 | 211.424 | 1.125 | 1.093 | 1.018 | | 9500x48 | stepg_f32 | 239.080 (A/B) | not measured | - | - | 215.240 | 211.644 | 1.130 (A/B) | n/a | 1.017 | | 9975x48 | fwd | 68.000 | 63.856 | torch.compile max-autotune-no-cudagraphs #2 | 59.008 | 61.489 | 58.817 | 1.152 | 1.082 | 1.045 | | 9975x48 | fwdg | 68.216 | 63.840 | torch.compile max-autotune-no-cudagraphs #2 | 59.145 | 61.569 | 58.964 | 1.153 | 1.079 | 1.044 | | 9975x48 | bwdg | 121.408 | 117.809 | FLA rms_norm_gated | 107.392 | 107.409 | 107.417 | 1.131 | 1.097 | 0.9999 | | 9975x48 | ckptg | 250.129 | 242.209 | FLA rms_norm_gated | 221.313 | 225.312 | 221.624 | 1.130 | 1.094 | 1.017 | | 9975x48 | stepg_f32 | 249.065 (A/B) | not measured | - | - | 224.568 | 220.272 | 1.131 (A/B) | n/a | 1.020 | | 10450x48 | fwd | 69.600 | 65.872 | torch.compile default #4 | 61.184 | 63.804 | 61.064 | 1.138 | 1.077 | 1.045 | | 10450x48 | fwdg | 69.696 | 66.272 | torch.compile default #4 | 61.408 | 63.873 | 61.232 | 1.135 | 1.079 | 1.043 | | 10450x48 | bwdg | 126.016 | 122.081 | FLA rms_norm_gated | 110.880 | 111.280 | 111.264 | 1.137 | 1.101 | 1.0001 | | 10450x48 | ckptg | 259.129 | 253.009 | FLA rms_norm_gated | 230.737 | 234.784 | 230.616 | 1.123 | 1.097 | 1.018 | | 10450x48 | stepg_f32 | 260.468 (A/B) | not measured | - | - | 235.060 | 231.064 | 1.127 (A/B) | n/a | 1.017 | | 11400x48 | fwd | 75.841 | 71.649 | torch.compile default #1 | 66.624 | 69.601 | 66.608 | 1.138 | 1.075 | 1.045 | | 11400x48 | fwdg | 75.873 | 72.097 | torch.compile default #1 | 66.736 | 69.712 | 66.840 | 1.137 | 1.080 | 1.043 | | 11400x48 | bwdg | 136.161 | 132.464 | FLA rms_norm_gated | 118.752 | 118.656 | 118.656 | 1.147 | 1.115 | 1.000 | | 11400x48 | ckptg | 281.393 | 274.785 | FLA rms_norm_gated | 247.633 | 252.912 | 247.816 | 1.136 | 1.110 | 1.021 | | 11400x48 | stepg_f32 | 281.760 (A/B) | not measured | - | - | 252.896 | 247.976 | 1.136 (A/B) | n/a | 1.020 | | 14250x48 | fwd | 93.856 | 87.329 | torch.compile max-autotune-no-cudagraphs #1 | 80.624 | 84.385 | 80.384 | 1.164 | 1.083 | 1.050 | | 14250x48 | fwdg | 94.000 | 87.889 | torch.compile max-autotune-no-cudagraphs #1 | 80.704 | 84.481 | 80.496 | 1.165 | 1.089 | 1.049 | | 14250x48 | bwdg | 166.017 | 161.336 | FLA rms_norm_gated | 146.529 | 146.320 | 146.320 | 1.133 | 1.101 | 1.000 | | 14250x48 | ckptg | 346.897 | 337.257 | FLA rms_norm_gated | 303.441 | 309.408 | 303.016 | 1.143 | 1.111 | 1.021 | | 14250x48 | stepg_f32 | 345.600 (A/B) | not measured | - | - | 309.401 | 303.148 | 1.140 (A/B) | n/a | 1.021 | | 16384x48 | fwd | 106.257 | 103.825 | FLA rms_norm_gated | 91.617 | 95.752 | 91.384 | 1.160 | 1.133 | 1.048 | | 16384x48 | fwdg | 106.368 | 103.968 | FLA rms_norm_gated | 91.713 | 95.849 | 91.488 | 1.160 | 1.134 | 1.048 | | 16384x48 | bwdg | 184.561 | 181.889 | FLA rms_norm_gated | 165.473 | 165.861 | 165.853 | 1.115 | 1.099 | 1.00005 | | 16384x48 | ckptg | 390.258 | 383.401 | FLA rms_norm_gated | 344.001 | 350.948 | 343.357 | 1.134 | 1.115 | 1.022 | | 16384x48 | stepg_f32 | 391.796 (A/B) | not measured | - | - | 350.737 | 343.433 | 1.141 (A/B) | n/a | 1.021 | | 19000x48 | fwd | 122.529 | 114.848 | torch.compile max-autotune-no-cudagraphs #2 | 105.600 | 110.257 | 105.569 | 1.160 | 1.088 | 1.044 | | 19000x48 | fwdg | 122.577 | 114.689 | torch.compile max-autotune-no-cudagraphs #2 | 105.632 | 110.400 | 105.689 | 1.160 | 1.086 | 1.045 | | 19000x48 | bwdg | 214.337 | 209.449 | FLA rms_norm_gated | 189.312 | 189.176 | 189.144 | 1.132 | 1.106 | 1.0002 | | 19000x48 | ckptg | 453.474 | 440.353 | FLA rms_norm_gated | 396.322 | 404.440 | 396.276 | 1.144 | 1.111 | 1.021 | | 19000x48 | stepg_f32 | 452.042 (A/B) | not measured | - | - | 404.200 | 396.216 | 1.141 (A/B) | n/a | 1.020 | | 32737x48 | fwd | 205.408 | 192.161 | torch.compile max-autotune-no-cudagraphs #5 | 176.511 | 183.425 | 176.529 | 1.164 | 1.089 | 1.039 | | 32737x48 | fwdg | 205.441 | 192.217 | torch.compile max-autotune-no-cudagraphs #3 | 176.544 | 183.601 | 176.656 | 1.164 | 1.089 | 1.039 | | 32737x48 | bwdg | 354.705 | 348.737 | FLA rms_norm_gated | 316.097 | 316.376 | 316.360 | 1.122 | 1.103 | 1.0001 | | 32737x48 | ckptg | 759.283 | 743.979 | FLA rms_norm_gated | 663.666 | 677.643 | 664.382 | 1.144 | 1.121 | 1.020 | | 32737x48 | stepg_f32 | 760.154 (A/B) | not measured | - | - | 677.238 | 663.723 | 1.145 (A/B) | n/a | 1.020 | | 16384x32 | fwd | 73.216 | 70.288 | torch.compile max-autotune-no-cudagraphs #1 | 64.544 | 65.601 | 62.816 | 1.134 | 1.089 | 1.044 | | 16384x32 | fwdg | 73.312 | 70.416 | torch.compile max-autotune-no-cudagraphs #1 | 64.656 | 65.660 | 62.888 | 1.134 | 1.089 | 1.044 | | 16384x32 | bwdg | 128.641 | 125.937 | FLA rms_norm_gated | 115.424 | 115.448 | 115.441 | 1.114 | 1.091 | 1.0001 | | 16384x32 | ckptg | 268.505 | 262.737 | FLA rms_norm_gated | 238.816 | 242.144 | 238.000 | 1.124 | 1.100 | 1.017 | | 16384x32 | stepg_f32 | 267.669 (A/B) | not measured | - | - | 242.037 | 237.872 | 1.125 (A/B) | n/a | 1.018 | ### Table 2 (GB300, sm_103a, CUDA 13.4): full step, previous Cake route vs new (A/B medians) | T x H | rows | op | previous Cake us | new us | previous / new | det Cake us | det / new | |---|---|---|---|---|---|---|---| | 9500x48 | 456000 | fwd | 59.088 | 56.592 | 1.044 | 64.288 | 1.136 | | 9500x48 | 456000 | fwdg | 59.177 | 56.608 | 1.045 | 64.416 | 1.138 | | 9500x48 | 456000 | bwdg | 102.476 | 102.481 | 0.99996 | 116.784 | 1.140 | | 9500x48 | 456000 | ckptg | 215.305 | 211.424 | 1.018 | 239.224 | 1.131 | | 9500x48 | 456000 | bwdg_f32 | 102.444 | 102.433 | 1.0001 | 116.888 | 1.141 | | 9500x48 | 456000 | stepg_f32 | 215.240 | 211.644 | 1.017 | 239.080 | 1.130 | | 9500x48 | 456000 | fwd + bwd | 161.653 | 159.089 | 1.016 | 181.200 | 1.139 | | 9975x48 | 478800 | fwd | 61.489 | 58.817 | 1.045 | 67.008 | 1.139 | | 9975x48 | 478800 | fwdg | 61.569 | 58.964 | 1.044 | 67.072 | 1.138 | | 9975x48 | 478800 | bwdg | 107.409 | 107.417 | 0.9999 | 121.312 | 1.129 | | 9975x48 | 478800 | ckptg | 225.312 | 221.624 | 1.017 | 248.973 | 1.123 | | 9975x48 | 478800 | bwdg_f32 | 107.380 | 107.400 | 0.9998 | 121.337 | 1.130 | | 9975x48 | 478800 | stepg_f32 | 224.568 | 220.272 | 1.020 | 249.065 | 1.131 | | 9975x48 | 478800 | fwd + bwd | 168.977 | 166.381 | 1.016 | 188.385 | 1.132 | | 10450x48 | 501600 | fwd | 63.804 | 61.064 | 1.045 | 70.304 | 1.151 | | 10450x48 | 501600 | fwdg | 63.873 | 61.232 | 1.043 | 70.368 | 1.149 | | 10450x48 | 501600 | bwdg | 111.280 | 111.264 | 1.0001 | 126.480 | 1.137 | | 10450x48 | 501600 | ckptg | 234.784 | 230.616 | 1.018 | 260.496 | 1.130 | | 10450x48 | 501600 | bwdg_f32 | 111.216 | 111.208 | 1.0001 | 126.400 | 1.137 | | 10450x48 | 501600 | stepg_f32 | 235.060 | 231.064 | 1.017 | 260.468 | 1.127 | | 10450x48 | 501600 | fwd + bwd | 175.153 | 172.496 | 1.015 | 196.848 | 1.141 | | 16384x32 | 524288 | fwd | 65.601 | 62.816 | 1.044 | 72.704 | 1.157 | | 16384x32 | 524288 | fwdg | 65.660 | 62.888 | 1.044 | 72.769 | 1.157 | | 16384x32 | 524288 | bwdg | 115.448 | 115.441 | 1.0001 | 128.564 | 1.114 | | 16384x32 | 524288 | ckptg | 242.144 | 238.000 | 1.017 | 267.521 | 1.124 | | 16384x32 | 524288 | bwdg_f32 | 115.468 | 115.464 | 1.00003 | 128.392 | 1.112 | | 16384x32 | 524288 | stepg_f32 | 242.037 | 237.872 | 1.018 | 267.669 | 1.125 | | 16384x32 | 524288 | fwd + bwd | 181.108 | 178.329 | 1.016 | 201.333 | 1.129 | | 11400x48 | 547200 | fwd | 69.601 | 66.608 | 1.045 | 75.904 | 1.140 | | 11400x48 | 547200 | fwdg | 69.712 | 66.840 | 1.043 | 75.976 | 1.137 | | 11400x48 | 547200 | bwdg | 118.656 | 118.656 | 1.000 | 136.092 | 1.147 | | 11400x48 | 547200 | ckptg | 252.912 | 247.816 | 1.021 | 281.797 | 1.137 | | 11400x48 | 547200 | bwdg_f32 | 118.672 | 118.672 | 1.00001 | 136.136 | 1.147 | | 11400x48 | 547200 | stepg_f32 | 252.896 | 247.976 | 1.020 | 281.760 | 1.136 | | 11400x48 | 547200 | fwd + bwd | 188.369 | 185.496 | 1.015 | 212.068 | 1.143 | | 14250x48 | 684000 | fwd | 84.385 | 80.384 | 1.050 | 93.344 | 1.161 | | 14250x48 | 684000 | fwdg | 84.481 | 80.496 | 1.049 | 93.472 | 1.161 | | 14250x48 | 684000 | bwdg | 146.320 | 146.320 | 1.000 | 165.857 | 1.134 | | 14250x48 | 684000 | ckptg | 309.408 | 303.016 | 1.021 | 345.804 | 1.141 | | 14250x48 | 684000 | bwdg_f32 | 146.176 | 146.168 | 1.0001 | 165.848 | 1.135 | | 14250x48 | 684000 | stepg_f32 | 309.401 | 303.148 | 1.021 | 345.600 | 1.140 | | 14250x48 | 684000 | fwd + bwd | 230.801 | 226.816 | 1.018 | 259.329 | 1.143 | | 16384x48 | 786432 | fwd | 95.752 | 91.384 | 1.048 | 106.769 | 1.168 | | 16384x48 | 786432 | fwdg | 95.849 | 91.488 | 1.048 | 106.904 | 1.169 | | 16384x48 | 786432 | bwdg | 165.861 | 165.853 | 1.00005 | 184.792 | 1.114 | | 16384x48 | 786432 | ckptg | 350.948 | 343.357 | 1.022 | 391.417 | 1.140 | | 16384x48 | 786432 | bwdg_f32 | 165.744 | 165.721 | 1.0001 | 184.824 | 1.115 | | 16384x48 | 786432 | stepg_f32 | 350.737 | 343.433 | 1.021 | 391.796 | 1.141 | | 16384x48 | 786432 | fwd + bwd | 261.709 | 257.341 | 1.017 | 291.696 | 1.134 | | 19000x48 | 912000 | fwd | 110.257 | 105.569 | 1.044 | 121.984 | 1.156 | | 19000x48 | 912000 | fwdg | 110.400 | 105.689 | 1.045 | 122.048 | 1.155 | | 19000x48 | 912000 | bwdg | 189.176 | 189.144 | 1.0002 | 214.192 | 1.132 | | 19000x48 | 912000 | ckptg | 404.440 | 396.276 | 1.021 | 452.058 | 1.141 | | 19000x48 | 912000 | bwdg_f32 | 189.128 | 189.136 | 0.99996 | 214.016 | 1.132 | | 19000x48 | 912000 | stepg_f32 | 404.200 | 396.216 | 1.020 | 452.042 | 1.141 | | 19000x48 | 912000 | fwd + bwd | 299.576 | 294.832 | 1.016 | 336.240 | 1.140 | | 32737x48 | 1571376 | fwd | 183.425 | 176.529 | 1.039 | 206.593 | 1.170 | | 32737x48 | 1571376 | fwdg | 183.601 | 176.656 | 1.039 | 206.609 | 1.170 | | 32737x48 | 1571376 | bwdg | 316.376 | 316.360 | 1.0001 | 354.253 | 1.120 | | 32737x48 | 1571376 | ckptg | 677.643 | 664.382 | 1.020 | 760.275 | 1.144 | | 32737x48 | 1571376 | bwdg_f32 | 316.552 | 316.536 | 1.0001 | 354.101 | 1.119 | | 32737x48 | 1571376 | stepg_f32 | 677.238 | 663.723 | 1.020 | 760.154 | 1.145 | | 32737x48 | 1571376 | fwd + bwd | 499.977 | 493.017 | 1.014 | 560.862 | 1.138 | | 7600x48 | 364800 | fwd | 48.416 | 48.421 | 0.9999 | 52.320 | 1.081 | | 7600x48 | 364800 | fwdg | 48.448 | 48.448 | 1.000 | 52.448 | 1.083 | | 7600x48 | 364800 | bwdg | 82.784 | 82.784 | 1.000003 | 97.112 | 1.173 | | 7600x48 | 364800 | ckptg | 175.881 | 175.969 | 0.9995 | 195.777 | 1.113 | | 7600x48 | 364800 | bwdg_f32 | 82.849 | 82.868 | 0.9998 | 97.148 | 1.172 | | 7600x48 | 364800 | stepg_f32 | 175.988 | 176.024 | 0.9998 | 195.824 | 1.112 | | 7600x48 | 364800 | fwd + bwd | 131.232 | 131.232 | 1.000002 | 149.560 | 1.140 | | 9120x48 | 437760 | fwd | 56.528 | 56.536 | 0.9999 | 62.016 | 1.097 | | 9120x48 | 437760 | fwdg | 56.496 | 56.496 | 1.000 | 62.208 | 1.101 | | 9120x48 | 437760 | bwdg | 97.480 | 97.480 | 1.000003 | 112.860 | 1.158 | | 9120x48 | 437760 | ckptg | 207.985 | 207.993 | 0.99996 | 230.096 | 1.106 | | 9120x48 | 437760 | bwdg_f32 | 97.552 | 97.544 | 1.0001 | 112.752 | 1.156 | | 9120x48 | 437760 | stepg_f32 | 207.868 | 207.904 | 0.9998 | 230.137 | 1.107 | | 9120x48 | 437760 | fwd + bwd | 153.977 | 153.977 | 1.000002 | 175.067 | 1.137 | | 9499x48 | 455952 | fwd | 59.344 | 59.320 | 1.0004 | 63.952 | 1.078 | | 9499x48 | 455952 | fwdg | 59.424 | 59.424 | 0.99999 | 64.128 | 1.079 | | 9499x48 | 455952 | bwdg | 102.336 | 102.320 | 1.0002 | 116.840 | 1.142 | | 9499x48 | 455952 | ckptg | 215.769 | 215.741 | 1.0001 | 238.488 | 1.105 | | 9499x48 | 455952 | bwdg_f32 | 102.328 | 102.336 | 0.9999 | 116.664 | 1.140 | | 9499x48 | 455952 | stepg_f32 | 214.561 | 214.540 | 1.0001 | 238.336 | 1.111 | | 9499x48 | 455952 | fwd + bwd | 161.760 | 161.745 | 1.0001 | 180.968 | 1.119 | <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Added support for RMSNorm with SiLU gating in training workflows. * On sm_103a, large inputs with at least 3,000 rows per SM now use an extra-long forward path. This path follows the same launch-grid behavior as the long forward path and can prefetch the next row block. * **Bug Fixes** * Improved handling of forward-path selection around the extra-long threshold. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Yingyi Huang <averyh@nvidia.com>
This PR switches the sm_107a mid forward of the non-deterministic package of Cake's SiLU-gated RMSNorm training kernel (
flashinfer.cake_rmsnorm_silu_gate_trainwithdeterministic=False) tocake_rmsnorm_silu_gate_train_87f0173e9583ad4fdd2a. That is the L2-prefetching module sm_100a and sm_103a already run. In it, thread 0 also warms two later row blocks in L2, with one bulk prefetch per tensor, wherever the inputs x and z hold their rows packed. The two blocks are the CTA's next block and the CTA's first block one resident wave later. The sm_107a routing thresholds and grid do not change: the mid forward serves inputs from 800 rows per SM up to the long forward's 1740. The five shapes in Table 1 fall in that range.The module this replaces,
cake_rmsnorm_silu_gate_train_b0eb3df9844d5b734850, is the same 128-thread build without the prefetch. Nothing routes to it anymore, so this PR removes it. It is the "previous Cake" baseline below. Every other module and route is FlashInfer main's code: the backward, the short and long forwards, and every sm_100a and sm_103a route run the same code as before.The PR is one commit on FlashInfer main after PR #8622. The A/B compared two FlashInfer trees: one whose sm_107a mid forward runs without the prefetch, and the same tree plus this PR's sm_107a route. In the measured tree, the new module's sources are byte-identical to this PR's.
A speedup is baseline us / new us, so a value above 1 means this PR is faster. The table gives ranges (min-max) over the five shapes of Table 1 on R200 (sm_107a, 212 SMs), CUDA 13.4. For stepg_f32 and fwd + bwd, the ranges cover the twelve shapes of Table 2: those five, plus seven shapes that run the same code in both trees.
In the pre-registered A/B, all 20 cells whose code changes (fwd, fwdg, ckptg and stepg_f32 at the five shapes) are faster than the previous Cake route. bwdg runs the same code in both trees. Neither the strongest non-Cake kernel (Table 1) nor the deterministic Cake kernel (Tables 1 and 2) is faster than new on any row. Every cell below 1x is a same-code cell against the previous Cake route, each by less than 0.3 %, and every one is listed under "Cells below 1x".
The kernel's other Cake variants are the deterministic package
flashinfer.cake_rmsnorm_silu_gate_det_train(the same API withdeterministic=True) and the FP32 weight-gradient output of the non-deterministic package. Both packages ship on sm_100a, sm_103a and sm_107a. sm_100a and sm_103a have run this mid forward since PR #8622, and this PR changes only the non-deterministic package's mid forward on sm_107a.How the tables were measured
flashinfer.testing. Inputs are BF16, and all times are in us.rms_norm_gated(fla.modules.fused_norm_gate).rmsnorm_fn(layernorm_gated).#knames the fastest compile.flashinfer.cake_rmsnorm_silu_gate_det_train, unchanged by this PR.fwdis one eager forward call, andfwdgis the forward replayed from a CUDA graph.bwdgis the backward replayed from a CUDA graph.ckptgis the checkpointed step (2 x forward + backward) in one CUDA graph, andstepg_f32is the same step with an FP32 dw.fwd + bwdis fwdg + bwdg, derived.Cells below 1x
Results on R200 (sm_107a, 212 SMs)
Table 1 (R200, sm_107a, CUDA 13.4): new vs the deterministic Cake kernel, the strongest non-Cake kernel and the previous Cake route
Table 2 (R200, sm_107a, CUDA 13.4): full step, previous Cake route vs new (A/B medians)
Summary by CodeRabbit