Skip to content

Commit 66bf7da

Browse files
iremyuxOzan Aydin
authored andcommitted
Enable sleef for Win Arm64 (pytorch#144876)
Sleef module was disabled for Windows Arm64 on iremyux@b021486 This PR enables it again since the issue is no longer valid. Pull Request resolved: pytorch#144876 Approved by: https://github.com/albanD, https://github.com/malfet Co-authored-by: Ozan Aydin <[email protected]>
1 parent 991a4b5 commit 66bf7da

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

aten/src/ATen/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ if(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^(s390x|ppc64le)$")
462462
list(APPEND ATen_CPU_DEPENDENCY_LIBS cpuinfo)
463463
endif()
464464

465-
if(NOT EMSCRIPTEN AND NOT INTERN_BUILD_MOBILE AND NOT (MSVC AND CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64"))
465+
if(NOT EMSCRIPTEN AND NOT INTERN_BUILD_MOBILE)
466466
if(NOT MSVC)
467467
# Bump up optimization level for sleef to -O1, since at -O0 the compiler
468468
# excessively spills intermediate vector registers to the stack
@@ -473,6 +473,8 @@ if(NOT EMSCRIPTEN AND NOT INTERN_BUILD_MOBILE AND NOT (MSVC AND CMAKE_SYSTEM_PRO
473473
else()
474474
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O1")
475475
endif()
476+
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
477+
set(SLEEF_ARCH_AARCH64 ON)
476478
endif()
477479

478480
if(NOT USE_SYSTEM_SLEEF)

caffe2/CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,10 +1761,7 @@ if(BUILD_TEST)
17611761
endif()
17621762
else()
17631763
add_executable(${test_name}_${CPU_CAPABILITY} "${test_src}")
1764-
target_link_libraries(${test_name}_${CPU_CAPABILITY} torch_library gtest_main)
1765-
if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
1766-
target_link_libraries(${test_name}_${CPU_CAPABILITY} sleef)
1767-
endif()
1764+
target_link_libraries(${test_name}_${CPU_CAPABILITY} torch_library sleef gtest_main)
17681765
endif()
17691766
target_include_directories(${test_name}_${CPU_CAPABILITY} PRIVATE $<INSTALL_INTERFACE:include>)
17701767
target_include_directories(${test_name}_${CPU_CAPABILITY} PRIVATE $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)

torch/_inductor/cpp_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ def _get_torch_related_args(
778778
if not aot_mode:
779779
libraries.append("torch_python")
780780

781-
if _IS_WINDOWS and platform.machine().lower() != "arm64":
781+
if _IS_WINDOWS:
782782
libraries.append("sleef")
783783

784784
return include_dirs, libraries_dirs, libraries

torch/utils/cpp_extension.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import importlib
55
import importlib.abc
66
import os
7-
import platform
87
import re
98
import shlex
109
import shutil
@@ -1015,7 +1014,7 @@ def CppExtension(name, sources, *args, **kwargs):
10151014
if not kwargs.get('py_limited_api', False):
10161015
# torch_python uses more than the python limited api
10171016
libraries.append('torch_python')
1018-
if IS_WINDOWS and platform.machine().lower() != "arm64":
1017+
if IS_WINDOWS:
10191018
libraries.append("sleef")
10201019

10211020
kwargs['libraries'] = libraries

0 commit comments

Comments
 (0)