Skip to content

[Triton/Gluon] : (ATTN DELTA) Add RotatingBufferBench support - #6838

Draft
rahulbatra85 wants to merge 1 commit into
mainfrom
triton_benchmark_attn_delta_rot_buffs
Draft

rahulbatra85 wants to merge 1 commit into
mainfrom
triton_benchmark_attn_delta_rot_buffs

Conversation

@rahulbatra85

Copy link
Copy Markdown
Contributor

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.

@rahulbatra85
rahulbatra85 requested a review from a team October 22, 2026 18:22
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the gfx1201 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 6838 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

@rahulbatra85
rahulbatra85 force-pushed the triton_benchmark_attn_delta_rot_buffs branch from e948668 to 942384c Compare October 22, 2026 18:24
@Boss2002n
Boss2002n requested a balanced review from Copilot October 22, 2026 21:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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
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

@zufayu
zufayu requested review from a team and Boss2002n October 23, 2026 01:03
@rahulbatra85
rahulbatra85 force-pushed the triton_benchmark_attn_delta_rot_buffs branch from 942384c to c038076 Compare October 24, 2026 00:44
@rahulbatra85
rahulbatra85 marked this pull request as draft October 24, 2026 17:52
@zufayu
zufayu removed request for a team and Boss2002n October 25, 2026 00:02
@Boss2002n Boss2002n assigned rahulbatra85 and unassigned Boss2002n Oct 26, 2026
@rahulbatra85
rahulbatra85 force-pushed the triton_benchmark_attn_delta_rot_buffs branch from c038076 to 1cf1388 Compare October 29, 2026 18:46
@rahulbatra85
rahulbatra85 marked this pull request as ready for review October 29, 2026 18:47
@aiter-bot

aiter-bot commented Oct 29, 2026 •

Copy link
Copy Markdown

NOT READY FOR HUMAN REVIEW

PR Self-Review

Revision 9d5b2676e8b0 · mode shadow

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

  1. What behavior does this PR change, and why is the existing behavior insufficient?
  2. What did you validate, and what remains unverified? Include commands, hardware/configuration and results.
  3. What behavior would each changed op test fail on before this PR, and why is that coverage not already provided by an existing canonical test?
  4. For every changed op_tests/ file, what behavior does it cover and why is it not redundant? Write None if no op test changed.

Edit the PR Self-Review section in the PR description. Include the current revision SHA; this comment refreshes automatically.

Missing or invalid answers

  • FAIL — missing ### Reviewed revision in the PR description
  • FAIL — missing ### Behavior and intent in the PR description
  • FAIL — missing ### Validation and unverified scope in the PR description
  • FAIL — missing ### PR-specific question in the PR description
  • FAIL — missing ### Changed op tests in the PR description
  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA
  • FAIL — Behavior and intent has no substantive answer
  • FAIL — Validation and unverified scope has no substantive answer
  • FAIL — PR-specific question has no substantive answer
  • FAIL — changed op test not explained in Changed op tests: op_tests/op_benchmarks/triton/bench_chunk_kda.py
  • FAIL — changed op test not explained in Changed op tests: op_tests/op_benchmarks/triton/bench_flash_kda.py
  • FAIL — changed op test not explained in Changed op tests: op_tests/op_benchmarks/triton/bench_fused_kda_decode.py
  • FAIL — changed op test not explained in Changed op tests: op_tests/op_benchmarks/triton/bench_kda.py
  • FAIL — Changed op tests must explain why each changed op test is necessary and non-redundant

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

@rahulbatra85
rahulbatra85 force-pushed the triton_benchmark_attn_delta_rot_buffs branch from 1cf1388 to d9a8d64 Compare October 29, 2026 18:57
@zufayu
zufayu requested review from a team and azaidy October 30, 2026 01:29
@rahulbatra85
rahulbatra85 force-pushed the triton_benchmark_attn_delta_rot_buffs branch 2 times, most recently from 173f866 to db29ed1 Compare November 2, 2026 18:25
@rahulbatra85 rahulbatra85 changed the title [Triton/Gluon] : (ATTN DELTA) Add rotating buffers and do_bench_aiter_triton support [Triton/Gluon] : (ATTN DELTA) Add RotatingBufferBench support Nov 2, 2026

@Boss2002n Boss2002n left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The KDA benchmarks now rotate their inputs in a CUDA graph, which is good, but something must change before merge.

Must fix before merge

  1. --state_dtype bf16 has no effect in bench_chunk_kda.py (bench_chunk_kda.py:90, :146): the pool makes the state without a dtype, so the Gluon and walk lines time an fp32 state but count bf16 bytes. Fix: pass state_dtype to their generators, and keep fp32 for the triton line.

Nice to fix

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.

@rahulbatra85
rahulbatra85 force-pushed the triton_benchmark_attn_delta_rot_buffs branch from db29ed1 to 9d5b267 Compare November 4, 2026 21:13
@rahulbatra85

Copy link
Copy Markdown
Contributor Author

The KDA benchmarks now rotate their inputs in a CUDA graph, which is good, but something must change before merge.

Must fix before merge

  1. --state_dtype bf16 has no effect in bench_chunk_kda.py (bench_chunk_kda.py:90, :146): the pool makes the state without a dtype, so the Gluon and walk lines time an fp32 state but count bf16 bytes. Fix: pass state_dtype to their generators, and keep fp32 for the triton line.

Nice to fix

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.

  1. Fixed

@rahulbatra85
rahulbatra85 marked this pull request as draft November 5, 2026 01:48

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants