MXFP8 kernel config tuning: training config in, faster training out No kernel or model code changes. Example numbers: Qwen3-4B, TP4 × FSDP16, SAC, 1x32 + pre-quantized weights, one Trn3 instance. INPUT Training config The user's torchtitan command, unchanged: model, parallelism, batch, MXFP8 recipe STEP 1 · CAPTURE Run 2–3 steps Record every MXFP8 kernel call's shape Found: 8 call sites, 12 kernel shapes STEP 2 · TUNE KERNELS Standalone search Replay each call alone, time many configs on the device 1,590 runs in ~32 min OUTPUT tuned.json Best config per kernel shape Predicted saving: 65 ms per step STEP 3 · VERIFY E2E Train with it A/B: base, tuned, base Loss matches baseline 0.802 to 0.741 s/step 1.08× faster A/B the in-graph pick STEP 4 · IN-GRAPH Refine in training Re-rank the top configs by real step time Qwen3-4B: tied Step 3, so Step 3's JSON ships Inside Step 2: how each kernel shape is tuned (standalone) 1. Baseline Kernel's default config, 3 reps The bar to beat 2. Broad sweep ~24 tilings per shape × spill on / off, from the kernel's own candidates Most of the gain 3. Refine around the best One-knob moves around the top 3; pair dX/dW for fused backward; try ratio knobs 2–3 rounds, stop at < 1% gain repeat 4. Finals Top 4 + baseline per shape, 3+ interleaved reps, pick by median Winner per shape 5. Write JSON Keep wins of 1%+, weight by calls/step, predict ms saved tuned.json Knobs swept (per kernel shape) • Tile size: tile_k, tile_n • Block size: TILES_IN_BLOCK_M / N / K (data kept on chip) • Load split: TILES_IN_LOAD_M / N · spill_reload · copy/swizzle ratios Illegal configs are filtered first; compile failures and wrong outputs are dropped. How each config is measured 1. Compile it on one NeuronCore, using the exact captured call 2. Check output vs an fp32 reference (wrong output = rejected) 3. Time on the device with the profiler (neuron-explorer), warm runs only On-device kernel time, not wall clock: it matches what the kernel costs inside training. Inside Step 4: in-graph refinement (after Step 3, using the real training step) Why: inside training, kernels share DMA queues and read inputs from the previous op, so standalone timings can mis-rank close configs. When: the model has fused backward kernels, or Step 3 showed less than ~half the predicted saving. Skipped if Step 3 showed 90% or more. 1. Profile candidates Baseline, top 3 variants and the Step 3 JSON: 1 profiled step each 2. Score each kernel in the graph Per-kernel time measured inside the real training step 3. Pick per kernel shape Fastest in the graph, only if beyond the profile noise 4. Training step decides Step-time A/B: Step 3 JSON vs in-graph pick; ship the fastest Result: the same training command + one override ./run_train.sh … --mxfp8_matmul_configs tuned.json (MoE experts: the converter's tuning_path=tuned.ntt.json) Verified: every tuned kernel used · loss steps 1–3 match baseline · faster than both bracketing baselines by more than the noise Measured vs untuned: Qwen3-14B 1.16× · Qwen3-30B-A3B 1.09× · Qwen3-4B 1.08× · GPT-OSS-20B 1.29×