mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
CMake: Clean up unused definitions (#69216)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/69216 This cleans up 4 pre-processor defines not used by any code: - HAVE_GCC_GET_CPUID - USE_GCC_GET_CPUID - USE_AVX - USE_AVX2 `cpuid` isn't used in PyTorch any more, we only use `cpuinfo`. `USE_AVX*` is also not used, instead `HAVE_*_CPU_DEFINITIONS` tells you which `CPU_CAPABILITY` flags are being compiled. There is also `fbgemm`'s code path adding `third_party` as an include path, despite `fbgemm` having a dedicated include directory and a CMake setup that properly includes it. Test Plan: Imported from OSS Reviewed By: albanD Differential Revision: D33794424 Pulled By: malfet fbshipit-source-id: 99d504af088818d4a26c2f6ce67ec0d59a5eb703
This commit is contained in:
parent
f7d127b654
commit
2e099d41f0
|
|
@ -14,9 +14,6 @@ COMMON_COPTS = [
|
||||||
"-DHAVE_SHM_OPEN=1",
|
"-DHAVE_SHM_OPEN=1",
|
||||||
"-DHAVE_SHM_UNLINK=1",
|
"-DHAVE_SHM_UNLINK=1",
|
||||||
"-D_FILE_OFFSET_BITS=64",
|
"-D_FILE_OFFSET_BITS=64",
|
||||||
"-DHAVE_GCC_GET_CPUID",
|
|
||||||
"-DTH_BLAS_MKL",
|
|
||||||
"-DUSE_GCC_GET_CPUID",
|
|
||||||
"-DTH_HAVE_THREAD",
|
"-DTH_HAVE_THREAD",
|
||||||
"-DUSE_FBGEMM",
|
"-DUSE_FBGEMM",
|
||||||
"-DUSE_DISTRIBUTED",
|
"-DUSE_DISTRIBUTED",
|
||||||
|
|
@ -369,8 +366,6 @@ cc_library(
|
||||||
)
|
)
|
||||||
|
|
||||||
ATEN_COPTS = COMMON_COPTS + [
|
ATEN_COPTS = COMMON_COPTS + [
|
||||||
"-DUSE_AVX",
|
|
||||||
"-DUSE_AVX2",
|
|
||||||
"-DCAFFE2_BUILD_MAIN_LIBS",
|
"-DCAFFE2_BUILD_MAIN_LIBS",
|
||||||
"-DHAVE_AVX_CPU_DEFINITION",
|
"-DHAVE_AVX_CPU_DEFINITION",
|
||||||
"-DHAVE_AVX2_CPU_DEFINITION",
|
"-DHAVE_AVX2_CPU_DEFINITION",
|
||||||
|
|
@ -1543,9 +1538,6 @@ cu_library(
|
||||||
)
|
)
|
||||||
|
|
||||||
PERF_COPTS = [
|
PERF_COPTS = [
|
||||||
"-DHAVE_GCC_GET_CPUID",
|
|
||||||
"-DUSE_AVX",
|
|
||||||
"-DUSE_AVX2",
|
|
||||||
"-DTH_HAVE_THREAD",
|
"-DTH_HAVE_THREAD",
|
||||||
"-DHAVE_AVX_CPU_DEFINITION",
|
"-DHAVE_AVX_CPU_DEFINITION",
|
||||||
"-DHAVE_AVX2_CPU_DEFINITION",
|
"-DHAVE_AVX2_CPU_DEFINITION",
|
||||||
|
|
|
||||||
|
|
@ -824,8 +824,6 @@ if(USE_FBGEMM)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(USE_FBGEMM)
|
if(USE_FBGEMM)
|
||||||
set(CAFFE2_THIRD_PARTY_ROOT "${PROJECT_SOURCE_DIR}/third_party")
|
|
||||||
include_directories(SYSTEM "${CAFFE2_THIRD_PARTY_ROOT}")
|
|
||||||
caffe2_update_option(USE_FBGEMM ON)
|
caffe2_update_option(USE_FBGEMM ON)
|
||||||
else()
|
else()
|
||||||
caffe2_update_option(USE_FBGEMM OFF)
|
caffe2_update_option(USE_FBGEMM OFF)
|
||||||
|
|
@ -1694,56 +1692,6 @@ if(NOT INTERN_BUILD_MOBILE)
|
||||||
add_compile_options(-mcpu=cortex-a9)
|
add_compile_options(-mcpu=cortex-a9)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
CHECK_INCLUDE_FILE(cpuid.h HAVE_CPUID_H)
|
|
||||||
# Check for a cpuid intrinsic
|
|
||||||
if(HAVE_CPUID_H)
|
|
||||||
CHECK_C_SOURCE_COMPILES("#include <cpuid.h>
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
unsigned int eax, ebx, ecx, edx;
|
|
||||||
return __get_cpuid(0, &eax, &ebx, &ecx, &edx);
|
|
||||||
}" HAVE_GCC_GET_CPUID)
|
|
||||||
endif()
|
|
||||||
if(HAVE_GCC_GET_CPUID)
|
|
||||||
add_compile_options(-DHAVE_GCC_GET_CPUID)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
CHECK_C_SOURCE_COMPILES("#include <stdint.h>
|
|
||||||
static inline void cpuid(uint32_t *eax, uint32_t *ebx,
|
|
||||||
uint32_t *ecx, uint32_t *edx)
|
|
||||||
{
|
|
||||||
uint32_t a = *eax, b, c = *ecx, d;
|
|
||||||
asm volatile ( \"cpuid\" : \"+a\"(a), \"=b\"(b), \"+c\"(c), \"=d\"(d) );
|
|
||||||
*eax = a; *ebx = b; *ecx = c; *edx = d;
|
|
||||||
}
|
|
||||||
int main() {
|
|
||||||
uint32_t a,b,c,d;
|
|
||||||
cpuid(&a, &b, &c, &d);
|
|
||||||
return 0;
|
|
||||||
}" NO_GCC_EBX_FPIC_BUG)
|
|
||||||
|
|
||||||
if(NOT NO_GCC_EBX_FPIC_BUG)
|
|
||||||
add_compile_options(-DUSE_GCC_GET_CPUID)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_package(VSX) # checks VSX
|
|
||||||
find_package(ZVECTOR) # checks ZVECTOR
|
|
||||||
# checks AVX and AVX2. Already called once in MiscCheck.cmake. Called again here for clarity --
|
|
||||||
# cached results will be used so no extra overhead.
|
|
||||||
find_package(AVX)
|
|
||||||
|
|
||||||
# we don't set -mavx and -mavx2 flags globally, but only for specific files
|
|
||||||
# however, we want to enable the AVX codepaths, so we still need to
|
|
||||||
# add USE_AVX and USE_AVX2 macro defines
|
|
||||||
if(C_AVX_FOUND)
|
|
||||||
message(STATUS "AVX compiler support found")
|
|
||||||
add_compile_options(-DUSE_AVX)
|
|
||||||
endif()
|
|
||||||
if(C_AVX2_FOUND)
|
|
||||||
message(STATUS "AVX2 compiler support found")
|
|
||||||
add_compile_options(-DUSE_AVX2)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WIN32 AND NOT CYGWIN)
|
if(WIN32 AND NOT CYGWIN)
|
||||||
set(BLAS_INSTALL_LIBRARIES "OFF"
|
set(BLAS_INSTALL_LIBRARIES "OFF"
|
||||||
CACHE BOOL "Copy the required BLAS DLLs into the TH install dirs")
|
CACHE BOOL "Copy the required BLAS DLLs into the TH install dirs")
|
||||||
|
|
|
||||||
2
third_party/mkl-dnn.BUILD
vendored
2
third_party/mkl-dnn.BUILD
vendored
|
|
@ -55,8 +55,6 @@ cc_library(
|
||||||
"third_party/oneDNN/include/oneapi/dnnl/dnnl_version.h",
|
"third_party/oneDNN/include/oneapi/dnnl/dnnl_version.h",
|
||||||
],
|
],
|
||||||
copts = [
|
copts = [
|
||||||
"-DUSE_AVX",
|
|
||||||
"-DUSE_AVX2",
|
|
||||||
"-DDNNL_DLL",
|
"-DDNNL_DLL",
|
||||||
"-DDNNL_DLL_EXPORTS",
|
"-DDNNL_DLL_EXPORTS",
|
||||||
"-DDNNL_ENABLE_CONCURRENT_EXEC",
|
"-DDNNL_ENABLE_CONCURRENT_EXEC",
|
||||||
|
|
|
||||||
3
third_party/sleef.BUILD
vendored
3
third_party/sleef.BUILD
vendored
|
|
@ -15,9 +15,6 @@ SLEEF_COPTS = [
|
||||||
"-fno-math-errno",
|
"-fno-math-errno",
|
||||||
"-fno-trapping-math",
|
"-fno-trapping-math",
|
||||||
"-DCAFFE2_USE_GLOO",
|
"-DCAFFE2_USE_GLOO",
|
||||||
"-DHAVE_GCC_GET_CPUID",
|
|
||||||
"-DUSE_AVX",
|
|
||||||
"-DUSE_AVX2",
|
|
||||||
"-std=gnu99",
|
"-std=gnu99",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user