Repository navigation
Conversation
…rom #8739) Co-authored-by: Sealeen Zhang <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
Co-authored-by: Sealeen Zhang <[email protected]>
Co-authored-by: Sealeen Zhang <[email protected]>
…dw reduction Co-authored-by: Sealeen Zhang <[email protected]>
… large inputs Co-authored-by: Sealeen Zhang <[email protected]>
…ir constraints and fall back to torch with the reason in LAST_PIECES Co-authored-by: Sealeen Zhang <[email protected]>
Standalone gated RMSNorm backward for the KDA output norm,
out = o * rsqrt(mean(o^2, -1) + eps) * w * sigmoid(gp)(o: [B, T, H, 128] or any [..., V]). main has no gated RMSNorm backward: the existing gated RMSNorm ops are forward/quant only, and the Triton rmsnorm backward has no gate.The kernel started as the one from #8739 commit 31f1d2e (removed there in 7b5df91), so there is one canonical copy. It has since been optimized:
aiter/ops/flydsl/kernels/gated_rmsnorm_bwd.py:create_gated_rmsnorm_bwd_kernel.aiter/ops/flydsl/gated_rmsnorm_bwd.py:gated_rmsnorm_bwd(o, gp, w, dy, eps=1e-6) -> (do, dgp, dw)with fp32 outputs, plus thegated_rmsnorm_bwd_torchautograd reference.op_tests/test_flydsl_gated_rmsnorm_bwd.py: checks accuracy against torch and measures perf for bf16, T=1000/1001/2048, H=96/48, D=128. T=1001 covers a partial last block. TB/s counts 3 input reads plus 2 fp32 writes.This matches #8739's hook contract, so it plugs in like this:
Measured on MI350X at 737336b (accuracy passes 18/18): T=2048 H=96 runs in 101 us at 3.48 TB/s (was 242 us), and T=1000 H=96 runs in 60 us at 2.9 TB/s.
Follow-up 1dc49b6, not yet measured:
The dw partial sum is still a torch
sum(0)over n_blocks x V. Folding it into the kernel needs a grid-wide counter (atomics plus fences, so that the last block can sum the partials) or a second launch, so it is left as is.Limits: