mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[submodule] Bump fbgemm to latest (#158210)
Merge the recent commits of FBGEMM and remove unnecessary CMake code. Specifically, we 1. enable `fbgemm_autovec` since the target is now correctly handled. 2. remove option `USE_FAKELOWP` which is not used. 3. remove `CAFFE2_COMPILER_SUPPORTS_AVX512_EXTENSIONS` check. Pull Request resolved: https://github.com/pytorch/pytorch/pull/158210 Approved by: https://github.com/q10
This commit is contained in:
@ -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()
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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 <intrin.h>
|
||||
#else
|
||||
#include <immintrin.h>
|
||||
#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)
|
||||
|
@ -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}")
|
||||
|
2
third_party/fbgemm
vendored
2
third_party/fbgemm
vendored
Submodule third_party/fbgemm updated: 0adf628317...21c7d30c52
Reference in New Issue
Block a user