8000 Decorator `skipIfXpu` disables tests when used on class · Issue #150779 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

Decorator skipIfXpu disables tests when used on class #150779

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
exclamaforte opened this issue Apr 7, 2025 · 7 comments
Open

Decorator skipIfXpu disables tests when used on class #150779

exclamaforte opened this issue Apr 7, 2025 · 7 comments
Assignees
Labels
high priority module: ci Related to continuous integration module: regression It used to work, and now it doesn't module: testing Issues related to the torch.testing module (not tests) module: tests Issues related to tests (not the torch.testing module) triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@exclamaforte
Copy link
Contributor
exclamaforte commented Apr 7, 2025

🐛 Describe the bug

skipIfXpu is used on classes, for example in test_autoheuristic.py:

@skipIfXpu(msg="AutoHeuristic doesn't currently work on the XPU stack")
class AutoHeuristicTest(TestCase):

If you try to run the tests:

(pytorch) $ python test_autoheuristic.py 

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK

No tests found:

(pytorch) $ python test_autoheuristic.py --discover-tests
<unittest.suite.TestSuite tests=[]>

Running a class member function with skipIfXpu seems to work, however:

(pytorch) $ python test_aot_inductor.py -k test_fp8
../home/gabeferns/pt-envs/pytorch/torch/backends/mkldnn/__init__.py:78: UserWarning: TF32 acceleration on top of oneDNN is available for Intel GPUs. The current Torch version does not have Intel GPU Support. (Triggered internally at /home/gabeferns/pt-envs/pytorch/aten/src/ATen/Context.cpp:148.)
  torch._C._set_onednn_allow_tf32(_allow_tf32)
W0407 12:19:41.756000 1780910 torch/_export/__init__.py:67] +============================+
W0407 12:19:41.756000 1780910 torch/_export/__init__.py:68] |     !!!   WARNING   !!!    |
W0407 12:19:41.756000 1780910 torch/_export/__init__.py:69] +============================+
W0407 12:19:41.757000 1780910 torch/_export/__init__.py:70] torch._export.aot_compile()/torch._export.aot_load() is being deprecated, please switch to directly calling torch._inductor.aoti_compile_and_package(torch.export.export())/torch._inductor.aoti_load_package() instead.
stats [('calls_captured', 2), ('unique_graphs', 1)]
inductor [('async_compile_cache_miss', 1), ('extern_calls', 1), ('async_compile_cache_hit', 1)]
graph_break []
aten_mm_info [('aten._scaled_mm.default_s0_32_16', 1)]
./home/gabeferns/pt-envs/pytorch/torch/backends/mkldnn/__init__.py:78: UserWarning: TF32 acceleration on top of oneDNN is available for Intel GPUs. The current Torch version does not have Intel GPU Support. (Triggered internally at /home/gabeferns/pt-envs/pytorch/aten/src/ATen/Context.cpp:148.)
  torch._C._set_onednn_allow_tf32(_allow_tf32)
stats [('calls_captured', 2), ('unique_graphs', 1)]
inductor [('extern_calls', 1)]
graph_break []
aten_mm_info [('aten._scaled_mm.default_s0_32_16', 1)]
.
----------------------------------------------------------------------
Ran 4 tests in 12.083s

OK

Versions

h100 devserver

cc @ezyang @gchanan @zou3519 @kadeng @msaroufim @seemethere @malfet @pytorch/pytorch-dev-infra @mruberry @ZainRizvi @gujinghui @EikanWang @fengyuan14 @guangyey

@exclamaforte exclamaforte changed the title Decorator skipIfXpu disables tests when used on class Decorator skipIfXpu disables tests when used on class Apr 7, 2025
@exclamaforte
Copy link
Contributor Author

It's used as a class decorator in these test files:

  • inductor/test_autoheurstic.py
  • inductor/test_b2b_gemm.py
  • inductor/test_decompose_mem_bound_mm.py
  • inductor/test_layout_optim.py

@exclamaforte exclamaforte added the module: xpu Intel XPU related issues label Apr 7, 2025
@exclamaforte
Copy link
Contributor Author
exclamaforte commented Apr 7, 2025

@skipIfRocm also has the same implementation. Not sure if these were meant to be used on classes, but I think both should be changed to match @skipIfTorchDynamo

cc: @chuanqi129 @lcskrishna

@malfet
Copy link
Contributor
malfet commented Apr 7, 2025

[Edit] Removing module: xpu as it's broader. In general, skip_if_xyz decorator should work on classes and should be a no-op if condition is false, otherwise entire class is skipped

@malfet malfet added high priority module: ci Related to continuous integration and removed module: xpu Intel XPU related issues labels Apr 7, 2025
@malfet malfet added module: regression It used to work, and now it doesn't module: tests Issues related to tests (not the torch.testing module) triage review and removed triage review labels Apr 7, 2025
@malfet
Copy link
Contributor
malfet commented Apr 7, 2025

@exclamaforte yeah, this is not the intended behavior, let me revert all skipIfXPU checks at class-level, but on the CI level we need to figure out how to test for something like that, i.e. there should probably be some sort of alert/warning fired when total number of test changes drastically for trunk. See previous case when some improperly reviewed PR disabled large chunk of tests: #142206

Also, if I remember correctly, unittest.skipIf is OK to apply against the classes, which will skip test discoverability if condition is false

@exclamaforte
Copy link
Contributor Author

@malfet sounds like a good idea! The autoheuristic tests seem broken, I'll make a PR to reenable the autoheuristic tests because I'm working on the feature right now. The others I'm not as familiar with.

@albanD albanD added triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module and removed triage review labels Apr 14, 2025 8000
@malfet malfet self-assigned this Apr 14, 2025
@malfet
Copy link
Contributor
malfet commented Apr 14, 2025

Taking AIs to:

@malfet malfet added the module: testing Issues related to the torch.testing module (not tests) label Apr 14, 2025
EikanWang added a commit that referenced this issue Apr 15, 2025
ghstack-source-id: b08f834
Pull Request resolved: #151315
@EikanWang
Copy link
Collaborator

@malfet , I found skipIfHpu also has a similar pattern. I submitted a PR #151315 to fix the issue for both XPU and HPU.

@ZainRizvi ZainRizvi moved this to In Progress in PyTorch OSS Dev Infra Apr 15, 2025
EikanWang added a commit that referenced this issue Apr 16, 2025
ghstack-source-id: fa236d5
Pull Request resolved: #151315
pytorchmergebot pushed a commit that referenced this issue Apr 26, 2025
ghstack-source-id: 2eb0f29
Pull Request resolved: #151315
pytorchmergebot pushed a commit that referenced this issue May 12, 2025
ghstack-source-id: a7a0ede
Pull Request resolved: #151315
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
high priority module: ci Related to continuous integration module: regression It used to work, and now it doesn't module: testing Issues related to the torch.testing module (not tests) module: tests Issues related to tests (not the torch.testing module) triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
Status: In Progress
Development

No branches or pull requests

4 participants
0