From 695eb327736d79b43555f5661afeaa97576612e7 Mon Sep 17 00:00:00 2001 From: Parichay Kapoor Date: Tue, 15 Sep 2020 17:43:17 +0900 Subject: [PATCH] [caffe2] Solving bug with disabling all nnpacks Instead of checking just USE_XNNPACK, check for all NNPACKS Change-Id: Idc566383322b0cad201e7d0e4c32b4da0c91c1ea Signed-off-by: Parichay Kapoor --- caffe2/CMakeLists.txt | 9 +++++++-- caffe2/utils/CMakeLists.txt | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt index fa68537..8920f7f 100644 --- a/caffe2/CMakeLists.txt +++ b/caffe2/CMakeLists.txt @@ -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() diff --git a/caffe2/utils/CMakeLists.txt b/caffe2/utils/CMakeLists.txt index 2925f41..a592506 100644 --- a/caffe2/utils/CMakeLists.txt +++ b/caffe2/utils/CMakeLists.txt @@ -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 -- 2.7.4