From b879ef7c0de78991b977aca03ac3a7f93fd88607 Mon Sep 17 00:00:00 2001 From: Jeff Daily Date: Tue, 23 Sep 2025 22:15:10 +0000 Subject: [PATCH] [ROCm][CI] skip TestCudaPrimaryCtx.test_set_device_0 (#163693) Fixes #ISSUE_NUMBER Pull Request resolved: https://github.com/pytorch/pytorch/pull/163693 Approved by: https://github.com/jeffdaily Co-authored-by: Jeff Daily --- test/test_cuda_primary_ctx.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/test_cuda_primary_ctx.py b/test/test_cuda_primary_ctx.py index 0bcb83bceeb3..7ce0b19ce884 100644 --- a/test/test_cuda_primary_ctx.py +++ b/test/test_cuda_primary_ctx.py @@ -5,7 +5,7 @@ import unittest import torch from torch.testing._internal.common_cuda import TEST_CUDA, TEST_MULTIGPU -from torch.testing._internal.common_utils import NoTest, run_tests, TestCase +from torch.testing._internal.common_utils import NoTest, run_tests, skipIfRocm, TestCase # NOTE: this needs to be run in a brand new process @@ -31,6 +31,9 @@ class TestCudaPrimaryCtx(TestCase): TestCudaPrimaryCtx.CTX_ALREADY_CREATED_ERR_MSG, ) + @skipIfRocm( + msg="last checked in ROCm 7, HIP runtime doesn't create context for hipSetDevice()" + ) def test_set_device_0(self): # In CUDA 12 the behavior of cudaSetDevice has changed. It eagerly creates context on target. # The behavior of `torch.cuda.set_device(0)` should also create context on the device 0.