diff --git a/CMakeLists.txt b/CMakeLists.txt index 16fec0c80028..48b9e2e8df3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -253,7 +253,6 @@ cmake_dependent_option(USE_CUFILE "Use cuFile" ON "USE_CUDA AND NOT WIN32" OFF) option(USE_FBGEMM "Use FBGEMM (quantized 8-bit server operators)" ON) option(USE_KINETO "Use Kineto profiling library" ON) option(USE_CUPTI_SO "Use CUPTI as a shared library" ON) -option(USE_FAKELOWP "Use FakeLowp operators" OFF) option(USE_GFLAGS "Use GFLAGS" OFF) option(USE_GLOG "Use GLOG" OFF) option(USE_LITE_PROTO "Use lite protobuf instead of full." OFF) @@ -836,10 +835,11 @@ include(ExternalProject) # ---[ Dependencies ---[ FBGEMM doesn't work on x86 32bit and # CMAKE_SYSTEM_PROCESSOR thinks its 64bit -if(USE_FBGEMM - AND((CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND CMAKE_SIZEOF_VOID_P EQUAL - 4) - OR CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")) +if(USE_FBGEMM AND NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + message(WARNING + "x64 operating system is required for FBGEMM. " + "Not compiling with FBGEMM. " + "Turn this warning off by USE_FBGEMM=OFF.") set(USE_FBGEMM OFF) endif() diff --git a/cmake/BLAS_ABI.cmake b/cmake/BLAS_ABI.cmake index bb0b5949d73d..45a15af1027a 100644 --- a/cmake/BLAS_ABI.cmake +++ b/cmake/BLAS_ABI.cmake @@ -1,3 +1,4 @@ +include(CMakePushCheckState) # Push host architecture when cross-compiling otherwise check would fail # when cross-compiling for arm64 on x86_64 cmake_push_check_state(RESET) diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index 8836b66bc036..26d882f2f7f1 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -664,55 +664,20 @@ if(USE_FBGEMM) if(NOT DEFINED FBGEMM_SOURCE_DIR) set(FBGEMM_SOURCE_DIR "${CAFFE2_THIRD_PARTY_ROOT}/fbgemm" CACHE STRING "FBGEMM source directory") endif() - if(NOT CAFFE2_COMPILER_SUPPORTS_AVX512_EXTENSIONS) - message(WARNING - "A compiler with AVX512 support is required for FBGEMM. " - "Not compiling with FBGEMM. " - "Turn this warning off by USE_FBGEMM=OFF.") - set(USE_FBGEMM OFF) - endif() - if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8) - message(WARNING - "x64 operating system is required for FBGEMM. " - "Not compiling with FBGEMM. " - "Turn this warning off by USE_FBGEMM=OFF.") - set(USE_FBGEMM OFF) - endif() if(USE_FBGEMM AND NOT TARGET fbgemm) set(FBGEMM_BUILD_TESTS OFF CACHE BOOL "") set(FBGEMM_BUILD_BENCHMARKS OFF CACHE BOOL "") - if(MSVC AND BUILD_SHARED_LIBS) - set(FBGEMM_LIBRARY_TYPE "shared" CACHE STRING "") - else() - set(FBGEMM_LIBRARY_TYPE "static" CACHE STRING "") - endif() - if(USE_ASAN) - set(USE_SANITIZER "address,undefined" CACHE STRING "-fsanitize options for FBGEMM") - endif() + set(FBGEMM_LIBRARY_TYPE "static" CACHE STRING "") add_subdirectory("${FBGEMM_SOURCE_DIR}") - set_property(TARGET fbgemm_generic PROPERTY POSITION_INDEPENDENT_CODE ON) - set_property(TARGET fbgemm_avx2 PROPERTY POSITION_INDEPENDENT_CODE ON) - set_property(TARGET fbgemm_avx512 PROPERTY POSITION_INDEPENDENT_CODE ON) - set_property(TARGET fbgemm PROPERTY POSITION_INDEPENDENT_CODE ON) - # Disabling autovec in fbgemm due to large library size causing symbol relocation issues, which is only allowed in static builds. - # Long-term solution involves modularizing fbgemm targets. - target_compile_definitions(fbgemm_generic PUBLIC DISABLE_FBGEMM_AUTOVEC) - target_compile_definitions(fbgemm_avx2 PUBLIC DISABLE_FBGEMM_AUTOVEC) - target_compile_definitions(fbgemm_avx512 PUBLIC DISABLE_FBGEMM_AUTOVEC) - - if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 13.0.0) - # See https://github.com/pytorch/pytorch/issues/74352 - target_compile_options_if_supported(asmjit -Wno-deprecated-copy) - target_compile_options_if_supported(asmjit -Wno-unused-but-set-variable) - endif() if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") target_compile_options_if_supported(asmjit -Wno-extra-semi) target_compile_options_if_supported(fbgemm -Wno-extra-semi) endif() + target_compile_options_if_supported(asmjit -Wno-unused-but-set-variable) + target_compile_options_if_supported(asmjit -Wno-unused-variable) endif() if(USE_FBGEMM) - target_compile_definitions(fbgemm PUBLIC DISABLE_FBGEMM_AUTOVEC) list(APPEND Caffe2_DEPENDENCY_LIBS fbgemm) endif() endif() @@ -721,9 +686,6 @@ if(USE_FBGEMM) caffe2_update_option(USE_FBGEMM ON) else() caffe2_update_option(USE_FBGEMM OFF) - message(WARNING - "Turning USE_FAKELOWP off as it depends on USE_FBGEMM.") - caffe2_update_option(USE_FAKELOWP OFF) endif() if(USE_OPENCL) diff --git a/cmake/MiscCheck.cmake b/cmake/MiscCheck.cmake index 9efb0b46c59d..54126b1f130d 100644 --- a/cmake/MiscCheck.cmake +++ b/cmake/MiscCheck.cmake @@ -12,46 +12,6 @@ if(NOT INTERN_BUILD_MOBILE) set(CAFFE2_PERF_WITH_AVX2 1) endif() endif() -# ---[ Check if the compiler has AVX512 support. -cmake_push_check_state(RESET) -if(MSVC AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - # We could've used MSVC's hidden option /arch:AVX512 that defines __AVX512F__, - # __AVX512DQ__, and __AVX512VL__, and /arch:AVX512F that defines __AVX512F__. - # But, we chose not to do that not to rely on hidden options. - set(CMAKE_REQUIRED_FLAGS "/D__AVX512F__ /D__AVX512DQ__ /D__AVX512VL__") -else() - # We only consider the case where all of avx512f, avx512dq, and avx512vl are - # supported. - # Platforms where avx512f is supported by not avx512dq and avx512vl as of - # Jan 15 2019 : linux_manywheel_2.7mu_cpu_build and - # linux_conda_3.7_cu100_build - set(CMAKE_REQUIRED_FLAGS "-mavx512f -mavx512dq -mavx512vl") -endif() -CHECK_CXX_SOURCE_COMPILES( - "#if defined(_MSC_VER) - #include - #else - #include - #endif - // check avx512f - __m512 addConstant(__m512 arg) { - return _mm512_add_ps(arg, _mm512_set1_ps(1.f)); - } - // check avx512dq - __m512 andConstant(__m512 arg) { - return _mm512_and_ps(arg, _mm512_set1_ps(1.f)); - } - int main() { - __m512i a = _mm512_set1_epi32(1); - __m256i ymm = _mm512_extracti64x4_epi64(a, 0); - ymm = _mm256_abs_epi64(ymm); // check avx512vl - __mmask16 m = _mm512_cmp_epi32_mask(a, a, _MM_CMPINT_EQ); - __m512i r = _mm512_andnot_si512(a, a); - }" CAFFE2_COMPILER_SUPPORTS_AVX512_EXTENSIONS) -if(CAFFE2_COMPILER_SUPPORTS_AVX512_EXTENSIONS) - message(STATUS "Current compiler supports avx512f extension. Will build fbgemm.") -endif() -cmake_pop_check_state() # ---[ Checks if compiler supports -fvisibility=hidden check_cxx_compiler_flag("-fvisibility=hidden" COMPILER_SUPPORTS_HIDDEN_VISIBILITY) diff --git a/cmake/Summary.cmake b/cmake/Summary.cmake index 24cfaa7f217d..63e501bcb5ab 100644 --- a/cmake/Summary.cmake +++ b/cmake/Summary.cmake @@ -136,7 +136,6 @@ function(caffe2_print_configuration_summary) message(STATUS " BUILD_NVFUSER : ${BUILD_NVFUSER}") message(STATUS " USE_EIGEN_FOR_BLAS : ${CAFFE2_USE_EIGEN_FOR_BLAS}") message(STATUS " USE_FBGEMM : ${USE_FBGEMM}") - message(STATUS " USE_FAKELOWP : ${USE_FAKELOWP}") message(STATUS " USE_KINETO : ${USE_KINETO}") message(STATUS " USE_GFLAGS : ${USE_GFLAGS}") message(STATUS " USE_GLOG : ${USE_GLOG}") diff --git a/third_party/fbgemm b/third_party/fbgemm index 0adf628317e0..21c7d30c526c 160000 --- a/third_party/fbgemm +++ b/third_party/fbgemm @@ -1 +1 @@ -Subproject commit 0adf628317e0cea414f66dcca901e0b85280fdb1 +Subproject commit 21c7d30c526c0f1ad873ecc632dca6cfa8a69067