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.