diff --git a/tensorflow/lite/micro/tools/benchmarking/generic_model_benchmark.cc b/tensorflow/lite/micro/tools/benchmarking/generic_model_benchmark.cc index e87670a3722..14456ef4e8a 100644 --- a/tensorflow/lite/micro/tools/benchmarking/generic_model_benchmark.cc +++ b/tensorflow/lite/micro/tools/benchmarking/generic_model_benchmark.cc @@ -170,6 +170,16 @@ void ShowOutputCRC32(tflite::MicroInterpreter* interpreter) { } } +void ShowInputCRC32(tflite::MicroInterpreter* interpreter) { + GenCRC32Table(); + for (size_t i = 0; i < interpreter->inputs_size(); ++i) { + TfLiteTensor* input = interpreter->input_tensor(i); + uint8_t* input_values = tflite::GetTensorData(input); + uint32_t crc32_value = ComputeCRC32(input_values, input->bytes); + MicroPrintf("Input CRC32: 0x%X", crc32_value); + } +} + int Benchmark(const uint8_t* model_data, tflite::PrettyPrintType print_type) { static Profiler profiler; static Profiler profiler2; @@ -225,6 +235,9 @@ int Benchmark(const uint8_t* model_data, tflite::PrettyPrintType print_type) { uint32_t seed = kRandomSeed; while (true) { SetRandomInput(seed++, interpreter); + ShowInputCRC32(&interpreter); + MicroPrintf(""); // null MicroPrintf serves as a newline. + TfLiteStatus status = interpreter.Invoke(); if ((status != kTfLiteOk) && (static_cast(status) != kTfLiteAbort)) { MicroPrintf("Model interpreter invocation failed: %d\n", status); diff --git a/tensorflow/lite/micro/tools/make/ext_libs/xtensa.inc b/tensorflow/lite/micro/tools/make/ext_libs/xtensa.inc index 28378add2f1..70e1880c800 100644 --- a/tensorflow/lite/micro/tools/make/ext_libs/xtensa.inc +++ b/tensorflow/lite/micro/tools/make/ext_libs/xtensa.inc @@ -58,10 +58,6 @@ else ifeq ($(TARGET_ARCH), hifi5) CCFLAGS += $(PLATFORM_FLAGS) CXXFLAGS += $(PLATFORM_FLAGS) - # override KERNEL_OPTIMIZATION_LEVEL to enable higher performance - # Xtensa intrinsics. - KERNEL_OPTIMIZATION_LEVEL := -O3 -LNO:simd - NNLIB_PATH := $(MAKEFILE_DIR)/downloads/xa_nnlib_hifi5 NDSPLIB_PATH := $(MAKEFILE_DIR)/downloads/ndsplib-hifi5 diff --git a/tensorflow/lite/micro/tools/make/targets/xtensa_makefile.inc b/tensorflow/lite/micro/tools/make/targets/xtensa_makefile.inc index 92527adce53..8a3ee7b6716 100644 --- a/tensorflow/lite/micro/tools/make/targets/xtensa_makefile.inc +++ b/tensorflow/lite/micro/tools/make/targets/xtensa_makefile.inc @@ -97,4 +97,10 @@ ifeq ($(OPTIMIZED_KERNEL_DIR), xtensa) $(TENSORFLOW_ROOT)tensorflow/lite/micro/kernels/xtensa/lstm_eval.cc \ $(TENSORFLOW_ROOT)tensorflow/lite/micro/kernels/xtensa/lstm_eval_hifi.cc \ $(TENSORFLOW_ROOT)tensorflow/lite/micro/kernels/xtensa/unidirectional_sequence_lstm.cc + + # override KERNEL_OPTIMIZATION_LEVEL to enable higher performance + # Xtensa intrinsics. +$(KERNEL_OBJDIR)$(TENSORFLOW_ROOT)tensorflow/lite/micro/kernels/xtensa/decompress.o: $(TENSORFLOW_ROOT)tensorflow/lite/micro/kernels/xtensa/decompress.cc + @mkdir -p $(dir $@) + $(CXX) $(CXXFLAGS) -O3 -LNO:simd $(INCLUDES) -c $< -o $@ endif