RiptideRiptide
Download Riptide SDKInstall Riptorch
Menu
Whitepapers · AMD Instinct · GPU kernels

Riptide kernels on AMD Instinct MI350X

Riptide's attention, decode and launch software for AMD Instinct MI350X (gfx950), measured in the same session as PyTorch 2.15 for ROCm, AITER, Triton and Hugging Face, with medians of 30 samples (10 runs for whole models), 95% bootstrap confidence intervals and a float64 check on every Riptide result.

Version
1.1 (updated 1 December 2026: limitations section retitled)
Date
30 November 2026
Author
Samario Torres, Riptide
Software
ROCm 10.2.0, PyTorch 2.15.0+rocm10.2.0, Triton 3.9.0, AOTriton 0.14.1, amd-aiter 0.1.7.post2.dev18; measured 19–22 November 2026
Download PDFOpen in new tabriptidecompute.com/whitepapers/riptide-kernels-mi350x

Abstract

Riptide writes attention, decode and launch code for AMD Instinct GPUs that installs next to PyTorch for ROCm. On one MI350X, against the faster of PyTorch's FLASH (AOTriton) and EFFICIENT attention backends in the same session:

  • Attention, head dim 64, bf16: forward 1.14–1.21× (full mask) and 1.25–1.39× (causal) at every length from 512 to 16,384 tokens, every confidence interval above 1; the training step (forward + backward) 1.04–1.93× full and 1.03–3.10× causal.
  • Attention, head dim 128, bf16: causal training step at 512 tokens 3.32× [3.28, 3.38] (249 against 75 TFLOP/s); the training step ahead at 512–1,024 tokens (1.14–3.32×), behind from 4,096 tokens (0.82–0.90×).
  • Against AITER's fastest correct backward (non-deterministic): head dim 64 training step 1.34–2.07× ahead; head dim 128 0.79–0.89×, behind.
  • float32-accuracy attention training: 2.34–3.39× PyTorch's fastest float32 path, with lower error against float64 at every length.
  • Generation, Qwen2.5-0.5B, one response at a time: 399 against 106 tokens per second for Hugging Face eager, 3.75× [3.73, 3.75].
  • Kernel launch: 1.53 µs against 6.83 µs for an empty Triton kernel, 4.47× [4.46, 4.48]; level with PyTorch's torch.cuda graphs for a tiny op.

Where AMD's kernels are still faster is stated alongside each result and collected at the end.

The problem

On a GPU the same maths can run at very different speeds depending on the kernel. Attention dominates transformer training at long sequences, and its backward pass is the hardest part to make fast and deterministic at once. At small sizes the opposite problem dominates: a 0.5-billion-parameter decode step is a few hundred small kernels, so the cost of launching them, not arithmetic or memory bandwidth, sets the speed. On the MI350X baseline, a Qwen2.5-0.5B decode step reads about 1 GB of weights, about 0.2 ms at the measured 5.5 TB/s, yet Hugging Face eager takes about 9 ms per token (106 tokens per second).

A faster kernel only counts if it computes the right answer. One of the baselines in this paper, AITER's deterministic backward, returned a wrong query gradient at long sequences; that case is documented in A silent gradient bug in AMD's attention kernels, and its timings are not used as a baseline here.

Method

Machine and software

One AMD Instinct MI350X (gfx950, 256 compute units, 1,000 W board limit) on RunPod: ROCm 10.2.0, amdgpu driver 7.1.3, Linux 6.12.107, PyTorch 2.15.0+rocm10.2.0 (HIP 7.17.26434), Triton 3.9.0, AOTriton 0.14.1, hipBLASLt 1.5.0, amd-aiter 0.1.7.post2.dev18. Runs: attention 20261119T185122Z (19 November), launch and decode 20261119T062450Z (19 November), AITER head-to-head (20 November), float32 and second-harness comparison (22 November). Every baseline ran on the same GPU in the same session as Riptide.

Baselines

  • Attention: PyTorch's SDPA with its default dispatch, the forced FLASH_ATTENTION backend (AOTriton on ROCm) and EFFICIENT_ATTENTION. "AMD's best" for a shape is the faster of FLASH and EFFICIENT in that session. AITER's flash_attn_func in both backward modes is compared separately. Riptide is called through PyTorch, so PyTorch's dispatch overhead is included in its times.
  • Generation: Hugging Face eager (attn_implementation="sdpa"); the same model as a PyTorch static-cache implementation run eagerly, through torch.compile and as a torch.cuda graph.
  • Launch: PyTorch eager, torch.cuda graphs and Triton.

Timing and statistics

  • Device events around inner back-to-back calls, with inner chosen so one sample lasts at least 2 ms; 5 warm-up calls, then 30 timed samples (micro-benchmarks) or 10 full runs (end-to-end models).
  • Reported: the median per call and a 95% confidence interval of the median by percentile bootstrap (2,000 resamples, fixed seed). Rates are computed at the median. A ratio's interval is formed conservatively from the opposite ends of the two time intervals.
  • Attention FLOPs: forward , halved when causal; forward + backward the forward. Every implementation is credited with the same FLOPs for the same call, so rates compare times.
  • Energy: amdsmi board energy counter sampled every 50 ms over a sustained 1.5 s window of back-to-back calls.

Correctness against float64

  • Forward: 64 sampled query rows of (batch 0, head 0) against float64 attention on the CPU, error ; tolerance in bf16, in fp16.
  • Backward (up to 8,192 tokens): dQ, dK and dV of (batch 0, head 0) against float64 autograd on the CPU, ; tolerance in bf16, in fp16. At 16,384 tokens, PyTorch's math backend on the same inputs is the check.
  • Kernel tests: every kernel configuration on odd shapes (1, 37, 129, 200 × 333 tokens and others), both masks, both dtypes, both head dims, strided inputs and custom scales; all passed on the MI350X in every session where they ran (162 of 162 on 20 November). The launch runtime's own 58 tests passed on the launch run's machine.
  • Decode: teacher-forced on the Hugging Face bf16 greedy continuation and compared step by step with the model in float64 on the CPU.

Every Riptide row in this paper passed its check.

Results

Attention: head dim 64

Table 1. Riptide / AMD's best (faster of PyTorch FLASH and EFFICIENT), bf16, 32 heads, 16,384 tokens per batch (batch = 16,384 / S). Median ratio [95% CI].
pass, mask5121,0242,0484,0968,19216,384
forward, full1.14× [1.09, 1.18]1.18× [1.14, 1.20]1.17× [1.14, 1.21]1.15× [1.10, 1.19]1.18× [1.13, 1.21]1.21× [1.19, 1.22]
forward, causal1.34× [1.26, 1.38]1.26× [1.20, 1.32]1.25× [1.22, 1.27]1.25× [1.19, 1.31]1.32× [1.28, 1.35]1.39× [1.38, 1.40]
training step, full1.93× [1.87, 1.97]1.05× [1.02, 1.09]1.04× [1.01, 1.12]1.06× [1.04, 1.08]1.06× [1.06, 1.07]1.07× [1.07, 1.08]
training step, causal3.10× [3.07, 3.14]1.03× [0.97, 1.06]1.04× [1.00, 1.08]1.14× [1.11, 1.17]1.05× [1.05, 1.07]1.11× [1.10, 1.11]
Line chart with 95 percent confidence whiskers of Riptide over AMD best at head dim 64, four series all at or above 1, training step causal 3.10 at 512
Figure 1. Head dim 64, bf16: Riptide’s ratio to the faster of PyTorch FLASH and EFFICIENT, with 95% confidence intervals. Values above the dashed line mean Riptide is faster.
Line chart of TFLOP/s against sequence length for Riptide, FLASH and EFFICIENT at head dim 64 forward; Riptide 518 to 717, PyTorch 444 to 594
Figure 2. Head dim 64 forward, full mask: throughput with 95% confidence intervals.

At 16,384 tokens the head-dim-64 forward ran at 717 TFLOP/s (full) and 714 TFLOP/s (causal), against 594 and 515 for AMD's best. Its energy per call, measured against PyTorch's default dispatch, was 3.10 J against 3.68 J (16% less) with the full mask and 1.57 J against 2.12 J (26% less) causal. At head dim 128 the picture follows the speed: 2.73 J against 3.92 J causal, but 5.40 J against 4.53 J (19% more) with the full mask, where Riptide's forward is slower.

Paired bars of joules per forward call at 16,384 tokens: head dim 64 3.10 vs 3.68 and 1.57 vs 2.12; head dim 128 full 5.40 vs 4.53; causal 2.73 vs 3.92
Figure 3. Energy per forward call at 16,384 tokens (board energy counter, sustained 1.5 s windows), Riptide against PyTorch’s default dispatch. At head dim 128 with the full mask, where Riptide is slower, it also uses more energy.

Attention: head dim 128

Table 2. The same comparison at head dim 128, bf16.
pass, mask5121,0242,0484,0968,19216,384
forward, full0.84× [0.76, 0.87]0.87× [0.85, 0.89]0.89× [0.83, 0.92]1.02× [1.00, 1.05]0.87× [0.86, 0.88]0.84× [0.83, 0.84]
forward, causal1.12× [1.09, 1.16]1.13× [1.06, 1.16]1.06× [1.02, 1.13]0.87× [0.84, 0.90]0.87× [0.85, 0.89]0.86× [0.85, 0.87]
training step, full1.14× [1.10, 1.17]1.14× [1.12, 1.17]0.87× [0.84, 0.91]0.90× [0.89, 0.91]0.84× [0.83, 0.84]0.84× [0.84, 0.84]
training step, causal3.32× [3.28, 3.38]1.15× [1.10, 1.23]1.14× [1.12, 1.16]0.85× [0.83, 0.86]0.83× [0.83, 0.84]0.82× [0.81, 0.82]
Line chart with 95 percent confidence whiskers at head dim 128 bf16; training step causal 3.32 at 512, every series near or below 1 from 4,096 tokens
Figure 4. Head dim 128, bf16: ratio to AMD’s best with 95% confidence intervals.
Line chart of training-step TFLOP/s at head dim 128 causal; Riptide 249 at 512 against 73 to 75 for PyTorch, EFFICIENT ahead from 4,096 tokens
Figure 5. Head dim 128, causal training step: throughput. PyTorch’s backends run at 73–75 TFLOP/s at 512 tokens; EFFICIENT overtakes Riptide from 4,096 tokens.
Line chart with 95 percent confidence whiskers at head dim 128 fp16 following the bf16 pattern
Figure 6. Head dim 128, fp16: ratio to AMD’s best with 95% confidence intervals.

The 3.32× row is real but should be read with its baseline: at 512 tokens and batch 32, PyTorch's FLASH and EFFICIENT causal backward ran at 73–75 TFLOP/s, about 3% of the MI350X's 2,307 TFLOP/s dense bf16 peak, while Riptide's ran at 249 TFLOP/s. AITER's fastest backward is faster than Riptide's at a shape of that kind (next section). In fp16 at head dim 128 the forward was level with AMD's best for full masks (0.91–1.01×) and ahead for causal (1.09–1.21×); the training step followed the bf16 pattern (1.11–3.12× at 512–1,024 tokens, 1.15× causal at 2,048, and 0.87–0.91× at the longer lengths).

Against AITER

Table 3. Riptide / AITER flash_attn_func, bf16, 32 heads, 16,384 tokens per batch, 20 November. AITER non-deterministic is its fastest backward (fp32 atomics); Riptide's backward is bit-for-bit repeatable. Training-step ratio [95% CI].
head dimmask1,0242,0484,09616,384
64full1.34× [1.31, 1.40]1.37× [1.34, 1.38]1.42× [1.39, 1.43]1.39× [1.38, 1.40]
64causal1.51× [1.48, 1.54]1.87× [1.84, 1.88]2.07× [2.04, 2.10]1.61× [1.60, 1.62]
128full0.86× [0.84, 0.88]0.81× [0.80, 0.82]0.85× [0.85, 0.86]0.82× [0.81, 0.84]
128causal0.89× [0.87, 0.91]0.86× [0.86, 0.87]0.79× [0.78, 0.80]0.82× [0.82, 0.83]
Line chart with confidence whiskers of Riptide over AITER non-deterministic; head dim 64 1.34 to 2.07, head dim 128 0.79 to 0.89
Figure 7. Training step against AITER’s fastest correct backward (non-deterministic), bf16, 32 heads, with 95% confidence intervals.

Forward only, Riptide was 1.05–1.13× AITER at head dim 64 and 0.83–1.03× at head dim 128. Repeating each backward twice on the same inputs, Riptide and AITER's deterministic mode were bit-for-bit repeatable on 16 of 16 shapes and AITER's non-deterministic mode on 1 of 16. In a second harness on 22 November (batch 4, 32 heads, causal), AITER's fastest mode was ahead of Riptide at head dim 128 at every length from 512 to 8,192 tokens (Riptide 0.70–0.94×), including 512 tokens (0.70×), the shape class of the 3.32× row above.

Attention at float32 accuracy

Table 4. Training step (forward + backward), float32, causal, batch 4, 32 heads, head dim 128, 22 November. Milliseconds and worst error against float64. PyTorch's FLASH backend has no float32 kernel on ROCm.
tokensRiptideerrorPyTorch fastest (backend)errorratio [95% CI]
1,0241.479 ms5.9e-73.458 ms (default)8.2e-72.34× [2.32, 2.36]
2,0483.636 ms7.5e-712.332 ms (default)1.1e-63.39× [3.35, 3.44]
4,09612.254 ms1.0e-636.282 ms (EFFICIENT)1.4e-62.96× [2.95, 2.98]
8,19244.844 ms1.4e-6134.706 ms (EFFICIENT)1.9e-63.00× [3.00, 3.01]
Grouped bars of float32 training-step milliseconds; Riptide 1.5 to 44.8 against PyTorch 3.5 to 134.7
Figure 8. float32 attention training step, causal, head dim 128: Riptide against PyTorch’s default dispatch and EFFICIENT backend, with 95% confidence intervals.

The same harness also ran tinygrad 0.14.0 (best of TinyJit and eager), which was correct and 2.4–23× slower than Riptide in bf16 and 9.9–21.5× slower in float32.

Generation: Qwen2.5-0.5B

Table 5. Qwen2.5-0.5B, bf16, greedy, 128 new tokens. Decode tokens per second, median [95% CI]. Riptide's prefill is the same as the torch.cuda graph row's prefill.
prompt, batchHugging Face eagertorch.compile*torch.cuda graph*Riptidevs Hugging Facevs torch.compile*
128, 1106 [106, 107]291 [290, 293]247399 [399, 399]3.75× [3.73, 3.75]1.37× [1.36, 1.38]
1,024, 1111 [111, 112]296 [295, 297]246315 [315, 315]2.83× [2.82, 2.83]1.06× [1.06, 1.07]
128, 8878 [873, 879]2,167 [2,152, 2,169]1,6142,072 [2,071, 2,073]2.36× [2.36, 2.38]0.96× [0.95, 0.96]
1,024, 8860 [858, 865]2,215 [2,208, 2,224]1,6141,741 [1,739, 1,741]2.02× [2.01, 2.03]0.79× [0.78, 0.79]
Grouped bars of decode tokens per second for four prompt and batch settings; Riptide 399 at batch 1 against 106 for Hugging Face
Figure 9. Qwen2.5-0.5B decode with 95% confidence intervals. Rows marked * use the static-cache model, which was not verified against float64.

\* The torch.compile and torch.cuda graph rows run the PyTorch static-cache model. Its eager decode step failed the teacher-forced float64 check (normwise logit error 0.915, near-tie agreement 0.32), and the compiled step was not checked separately, so those rows are unverified. Hugging Face eager passed (logit error 0.0450) and is the verified baseline; Riptide's decode passed (0.0439, near-tie agreement 1.00). Time to first token was the same as the torch.cuda graph prefill (4.72 against 4.71 ms at prompt 128, batch 1), because the prefill is the same.

Launch cost and a small training step

Table 6. Per-launch time, µs, median [95% CI], same session. Riptide has more than one launch mode, labelled A, B and C here; the row shows the best.
rowAMD's stack, bestRiptide, bestratio [95% CI]
empty kernel, asynchronousTriton 6.83 [6.82, 6.84]mode A 1.53 [1.53, 1.53]4.47× [4.46, 4.48]
tiny op (x += v), asynchronoustorch.cuda graph 1.55; eager 3.16mode A 1.531.01× [1.01, 1.02]
tiny op, launch + waitPyTorch eager 12.67mode B 11.711.08× [1.08, 1.08]
dependent chain of 1,000, per chaintorch.cuda graph 1,691mode A 1,6531.02× [1.02, 1.02]
MNIST MLP training step, loss read every steptorch.cuda graph 0.225 msmode A 0.127 ms1.76× [1.59, 1.90]
MNIST CNN training steptorch.cuda graph 0.284 ms0.287 ms0.99× [0.99, 0.99]
Three panels of per-launch microseconds: empty kernel Triton 6.83 vs Riptide 1.53; tiny op; launch plus wait
Figure 10. Launch cost per kernel with 95% confidence intervals: an empty kernel, a tiny operation, and launch plus wait.
Log-log lines of per-kernel cost against chain length for PyTorch eager, torch.cuda graph and two Riptide launch modes
Figure 11. Dependent chains of 1 to 1,000 kernels: per-kernel cost. Riptide’s mode A matches torch.cuda graphs; mode B is slower on long chains.
Two panels of horizontal bars of seconds per MNIST epoch for six and four implementations, Riptide 0.120 s against 0.211 s for torch.cuda graph
Figure 12. One MNIST epoch (938 steps, loss read every step), median of 10 runs with 95% confidence intervals.

Every launch row checks counts and values exactly, and every training row passed its float64 criterion (first loss, first 50 losses, accuracy).

Limitations and next steps

The limits of these results, each with its cause and, where one is planned, the next step.

  • Head dim 128 at 4,096 tokens and longer: 0.82–0.90× of PyTorch's best for the bf16 training step and 0.84–0.87× forward (except the full-mask forward at 4,096 tokens, 1.02×), where AMD's kernels are strongest. Cause: the backward share is the cost of staying deterministic (next item); the forward limit was measured inside Riptide's kernel, not in memory bandwidth, and is being worked on.
  • Against AITER's non-deterministic backward at head dim 128: 0.79–0.89× at 1,024–16,384 tokens (32 heads), and 0.70–0.94× at 512–8,192 tokens (batch 4). Cause: this is AITER's fastest mode, which gives up bit-for-bit repeatability; Riptide's backward is deterministic and does more work to stay so, which the notes identify as most of the gap. The timing gap stands.
  • Second harness (22 November, batch 4, causal): 0.63× [0.62, 0.65] of PyTorch's best at head dim 64, 1,024 tokens, and 0.87–0.93× at head dim 128, 1,024, 4,096 and 8,192 tokens. Cause: under investigation.
  • Head dim 128 forward, full mask, at 512–2,048 and 8,192–16,384 tokens: 0.84–0.89×. Cause: under investigation.
  • Decode at batch 8 against torch.compile (unverified baseline): 0.96× at prompt 128 and 0.79× at prompt 1,024. Cause: Riptide's batch-8 decode does not yet reuse the weights across the batch as well as torch.compile does, and attention over a long cache is slower. Batch-8 decode and decode over a long cache are open work.
  • Decode is far from the memory floor: a batch-1 step takes 2.5 ms, about 12× the ~0.2 ms needed to read the weights once. Cause: launching is now a small part of the step; the rest is in the decode kernels, which are the next work.
  • Energy at head dim 128, full mask: 5.40 J per forward call against 4.53 J for PyTorch's default dispatch at 16,384 tokens. Cause: under investigation.
  • Riptide's launch mode B is 2.9× slower per dependent kernel than mode A (4.77 against 1.65 ms per 1,000-kernel chain), and a decode step in mode B takes 15–25% longer than in mode A. Cause: under investigation; mode A is the one to use for dependent chains.
  • Launch of a tiny op and of dependent chains is level with torch.cuda graphs; the 4.47× is against Triton's launch path for an empty kernel.
  • The MNIST CNN step is level (Riptide has no dedicated CNN kernels yet), and time to first token is unchanged (the prompt is processed by the same PyTorch code).
  • Scope: one MI350X, measured 19–22 November 2026; not re-run since. The MI300X (gfx942) port was not part of these runs.

Reproduction notes

  • Harness. Every phase runs on a rented GPU with the same statistics for AMD's software and for Riptide. Each run records ROCm, driver, kernel, firmware, clocks, PyTorch, Triton and library versions, and a manifest lists every output file with its SHA-256.
  • Peak. "% of peak" uses AMD's published dense peak for the GPU (MI350X bf16/fp16: 2,306.9 TFLOP/s).
  • Availability. Riptide's AMD kernels are available for evaluation, installed next to PyTorch for ROCm, through Request an evaluation; full results and raw data are shared with evaluation partners.

Date and version

Version 1.1, 30 November 2026. Measurements from 19, 20 and 22 November 2026. Updated 1 December 2026: limitations section retitled.

Working with Riptide

Riptide works with a small number of teams. Each engagement starts with 4 weeks inside your systems, learning how your models, data and infrastructure work. Only then does Riptide apply its software to them. Contact samario@riptidecompute.com or riptidecompute.com/evaluate.