Skip to content

[Triton/Gluon] bench_fused_indexed_gated_residual: time the eager-rounded path - #8717

Open
Shan2L wants to merge 1 commit into
ROCm:mainfrom
Shan2L:triton/gated-residual-bench-rounded
Open

Shan2L wants to merge 1 commit into
ROCm:mainfrom
Shan2L:triton/gated-residual-bench-rounded

Conversation

@Shan2L

@Shan2L Shan2L commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Summary

op_tests/op_benchmarks/triton/bench_fused_indexed_gated_residual.py now times fused_indexed_gated_residual with round_intermediate=True. Before timing, it checks that the fused output equals the eager baseline. Split out of #8681 at review's request.

Motivation

The benchmark called the op with the default round_intermediate=False, while its eager baseline (residual + gate[indices] * x) rounds the product to bf16 before the add. So the two providers did not compute the same result, and the comparison was not like-for-like.

Changes

  • The fused provider passes round_intermediate=True.
  • Before timing, the fused provider runs once and raises if its output differs from eager.

No kernel or op change.

Performance (if applicable)

Kernel unchanged. The benchmark now times the eager-rounded path, on gfx1201 (Radeon AI PRO R9700), N = 5376:

Hardware Workload/configuration fused eager Change
R9700 (gfx1201) M = 16384, run-of-index indices 917 us 2072 us fused 2.26x faster, output bit-identical to eager
R9700 (gfx1201) M = 4096, scattered indices 230 us 495 us fused 2.16x faster, output bit-identical to eager

Testing

  • Unit tests added or updated
  • Performance benchmarks run
  • Tested on MI250X
  • Tested on MI300X

Documentation

  • Docstrings updated
  • User guide updated
  • Performance guide updated
  • No documentation change is needed, with the reason stated below

Benchmark-only change.

AI assistance: this change was developed with the help of an AI coding assistant (GitHub Copilot). All timings above were run on the listed hardware.

PR Self-Review

Reviewed revision

e05a7f0

Behavior and intent

Only the benchmark changes. Its fused provider now computes the same rounding as its eager provider, and it verifies bit-equality before timing. If the two ever diverge, it raises instead of reporting a misleading speedup. The op and the tests are unchanged.

Validation and unverified scope

  • gfx1201 (Radeon AI PRO R9700), torch 2.14.0 + ROCm 10.1: python3 op_tests/op_benchmarks/triton/bench_fused_indexed_gated_residual.py -M 16384 and -M 4096 --scattered. The equality check passes, and the timings are in the table above.
  • Unverified: MI hardware (none available to me).

PR-specific question

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?

The only changed file is the benchmark; no op test changes. Before this PR it timed round_intermediate=False against an eager baseline that rounds the product, so the reported speedup compared two different computations. The new equality check raises in that configuration. No existing test or benchmark checks that the two benchmark providers agree. The op's own rounding behavior is covered by test_fused_indexed_gated_residual.py, which this PR does not touch.

Changed op tests

  • op_tests/op_benchmarks/triton/bench_fused_indexed_gated_residual.py: the fused provider uses round_intermediate=True, and its output is checked equal to eager before timing, so the two providers compute identical results. It is a benchmark, not a test.

The benchmark timed the op with the default round_intermediate=False
against an eager baseline that rounds the product first, so the two
providers did not compute the same result. Pass round_intermediate=True
and check that the output equals eager before timing.

Signed-off-by: Sylvan Liu <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

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

Extended tests (opt-in via labels):

Label Tests
ci:mi300x Run Aiter standard tests on MI300X in PRs; main branch always runs them
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 Radeon R9700 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 8717 --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.

Reviews:
A reviewer is usually assigned within one working day after the PR is ready for review (see Code Review Process). If nobody has responded for about a week, mention the area contact listed in CONTACTS.md. Want to help review? See REVIEWERS.md.

@github-actions github-actions Bot changed the title [Triton] bench_fused_indexed_gated_residual: time the eager-rounded path [Triton/Gluon] bench_fused_indexed_gated_residual: time the eager-rounded path Nov 26, 2026
@Boss2002n
Boss2002n requested a balanced review from Copilot November 26, 2026 02: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.

🟢 Approval recommended

No active review issues are reported for the benchmark-only change aligning provider rounding and adding a pre-timing output comparison.

No open issues 🎉

What changed in this PR

This benchmark-only change makes the fused and eager providers use matching rounding behavior, so their timings compare the same computation. It separates the benchmark correction from #8681 and leaves the op and kernel unchanged.

Changes:

  • Pass round_intermediate=True to the fused provider.
  • Check fused output against eager output before timing and raise on a mismatch.
File Description
op_tests/​op_benchmarks/​triton/​bench_fused_indexed_gated_residual.py Aligns fused rounding with eager and adds a pre-timing equality check.

Review effort: Balanced

@aiter-bot

Copy link
Copy Markdown

NOT READY FOR HUMAN REVIEW

PR Self-Review

Revision e05a7f0b048d · mode shadow

Author self-review accepted. Readiness report:

Author answers

  • PASS — current-SHA answers are present and structurally specific
Show the author's self-review answers

Behavior and intent

Only the benchmark changes. Its fused provider now computes the same rounding as its eager provider, and it verifies bit-equality before timing. If the two ever diverge, it raises instead of reporting a misleading speedup. The op and the tests are unchanged.

Validation and unverified scope

- gfx1201 (Radeon AI PRO R9700), torch 2.14.0 + ROCm 10.1: `python3 op_tests/op_benchmarks/triton/bench_fused_indexed_gated_residual.py -M 16384` and `-M 4096 --scattered`. The equality check passes, and the timings are in the table above.
- Unverified: MI hardware (none available to me).

PR-specific question

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?

The only changed file is the benchmark; no op test changes. Before this PR it timed `round_intermediate=False` against an eager baseline that rounds the product, so the reported speedup compared two different computations. The new equality check raises in that configuration. No existing test or benchmark checks that the two benchmark providers agree. The op's own rounding behavior is covered by `test_fused_indexed_gated_residual.py`, which this PR does not touch.

Changed op tests

- `op_tests/op_benchmarks/triton/bench_fused_indexed_gated_residual.py`: the fused provider uses `round_intermediate=True`, and its output is checked equal to eager before timing, so the two providers compute identical results. It is a benchmark, not a test.

PR state

  • PASS — pull request is marked ready for review

Copilot findings

  • PASS — no active Copilot finding lacks a substantive author reply

Code and op-test hygiene

  • PASS — no committed artifact or conflict marker detected

Required CI

  • PASS — Black: passed
  • PASS — Ruff: passed
  • PASS — Repository dependency: passed
  • FAIL — Aiter Test Gate: failed
  • Required CI failed; fix it before requesting human review.

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

@Shan2L

Shan2L commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

The Aiter Test Gate failure comes from shard 7/8 of the standard tests, in op_tests/tuning_tests/test_mp_tuner_logic.py:

FAIL: test_worker_records_start_only_when_task_leaves_queue (TestTaskExecutionTiming)
  File "op_tests/tuning_tests/test_mp_tuner_logic.py", line 402
    self.assertGreater(start_times[0], 0)
AssertionError: 0.0 not greater than 0

This PR only changes op_tests/op_benchmarks/triton/bench_fused_indexed_gated_residual.py, which no standard test imports, so the failure is unrelated (it looks like a timing race in the mp tuner test). Every other job passed. I don't have permission to re-run jobs. Could a maintainer re-run the failed job? Thanks!

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