Repository navigation
moe: compute the silu activation once per CTA in the verify-row silu_down kernel (+25% short / +10% agent decode, byte-identical) - #228
Conversation
…mpute The rows silu_down kernel recomputed (g/(1+exp(-g)))*u per element per column thread; with one column per thread that's 256x redundant SFU work and made silu_down_rows ~2x slower than the per-row arm while reading half the bytes. Stage s_act (fp32) per k-tile like the single-row smem kernel's phase-1 precompute; identical expression and values, same smem budget as the s_g/s_u pair it replaces. Bench now prints separate gate_up/silu_down times per case. Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…cap) cases.rs grew past 500 with the per-phase timing split; the guard helpers belong with the constants anyway. Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Microbench (sparky job 40): the first real run of the slim bench, both builds in one job, every case byte-identical, 6 RESULT lines parsed per arm. Cold rotation over 48 layer tables. Ratio = rows kernel ÷ 4 single-row launches:
The single-row reference itself differs ~15% between the two builds' runs (same kernel code), so treat these as directional. The in-situ A/B above is the decisive number. The GB10 merge gate on this head (agentic-webserver 50 + BFCL ST-995) is running as sparky job 41. |
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
GB10 gate progress (sparky job 41, head 86c11d7 = main + #219 + this PR; default FP4-Local recipe profile r1short):
That's one agentic run per build, and the direction matches the fixed-prompt A/B above. BFCL ST-995 is running (~3 h); byte-identical outputs should give 87.44 / 87.32 exactly. |
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
All gates passed: merging. sparky GB10, head 86c11d7 (= main db442e2 + this PR), default FP4-Local recipe profile:
|
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Summary
Stacked on #219 (base
perf/fp4l-moe-verify-dedup). I'll retarget this to main once #219 merges.The decode profile of #219 (sparky nsys, 3 × 1,024 tokens, ms per generated token) showed its
silu_downrows kernel at 6.55 ms/token, against 3.28 for the per-row kernel it replaces, while reading half the bytes of gate_up. The cause:silu_down_shared_t_rows_implrecomputedsilu(g)·u(two__expf+ divide) per element, per row, inside every one of its 256 column threads. The single-row kernel computess_actonce per CTA.This stages the activation per k-tile in shared memory, computed once per element per CTA with the single-row kernel's expression
(gf / (1.0f + __expf(-gf))) * ufin fp32. The inner loop reads it back. Each row's per-element accumulate (act·(lut·sc), same order) is unchanged, so outputs stay byte-identical.Evidence (sparky GB10,
nvidia/Qwen3.8-Flash-Next-FP4-Local, default recipe profile r1short, MTP 3; job39c-s71-insitu)ab_stream.pyfixed prompts (completion lengths identical):Medians: short 27.28 → 34.22 tok/s, agent (~17K-token prompt) 24.52 → 27.06 tok/s. Against main before #219 (25.98 / 23.41, earlier A/B on the same prompts), that's about +32% short and +16% agent decode. Within-arm spread is ≤ 0.1 tok/s.
A microbench of #219's vs this PR's rows kernels (sparky job 40) and a GB10 merge gate (agentic-webserver 50 + BFCL ST-995) on the merge with main follow. Byte-identical outputs mean BFCL should match main exactly.
Test plan
Generated with Devin