[CMake] Simplify CPU architecture detection logic (#54637)

Summary:
CMAKE_SYSTEM_PROCESSOR set to x86_64(on Linux) or AMD64 (5ec224496b)(on Windows) indicates build is running on x86_64 architecture, while `CMAKE_SYSTEM_PROCESSOR` set to aarch64 or arm64 means we running on ARMv8+ architecture.
Delete `i[3-6]86` pattern as 32-bit builds are no longer supported

Pull Request resolved: https://github.com/pytorch/pytorch/pull/54637

Reviewed By: ezyang

Differential Revision: D27311897

Pulled By: malfet

fbshipit-source-id: 26989fc9b54a96d70c768ab03ca4528506ee7808
This commit is contained in:
Nikita Shulga
2021-03-25 12:30:41 -07:00
committed by Facebook GitHub Bot
parent 911b8b1bfc
commit 68bdeef2ce

View File

@ -121,21 +121,10 @@ endif()
set(CPU_AARCH64 OFF)
set(CPU_INTEL OFF)
if(WIN32)
# On Windows, CMAKE_HOST_SYSTEM_PROCESSOR is calculated through `PROCESSOR_ARCHITECTURE`,
# which only has the value of `x86` or `AMD64`. We cannot infer whether it's a Intel CPU
# or not. However, the environment variable `PROCESSOR_IDENTIFIER` could be used.
if($ENV{PROCESSOR_IDENTIFIER} MATCHES "Intel")
set(CPU_INTEL ON)
else()
set(CPU_INTEL OFF)
endif()
else()
if(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64|i[3-6]+86)")
set(CPU_INTEL ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64)")
set(CPU_AARCH64 ON)
endif()
if(CMAKE_SYSTEM_PROCESSOR MATCHES "(AMD64|x86_64)")
set(CPU_INTEL ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64)")
set(CPU_AARCH64 ON)
endif()