Skip to content

[Testcase Refactoring] Split test_cudagraph_bisect_max into a CUDA-classified test class - #198360

Closed
gavinwang269 wants to merge 1 commit into
pytorch:mainfrom
gavinwang269:cb2/m7-cudagraph_bisect_max
Closed

gavinwang269 wants to merge 1 commit into
pytorch:mainfrom
gavinwang269:cb2/m7-cudagraph_bisect_max

Conversation

@gavinwang269

@gavinwang269 gavinwang269 commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

test_cudagraph_bisect_max needs CUDA graphs, so it does not belong in the
accelerator-wide TestCompilerBisector class, where it was reachable for any
device the old aggregate gate accepted. This moves it into a class of its own,
classified for CUDA and instantiated through instantiate_device_type_tests,

Changes

  • New TestCompilerBisectorCuda with hw_classification = CUDA, holding
    test_cudagraph_bisect_max, instantiated with
    instantiate_device_type_tests(..., only_for="cuda") so the test takes the
    injected device parameter instead of naming one.
  • @requires_cuda is not kept on top of that: after only_for="cuda" the
    instantiation already answers it, and a second gate would be a second,
    independently rotting source of the same fact.
  • The Triton condition that the original class reached through the HAS_GPU
    formula is restored on the class that still needs a Triton kernel, expressed as
    its own requirement rather than as part of an aggregate boolean.
  • test_rng no longer carries an upstream PrivateUse1 skip; per maintainer
    direction out-of-tree accelerators are exposed rather than silently skipped,
    and a backend that does not support it opts out in its own
    instantiate_device_type_tests instantiation.

Test Plan

Host: torch 2.16.0.dev20261029; the "cpu" venv autoloads torch_npu and
therefore registers PrivateUse1, so CPU-only claims below run with
TORCH_DEVICE_BACKEND_AUTOLOAD=0. All pytest commands from a directory
outside the source tree with the absolute file path.

CPU-only (no CUDA, no accelerator registered) at head 78146ef:

TORCH_DEVICE_BACKEND_AUTOLOAD=0 python -m pytest -q -rs test/dynamo/test_compiler_bisector.py
-> collected: 3 (TestCompilerBisector::test_pre_grad / test_crossref / test_eager_backend)
-> 3 passed

With the HAS_GPU gate removed the three GENERIC tests now run on a
GPU-less host and pass; that addresses the automated review's request for
HEAD numbers. The new head's macOS/Windows CPU test jobs have not reported yet, so those remain CI's to report.

Test-ID move: on a CUDA build test_cudagraph_bisect_max is
TestCompilerBisectorCudaCUDA.test_cudagraph_bisect_max_cuda (class name =
original + device_type.upper(), method suffix _cuda, per
instantiate_device_type_tests). On a machine with no CUDA device type
registered it is not collected at all (only_for="cuda" matches nothing);
collection here is 10 IDs with PrivateUse1 registered vs 11 pre-PR.

PrivateUse1-registered host (same wheel, torch_npu autoloaded):

python -m pytest -q -rs test/dynamo/test_compiler_bisector.py
-> 1 failed, 3 passed, 6 skipped   (skips: 6x "requires Triton on npu", the pre-existing per-device gates)

The one failure is TestCompilerBisectorRNGNPU.test_rng_npu with
String comparison failed: 'eager' != 'inductor'. This is the intended
coverage change decided in review: per @fffrog's instruction the
@skipPRIVATEUSE1 special case is not restored — test_rng is exposed to
all out-of-tree accelerators and backends that do not support it skip it in
their own instantiate_device_type_tests instantiation. (preserve_rng_state
currently preserves only CPU/CUDA/XPU RNG, so an out-of-tree backend without
RNG preservation must opt out.) The stock (pre-PR) file run with the same
command gives 11 skipped, 0 failed, isolating this as the deliberate
skip-to-exposed delta, not a pre-existing failure.

NPU hardware (8x Ascend 910B4, triton-ascend installed):

python -m pytest -q -rs test/dynamo/test_compiler_bisector.py -k test_rng
-> 1 failed, 9 deselected

The bisect diverges on the eager/aot legs (RNG, as above); the inductor leg
on this wheel additionally hits a pre-existing torch_npu codegen skew
(NPUPythonWrapperCodeGen... 'tunable_dyn_dims_mask'), reproduced with a
plain torch.compile of the same function and unrelated to this change.
Pre-PR the same command skipped with "test doesn't work on privateuse1
backend".

Lint:

python tools/linter/adapters/test_linter.py test/dynamo/test_compiler_bisector.py
-> no findings (allowlist entry removed in this PR)
lintrunner test/dynamo/test_compiler_bisector.py tools/linter/adapters/test_linter_allowlist.json
-> ok No lint issues.

Not covered here: the CUDA legs (test_cudagraph_bisect_max_cuda, the
cuda/xpu variants of the Triton-gated tests) — this host has no NVIDIA
hardware; the upstream hardware shards run those.

Signed-off-by: gavinwang269 [email protected]

Rebase note (2026-11-09): replayed onto current main after #198354/#198355 merged, and per review this now also removes the import-time HAS_GPU gate and the GPU_TYPE/HAS_GPU import (both have no users left in the file). The single GENERIC declaration here is the only one across the series.

Scope note: an earlier revision of this PR carried the dead-scaffolding cleanup from #198362; per the review discussion that cleanup is dropped, and this PR closes out the bisector series with the move and the classification only (+53/-53).

Final-cleanup note (2026-11-10): as the last PR touching test_compiler_bisector.py in this series, this also drops the file entry from tools/linter/adapters/test_linter_allowlist.json (TEST_LINTER runs clean on the file after the removal), and moves the Triton gates to accelerator-aware @skipIf(..., device_type=...) forms, narrowed per review on each class.

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @kadeng @chauhang @amjames @jataylo @azahed98

@pytorch-bot

pytorch-bot Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

PR Status: Approved 🚀

Please fix all CI failures and trigger merge by commenting "@pytorchbot merge".

🟡 AUTOMATED REVIEW - OUTDATED (earlier commit) - Changes requested:

The PR moves test_cudagraph_bisect_max into a new CUDA-only
TestCompilerBisectorCuda class, marks TestCompilerBisector GENERIC without its
HAS_GPU gate, switches the Triton gates to device-aware skipIf, and removes the
file from the test-linter allowlist. Recommendation: Request Changes, because
test_rng lost its PrivateUse1 skip and now fails on PrivateUse1 and HPU
backends, and its comment is now false.

Findings (3):

[major] test/dynamo/test_compiler_bisector.py:433
Blocking: `test_rng` now runs with no gate on PrivateUse1 and HPU and fails
there. The PR replaced `@​ skipPRIVATEUSE1` with `@​ skipIf(not has_triton(), ...,
device_type=("cuda", "xpu"))` and dropped the class-level `has_triton()` skip.
`common_device_type.skipIf` only checks its condition for the listed device
types, so other devices run with no check. `instantiate_device_type_tests(...,
except_for="cpu", allow_xpu=True)` still creates PrivateUse1 variants (when
registered) and HPU variants (when TEST_HPU). `preserve_rng_state` only
saves/restores CPU, CUDA and XPU RNG, so eager and compiled draws differ,
`do_bisect` returns `backend="eager"`, and `assertEqual(out.backend,
"inductor")` fails. Upstream CI isn't affected; out-of-tree backends are. The
comment at :429-432 ("PrivateUse1 backends are skipped explicitly") is now
false, and the description doesn't mention the change. Rule 4 bars
`skipPRIVATEUSE1` on ACCELERATOR classes, so instead use the setUp gate from
`TestCompilerBisectorDevice` (`if not has_triton_for_device(self.device_type):
self.skipTest(...)`) and reword the comment. Caveat: a PrivateUse1 backend with
a Triton interface would still diverge; maintainers may need to decide whether
ACCELERATOR is the right classification.

[minor] test/dynamo/test_compiler_bisector.py:379
Non-blocking: the Triton gate on `test_cudagraph_bisect_max` lists an XPU entry
that can never apply, and its check is less precise than the rest of the file.
`TestCompilerBisectorCuda` is instantiated `only_for="cuda"`, so `"xpu"` never
matches, and listing it contradicts the comment saying XPU doesn't support
cudagraphs. `common_device_type.py:1737` says to prefer existing decorators over
the `device_type` kwarg, so `@​ skipCUDAIf(not has_triton(), ...)` is the
idiomatic form. Also, `has_triton()` is true if any accelerator has Triton. The
sibling class's per-device `has_triton_for_device(self.device_type)` is more
precise.

[minor] test/dynamo/test_compiler_bisector.py:31
Non-blocking: the Test Plan in the PR description doesn't describe HEAD. It
reports "10 collected / 10 skipped: [6] requires GPU and Triton, [4] requires
Triton" and says no test IDs move, but that skip string no longer exists at
HEAD. The test ID also moves: `TestCompilerBisector.test_cudagraph_bisect_max`
becomes `TestCompilerBisectorCudaCUDA.test_cudagraph_bisect_max_cuda`. With the
`HAS_GPU` gate removed, the 3 `TestCompilerBisector` tests now run on CPU-only
hosts instead of skipping. Nothing posted shows `test_pre_grad`, `test_crossref`
and `test_eager_backend` passing on CPU, including the macOS and Windows CPU
shards. Please update the plan with a run at HEAD.

Reviewed commit: 9e81acb (NOT the current head 78146ef)

Review run

🐛 Report a bad review

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/198360

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 78146ef with merge base 921ec49 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot

pytorch-bot Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Workflows were awaiting approval. CI has now been triggered for the ciflow labels on this PR.

@gavinwang269

Copy link
Copy Markdown
Contributor Author

@pytorchbot label "module: tests/graph"

@pytorch-bot pytorch-bot Bot added the module: tests/graph This label covers all test cases within the Graph sheet. label Sep 23, 2026
@fffrog fffrog moved this to Backlog in PyTorch Test Refactoring Sep 23, 2026
Comment thread test/dynamo/test_compiler_bisector.py Resolved
Comment thread test/dynamo/test_compiler_bisector.py Resolved
Comment thread test/dynamo/test_compiler_bisector.py Resolved
Comment thread test/dynamo/test_compiler_bisector.py Resolved
Comment thread test/dynamo/test_compiler_bisector.py Resolved
Comment thread test/dynamo/test_compiler_bisector.py Resolved
Comment thread test/dynamo/test_compiler_bisector.py Resolved
Comment thread test/dynamo/test_compiler_bisector.py Resolved
Comment thread test/dynamo/test_compiler_bisector.py Resolved
Comment thread test/dynamo/test_compiler_bisector.py Resolved
@gavinwang269

Copy link
Copy Markdown
Contributor Author

Hi @fffrog — thanks for the detailed review! To frame it: this PR is one slice of the orthogonal split for #191435 and converts test_cudagraph_bisect_max only; every other test in this file is migrated by its own sibling PR. Here is where each of your suggestions lands:

Your comment Handled in Note
test_bad_decomp → (self, device) / device (L50, L93) #198354 done there
test_joint_graph (L144, L167) #198355 done there
test_rng (L183) #198356 done there
test_emulate_precision_casts (L245, L257) #198357 done there
test_bad_lowering (L267, L275) #198358 done there
test_bisect_pre_grad_graph (L300, L337) #198359 done there
Remove GPU_TYPE / HAS_GPU import (L20) #198362 done there
test_pre_grad / test_crossref / test_eager_backend → GENERIC (L106, L200, L285) #198362 these three are the only tests left in the old class after the migrations; the cleanup tags TestCompilerBisector with hw_classification = GENERIC (the old class effectively becomes the generic class). If you would rather see them extracted into a separately named generic class, happy to do that too.
test_bisect_run_debuginfo → GENERIC (L383) #198361 this PR only relocates it unchanged (class ordering); agreed it is device-agnostic — I will make #198361 keep it in the generic class instead of instantiating it.

Two class-level points, where the series design differs slightly from the literal suggestion — please sanity-check:

  • L32 / L33 (has_triton skip + hw_classification = ACCELERATOR on TestCompilerBisector): in the final state the old class becomes the GENERIC class (row above), so the ACCELERATOR tag and @unittest.skipIf(not has_triton(), "requires Triton") live on the instantiated TestCompilerBisectorDevice (visible in this PR's diff), and the old not HAS_GPU guard is deleted by [Testcase Refactoring] Clean up old TestCompilerBisector class after device migrations #198362. Keeping the triton guard at test level rather than class level is also more accurate — it leaves CPU-only bisector tests runnable without Triton.
  • L344 (test_cudagraph_bisect_max should be CUDA + its own class): agreed — cudagraphs are CUDA-specific behavior, so instantiate_device_type_tests(allow_xpu=True) + skipXPUIf(True, ...) was the wrong fit. I will rework this PR to move the test into a dedicated TestCompilerBisectorCuda class tagged hw_classification = HardwareClassification.CUDA (keeping @requires_cuda), and drop the instantiation from this PR. Will update the title and description accordingly.

@gavinwang269
gavinwang269 force-pushed the cb2/m7-cudagraph_bisect_max branch from 8c2487e to 16bd2c2 Compare September 24, 2026 09:15
@gavinwang269 gavinwang269 changed the title [Testcase Refactoring] Make test_cudagraph_bisect_max device-agnostic via instantiate_device_type_tests [Testcase Refactoring] Split test_cudagraph_bisect_max into a CUDA-classified test class Sep 24, 2026
@janeyx99 janeyx99 added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Sep 25, 2026
@gavinwang269
gavinwang269 force-pushed the cb2/m7-cudagraph_bisect_max branch 2 times, most recently from 5f705a5 to c01298e Compare September 28, 2026 08:57
gavinwang269 added a commit to gavinwang269/pytorch that referenced this pull request Sep 30, 2026
…device migrations

Rebased onto latest main (scaffold + migrated debuginfo from pytorch#198361 are kept).
Drops the seven methods whose device versions arrive in the parallel move
pieces pytorch#198354 (test_bad_decomp), pytorch#198355 (test_joint_graph), pytorch#198356
(test_rng), pytorch#198357 (test_emulate_precision_casts), pytorch#198358
(test_bad_lowering), pytorch#198359 (test_bisect_pre_grad_graph) and pytorch#198360
(test_cudagraph_bisect_max); keeps test_pre_grad, test_crossref and
test_eager_backend. Marks the remaining class GENERIC, renames test_ns to
bisector_ns (a class attribute named test_* would otherwise be collected by
instantiate_device_type_tests), slims tearDown and removes get_lib.

Must merge LAST in the series, only after every sibling move above has
landed; otherwise the deleted GPU tests lose their replacements.

Also fixes the lint failures on the previous revision: removes imports that
are unused at this point in the series (contextmanager, import_module,
_prims_common, preserve_rng_state, module-level config) and normalizes the
blank-line runs left by the method removals. These imports are intentionally
not kept for the siblings; each move piece brings back exactly what it uses.

Signed-off-by: gavinwang269 <[email protected]>
Comment thread test/dynamo/test_compiler_bisector.py Resolved
Comment thread test/dynamo/test_compiler_bisector.py Resolved
Comment thread test/dynamo/test_compiler_bisector.py Resolved
Comment thread test/dynamo/test_compiler_bisector.py Resolved
Comment thread test/dynamo/test_compiler_bisector.py Resolved
Comment thread test/dynamo/test_compiler_bisector.py Resolved
@gavinwang269

Copy link
Copy Markdown
Contributor Author

@pytorchbot label "ciflow/trunk"

@pytorch-bot

pytorch-bot Bot commented Oct 30, 2026

Copy link
Copy Markdown

The ciflow label(s) ciflow/trunk will be added, but CI won't be triggered until the workflows are approved (scroll to the bottom of this page).

Please ping one of the reviewers if you do not have access to approve and run workflows.

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Oct 30, 2026
lizhihai137
lizhihai137 previously approved these changes Oct 30, 2026
@gavinwang269

Copy link
Copy Markdown
Contributor Author

@pytorchbot rerun

@pytorch-bot

pytorch-bot Bot commented Oct 30, 2026

Copy link
Copy Markdown

❌ 🤖 pytorchbot command failed:

@pytorchbot: error: argument command: invalid choice: 'rerun' (choose from 'merge', 'revert', 'rebase', 'label', 'drci', 'review', 'pre-review', 'lint', 'fix-lint', 'apply-lint', 'cherry-pick')

usage: @pytorchbot [-h]
                   
                   {merge,revert,rebase,label,drci,review,pre-review,lint,fix-lint,apply-lint,cherry-pick}
                   ...

Try @pytorchbot --help for more info.

@gavinwang269
gavinwang269 force-pushed the cb2/m7-cudagraph_bisect_max branch 2 times, most recently from c284836 to 30a9331 Compare November 2, 2026 06:30
@gavinwang269
gavinwang269 requested a review from fffrog November 10, 2026 06:55
@janeyx99 janeyx99 added the in progress PR is being worked on by the author, until the automated review accepts it label Nov 10, 2026

@github-actions github-actions Bot 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.

Automated review of 9e81acb: changes requested before human review.

The PR moves test_cudagraph_bisect_max into a new CUDA-only TestCompilerBisectorCuda class, marks TestCompilerBisector GENERIC without its HAS_GPU gate, switches the Triton gates to device-aware skipIf, and removes the file from the test-linter allowlist. Recommendation: Request Changes, because test_rng lost its PrivateUse1 skip and now fails on PrivateUse1 and HPU backends, and its comment is now false.

🔴 1 blocking finding is attached to the code below.

⚪ 2 non-blocking findings

@skipIf(not has_triton(), "requires triton", device_type=("cuda", "xpu"))

Non-blocking: the Triton gate on test_cudagraph_bisect_max lists an XPU entry that can never apply, and its check is less precise than the rest of the file. TestCompilerBisectorCuda is instantiated only_for="cuda", so "xpu" never matches, and listing it contradicts the comment saying XPU doesn't support cudagraphs. common_device_type.py:1737 says to prefer existing decorators over the device_type kwarg, so @ skipCUDAIf(not has_triton(), ...) is the idiomatic form. Also, has_triton() is true if any accelerator has Triton. The sibling class's per-device has_triton_for_device(self.device_type) is more precise.


hw_classification = HardwareClassification.GENERIC

Non-blocking: the Test Plan in the PR description doesn't describe HEAD. It reports "10 collected / 10 skipped: [6] requires GPU and Triton, [4] requires Triton" and says no test IDs move, but that skip string no longer exists at HEAD. The test ID also moves: TestCompilerBisector.test_cudagraph_bisect_max becomes TestCompilerBisectorCudaCUDA.test_cudagraph_bisect_max_cuda. With the HAS_GPU gate removed, the 3 TestCompilerBisector tests now run on CPU-only hosts instead of skipping. Nothing posted shows test_pre_grad, test_crossref and test_eager_backend passing on CPU, including the macOS and Windows CPU shards. Please update the plan with a run at HEAD.

Please address the findings and push; a new commit normally gets a fresh automated review.

Disagree with a finding? Reply with your reasoning, then comment @pytorchbot review to request a re-review. This review is AI-generated and advisory. Each new automated review replaces the previous one. Report a bad review

Comment thread test/dynamo/test_compiler_bisector.py Resolved
@fffrog fffrog added the no automated review Request skipping the automated PR review process label Nov 11, 2026
@pytorch-bot pytorch-bot Bot added ready for review Automated review passed, ready for a final review by a maintainer. and removed in progress PR is being worked on by the author, until the automated review accepts it labels Nov 11, 2026
@fffrog fffrog moved this from Developing to Ready for Merge in PyTorch Test Refactoring Nov 11, 2026
@github-actions
github-actions Bot dismissed their stale review November 11, 2026 01:49

Withdrawn: this PR opted out of automated review.

Comment thread test/dynamo/test_compiler_bisector.py Resolved
Comment thread test/dynamo/test_compiler_bisector.py Resolved
…ssified class

Summary

test_cudagraph_bisect_max needs CUDA graphs, so it does not belong in the
accelerator-wide TestCompilerBisector class. This moves it into a class of
its own, classified for CUDA and instantiated through
instantiate_device_type_tests. With the move (and pytorch#198354/pytorch#198355 having
landed), TestCompilerBisector holds only device-agnostic tests, so it gains
the GENERIC classification and drops the import-time HAS_GPU gate along with
the now-unused GPU_TYPE/HAS_GPU and requires_cuda imports; the Triton gates
that remain become accelerator-aware @skipIf(..., device_type=...) forms, and
as the last PR touching this file the test-linter allowlist entry is removed.

Review-round decisions on pytorch#198360. The automated review noted that test_rng,
after losing @skipPRIVATEUSE1, now runs and fails on PrivateUse1/HPU and
asked to restore a skip via a setUp gate; the human maintainer instructed the
opposite on the same lines (discussion_r4533004167): expose the test to all
out-of-tree accelerators and let a backend that does not support it skip it
in its own instantiation rather than have upstream silently skip it. The
maintainer instruction wins: no upstream gate is added for other backends,
and the stale comment block claiming PrivateUse1 is "skipped explicitly" is
removed with nothing replacing it, so no comment asserts a skip that does not
happen. The measured consequence, stated plainly: on an Ascend 910B4
(torch_npu, triton-ascend installed) test_rng_npu now runs and fails because
preserve_rng_state (torch/_dynamo/utils.py) saves/restores only CPU, CUDA and
XPU RNG, so the eager and compiled draws diverge and do_bisect reports
backend="eager". Coverage delta is skip -> fail on backends that do not
preserve RNG state; the out-of-tree test suite is expected to opt out.

Style: the Triton gate on test_cudagraph_bisect_max drops the "xpu" entry per
the maintainer's suggestion (the class is instantiated only_for="cuda", so
the entry can never match). only_for="cuda" itself is kept: Rule 4's only_for
ban is scoped to ACCELERATOR classes, Rule 5 imposes no instantiation
requirements on CUDA-classified classes, and the in-tree linter's OnlyForRule
is registered for ACCELERATOR only (checked by running the linter plus a
deliberate-violation probe to confirm the finding fires where it should).

Test Plan

torch 2.16.0.dev20261029; the "cpu" venv autoloads torch_npu (registers
PrivateUse1), so CPU-only claims use TORCH_DEVICE_BACKEND_AUTOLOAD=0. All
pytest runs from /tmp with absolute paths.

CPU-only host, final state:

    TORCH_DEVICE_BACKEND_AUTOLOAD=0 python -m pytest -q -rs test/dynamo/test_compiler_bisector.py
    -> collected 3 (test_pre_grad, test_crossref, test_eager_backend), 3 passed

so the 3 GENERIC tests run and pass on a GPU-less host now that the HAS_GPU
gate is gone. (Linux only; the macOS/Windows CPU shards are left to CI.)

Same file on a host with PrivateUse1 registered: collected 10 vs 11 for the
stock file; the moved test is not instantiated where no CUDA device type
exists (on CUDA builds it is
TestCompilerBisectorCudaCUDA.test_cudagraph_bisect_max_cuda). Whole file:

    python -m pytest -q -rs <file>   # final: 1 failed, 3 passed, 6 skipped
    python -m pytest -q -rs <stock>  # base commit version: 11 skipped, 0 failed

The one failure is TestCompilerBisectorRNGNPU.test_rng_npu with
AssertionError: String comparison failed: 'eager' != 'inductor', i.e. the
intended exposure above (stock skipped it via the class-level Triton gate on
this no-triton venv and via @skipPRIVATEUSE1 on the NPU machine); the 6 skips
are the pre-existing per-device "requires Triton on npu" gates.

NPU machine (8x Ascend 910B4, triton-ascend installed), final state:

    python -m pytest -q -rs test/dynamo/test_compiler_bisector.py -k test_rng
    -> 1 failed, 9 deselected

(the bisect leg diverges on RNG as above; the inductor leg additionally hits
a pre-existing torch_npu wheel codegen crash, reproduced with a plain
torch.compile of the same function and unrelated to this change). Pre-PR the
same command skips with "test doesn't work on privateuse1 backend".

Lint:

    python tools/linter/adapters/test_linter.py test/dynamo/test_compiler_bisector.py
    -> no findings (allowlist entry removed; a deliberate ACCELERATOR
       only_for violation makes it emit exactly the [only_for] finding)
    lintrunner test/dynamo/test_compiler_bisector.py tools/linter/adapters/test_linter_allowlist.json
    -> ok No lint issues.

Not covered here: the CUDA legs (no NVIDIA hardware on this host); the
upstream hardware shards run those.
@gavinwang269
gavinwang269 force-pushed the cb2/m7-cudagraph_bisect_max branch from 9e81acb to 78146ef Compare November 11, 2026 03:02
@gavinwang269
gavinwang269 requested a review from fffrog November 11, 2026 03:09
@gavinwang269

Copy link
Copy Markdown
Contributor Author

@pytorchbot review

@pytorch-bot

pytorch-bot Bot commented Nov 11, 2026

Copy link
Copy Markdown

The automated review only re-runs on PRs labeled in progress and neither ready for review nor no automated review.

@gavinwang269

gavinwang269 commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Both requested changes are implemented in 78146ef7293e, which is the only delta on top of the head you reviewed:

  • line 379: device_type=("cuda", "xpu") → device_type=("cuda"), exactly your suggestion;
  • the four stale comment lines above test_rng are removed with nothing replacing them, so the test is exposed to every out-of-tree accelerator and each backend opts out in its own instantiate_device_type_tests if unsupported, per your reasoning.

git diff 9e81acbad869..78146ef7293e is 1 insertion and 5 deletions in this one file — no other change rode along. The Test Plan in the PR description was rewritten against this head, including a CPU-only run (TORCH_DEVICE_BACKEND_AUTOLOAD=0: 3 collected, 3 passed) and the measured consequence of the exposure on Ascend 910B4, which I summarized in reply to the automated finding on the same lines rather than hiding it here.

Ready for re-review whenever convenient. If you would rather have torch_npu's CI opt this variant out through a companion change on that side, say the word and I will prepare it.

One more thing this PR needs from someone with permission: the fork CI workflows on head 78146ef7293e are still sitting in the approval queue — pull, Lint, BC Lint and docs-build all report action_required, so no CI has actually run on this head yet. If you could approve those runs while you are here, the PR would have its checks as well as its review.

@gavinwang269

Copy link
Copy Markdown
Contributor Author

Re-review request for the current head 78146ef.

Both of @fffrog's comments are applied at this head: the Triton gate on test_cudagraph_bisect_max now reads @skipIf(not has_triton(), "requires triton", device_type=("cuda")) (suggestion applied verbatim; the xpu entry was dead under only_for="cuda"), and the comment block above test_rng is removed with nothing replacing it — out-of-tree backends that do not preserve RNG state can opt out in their own instantiation rather than being silently skipped upstream.

Review re-requested — thanks!

@fffrog fffrog left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

SGTM

@fffrog fffrog added the module: tests/simple This label covers all the testcase that are very straightforward label Nov 11, 2026
@gavinwang269

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@github-project-automation github-project-automation Bot moved this from Ready for Merge to Done in PyTorch Test Refactoring Nov 11, 2026
gavinwang269 added a commit to gavinwang269/pytorch that referenced this pull request Nov 18, 2026
… into its own CUDA-classified class

First independent slice of the static-launcher split (per pytorch#198436 review: the
unit class mixes device-gated tests with a GENERIC label; original monolith
pytorch#198437 at 505 lines). Moves test_tensor_memory_autotuner_retries_without_pipelining
(CUDAAutotuner + StaticallyLaunchedCudaKernel internals, Triton-gated and RoCm-
skipped) into a new CUDA-classified class TestStaticTritonLauncherUnitCuda -- not
instantiated, since running CUDA-internal mock behavior under XPU/PrivateUse1
class variants would produce meaningless duplicates (the shape flagged in
pytorch#198359/pytorch#198360 review). Shared helpers stay on the unit class, delegated by
reference (staticmethod-wrapped); nothing is copied.
gavinwang269 added a commit to gavinwang269/pytorch that referenced this pull request Nov 18, 2026
…ified class

Independent slice of the static-launcher split: moves test_global_scratch_allocation,
test_fast_launcher_rejects_global_scratch (skipIfRocm) and
test_rocm_rejects_global_scratch (ROCm-only) out of the unit class into
TestStaticTritonLauncherUnitRoCm, classified CUDA and intentionally not
instantiated (mock CUDA/ROCm-internal behavior duplicated across device classes
would be meaningless -- the shape flagged in pytorch#198359/pytorch#198360 review). Scratch-kernel
factory delegated by reference; nothing copied; no dependency on sibling slices.
gavinwang269 added a commit to gavinwang269/pytorch that referenced this pull request Nov 30, 2026
…ified class

Independent slice of the static-launcher split: moves test_global_scratch_allocation,
test_fast_launcher_rejects_global_scratch (skipIfRocm) and
test_rocm_rejects_global_scratch (ROCm-only) out of the unit class into
TestStaticTritonLauncherUnitCUDA (renamed from a RoCm-specific name since the
class is classified CUDA and its bodies exercise CUDA/ROCm launcher internals
through mocks), intentionally not instantiated (mock CUDA/ROCm-internal
behavior duplicated across device classes would be meaningless -- the shape
flagged in pytorch#198359/pytorch#198360 review). Scratch-kernel factory delegated by
reference; nothing copied; no dependency on sibling slices.

Test Plan:
```bash
python -m pytest test/inductor/test_static_triton_launcher.py --collect-only -q
# 24/60 tests collected, renamed class present
```
gavinwang269 added a commit to gavinwang269/pytorch that referenced this pull request Dec 1, 2026
…ified class

Independent slice of the static-launcher split: moves test_global_scratch_allocation,
test_fast_launcher_rejects_global_scratch (skipIfRocm) and
test_rocm_rejects_global_scratch (ROCm-only) out of the unit class into
TestStaticTritonLauncherUnitCUDA (renamed from a RoCm-specific name since the
class is classified CUDA and its bodies exercise CUDA/ROCm launcher internals
through mocks), intentionally not instantiated (mock CUDA/ROCm-internal
behavior duplicated across device classes would be meaningless -- the shape
flagged in pytorch#198359/pytorch#198360 review). Scratch-kernel factory delegated by
reference; nothing copied; no dependency on sibling slices.

Test Plan:
```bash
python -m pytest test/inductor/test_static_triton_launcher.py --collect-only -q
# 24/60 tests collected, renamed class present
```

Co-Authored-By: Claude Code <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/inductor ciflow/trunk Trigger trunk jobs on your pull request Merged module: dynamo module: tests/graph This label covers all test cases within the Graph sheet. module: tests/simple This label covers all the testcase that are very straightforward no automated review Request skipping the automated PR review process open source ready for review Automated review passed, ready for a final review by a maintainer. topic: not user facing topic category triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants