Skip to content

perf(hip): FP8 attention for Ripple — accuracy slice (ATLAS_RIPPLE_ATTN_FP8_SIM=1) - #361

Draft
AzeezIsh wants to merge 2 commits into
mainfrom
perf/hip-ripple-attn-fp8
Draft

AzeezIsh wants to merge 2 commits into
mainfrom
perf/hip-ripple-attn-fp8

Conversation

@AzeezIsh

Copy link
Copy Markdown
Contributor

Draft: accuracy slice only. Not for merge.

Ripple keeps its attention projections in BF16. On gfx1151 they are:

  • 47% of AR decode, with dense_gemv_bf16 at about 200 GB/s;
  • about 35% of DFlash2 decode, as rocBLAS GEMMs.

They are already at bandwidth, so only fewer bytes help. NVFP4 requant failed ST-995 (f282, o-only: 75.28 / 77.51), so this tries FP8 E4M3 with a per-row scale.

Kernel evidence (devlab kbench 43474657608, scripts/devlab/kbench_attn8). fp8_m32<64> is the #354 m32 WMMA body with an e4m3 B operand; its e4m3→f16 conversion is a free shift. Times are against rocBLAS BF16:

Projection M17 (verify) M1 (decode)
q|gate 509 vs 1089 µs 437 vs 1315 µs (dense_gemv_fp8w)
o 291 vs 889 µs —
k|v 143 vs 205 µs —

The output error equals the quantizer's own (rms 2.6%).

This commit. ATLAS_RIPPLE_ATTN_FP8_SIM=1 round-trips q|gate/k/v/o through per-row e4m3 in place at load. That gives the FP8 numerics with no route changes, so ST-995 can decide before the routes exist. It adds one BF16 rounding, so the result is pessimistic. The flag is off by default.

Gates running:

  • runner AR ST-995: 43484429475 vs main 43474735369;
  • framework DFlash2 ST-995: f287.

If it passes, the next slices add the FP8 decode, verify and prefill routes and free the BF16 copies (about 13 GB).

🤖 Generated with Claude Code

…LE_ATTN_FP8_SIM=1)

Ripple's BF16 attention projections are 47% of AR decode and ~35% of
DFlash2 decode on gfx1151, already at bandwidth, and NVFP4 failed ST-995.
FP8 E4M3 halves the bytes. kbench (devlab 43474657608): a per-row FP8 m32
WMMA verify twin is 2.1x (q|gate), 3.0x (o), 1.4x (k|v) faster than
rocBLAS BF16 at M17, and dense_gemv_fp8w is 2.8-3.0x at M1.

This slice only prices the accuracy. Under ATLAS_RIPPLE_ATTN_FP8_SIM=1 every
q|gate/k/v/o row is round-tripped through per-row E4M3 in place at load,
using quantize_bf16_to_fp8's scale and encode. It adds one more BF16 rounding,
so it is never more accurate than the real FP8 path. Speed and bytes are
unchanged and the flag is off by default; ST-995 decides whether the FP8
routes get built.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Accuracy gate, framework f287: DFlash2 ST-995 with ATLAS_RIPPLE_ATTN_FP8_SIM=1 scores 76.88 / 80.16 against same-day main f286 at 77.29 / 80.87 (item-reproducible). That fails the ≥-baseline rule.

Per category it is mixed:

  • Gains: live_simple +4.0, live_parallel_multiple +4.2, simple_javascript +3.2, multiple +1.6.
  • Losses: simple_java −6.5, irrelevance −4.2, live_irrelevance −2.3, parallel_multiple −1.6.

Per-row E4M3 with an extra BF16 rounding is not accurate enough for Ripple's attention. Holding this PR. The next slice to try is finer scaling (1×128 blocks along K) before building the FP8 routes. The runner's AR ST-995 legs hit the 6 h job limit and were cancelled, so the runner cannot gate Ripple AR ST-995.

…accuracy slice

The per-row slice (=1) failed ST-995 on framework (f287 76.88 / 80.16 vs main
77.29 / 80.87). With one scale per output row across K=5120 or 10240, a
single outlier channel coarsens the whole row. =g128 gives each row one
scale per 128-wide K group, the granularity block-FP8 checkpoints use along
K, with the same encode and decode as =1. Off by default.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Second accuracy slice, ATLAS_RIPPLE_ATTN_FP8_SIM=g128 (one scale per row per 128-wide K group), framework f289: 77.19 / 80.37 against main at 77.29 / 80.87. That is closer than per-row (76.88 / 80.16) but still below baseline, so it fails the ≥-baseline rule. Ripple's attention does not tolerate E4M3 weights at either granularity in this round-trip form. Holding this PR. The FP8 attention line is parked unless a finer format (e.g. MXFP8 32-blocks) is wanted.

@github-actions github-actions Bot added the needs-rebase Conflicts with main — its green checks are NOT real (GitHub skips merge-commit workflows) label Nov 19, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase Conflicts with main — its green checks are NOT real (GitHub skips merge-commit workflows)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant