8000 Check that CPUInductor selects valid SIMD ISA · pytorch/builder@954bf67 · GitHub
[go: up one dir, main page]

Skip to content

Commit 954bf67

Browse files
committed
Check that CPUInductor selects valid SIMD ISA
I.e. for every platform we support, it should be something but invalid AVX512 on Intel Linux, and NEON on Apple silicon and Linux aarch64
1 parent 1ab922d commit 954bf67

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/smoke_test/smoke_test.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,14 @@ def foo(x: torch.Tensor) -> torch.Tensor:
258258
x_pt2 = torch.compile(foo)(x)
259259
torch.testing.assert_close(x_eager, x_pt2)
260260

261+
# Check that SIMD were detected for the architecture
262+
if device == "cpu":
263+
from torch._inductor.cpu_vec_isa import invalid_vec_isa, pick_vec_isa
264+
isa = pick_vec_isa()
265+
if isa == invalid_vec_isa:
266+
raise RuntimeError("Can't detect vectorized ISA for CPU")
267+
print(f"Picked CPU ISA {type(isa).__name__} bit width {isa.bit_width()}")
268+
261269
# Reset torch dynamo since we are changing mode
262270
torch._dynamo.reset()
263271
dtype = torch.float32

0 commit comments

Comments
 (0)
0