Repository navigation
[Triton/Gluon] bench_pa_decode: report the real KV bandwidth and time with CUDA graphs - #6690
Conversation
… with CUDA graphs The benchmark used 4 physical KV blocks and counted the bytes of those 4 blocks, so it printed about 10 GB/s for a decode that reads 268 MB. Count the K and V bytes of every attended token. Use one page per block slot (capped at 4 GB per cache tensor) with distinct pages, and add -num_blocks. Time with do_bench_cudagraph. Make max_context_len a Python int so the Triton wrapper does not sync on a device tensor and can be captured.
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
There was a problem hiding this comment.
🟡 Changes recommended
The enlarged FP8 cache pool can overflow Triton’s signed 32-bit offsets and produce invalid memory addresses.
1 open issue
What changed in this PR
This PR improves paged-attention decode benchmark bandwidth accounting and timing for Triton and Gluon.
Changes:
- Count K and V bytes for every attended token.
- Size the page pool by workload, with a cap and CLI override.
- Use CUDA graph timing and a Python integer for maximum context length.
| File | Description |
|---|---|
op_tests/op_benchmarks/triton/bench_pa_decode.py |
Updates page allocation, bandwidth accounting, and graph-based timing. |
Review effort: Balanced
Add validation for num_blocks in Triton backend to ensure it does not exceed max_blocks. Co-authored-by: Copilot Autofix powered by AI <[email protected]>

BS * SEQ_LEN * kv_heads * head_size * dtype bytes * 2) in the bandwidth number.-num_blocksto set the pool size. When the pool is large enough, the block table uses distinct pages.do_bench_cudagraph, after one warm-up call.max_context_lena Python int. The Triton wrapper no longer syncs on a device tensor, so it can be captured in a CUDA graph.Test Result
MI355X, bf16, 64 query heads, 8 kv heads, head size 128, 8 × 8192:
MI450-MC
Can observe realistic numbers now
Motivation
bench_pa_decode.pyprinted bandwidth numbers that were far too low. For batch 8 and 8192 tokens it printed 12 GB/s (Triton) and 10 GB/s (Gluon). The real values are in the TB/s range.There were two causes:
The script also timed each call with
do_bench, which includes launch overhead and, for the Triton backend, a device sync on every call.Technical Details
Test Plan
Submission Checklist