[caffe2] Solving bug with disabling all nnpacks sandbox/kparichay/v1.6.0-rc1_protobuf_1.12.3
authorParichay Kapoor <pk.kapoor@samsung.com>
Tue, 15 Sep 2020 08:43:17 +0000 (17:43 +0900)
committerParichay Kapoor <pk.kapoor@samsung.com>
Tue, 15 Sep 2020 08:43:17 +0000 (17:43 +0900)
Instead of checking just USE_XNNPACK, check for all NNPACKS

Change-Id: Idc566383322b0cad201e7d0e4c32b4da0c91c1ea
Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
caffe2/CMakeLists.txt
caffe2/utils/CMakeLists.txt

index fa68537..8920f7f 100644 (file)
@@ -87,8 +87,13 @@ endif()
 # Note: the folders that are being commented out have not been properly
 # addressed yet.
 
+set(DISABLE_NNPACK_AND_FAMILY OFF)
+if(NOT (USE_NNPACK OR USE_QNNPACK OR USE_PYTORCH_QNNPACK OR USE_XNNPACK))
+  set(DISABLE_NNPACK_AND_FAMILY ON)
+endif()
+
 # For pthreadpool_new_if_impl. TODO: Remove when threadpools are unitied.
-if(NOT MSVC AND USE_XNNPACK)
+if(NOT MSVC AND NOT DISABLE_NNPACK_AND_FAMILY)
   if(NOT TARGET fxdiv)
     set(FXDIV_BUILD_TESTS OFF CACHE BOOL "")
     set(FXDIV_BUILD_BENCHMARKS OFF CACHE BOOL "")
@@ -659,7 +664,7 @@ elseif(USE_CUDA)
 endif()
 
 
-if(NOT MSVC AND USE_XNNPACK)
+if(NOT MSVC AND NOT DISABLE_NNPACK_AND_FAMILY)
   TARGET_LINK_LIBRARIES(torch_cpu PRIVATE fxdiv)
 endif()
 
index 2925f41..a592506 100644 (file)
@@ -36,7 +36,7 @@ list(APPEND Caffe2_CPU_SRCS
 # ---[ threadpool/pthreadpool* is a local modification of the NNPACK
 # pthreadpool with a very similar interface. Neither NNPACK, nor this
 # thread pool supports Windows.
-if(NOT MSVC AND USE_XNNPACK)
+if(NOT MSVC AND NOT DISABLE_NNPACK_AND_FAMILY)
   add_definitions(-DUSE_INTERNAL_THREADPOOL_IMPL)
   set(Caffe2_CPU_SRCS ${Caffe2_CPU_SRCS}
           utils/threadpool/pthreadpool.cc