# Ragged CFG 完整结果

FP32，W8，block=32，legacy task grain，full-packet 开、fusion 关、fast math 关。时间单位 µs。两种计时边界不能混用；配对比值是逐轮比值的中位数，不是表中中位时间相除。

## 单线程纯 native entry：RMSNorm

实际 ORC / TorchInductor 入口；6 个平衡顺序，每次 7 个样本。不含 Runtime、Python、分配；保留原生函数调用、Luisa launch record 重置及 LLVM 生成的 libc 调用。

| 尺寸 | baseline | candidate | Inductor | candidate/baseline | candidate/Inductor | 后者逐轮范围 |
|---|---:|---:|---:|---:|---:|---:|
| 17×65 | 9.508 | 1.334 | 0.714 | 0.140 | 1.869 | 1.863–1.872 |
| 257×1538 | 1818.533 | 526.531 | 236.831 | 0.290 | 2.224 | 2.207–2.258 |
| 1024×4097 | 18361.792 | 5645.630 | 2531.710 | 0.308 | 2.230 | 2.218–2.242 |
| 129×768 | 25.616 | 25.579 | 59.315 | 0.998 | 0.431 | 0.417–0.437 |

## Runtime E2E：全部 86 个固定映射对照

8 个请求的 CPU workers；2 个反向顺序，每次 7 个样本；小差异与相反方向的轮次不能视为稳定收益。local=1 为 whole-program，local=8 为 packet-local；attention 仅测 local=1。RoPE 要求偶数宽度，奇数测试点向上取偶，开关两侧相同。

| 算子 / 尺寸 | local | off | on | on/off 配对比 | 配对范围 | direct CFG off→on |
|---|---:|---:|---:|---:|---:|---|
| rmsnorm 3×63 | 1 | 0.552 | 0.568 | 1.028 | 1.026–1.030 | [True]→[True] |
| rmsnorm 3×63 | 8 | 1.451 | 0.189 | 0.130 | 0.130–0.130 | [False]→[True] |
| rmsnorm 17×65 | 1 | 1.275 | 1.276 | 1.001 | 0.999–1.003 | [True]→[True] |
| rmsnorm 17×65 | 8 | 35.630 | 28.119 | 0.791 | 0.747–0.835 | [False]→[True] |
| rmsnorm 64×256 | 1 | 40.201 | 38.917 | 1.005 | 0.738–1.271 | [True]→[True] |
| rmsnorm 64×256 | 8 | 35.859 | 35.385 | 0.987 | 0.962–1.012 | [True]→[True] |
| rmsnorm 129×769 | 1 | 68.662 | 64.416 | 0.941 | 0.891–0.991 | [True]→[True] |
| rmsnorm 129×769 | 8 | 115.562 | 73.810 | 0.639 | 0.634–0.644 | [False]→[True] |
| rmsnorm 257×1538 | 1 | 105.079 | 108.233 | 1.032 | 0.986–1.078 | [True]→[True] |
| rmsnorm 257×1538 | 8 | 302.871 | 126.820 | 0.419 | 0.408–0.430 | [False]→[True] |
| rmsnorm 1024×4097 | 1 | 557.285 | 537.016 | 0.966 | 0.908–1.025 | [True]→[True] |
| rmsnorm 1024×4097 | 8 | 2623.024 | 859.845 | 0.329 | 0.301–0.356 | [False]→[True] |
| rmsnorm 17×16384 | 1 | 284.525 | 283.052 | 0.995 | 0.991–0.998 | [True]→[True] |
| rmsnorm 17×16384 | 8 | 70.180 | 71.703 | 1.022 | 1.005–1.038 | [True]→[True] |
| layernorm 3×63 | 1 | 0.650 | 0.649 | 0.999 | 0.999–0.999 | [True]→[True] |
| layernorm 3×63 | 8 | 2.314 | 0.222 | 0.096 | 0.096–0.096 | [False]→[True] |
| layernorm 17×65 | 1 | 1.541 | 1.541 | 1.000 | 0.987–1.013 | [True]→[True] |
| layernorm 17×65 | 8 | 38.911 | 30.643 | 0.788 | 0.778–0.798 | [False]→[True] |
| layernorm 64×256 | 1 | 36.857 | 36.484 | 0.990 | 0.985–0.995 | [True]→[True] |
| layernorm 64×256 | 8 | 41.410 | 38.153 | 0.923 | 0.886–0.960 | [True]→[True] |
| layernorm 129×769 | 1 | 74.092 | 70.685 | 0.957 | 0.905–1.008 | [True]→[True] |
| layernorm 129×769 | 8 | 180.430 | 101.439 | 0.561 | 0.537–0.584 | [False]→[True] |
| layernorm 257×1538 | 1 | 106.841 | 107.389 | 1.005 | 1.003–1.008 | [True]→[True] |
| layernorm 257×1538 | 8 | 496.117 | 220.570 | 0.445 | 0.408–0.481 | [False]→[True] |
| layernorm 1024×4097 | 1 | 640.479 | 650.120 | 1.015 | 1.006–1.024 | [True]→[True] |
| layernorm 1024×4097 | 8 | 4652.261 | 1610.669 | 0.346 | 0.346–0.346 | [False]→[True] |
| layernorm 17×16384 | 1 | 379.722 | 380.792 | 1.003 | 0.999–1.006 | [True]→[True] |
| layernorm 17×16384 | 8 | 82.807 | 82.761 | 0.999 | 0.997–1.002 | [True]→[True] |
| masked_softmax 3×63 | 1 | 1.230 | 1.233 | 1.003 | 1.002–1.004 | [True]→[True] |
| masked_softmax 3×63 | 8 | 2.865 | 0.576 | 0.201 | 0.199–0.203 | [False]→[True] |
| masked_softmax 17×65 | 1 | 4.414 | 4.395 | 0.996 | 0.995–0.996 | [True]→[True] |
| masked_softmax 17×65 | 8 | 43.113 | 31.898 | 0.741 | 0.704–0.778 | [False]→[True] |
| masked_softmax 64×256 | 1 | 62.290 | 61.935 | 0.994 | 0.984–1.005 | [True]→[True] |
| masked_softmax 64×256 | 8 | 59.684 | 60.583 | 1.015 | 1.005–1.025 | [True]→[True] |
| masked_softmax 129×769 | 1 | 124.563 | 123.043 | 0.988 | 0.984–0.992 | [True]→[True] |
| masked_softmax 129×769 | 8 | 204.308 | 120.795 | 0.591 | 0.587–0.596 | [False]→[True] |
| masked_softmax 257×1538 | 1 | 203.644 | 206.595 | 1.014 | 0.995–1.034 | [True]→[True] |
| masked_softmax 257×1538 | 8 | 635.389 | 337.075 | 0.531 | 0.530–0.531 | [False]→[True] |
| masked_softmax 1024×4097 | 1 | 1707.468 | 1835.155 | 1.075 | 1.070–1.079 | [True]→[True] |
| masked_softmax 1024×4097 | 8 | 6290.556 | 3025.538 | 0.481 | 0.481–0.481 | [False]→[True] |
| masked_softmax 17×16384 | 1 | 1102.652 | 1093.275 | 0.992 | 0.984–0.999 | [True]→[True] |
| masked_softmax 17×16384 | 8 | 212.220 | 212.507 | 1.001 | 0.999–1.004 | [True]→[True] |
| swiglu 3×63 | 1 | 1.343 | 1.333 | 0.993 | 0.986–0.999 | [True]→[True] |
| swiglu 3×63 | 8 | 1.470 | 0.397 | 0.270 | 0.269–0.271 | [False]→[True] |
| swiglu 17×65 | 1 | 3.475 | 3.476 | 1.000 | 1.000–1.001 | [True]→[True] |
| swiglu 17×65 | 8 | 34.822 | 30.084 | 0.864 | 0.851–0.877 | [False]→[True] |
| swiglu 64×256 | 1 | 57.397 | 54.600 | 0.952 | 0.925–0.980 | [True]→[True] |
| swiglu 64×256 | 8 | 49.452 | 48.106 | 0.973 | 0.956–0.990 | [True]→[True] |
| swiglu 129×769 | 1 | 108.927 | 106.591 | 0.979 | 0.934–1.025 | [True]→[True] |
| swiglu 129×769 | 8 | 128.198 | 87.815 | 0.685 | 0.676–0.694 | [False]→[True] |
| swiglu 257×1538 | 1 | 177.434 | 178.943 | 1.009 | 1.001–1.016 | [True]→[True] |
| swiglu 257×1538 | 8 | 374.607 | 177.443 | 0.474 | 0.468–0.480 | [False]→[True] |
| swiglu 1024×4097 | 1 | 1327.861 | 1317.625 | 0.992 | 0.985–1.000 | [True]→[True] |
| swiglu 1024×4097 | 8 | 3223.042 | 1407.687 | 0.437 | 0.434–0.439 | [False]→[True] |
| swiglu 17×16384 | 1 | 812.286 | 814.333 | 1.003 | 1.002–1.003 | [True]→[True] |
| swiglu 17×16384 | 8 | 140.099 | 140.775 | 1.005 | 1.005–1.005 | [True]→[True] |
| gelu_residual 3×63 | 1 | 1.283 | 1.289 | 1.005 | 0.996–1.013 | [True]→[True] |
| gelu_residual 3×63 | 8 | 1.796 | 0.632 | 0.352 | 0.349–0.355 | [False]→[True] |
| gelu_residual 17×65 | 1 | 5.727 | 5.715 | 0.998 | 0.993–1.003 | [True]→[True] |
| gelu_residual 17×65 | 8 | 36.245 | 30.713 | 0.848 | 0.829–0.866 | [False]→[True] |
| gelu_residual 64×256 | 1 | 67.424 | 69.324 | 1.027 | 0.987–1.067 | [True]→[True] |
| gelu_residual 64×256 | 8 | 55.312 | 59.552 | 1.082 | 1.006–1.158 | [True]→[True] |
| gelu_residual 129×769 | 1 | 132.935 | 134.692 | 1.013 | 1.010–1.017 | [True]→[True] |
| gelu_residual 129×769 | 8 | 150.894 | 104.853 | 0.695 | 0.691–0.699 | [False]→[True] |
| gelu_residual 257×1538 | 1 | 254.520 | 253.755 | 0.997 | 0.995–0.999 | [True]→[True] |
| gelu_residual 257×1538 | 8 | 438.628 | 259.333 | 0.591 | 0.590–0.593 | [False]→[True] |
| gelu_residual 1024×4097 | 1 | 1971.533 | 1979.266 | 1.004 | 1.001–1.007 | [True]→[True] |
| gelu_residual 1024×4097 | 8 | 4078.573 | 2268.784 | 0.556 | 0.556–0.557 | [False]→[True] |
| gelu_residual 17×16384 | 1 | 1388.156 | 1388.080 | 1.000 | 0.999–1.001 | [True]→[True] |
| gelu_residual 17×16384 | 8 | 214.098 | 217.684 | 1.017 | 1.005–1.028 | [True]→[True] |
| rope 3×64 | 1 | 0.587 | 0.585 | 0.997 | 0.997–0.997 | [True]→[True] |
| rope 3×64 | 8 | 0.180 | 0.178 | 0.988 | 0.983–0.993 | [True]→[True] |
| rope 17×66 | 1 | 1.874 | 1.898 | 1.013 | 1.000–1.026 | [True]→[True] |
| rope 17×66 | 8 | 34.797 | 28.709 | 0.825 | 0.817–0.833 | [False]→[True] |
| rope 64×256 | 1 | 39.271 | 36.520 | 0.939 | 0.834–1.044 | [True]→[True] |
| rope 64×256 | 8 | 38.805 | 40.243 | 1.039 | 0.998–1.080 | [True]→[True] |
| rope 129×770 | 1 | 69.640 | 69.894 | 1.004 | 0.991–1.017 | [True]→[True] |
| rope 129×770 | 8 | 130.828 | 80.397 | 0.615 | 0.608–0.621 | [False]→[True] |
| rope 257×1538 | 1 | 114.922 | 116.234 | 1.012 | 1.002–1.021 | [True]→[True] |
| rope 257×1538 | 8 | 333.106 | 148.814 | 0.447 | 0.413–0.482 | [False]→[True] |
| rope 1024×4098 | 1 | 709.696 | 706.968 | 0.996 | 0.993–0.999 | [True]→[True] |
| rope 1024×4098 | 8 | 3055.139 | 1003.560 | 0.328 | 0.328–0.329 | [False]→[True] |
| rope 17×16384 | 1 | 351.248 | 349.117 | 0.994 | 0.989–0.999 | [True]→[True] |
| rope 17×16384 | 8 | 67.861 | 68.626 | 1.011 | 0.999–1.024 | [True]→[True] |
| attention 1×4×2×16×32×16×16 | 1 | 34.437 | 35.014 | 1.017 | 1.006–1.028 | [True]→[True] |
| attention 1×4×1×64×128×32×32 | 1 | 105.041 | 101.175 | 0.965 | 0.926–1.003 | [True]→[True] |
