Skip to content
Peter Styk HPC & AI Platform Engineer

Reports · Qwen3.8-27B on one AMD Instinct MI300X · Attention kernel: Triton

The Triton kernel is third of four: it repairs writing, not reading

The four lower rungs of the context ladder on vLLM's Triton attention kernel, chosen by hand. At 128,000 tokens of context it writes 10.3 times as fast as the kernel vLLM picks by itself, but the first token still takes 65 seconds, where the default needs 76.

Test
Attention kernel: Triton
Run
20261125T212044Z-series-attn-triton-attn

Also as a one-minute video and a PDF of 6 pages.

01Overview

The context ladder showed the kernel vLLM picks by itself collapsing as the prompt grows. I replayed its four lower rungs on each of the three other attention kernels this install offers, one server per kernel. This is the one for the Triton kernel, TRITON_ATTN. It repairs writing: at 128,000 tokens of context it writes 10.3 times as fast as the default. It hardly touches reading: the first token comes after 65 s, where the default needs 76 s. Both of AMD's kernels are faster on both counts.

  • 38.1 answer tokens a second at 128,000 tokens of context; 3.7 on the default kernel
  • 10.3 times as fast in writing as the default at 128,000 tokens, from the two servers' writing seconds
  • 65 s before the first token at 128,000 tokens; 76 s on the default kernel
  • 1,973 prompt tokens read a second at 128,000, averaged over the prompt; 1,686 on the default kernel
Seconds before the first token0500.49 s2.54 s19.7 sdefault 75.9 sTriton 64.9 sAITER unified 45.7 sAITER flash 24.5 sPrompt tokens read a second (prefill, averaged over the whole prompt)05,00010K8,2396,3123,257AITER flash 5,234AITER unified 2,799Triton 1,973default 1,686Answer tokens written a second (decode, each server's own timer; grey bars: the bracket at the client)0504,00016,00064,000128,000tokens in the prompt (logarithmic scale)65.361.047.8AITER flash 54.8AITER unified 46.7Triton 38.1default 3.7
Figure 1The four rungs on the four kernels. This document's kernel is in colour with its values; the other three are grey, each named at the end of its line with its value at 128,000 tokens. Top: the wait for the first token. Middle: how fast the prompt was read, averaged over the whole prompt. Bottom: how fast the answer was written; the grey bars are the two figures the client can compute, shown only as a bracket.Source: cross/ladder.json: each run's summary.json single_requests[] (first_token_s, prefill_tok_s, decode_tok_s_server)

Third of the four in writing from 16,000 tokens up: at 128,000 tokens 38.1 answer tokens a second, against 46.7 on AITER unified and 54.8 on AITER flash. In reading it is third or last at every rung: 1,973 prompt tokens a second at 128,000, the default 1,686.

From 4,000 to 128,000 tokens this kernel keeps 58.3% of its writing speed and 23.9% of its reading speed. The default kernel keeps 8.4% and 20.0%.

02How it was run

The machine, and the one part that was changed

AMD Instinct MI300XQwen3.8-27B · vLLM 0.27.1streamsone at a timeengine stepprefill1,973 tokens/s, topdecode38.1 tokens/s, topattentionTRITON_ATTNthe one changecache7.1% in usecompute unitsclientsCPU · 20 cores
Figure 2The serving settings are those of the context ladder; the attention kernel is the one change. "Top" is the 128,000-token rung.Source: FACTS.json; summary.json server.attention_kernel and plans.plan-context-ladder-short

Four servers, one for each kernel

serverattention kernelchosenenvironment setcache slotsstart-up graphsready, scompiling, s
AITER flashROCM_AITER_FAby handVLLM_ROCM_USE_AITER=11,723,32512.90 GiB20637.3
AITER unifiedROCM_AITER_UNIFIED_ATTNby handVLLM_ROCM_USE_AITER=11,812,8207.42 GiB19436.8
TritonTRITON_ATTNby handVLLM_ROCM_USE_AITER=11,816,3946.83 GiB18537.0
defaultROCM_ATTNby vLLMnone1,826,4766.83 GiB944.9

Like for like. The three servers with a kernel chosen by hand differ in --attention-backend only; all three have AMD's AITER library switched on. Against the default two things differ: the kernel, and AITER being on. The default's rungs come from its full ladder, which has the same seed.

The slower starts are not a cost of a kernel. My reading: vLLM's compile cache did not hold these three configurations' graphs yet, so each compiled for about 37 s where the default's server needed 4.9 s.

  1. A warm-up request of 1,000 tokens goes first. It is not a rung.
  2. Then four requests, one at a time: 4,000, 16,000, 64,000 and 128,000 random token ids in, 64 tokens forced back. The next is sent only when the last token of the answer before has arrived.
  3. Beside it a sampler reads the server's counters, the card and the CPU once a second.
Prompt plus answer of each request, against the model's limit1,000 in warm-up, not a rung1,016 tokens4,000 in4,064 tokens16,000 in16,064 tokens64,000 in64,064 tokens128,000 in128,064 tokensthe model's limit262,144 tokens
Figure 3The plan against the model's limit: the four rungs reach half of it.Source: plans/context-ladder-short.json; summary.json server.max_model_len

Settings

Model Qwen3.8-27B: 27.8 billion parameters, BF16 weights, 262,144 tokens of context
Card one AMD Instinct MI300X: 304 compute units, 191.7 GiB of memory
Server vLLM 0.27.1+rocm723, ROCm 7.2.3, PyTorch 2.11.0+gitd0c8b1f
Machine a cloud GPU virtual machine: 20 virtual cores, Intel Xeon Platinum 8568Y+
This run 20261125T212044Z-series-attn-triton-attn, started 2026-11-25T21:20:58Z, server ready after 185 s

The load is made on the same machine as the server and shares its CPU cores. It talks to the server on the loopback address: no request leaves the machine.

03The record

Prompt length by kernel: the whole grid

Answer tokens a second, by kernel and prompt length02040604K16K64K128KAITER flashAITER unifiedTritondefaulttokens in the prompt
Figure 4Writing speed on the four attention kernels at the four rungs. A view only: the exact values are in the first matrix beside it. The default kernel is the front row.Source: cross/ladder.json decode_tok_s_server (each run's summary.json)
tokens in the prompt4K16K64K128KAITER flash65.864.859.854.8AITER unified65.261.753.946.7Triton65.361.047.838.1default43.621.36.93.7darker = more: answer tokens a second
Figure 5Writing: the same values as the view, exactly.Source: cross/ladder.json decode_tok_s_server
tokens in the prompt4K16K64K128KAITER flash8,9797,1946,6045,234AITER unified8,3297,2004,2972,799Triton8,2396,3123,2571,973default8,3936,2322,9141,686darker = more: prompt tokens read a second
Figure 6Reading, averaged over each prompt.Source: cross/ladder.json prefill_tok_s
tokens in the prompt4K16K64K128KAITER flash0.452.229.6924.5AITER unified0.482.2214.945.7Triton0.492.5419.764.9default0.482.5722.075.9darker = more: seconds before the first token (shaded by order of magnitude)
Figure 7The wait for the first token, in seconds.Source: cross/ladder.json first_token_s
tokens in the prompt4K16K64K128KAITER flash1.5×3.0×8.6×14.9×AITER unified1.4×2.8×7.7×12.7×Triton1.4×2.8×6.8×10.3×darker = more: times as fast in writing as the default kernel
Figure 8Writing against the default kernel: the default's writing seconds divided by each kernel's, cut to one decimal.Source: computed from cross/ladder.json server_decode_s

The exact record of this run

prompt tokensfirst token, sreading, s (server)prompt tokens/swriting, s (server)answer tokens/s (server)bracket at the clientms per answer tokenwriting, against the defaultcache in use, %
4,0000.490.488,2390.96565.365.5 to 65.515.31.4×-
16,0002.542.526,3121.03261.061.7 to 61.716.42.8×1.0
64,00019.6519.593,2571.31947.848.6 to 49.320.96.8×3.6
128,00064.8764.761,9731.65338.138.7 to 40.026.210.3×7.1
Not a rung: the warm-up request, 16 tokens asked back
1,0000.580.571,7270.22566.767.0 to 67.015.0--

One row per request, from summary.json and cross/ladder.json. First token: at the client, from sending to the first text chunk. Reading and writing seconds: the server's own prefill and decode timers for that request. Answer tokens a second: the answer's tokens less one, divided by the writing seconds. The bracket: a token that carries no visible text sends no chunk, and these answers are random tokens, so counting chunks gives too low a speed and spreading all tokens over the time from the first chunk to the last too high a one; the server's own timer can sit just below it, because tokens without text at either end of an answer shorten the client's window.

04Why

Why it is third: writing repaired, reading as slow as the default

Milliseconds for one answer token0200default 273Triton 26The three chosen kernels, enlarged020016,00064,000128,000tokens of context (linear scale)Triton 26.2AITER unified 21.4AITER flash 18.2
Figure 9Writing. The time for one answer token against the context, on plain scales. Top: the four kernels on one scale. Bottom: the three chosen kernels, enlarged.Source: computed from cross/ladder.json server_decode_s (each run's summary.json)
Seconds for one bite05064,000128,000tokens already read when the bite began (linear scale)default 8.0 sTriton 7.0 sAITER unified 4.5 sAITER flash 2.0 s
Figure 10Reading. The seconds each full bite of the 128,000-token prompt took, against what had been read before it. The record has whole seconds, so each line is a centred mean over three bites.Source: each run's timeline.json: the seconds between two moves of the server's work counter (est_tflops), which moves once per bite

The 128,000-token prompt went in as 16 bites of at most 8,192 tokens. On this kernel the first three took 2.0 s each on average and the last three full ones 6.7 s; on the default kernel the same bites took 2.0 s and 7.7 s.

One answer token took 15.3 ms at 4,000 tokens of context and 26.2 ms at 128,000: 0.088 ms more for every 1,000 tokens of context. On the default kernel that figure is 2.01 ms, 22 times as much.

Added to one answer token by 1,000 tokens of contextAITER flash0.025 msAITER unified0.049 msTriton0.088 msdefault2.01 ms
Figure 11Writing: what 1,000 more tokens of context add to the time for one answer token, on each kernel.Source: computed from cross/ladder.json server_decode_s: the rise from the 4,000-token rung to the 128,000-token rung
Reading speed for the tokens from 64,000 to 128,000AITER flash4,334 tokens/sAITER unified2,076 tokens/sTriton1,415 tokens/sdefault1,186 tokens/s
Figure 12Reading: how fast the second half of the longest prompt went in, on each kernel.Source: computed from cross/ladder.json first_token_s: tokens added over the rung before, divided by seconds added

05Second by second

One prompt, four kernels, second by second

Cache slots in use, thousands0100010203040506070seconds since the request was sentAITER flash 24.5 sAITER unified 45.7 sdefault 75.9 sTriton 64.9 s
Figure 13The 128,000-token prompt going into the cache on the four servers, from the second it was sent to its first token. The same prompt, token for token, on each. The steps are the bites; where a line ends, that server's first answer token left.Source: each run's timeline.json (vllm:kv_cache_usage_perc every second, times its summary.json server.kv_cache_tokens) and its single_requests[stage=in-128000].first_token_s
serverthe rung took, sTFLOPS, vLLM's estimate% of AMD's stated peakestimated work, quadrillion operationsCPU busy, %engine cores
AITER flash2578460.319.610.72.03
AITER unified4642932.919.710.62.00
Triton6629022.219.110.72.01
default9220715.919.110.62.00

The 128,000-token rung on each server. TFLOPS is vLLM's estimate from the model's shape over the whole request, not a hardware counter, and the peak it is divided by is AMD's stated figure. The estimated work is about the same on every kernel; only the time differs.

vLLM's estimate counts too much attention for this model. What it adds for every bite already read is attention over the context in 64 layers; the model's configuration has full attention in 16 of its 64. At 128,000 tokens 67% of the estimated work is that attention. Counted for 16 layers, the same arithmetic gives 145 TFLOPS on this kernel, 11.1% of AMD's stated peak. My reading, not vLLM's figure.

Writing and reading are slow on the default kernel for two different reasons, and this kernel removes only the first. Its answer tokens no longer pay the default's price for the context. Its bites of the prompt take almost as long as the default's, so the wait for the first token barely moves.

Against the fastest kernel at 128,000 tokens: the first token comes after 65 s here and after 24 s on AITER flash; writing runs at 38.1 against 54.8 tokens a second. The two servers differ in the kernel only.

06What it means

What I take from it

  • With the Triton attention kernel chosen by hand, a request of 128,000 tokens waits 65 s for its first token and is then written at 38.1 tokens a second.
  • That is 10.3 times the default kernel's writing speed and 1.1 times as soon to the first token.
  • It is third of the four in writing from 16,000 tokens up, and third or last in reading at every rung. At 128,000 tokens the default reads at 1,686 prompt tokens a second and this kernel at 1,973.
  • Better than the default wherever writing matters, and no answer to a long wait for the first token. On this card both of AMD's kernels do more.

Not results, and limits

The 1,000-token request at the start is a warm-up, not a rung.

  • Speed and behaviour only: random-token prompts and answers of 64 forced tokens say nothing about the quality of an answer.
  • One request at a time on an otherwise idle server, each rung once. Two starts of one configuration differed by up to about 2% on these rungs.
  • Four rungs, up to half the model's context.

measured: read from a run file · computed: arithmetic on measured values · estimate: vLLM's, from the model's shape · my reading: interpretation, not measurement

Words used

Attention kernel
(--attention-backend) the GPU code that lets each token look back over the context. Four exist here: ROCM_ATTN (the default pick), ROCM_AITER_FA (AITER flash attention), ROCM_AITER_UNIFIED_ATTN, TRITON_ATTN.
AITER
AMD's library of GPU kernels for inference. Off by default in this install (VLLM_ROCM_USE_AITER).
Prefill
the server reading the prompt. Every prompt token passes through the model once before the first answer token.
Decode
the server writing the answer, one token per stream per engine step.
First token
(time to first token) from sending the request to receiving the first answer token. It contains waiting in line and prefill.
Context
all tokens a request holds: prompt plus answer so far. This model's native limit is 262,144.
Chunked prefill
a long prompt is read in bites across several engine steps, at most max_num_batched_tokens (8,192 here by default) per step for all requests together.
TFLOPS
trillions of arithmetic operations per second. Here always vLLM's estimate from the model's shape (--enable-mfu-metrics), not a hardware counter. It counts attention in all 64 layers where this model has it in 16: 1.7% high for short prompts, over half too high from 128,000 tokens of context.

Every number in this document was read from these files at build time (sha256, first 12 characters):

FACTS.json 160f5ca0d495 · GLOSSARY.md 98323be796af · cross/compute-estimate.json b36121710947 · cross/ladder.json 3511faec1269 · facts/box/20261125T192138Z/model-config.json 191e0af23210 · plans/context-ladder-short.json b6a8613ab993 · runs/20261125T201346Z-series/plan-context-ladder/timeline.json 7ee787305964 · runs/20261125T201346Z-series/summary.json aab3940eb12e · runs/20261125T211511Z-series-attn-rocm-aiter-unified-attn/plan-context-ladder-short/timeline.json 49ed1e646107 · runs/20261125T211511Z-series-attn-rocm-aiter-unified-attn/summary.json 12b96900e2e1 · runs/20261125T212044Z-series-attn-triton-attn/plan-context-ladder-short/timeline.json f30fdb834d79 · runs/20261125T212044Z-series-attn-triton-attn/summary.json 6ecc28a27410 · runs/20261125T212632Z-series-attn-rocm-aiter-fa/plan-context-ladder-short/timeline.json 66856580a6bb · runs/20261125T212632Z-series-attn-rocm-aiter-fa/summary.json 0272c72e9f27

47 values bound by path, 13 figures drawn from data.

Supporting material · video

The same result in a minute

The whole series

Supporting material · PDF

The report as a document

6 pages · A4 · 386 KB · every number traced to its run file

Download the PDF