Skip to content

[Triton/Gluon] [Test] Stop test_extend_attention from changing the default dtype of later tests - #6747

Merged
azaidy merged 3 commits into
mainfrom
satya/fix_test_default_dtype_leak
Oct 21, 2026
Merged

azaidy merged 3 commits into
mainfrom
satya/fix_test_default_dtype_leak

Conversation

@Boss2002n

@Boss2002n Boss2002n commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

op_tests/triton_tests/fusions/test_mhc_fused_post_pre_delayed_rmsnorm.py fails (13 tests) when it runs after op_tests/triton_tests/attention/test_extend_attention.py in the same pytest process. This happened in Triton Tests (MI35X) shard 4 of #6679. test_op_fwd calls torch.set_default_dtype(dtype) and torch.set_default_device(device), and it does not restore them. After a bfloat16 case, make_inputs of the mHC test creates fn in bfloat16, and the wrapper assert fn.dtype == torch.float32 fails (mhc_fused_post_pre_delayed_rmsnorm.py:69).

Technical details

test_extend_attention.py: test_op_fwd resets the default dtype to torch.float32 and the default device to None at its end, before its final assert_close, so the tests after it get the torch defaults.

Test plan

On a gfx1250 GPU:

  • Run one bfloat16 case of test_extend_attention.py::test_op_fwd, then test_mhc_fused_post_pre_delayed_rmsnorm.py, in one pytest process, on main and on this branch.
  • Run both full files in one pytest process on this branch.

Test results

  • main: 13 failed, 1 passed. The error is the AssertionError at mhc_fused_post_pre_delayed_rmsnorm.py:69, the same as in CI.
  • This branch: 14 passed.
  • Both full files on this branch: 45 passed.

@Boss2002n Boss2002n self-assigned this Oct 21, 2026
@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 6747 --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.

@Boss2002n
Boss2002n marked this pull request as ready for review October 21, 2026 01:06
@Boss2002n
Boss2002n requested review from a team and a balanced review from Copilot October 21, 2026 01:06

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

The scoped fixture restores test state, and no blocking issues were found.

No open issues 🎉

What changed in this PR

This PR prevents extend-attention tests from leaking PyTorch defaults into later tests.

Changes:

  • Add an automatic fixture to save and restore the default dtype and device after each test, including failures.
  • Leave kernel behavior unchanged.
File Description
op_tests/​triton_tests/​attention/​test_extend_attention.py Add cleanup for PyTorch default state.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 21, 2026 02:22

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

Cleanup must preserve incoming defaults and run on exceptions to avoid affecting later tests.

1 open issue

Review effort: Balanced

@azaidy
azaidy self-requested a review October 21, 2026 14:23

@azaidy azaidy 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.

LGTM!

@azaidy
azaidy merged commit 377de28 into main Oct 21, 2026
@azaidy
azaidy deleted the satya/fix_test_default_dtype_leak branch October 21, 2026 17:03
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.

3 participants