Skip to content

Commit a790959

Browse files
robert-hardwickpytorchmergebot
authored andcommitted
AArch64 xFail for failing tests in inductor/test_cpu_repro (#171095)
This PR enables inductor/test_cpu_repro on AArch64 and marks known failures with xfail and link to issue. Pull Request resolved: #171095 Approved by: https://github.com/jgong5, https://github.com/Skylion007, https://github.com/malfet
1 parent 0951602 commit a790959

3 files changed

Lines changed: 27 additions & 10 deletions

File tree

.ci/pytorch/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1785,7 +1785,7 @@ test_linux_aarch64() {
17851785
inductor/test_split_cat_fx_passes inductor/test_compile inductor/test_torchinductor \
17861786
inductor/test_torchinductor_codegen_dynamic_shapes inductor/test_torchinductor_dynamic_shapes inductor/test_memory \
17871787
inductor/test_triton_cpu_backend inductor/test_triton_extension_backend inductor/test_mkldnn_pattern_matcher inductor/test_cpu_cpp_wrapper \
1788-
inductor/test_cpu_select_algorithm \
1788+
inductor/test_cpu_select_algorithm inductor/test_cpu_repro \
17891789
--shard "$SHARD_NUMBER" "$NUM_TEST_SHARDS" --verbose
17901790
}
17911791

test/inductor/test_cpu_repro.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,17 @@
3232
from torch.nn import functional as F
3333
from torch.testing._internal.common_utils import (
3434
instantiate_parametrized_tests,
35+
IS_ARM64,
36+
IS_CPU_CAPABILITY_SVE256,
37+
IS_CPU_EXT_SVE_SUPPORTED,
3538
IS_FBCODE,
3639
IS_MACOS,
3740
MI200_ARCH,
3841
parametrize,
3942
skipIfRocmArch,
4043
slowTest,
4144
TEST_MKL,
45+
xfailIf,
4246
xfailIfS390X,
4347
)
4448
from torch.utils._python_dispatch import TorchDispatchMode
@@ -3469,6 +3473,8 @@ def fn(x):
34693473
3,
34703474
)
34713475

3476+
@xfailIf(IS_ARM64 and not IS_CPU_CAPABILITY_SVE256)
3477+
# see https://github.com/pytorch/pytorch/issues/142231
34723478
@config.patch({"fx_graph_cache": False, "fx_graph_remote_cache": False})
34733479
def test_two_local_buffers_in_outer_loop_fusion(self):
34743480
def fn(x):
@@ -3807,6 +3813,8 @@ def forward(self, x):
38073813
self.common(m, (x,))
38083814
check_metrics_vec_kernel_count(8)
38093815

3816+
@xfailIf(IS_ARM64 and IS_CPU_CAPABILITY_SVE256)
3817+
# see https://github.com/pytorch/pytorch/issues/169958
38103818
@requires_vectorization
38113819
@config.patch("cpp.enable_tiling_heuristics", False)
38123820
def test_transpose_copy(self):
@@ -4054,6 +4062,8 @@ def fn(a, b):
40544062
self.common(fn, (x, y))
40554063
check_metrics_vec_kernel_count(2)
40564064

4065+
@xfailIf(IS_ARM64 and IS_CPU_CAPABILITY_SVE256)
4066+
# see https://github.com/pytorch/pytorch/issues/170877
40574067
def test_transpose_mxn_16_16_bf16_fp16(self):
40584068
def fn(a, b):
40594069
c = a * b
@@ -4698,6 +4708,7 @@ def fn(x, y):
46984708
y = torch.randint(0, 255, (3, 3), dtype=torch.uint8)
46994709
self.common(fn, (x, y))
47004710

4711+
@xfailIf(IS_ARM64) # see https://github.com/pytorch/pytorch/issues/168972
47014712
def test_float32_to_uint8(self):
47024713
# https://github.com/pytorch/pytorch/issues/156788
47034714
@torch.compile
@@ -5393,6 +5404,9 @@ def forward(self, x):
53935404
x = torch.randn(1, 4, 2, 2)
53945405
self.common(fn, (x,))
53955406

5407+
@xfailIf(
5408+
IS_ARM64 and IS_CPU_EXT_SVE_SUPPORTED
5409+
) # see https://github.com/pytorch/pytorch/issues/142134
53965410
@parametrize("is_inference", (True, False))
53975411
def test_disabled_amp(self, is_inference):
53985412
class M(torch.nn.Module):
@@ -6096,6 +6110,7 @@ def fn(x):
60966110

60976111
torch.compile(fn)(torch.randn(2, 2))
60986112

6113+
@xfailIf(IS_ARM64) # https://github.com/pytorch/pytorch/issues/176285
60996114
@skipIfRocmArch(MI200_ARCH)
61006115
@unittest.skipIf(not torch.backends.mkldnn.is_available(), "MKLDNN is not enabled")
61016116
@requires_vectorization

torch/testing/_internal/common_utils.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,22 +1401,24 @@ def printErrors(self) -> None:
14011401
else:
14021402
unittest.main(argv=argv)
14031403

1404+
def cpu_supports_feature(feature):
1405+
if sys.platform != 'linux':
1406+
return False
1407+
with open("/proc/cpuinfo") as f:
1408+
flags = {t for k, v in (line.split(":", 1) for line in f if ":" in line)
1409+
if k.strip().lower() in ("flags", "features") for t in v.split()}
1410+
return feature.lower() in flags
1411+
14041412
IS_LINUX = sys.platform == "linux"
14051413
IS_WINDOWS = sys.platform == "win32"
14061414
IS_MACOS = sys.platform == "darwin"
14071415
IS_PPC = platform.machine() == "ppc64le"
14081416
IS_X86 = platform.machine() in ('x86_64', 'i386')
14091417
IS_ARM64 = platform.machine() in ('arm64', 'aarch64')
14101418
IS_S390X = platform.machine() == "s390x"
1411-
1412-
def is_avx512_vnni_supported():
1413-
if sys.platform != 'linux':
1414-
return False
1415-
with open("/proc/cpuinfo", encoding="ascii") as f:
1416-
lines = f.read()
1417-
return "vnni" in lines
1418-
1419-
IS_AVX512_VNNI_SUPPORTED = is_avx512_vnni_supported()
1419+
IS_AVX512_VNNI_SUPPORTED = cpu_supports_feature("vnni")
1420+
IS_CPU_EXT_SVE_SUPPORTED = cpu_supports_feature("sve")
1421+
IS_CPU_CAPABILITY_SVE256 = torch._C._get_cpu_capability() == "SVE256"
14201422

14211423
if IS_WINDOWS:
14221424
@contextmanager

0 commit comments

Comments
 (0)