diff --git a/tensorflow/lite/tools/evaluation/utils.cc b/tensorflow/lite/tools/evaluation/utils.cc index f86a7316ecf..69f962d7e9a 100644 --- a/tensorflow/lite/tools/evaluation/utils.cc +++ b/tensorflow/lite/tools/evaluation/utils.cc @@ -163,7 +163,11 @@ TfLiteDelegatePtr CreateHexagonDelegate( } // TODO(b/149248802): include XNNPACK delegate when the issue is resolved. -#if !defined(__Fuchsia__) +#if defined(__Fuchsia__) || defined(TFLITE_WITHOUT_XNNPACK) +TfLiteDelegatePtr CreateXNNPACKDelegate(int num_threads) { + return CreateNullDelegate(); +} +#else TfLiteDelegatePtr CreateXNNPACKDelegate() { TfLiteXNNPackDelegateOptions xnnpack_options = TfLiteXNNPackDelegateOptionsDefault(); diff --git a/tensorflow/lite/tools/evaluation/utils.h b/tensorflow/lite/tools/evaluation/utils.h index d1717f92e5f..e7c8246b340 100644 --- a/tensorflow/lite/tools/evaluation/utils.h +++ b/tensorflow/lite/tools/evaluation/utils.h @@ -28,7 +28,7 @@ limitations under the License. #endif // TODO(b/149248802): include XNNPACK delegate when the issue is resolved. -#if !defined(__Fuchsia__) +#if !defined(__Fuchsia__) || defined(TFLITE_WITHOUT_XNNPACK) #include "tensorflow/lite/delegates/xnnpack/xnnpack_delegate.h" #endif @@ -73,12 +73,12 @@ TfLiteDelegatePtr CreateHexagonDelegate( const std::string& library_directory_path, bool profiling); // TODO(b/149248802): include XNNPACK delegate when the issue is resolved. -#if !defined(__Fuchsia__) +#if !defined(__Fuchsia__) || defined(TFLITE_WITHOUT_XNNPACK) TfLiteDelegatePtr CreateXNNPACKDelegate(); TfLiteDelegatePtr CreateXNNPACKDelegate( const TfLiteXNNPackDelegateOptions* options); -TfLiteDelegatePtr CreateXNNPACKDelegate(int num_threads); #endif +TfLiteDelegatePtr CreateXNNPACKDelegate(int num_threads); } // namespace evaluation } // namespace tflite diff --git a/tensorflow/lite/tools/make/Makefile b/tensorflow/lite/tools/make/Makefile index 2684d1fd05b..e0aa625744b 100644 --- a/tensorflow/lite/tools/make/Makefile +++ b/tensorflow/lite/tools/make/Makefile @@ -172,6 +172,9 @@ ifeq ($(BUILD_WITH_RUY),true) CXXFLAGS += -DTFLITE_WITH_RUY endif +# Not to include XNNPACK. +CXXFLAGS += -DTFLITE_WITHOUT_XNNPACK + BUILD_WITH_NNAPI ?= false ifeq ($(BUILD_WITH_NNAPI),true) CORE_CC_ALL_SRCS += tensorflow/lite/delegates/nnapi/nnapi_delegate.cc @@ -212,7 +215,11 @@ BENCHMARK_LIB_SRCS := $(filter-out \ $(wildcard $(BENCHMARK_SRCS_DIR)/*_test.cc) \ $(BENCHMARK_MAIN_SRC) \ $(BENCHMARK_PERF_OPTIONS_SRC) \ - $(BENCHMARK_SRCS_DIR)/benchmark_plus_flex_main.cc, \ + $(BENCHMARK_SRCS_DIR)/benchmark_plus_flex_main.cc \ + $(BENCHMARK_SRCS_DIR)/gpu_delegate_provider.cc \ + $(BENCHMARK_SRCS_DIR)/hexagon_delegate_provider.cc \ + $(BENCHMARK_SRCS_DIR)/nnapi_delegate_provider.cc \ + $(BENCHMARK_SRCS_DIR)/xnnpack_delegate_provider.cc, \ $(BENCHMARK_ALL_SRCS)) # These target-specific makefiles should modify or replace options like