8000 [CpuInductor] Enable NEON ISA detection on Linux ARM by pytorchbot · Pull Request #133578 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

[CpuInductor] Enable NEON ISA detection on Linux ARM #133578

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
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
24 changes: 17 additions & 7 deletions torch/_inductor/codecache.py
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,7 @@
#include <ATen/cpu/vec/vec.h>
#endif

__attribute__((aligned(64))) float in_out_ptr0[16] = {0.0};
alignas(64) float in_out_ptr0[16] = {0.0};

extern "C" void __avx_chk_kernel() {
auto tmp0 = at::vec::Vectorized<float>(1);
Expand Down Expand Up @@ -1470,12 +1470,12 @@
# we only cache some key isa information.
@functools.lru_cache(None)
def valid_vec_isa_list() -> List[VecISA]:
isa_list: List[VecISA] = []
if sys.platform == "darwin" and platform.processor() == "arm":
return [VecNEON()]
isa_list.append(VecNEON())

cur_os = sys.platform
if cur_os != "linux" and cur_os != "win32":
return []
if sys.platform not in ["linux", "win32"]:
return isa_list

if platform.machine() == "s390x":
with open("/proc/cpuinfo") as _cpu_info:
Expand All @@ -1488,8 +1488,18 @@
if featuresmatch:
for group in featuresmatch.groups():
if re.search(r"[\^ ]+vxe[\$ ]+", group):
return [VecZVECTOR()]
return []
isa_list.append(VecZVECTOR())
break
elif arch == "aarch64":

Check failure on line 1493 in torch/_inductor/codecache.py

View workflow job for this annotation

GitHub Actions / lintrunner-noclang / linux-job

MYPY [name-defined]

Name "arch" is not defined
isa_list.append(VecNEON())
elif arch in ["x86_64", "AMD64"]:

Check failure on line 1495 in torch/_inductor/codecache.py

View workflow job for this annotation

GitHub Actions / lintrunner-noclang / linux-job

MYPY [name-defined]

Name "arch" is not defined
"""
arch value is x86_64 on Linux, and the value is AMD64 on Windows.
"""
_cpu_supported_x86_isa = x86_isa_checker()
for isa in supported_vec_isa_list:
if str(isa) in _cpu_supported_x86_isa and isa:
isa_list.append(isa)

isa_list = []
_cpu_supported_isa = x86_isa_checker()
Expand Down
Loading
0