Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions test/jit/test_freezing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
from torch.testing._internal.common_quantization import skipIfNoFBGEMM
from torch.testing._internal.common_quantized import override_quantized_engine
from torch.testing._internal.common_utils import (
NAVI_ARCH,
set_default_dtype,
skipCUDAMemoryLeakCheckIf,
skipIfRocmArch,
skipIfTorchDynamo,
TEST_WITH_ROCM,
)
Expand Down Expand Up @@ -2972,6 +2974,7 @@ def test_conv_to_mkldnn_no_mkldnn(self):
self.assertEqual(frozen(inp), mod(inp))

@unittest.skipIf(not (TEST_CUDNN or TEST_WITH_ROCM), "requires CUDNN")
@skipIfRocmArch(NAVI_ARCH) # not supported by MIOPEN on NAVI
def test_freeze_conv_relu_fusion(self):
with set_default_dtype(torch.float):
conv_bias = [True, False]
Expand Down Expand Up @@ -3034,6 +3037,7 @@ def forward(self, x):
self.assertEqual(mod_eager(inp), frozen_mod(inp))

@unittest.skipIf(not (TEST_CUDNN or TEST_WITH_ROCM), "requires CUDNN")
@skipIfRocmArch(NAVI_ARCH) # not supported by MIOPEN on NAVI
def test_freeze_conv_relu_fusion_not_forward(self):
with set_default_dtype(torch.float):

Expand Down
3 changes: 3 additions & 0 deletions test/nn/test_convolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@
gradgradcheck,
instantiate_parametrized_tests,
MACOS_VERSION,
NAVI_ARCH,
parametrize as parametrize_test,
run_tests,
set_default_dtype,
skipIfNotMiopenSuggestNHWC,
skipIfRocmArch,
skipIfRocmVersionLessThan,
subtest,
TEST_SCIPY,
Expand Down Expand Up @@ -3910,6 +3912,7 @@ def test_conv2d_no_grad(self, device, dtype):

@onlyCUDA
@skipCUDAIfNoCudnn
@skipIfRocmArch(NAVI_ARCH) # not supported by MIOPEN on NAVI
@dtypes(torch.float, torch.float16)
@precisionOverride({torch.half: 0.002, torch.float: 1e-4})
def test_cudnn_convolution_relu(self, device, dtype):
Expand Down
16 changes: 15 additions & 1 deletion torch/testing/_internal/common_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@


MI300_ARCH = ("gfx940", "gfx941", "gfx942")

NAVI_ARCH = ("gfx1030", "gfx1100", "gfx1101", "gfx1200", "gfx1201")
NAVI4_ARCH = ("gfx1200", "gfx1201")

def freeze_rng_state(*args, **kwargs):
return torch.testing._utils.freeze_rng_state(*args, **kwargs)
Expand Down Expand Up @@ -1849,6 +1850,19 @@ def wrapper(*args, **kwargs):
return dec_fn(func)
return dec_fn

def skipIfRocmArch(arch: Tuple[str, ...]):
def dec_fn(fn):
@wraps(fn)
def wrap_fn(self, *args, **kwargs):
if TEST_WITH_ROCM: # noqa: F821
prop = torch.cuda.get_device_properties(0)
if prop.gcnArchName.split(":")[0] in arch:
reason = f"skipIfRocm: test skipped on {arch}"
raise unittest.SkipTest(reason)
return fn(self, *args, **kwargs)
return wrap_fn
return dec_fn

def runOnRocm(fn):
@wraps(fn)
def wrapper(*args, **kwargs):
Expand Down