Repository navigation
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
There was a problem hiding this comment.
🟡 Changes recommended
The benchmark rounding and equality-check changes are unrelated to the output-overlap fix and must move to a follow-up PR to satisfy the one-problem-per-PR rule.
1 open issue
What changed in this PR
This PR strengthens output validation for AITER’s existing Triton fused_indexed_gated_residual op and aligns its benchmark with eager arithmetic. The GPU kernel is unchanged.
Changes:
- Reject overlapping output rows while preserving padded layouts and valid in-place updates.
- Add rejection tests for broadcast and short-stride outputs.
- Benchmark with
round_intermediate=Trueand check exact equality with eager before timing.
| File | Description |
|---|---|
op_tests/triton_tests/fusions/test_fused_indexed_gated_residual.py |
Tests rejection of two overlapping output layouts. |
op_tests/op_benchmarks/triton/bench_fused_indexed_gated_residual.py |
Enables eager-compatible rounding and checks results before timing. |
aiter/ops/triton/fusions/fused_indexed_gated_residual.py |
Adds output-row overlap validation before launch. |
Review effort: Balanced
| kernel_fn = ( | ||
| functools.partial(fused_indexed_gated_residual, round_intermediate=True) | ||
| if provider == "fused" | ||
| else _eager_fn | ||
| ) |
READY FOR HUMAN REVIEWPR Self-ReviewRevision Author self-review accepted. Readiness report: Author answers
Show the author's self-review answersBehavior and intentValidation and unverified scopePR-specific questionChanged op testsPR state
Copilot findings
Code and op-test hygiene
Required CI
Shadow mode reports what would block but keeps the status successful. Set |
8f469fe to
77006be
Compare
An out tensor whose rows overlap (e.g. torch.empty((1, N)).expand(M, N), row stride 0) passed validation, and rows then raced on the same addresses. Reject M > 1 with out.stride(0) < N; padded row strides and exact in-place aliases stay valid. Found in review of the HIP version (ROCm#6417). Signed-off-by: Sylvan Liu <[email protected]>
77006be to
2a5494c
Compare
There was a problem hiding this comment.
pls remove the additional test function - other than that LGTM
There was a problem hiding this comment.
Removed in 64562c4. The PR is now only the host-side assert; the PR description is updated to match.
Signed-off-by: Sylvan Liu <[email protected]>
|
@Boss2002n The extra test is removed in 64562c4, so the PR is now only the overlap assert in the wrapper. Could you take another look? The two failing checks ( |

Summary
aiter.ops.triton.fusions.fused_indexed_gated_residual(merged in #6416) now rejects anouttensor whose rows overlap. The issue was found by @junhaha666 in review of the HIP version of the same op (#6417, comment #6417 (comment)).Motivation
An
outwhose rows overlap passes validation. For example,torch.empty((1, N)).expand(M, N)has row stride 0, so all M rows are written to the same addresses, and the result is wrong and nondeterministic.Changes
fused_indexed_gated_residual: assertM <= 1 or N == 0 or out.stride(0) >= Nbefore launch, in the sameassertstyle as the existing checks. Padded row strides and the in-place aliasout=residualstay valid.No kernel change. The benchmark fix that was part of this PR is now a separate PR, #8717, as requested in review.
Performance (if applicable)
Not applicable: the change adds one host-side assertion before launch.
Testing
Documentation
The new check only rejects inputs that already gave wrong results.
AI assistance: this change was developed with the help of an AI coding assistant (GitHub Copilot). The check was run on the listed hardware before the test was removed (see Validation).
PR Self-Review
Reviewed revision
64562c4
Behavior and intent
fused_indexed_gated_residualnow raisesAssertionErrorfor anoutwith overlapping rows (M > 1, N > 0 andout.stride(0) < N). Before, such an output passed validation, several programs wrote the same addresses, and the results were wrong and nondeterministic. Valid outputs, including padded row strides andout=residual, behave exactly as before.Validation and unverified scope
python3 -m pytest -q op_tests/triton_tests/fusions/test_fused_indexed_gated_residual.py35 passed at 2a5494c (on main afce047), includingtest_rejects_overlapping_output_rows.True, only that test failed (36 passed, 1 failed, measured before the rebase), so nothing in the file covers the check now.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?
No op test is changed by this PR (the test it first added was removed in review), so there is none to answer for.
Changed op tests
None.