Repository navigation
[Triton/Gluon] : (ATTN DELTA) Add RotatingBufferBench support - #6838
rahulbatra85 wants to merge 1 commit into
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
e948668 to
942384c
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Graph capture can omit pool entries, and pool sizing counts unused buffers, so measurements do not enforce the requested active footprint.
5 open issues
Exclude unused state and output tensors from prepare pool sizing · New Pool sizing overestimates each timing arm's active footprint · New Validate graph lengths and replay counts as positive integers · New Format callable values without assuming a func attribute · New Replay rotates only a prefix of oversized buffer pools · New
What changed in this PR
This PR moves KDA benchmarks to shared rotating-buffer graph timing. It aims to reduce cache-warm bias and measure execution without CPU launch overhead.
Changes:
- Add shared input-pool generation and graph-replay timing helpers.
- Add command-line controls for pool size, warmup, and graph replay.
- Migrate four KDA benchmarks while retaining legacy timing options as unused compatibility flags.
| File | Description |
|---|---|
op_tests/op_benchmarks/triton/utils/benchmark_utils.py |
Add rotating input pools and graph timing. |
op_tests/op_benchmarks/triton/utils/argparse.py |
Add shared pool and graph controls. |
op_tests/op_benchmarks/triton/bench_kda.py |
Migrate recurrent KDA timing and variability reporting. |
op_tests/op_benchmarks/triton/bench_fused_kda_decode.py |
Migrate decode and speculative-decode comparisons. |
op_tests/op_benchmarks/triton/bench_flash_kda.py |
Migrate FlashKDA timing to the shared helpers. |
op_tests/op_benchmarks/triton/bench_chunk_kda.py |
Add rotating pools for full, prepare, and walk measurements. |
Review effort: Balanced
942384c to
c038076
Compare
c038076 to
1cf1388
Compare
NOT READY FOR HUMAN REVIEWPR Self-ReviewRevision Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision. Questions to answer in the PR description
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
1cf1388 to
d9a8d64
Compare
173f866 to
db29ed1
Compare
Boss2002n
left a comment
There was a problem hiding this comment.
The KDA benchmarks now rotate their inputs in a CUDA graph, which is good, but something must change before merge.
Must fix before merge
--state_dtype bf16has no effect inbench_chunk_kda.py(bench_chunk_kda.py:90,:146): the pool makes the state without adtype, so the Gluon and walk lines time an fp32 state but count bf16 bytes. Fix: passstate_dtypeto their generators, and keep fp32 for thetritonline.
Nice to fix
- Build
betaand itsin_projonce on the fixed side: the pool counts all ofin_proj, so 4 of 12 default shapes rotate 132-243 MB, not 256 MB (bench_chunk_kda.py:108-125). - Add the four fused-only fields to the pool only with
--fused; anflathat does not take them fails withTypeError(bench_kda.py:208-212). - Delete the dead
_chunk_kda_fn(bench_flash_kda.py:171-199). - Write the pool code in the
_p_genandfunctools.partialform of the benchmarks in #7121 (bench_kda.py:156-212). - Correct the "cache-warm" header (
bench_kda.py:352-355) and the two false docstrings (bench_fused_kda_decode.py:175-177,bench_flash_kda.py:9-13). - Cut the eight long comments to one short sentence each, and delete the repeated one at
:494-495(bench_fused_kda_decode.py:268-276).
Merge order
Merge #7121 first. With #7225, the later PR must add conv1d_layout to _generate_kda_pool_inputs, or bench_kda.py fails with TypeError; with #6912, the later PR must keep an eager --varlen path.
db29ed1 to
9d5b267
Compare
|

Motivation
Cache-warm inputs. Most AITER Triton benchmarks reuse a single set of inputs across benchmark iterations. Depending on their size, those inputs can stay resident in L2, so later iterations read from cache instead of HBM. This overstates performance, especially for memory-bound and small-shape kernels, and can make autotuning pick the wrong configs. In real workloads, other layers’ weights and activations pass through the cache between calls to a kernel, so its inputs usually have to be read from HBM. This PR allocates multiple input sets whose combined size is larger than the L2 cache and rotates through them, so each launch sees cold-cache behavior.
triton.testing.do_bench approximates this by flushing L2 before each run. However, the flush can’t be placed inside a captured graph without being timed along with the kernel, and it adds gaps between launches. Rotating buffers avoid both problems.
Graph capture. Most benchmarks launch kernels eagerly, which includes CPU launch overhead in the measurement. That overhead can dominate for small kernels. Production inference stacks (e.g. vLLM and SGLang decode paths) typically run under HIP graphs. The new do_bench captures the rotated launches in a graph, which makes the measured time closer to what these kernels see in deployment.