Disable FBGEMM when building under x86 32bit (#17922)
authorThomas Viehmann <tv@beamnet.de>
Wed, 13 Mar 2019 10:43:58 +0000 (03:43 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 13 Mar 2019 10:46:50 +0000 (03:46 -0700)
Summary:
FBGEMM doesn't work on x86 32bit and prior to this patch, it will
generate x86_64 objects in a build that is supposed to be x86 32bit.
FBGEMM actually relies on registers not available on x86_32, so
we disable it.

This takes of one element of #17901. There are more dependencies
and a separate PR (#17915) regarding AVX detection for the code in the
main repository.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/17922

Differential Revision: D14437340

Pulled By: soumith

fbshipit-source-id: bd9fc98cf607d9b0bc28127fbbc8b04fa10eecbe

CMakeLists.txt

index 9ef8bc1..2f79094 100644 (file)
@@ -221,6 +221,11 @@ include(cmake/MiscCheck.cmake)
 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"))
+  set(USE_FBGEMM OFF)
+endif()
+
 include(cmake/Dependencies.cmake)
 
 if(USE_FBGEMM)