Repository navigation
[Testcase Refactoring] Make TestStaticTritonLauncher device-agnostic via instantiate_device_type_tests - #198437
gavinwang269 wants to merge 7 commits into
Conversation
PR Status: Approved 🚀Please fix all CI failures and trigger merge by commenting "@pytorchbot merge". ✅ AUTOMATED REVIEW - OUTDATED (earlier commit) - Ready for human review:
Findings (1): Reviewed commit: 🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/198437
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 879a6d2 with merge base 0f719e8 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
|
|
@pytorchbot label "module: tests/graph" |
c03fbed to
1188809
Compare
1188809 to
efd52a4
Compare
3299800 to
77f9e7a
Compare
77f9e7a to
8ca8d64
Compare
… 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.
8ca8d64 to
39cfe0a
Compare
… 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.
8dda50b to
b5da55e
Compare
|
Hi @aorenste, could you give this an approving review? It needs one approval from someone in the merge-rules approver lists; the two content approvals so far (lizhihai137 Nov 2, KarhouTam Dec 1) are from contributors outside those lists, so the bot still reports it as needing additional approval. This is the launcher slice of the static-launcher testcase family. It makes TestStaticTritonLauncher device-agnostic: the CUDA-only and XPU-only groups move into classes gated on runtime capabilities instead of device-name decorators, so an out-of-tree backend can run the same checks. One file, test/inductor/test_static_triton_launcher.py, +368/-327, no source changes. State on the current head 879a6d2, rebased onto main on Dec 1: every check on it has completed with nothing failing (209 checks, 206 green, 2 skipped, 1 neutral), and the label set is complete (topic: not user facing, ready for review). Sibling slices are #203550 and #203551, #198436 stays a draft until the family lands. If test refactors in inductor are not your area, a pointer to the right reviewer works too. Thanks! |
|
@pytorchbot triage |
|
Hi @lezcano - this one is squarely in torch.testing territory so one more ping: TestStaticTritonLauncher becomes device-agnostic via common_utils gating, one test file, no source changes. CI green on the same head since Nov 25, all threads resolved. It is the tail of the static-launcher split family (#203548 landed). Approvals so far on this PR came from contributors outside the merge-rules lists, so one approving review from the Core or Testing list lands it. Thanks! |
|
Hi @jansel - you approved the split family predecessor (#203548). This is the sibling testcase slice: TestStaticTritonLauncher becomes device-agnostic via common_utils gating, one test file, no source changes. CI green on the current head since Nov 25, all threads resolved, and the earlier approvals on it (KarhouTam, lizhihai137) are unfortunately outside the merge-rules lists for this path, so one approve from you lands it. Thanks! |
|
Hi @soulitzer - could you approve if the approach looks right? TestStaticTritonLauncher becomes device-agnostic (one test file, no source changes) so out-of-tree backends exercise the static launcher path instead of skipping it. CI green on the same head since Nov 25, threads resolved. It is the tail of the static-launcher split family (#203548 landed). One merge-rules approve lands it. Thanks! |
… a device-generic class (#203551) ## Summary Slice 3 of 4 of the static-launcher re-cut (independent; any order; original monolith #198437). The two ROCm-gated cubin metadata-group tests move out of `TestStaticTritonLauncherUnit` into `TestStaticTritonLauncherUnitMetadataGroup`, classified `HardwareClassification.GENERIC`. Both fake the compiled kernel (SimpleNamespace plus temp files), pass `device_type` to `can_statically_launch` as data (it selects the binary extension from `GPU_KERNEL_BIN_EXTS`), and `reload_cubin_path` with `device=0` initializes no device, so they run and pass on a CPU-only wheel and fit the Generic profile in test/REVIEW.md. The class is not instantiated. The two tests already sat at the end of the unit class, so the diff against main is 13 added lines of class scaffolding with no deletions; `_can_statically_launch` stays on the unit class, delegated by reference: hoisting it to a module-level helper or mixin would edit the unit class region owned by the sibling slice, so that refactor is left to a family-wide cleanup. ## Test Plan - [x] CPU wheel (torch 2.16.0.dev20261029+cpu, triton not installed), both tests run and pass: ``` python test/inductor/test_static_triton_launcher.py TestStaticTritonLauncherUnitMetadataGroup -v ``` - [x] In-tree test linter: this file is listed in `tools/linter/adapters/test_linter_allowlist.json`, so the regular lintrunner path checks nothing for it. Re-running `tools/linter/adapters/test_linter.py` over the file with the allowlist entry removed in memory reports 0 findings in the new class region; the 13 remaining findings in the file live in class regions owned by the sibling slices. ## Linked issue or supporting maintainer Part of #185590 (test case refactoring initiative) - hardware-decoupling slice. Pull Request resolved: #203551 Approved by: https://github.com/lizhihai137, https://github.com/jansel
|
Hi @jansel - thanks again for landing #203551 minutes ago. The sibling testcase slice is this one: TestStaticTritonLauncher becomes device-agnostic via common_utils gating, one test file, no source changes. CI green on the same head since Nov 25, all threads resolved. Same family, same pattern you already approved (predecessors 198438/198439/198440/203548). One approve here and |
|
Hi @anijain2305 - you already have the sibling context from #206704; this is the tail of the static-launcher testcase split: TestStaticTritonLauncher becomes device-agnostic via common_utils gating, one test file, no source changes. CI green on the same head since Nov 25, all threads resolved. One merge-rules approve lands it (#203551 and #206703 in the same family merged this way). Thanks! |
|
Hi @bdhirsh - new face here so one line of context: this makes TestStaticTritonLauncher device-agnostic (one test file, no source changes) so out-of-tree backends exercise the static launcher path instead of a CUDA-only class gate. It is the tail of a split family already landed by you-adjacent reviewers (#203548, #203551, #206703). CI green on the same head since Nov 25, threads resolved. One merge-rules approve lands it. Thanks! |
|
Hi @eqy - you're mid-window so a short ping: this is the remaining testcase tail of the static-launcher split (the sibling #203551 with the same file merged yesterday). One test file, no source changes: TestStaticTritonLauncher becomes device-agnostic via common_utils gating. CI 208/208 green on the same head since Nov 25, all threads resolved. An approving review lands it the same way as #203551. Thanks! |
|
Hi @ezyang - flagging the tail of the static-launcher testcase split before your noon window: TestStaticTritonLauncher becomes device-agnostic (one test file, no source changes) so out-of-tree backends get the launcher coverage. The family is landing one by one (#203548, #206703, #203551 merged), this is the last standing slice with CI 208/208 green since Nov 25 and all threads resolved. One merge-rules approve closes it. Thanks! |
|
Hi @jbschlosser - this one lives in common_utils device-gating territory which you own: TestStaticTritonLauncher becomes device-agnostic via common_utils gating (one test file, no source changes) so out-of-tree backends run the launcher tests instead of skipping them. Sibling slices already landed (#203548, #203551, #206703). CI 208/208 green on the same head since Nov 25, threads resolved. One approving review from the Core list lands the family tail. Thanks! |
|
@pytorchbot merge |
Merge startedYour 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 |
|
The merge job was canceled or timed out. This most often happen if two merge requests were issued for the same PR, or if merge job was waiting for more than 6 hours for tests to finish. In later case, please do not hesitate to reissue the merge command |
|
@pytorchbot merge |
1 similar comment
|
@pytorchbot merge |
Merge startedYour 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 |
…ified class (#203550) ## Summary Slice 2 of 4 of the static-launcher re-cut (independent; any order; original monolith #198437). Moves three scratch-space tests out of `TestStaticTritonLauncherUnit` into the existing CUDA-classified class `TestStaticTritonLauncherUnitCuda`, established by #203548: `test_global_scratch_allocation`, `test_fast_launcher_rejects_global_scratch` (both `@skipIfRocm`) and `test_rocm_rejects_global_scratch` (ROCm-only). No new class: the three bodies move verbatim, and the scratch-kernel factory is delegated by reference, never copied. The class docstring, inherited stale from main, is corrected in this PR: it claimed the class cannot run on RoCm and named a `CUDAAutotuner` that does not exist; it now describes the class as covering the CUDA/ROCm paths of `CachingAutotuner` and `StaticallyLaunchedCudaKernel`, noting that `CachingAutotuner` itself is device-generic. (+50/-55, one file; relocation of the three test bodies plus the docstring fix) ## What classifies `TestStaticTritonLauncherUnit` This slice does not declare `hw_classification` on the source class. The unit class still holds the last two device-gated tests, `test_static_launch_takes_cubin_from_metadata_group` and `test_static_launch_rejects_ambiguous_metadata_group` (`@skipIfRocm`); slice 3 (#203551) moves those into `TestStaticTritonLauncherUnitMetadataGroup` (GENERIC). Once that lands no device-gated test remains in the unit class, and its GENERIC declaration is the final slice of this re-cut, which is not opened yet. REVIEW.md Scenario 1 permits the multi-PR split; this section is the split explanation the rule asks for. ## Test Plan - [x] cpu wheel venv (previous head): failure set identical to base; the two commits added after it each change only the class docstring (AST-verified), no behavioral diff - [x] ROCm run: green. Run 46792320695 (<https://github.com/pytorch/pytorch/actions/runs/46792320695>), triggered by head `f72c3ea88139`: build plus all 8 `default` shards pass on `linux-noble-rocm-py3.11-mi300`; `test_rocm_rejects_global_scratch` ran on shard 1/8 and passed, per the shard's junit report (56 tests, 0 skipped, 0 failed). The current head `daeb4dafbdf3` only rewords the class docstring, no behavioral change. The `ciflow/rocm-mi300` label made `test_rocm_rejects_global_scratch` actually execute. It runs because `rocm-mi300.yml` runs the `default` config, which discovers this file (it is in neither the job's `tests-to-exclude` nor the `ROCM_BLOCKLIST` in `test/run_test.py`), and ROCm jobs exclude `GENERIC` classes only, so the CUDA-classified class runs. The earlier review round suggested `ciflow/inductor-rocm-mi300` instead; that workflow runs the `inductor` config, whose `test_inductor_shard` in `.ci/pytorch/test.sh` never includes `test_static_triton_launcher`. - [ ] in-tree test linter: not a meaningful check for this file yet. It is listed in `tools/linter/adapters/test_linter_allowlist.json`, and `check_file` in `tools/linter/adapters/test_linter.py` returns early for allowlisted paths, so the regular lintrunner path verifies nothing here. The file leaves the allowlist when the family-wide classification completes. ## Linked issue or supporting maintainer Part of #185590 (test case refactoring initiative) - hardware-decoupling slice. Pull Request resolved: #203550 Approved by: https://github.com/lizhihai137, https://github.com/jansel
Current state (2026-12-02)
879a6d25a2f3, rebased onto main on Dec 1. One file changed:test/inductor/test_static_triton_launcher.py.topic: not user facing,ready for review,module: tests/graph,ciflow/inductor,ciflow/xpu.Summary
Launcher-migration slice of the static-launcher file (the original #192893 monolith has been re-cut into dependency-free, review-sized PRs per #198436's review request; this PR is +363/-324 in one file; the unit-class splits are in #203548 (Triton-gated autotuner), #203550 (RoCm scratch trio), #203551 (cubin metadata pair), each with its own correctly-scoped class; merge in any order).
Changes (one file: test/inductor/test_static_triton_launcher.py)
TestStaticTritonLauncheron main is a@requires_gpu_and_tritonclass with 24 test methods bound toGPU_TYPE. It is made device-agnostic viainstantiate_device_type_tests(..., except_for="cpu", allow_xpu=True)withhw_classification = HardwareClassification.ACCELERATOR. All 24 tests are kept; where each one lives:TestStaticTritonLauncher(ACCELERATOR). All 13 now take the injecteddeviceand pass it toself._make_launcher(compiled_kernel, device), so the binary key (cubin/zebin/npubin/hsaco), the launcher class and the load interface resolve from the device under test instead ofGPU_TYPE.test_bfloat16_scalarswaps its process-wide@skipIfRocm/@unittest.skipIf(not HAS_XPU_AND_TRITON and not SM80OrLater, ...)guards for the device-aware@skipCUDAIfRocm/@skipCUDAIf(not SM80OrLater, ...)fromcommon_device_type.@requires_gpu_and_tritonis replaced by asetUpgate that is per-device rather than process-wide:has_triton_for_device(self.device_type)so a backend without Triton skips even when another backend has it, andis_registered_static_launch_device(self.device_type)(only cuda, hip and xpu register a static launcher) so Triton-capable but launcher-less backends skip instead of raising.test_xpu_*tests move to a newTestStaticTritonLauncherXpuOnly(hw_classification = XPU, keeps the class-level@requires_gpu_and_tritonand its per-test@unittest.skipUnless(HAS_XPU_AND_TRITON, ...)decorators), instantiatedonly_for="xpu", allow_xpu=True, mirroringTestFastLauncherXpuOnlyfrom [Testcase Refactoring] Keep XPU coverage and classify TestFastLauncher hw classes #198439.test_oversized_shared_mem,test_too_high_oversized_shared_mem, both on main via [Inductor] Support oversized shared memory in the static CUDA launcher and AOTI #199309; their helper readstorch.cuda.get_device_properties) move to a newTestStaticTritonLauncherCudaOversized(hw_classification = CUDA), instantiatedonly_for=("cuda",)with asetUpskip forself.device_type != "cuda"(plus a runtimehas_triton_for_deviceskip), the wayTestCudaStaticTritonCompileResultis scoped. Their@skipIfRocmis kept;@skipIfXpuand the body-levelSkipTestguards are dropped because the class is CUDA-only.test_launcher_keeps_module_owner_alive_until_releasemoves intoTestStaticTritonLauncherUnit, the host-side unit class, so the module-owner lifetime check runs once without a working Triton device.instantiate_device_type_testscalls for the three launcher classes sit in the file's single trailing group, the shape [Testcase Refactoring] Split TestFastLauncherCompileResult into mixin, accelerator and CUDA-only classes #198440 established.No helper or other class is touched:
StaticLauncherTestMixinalready takes optionaldevicearguments on main (landed via #198439/#198440), andTestFastLauncherplus the compile-result classes keep their current scoping.Notes
except_for="cpu"; no MTIA base is registered, so no MTIA variants are generated. This is a coverage note for [Testcase Refactoring] Declare TestStaticTritonLauncherUnit as a GENERIC hardware-classification class #198436's open question, not a regression on currently-tested devices.Verification
TestStaticTritonLauncherUnitfailure set identical to the pre-change head (28 tests; the two failures are preexisting wheel-vs-trunk artifacts already present before this PR's edits, 3 skips)ast.parseclean; ruff 0.14.4 with the repo config:checkandformat --checkclean on the file; in-treetest_linterrun with this file's allowlist entry temporarily removed: no findings in this PR's three launcher classes (the remaining file-level findings belong to the unit-class and fast-launcher regions tracked in [Testcase Refactoring] Declare TestStaticTritonLauncherUnit as a GENERIC hardware-classification class #198436 and the fast-launcher follow-up)ciflow/xpulabel requested so this PR's CI actually exercises the XPU instantiations (the 13 ACCELERATOR tests on xpu and the 8-test XPU-only class); CUDA CI covers the cuda instantiations and the new CUDA-only classLinked issue or supporting maintainer
Part of #185590 (test case refactoring initiative), hardware-decoupling slice.