[ROCm] Fix test_cuda_synchronize failure on ROCm (#164735)

This PR skips the hipify step of torch/csrc/jit/ir/ir.h to avoid a build-time error for the JIT cuda namespace.  This fixes two skipped tests in test/jit/test_cuda.py.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/164735
Approved by: https://github.com/jeffdaily

Co-authored-by: Jeff Daily <jeff.daily@amd.com>
This commit is contained in:
rraminen
2025-10-07 01:14:20 +00:00
committed by PyTorch MergeBot
parent afee8062d5
commit 49f7d8d19d
4 changed files with 1 additions and 7 deletions

View File

@ -14,7 +14,6 @@ from torch.testing._internal.common_utils import (
NoTest,
raise_on_run_directly,
skipCUDANonDefaultStreamIf,
skipIfRocm,
TEST_CUDA,
)
from torch.testing._internal.jit_utils import JitTestCase
@ -48,7 +47,6 @@ class TestCUDA(JitTestCase):
torch.cuda.empty_cache()
super().tearDown()
@skipIfRocm
@unittest.skipIf(not TEST_MULTIGPU, "detected only one GPU")
def test_cuda_synchronize(self):
# Test device synchronization.
@ -160,7 +158,6 @@ class TestCUDA(JitTestCase):
self.assertEqual(0, d2)
self.assertEqual(d0, d2)
@skipIfRocm
@unittest.skipIf(not TEST_MULTIGPU, "detected only one GPU")
@unittest.skipIf(not TEST_LARGE_TENSOR, "not enough memory")
@skipCUDANonDefaultStreamIf(True)

View File

@ -137,6 +137,7 @@ ignores = [
"third_party/nvfuser/runtime/helpers.cu",
"torch/csrc/jit/codegen/fuser/cuda/resource_strings.h",
"torch/csrc/jit/tensorexpr/ir_printer.cpp",
"torch/csrc/jit/ir/ir.h",
# generated files we shouldn't frob
"torch/lib/tmp_install/*",
"torch/include/*",

View File

@ -1175,12 +1175,10 @@ bool Node::hasSideEffects() const {
case prim::rpc_sync: // It represents RPC message sent.
case prim::rpc_remote: // It represents RPC message sent.
case aten::wait: // It can represent RPC message received.
#if !defined(USE_ROCM)
case cuda::set_stream:
case cuda::_set_device:
case cuda::_current_device:
case cuda::synchronize:
#endif
case prim::Enter:
case prim::Exit:
return true;

View File

@ -78,9 +78,7 @@ namespace aten {
using namespace ::c10::aten;
}
namespace cuda {
#if !defined(USE_ROCM)
using namespace ::c10::cuda;
#endif
} // namespace cuda
struct Function;