Merge pull request #38861 from mansnils:update_mve_flag

PiperOrigin-RevId: 316991673
Change-Id: I915b9ecf9e2a53ad93440aa8926fee8dae134666
This commit is contained in:
TensorFlower Gardener 2020-06-17 16:52:02 -07:00
commit b664b58e68
5 changed files with 11 additions and 15 deletions

View File

@ -115,7 +115,7 @@ void* Init(TfLiteContext* context, const char* buffer, size_t length) {
}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
#if defined(__ARM_FEATURE_DSP)
#if defined(__ARM_FEATURE_DSP) || defined(__ARM_FEATURE_MVE)
OpData data;
int32_t buf_size = 0;
@ -240,7 +240,7 @@ TfLiteStatus EvalQuantizedPerChannel(
quant_params.multiplier = data->per_channel_output_multiplier;
quant_params.shift = data->per_channel_output_shift;
#if defined(__ARM_FEATURE_DSP)
#if defined(__ARM_FEATURE_DSP) || defined(__ARM_FEATURE_MVE)
RuntimeShape filter_shape = GetTensorShape(filter);
RuntimeShape input_shape = GetTensorShape(input);
RuntimeShape output_shape = GetTensorShape(output);

View File

@ -104,7 +104,7 @@ void* Init(TfLiteContext* context, const char* buffer, size_t length) {
}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
#if defined(__ARM_FEATURE_DSP)
#if defined(__ARM_FEATURE_DSP) || defined(__ARM_FEATURE_MVE)
auto* params =
reinterpret_cast<TfLiteDepthwiseConvParams*>(node->builtin_data);
@ -186,7 +186,7 @@ TfLiteStatus EvalQuantizedPerChannel(TfLiteContext* context, TfLiteNode* node,
op_params.quantized_activation_min = std::numeric_limits<int8_t>::min();
op_params.quantized_activation_max = std::numeric_limits<int8_t>::max();
#if defined(__ARM_FEATURE_DSP)
#if defined(__ARM_FEATURE_DSP) || defined(__ARM_FEATURE_MVE)
RuntimeShape filter_shape = GetTensorShape(filter);
const int filter_height = filter_shape.Dims(1);
const int filter_width = filter_shape.Dims(2);
@ -284,7 +284,7 @@ TfLiteStatus EvalQuantized(TfLiteContext* context, TfLiteNode* node,
// Legacy ops used mixed left and right shifts. Now all are +ve-means-left.
op_params.output_shift = -data->output_shift;
#if defined(__ARM_FEATURE_DSP)
#if defined(__ARM_FEATURE_DSP) || defined(__ARM_FEATURE_MVE)
// optimizations utilize loop unrolling which requires the following power
// of two kernel dimensions
RuntimeShape filter_shape = GetTensorShape(filter);

View File

@ -84,11 +84,11 @@ TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
TF_LITE_ENSURE_TYPES_EQ(context, input->type, output->type);
TF_LITE_ENSURE_MSG(context, input->type == filter->type,
"Hybrid models are not supported on TFLite Micro.");
#if defined(__ARM_FEATURE_DSP)
#if defined(__ARM_FEATURE_DSP) || defined(__ARM_FEATURE_MVE)
RuntimeShape filter_shape = GetTensorShape(filter);
const int filter_dim_count = filter_shape.DimensionsCount();
const int accum_depth = filter_shape.Dims(filter_dim_count - 1);
const int32_t buf_size = arm_fully_connected_s8_get_buffer_size(accum_depth);
int* buffer_idx = reinterpret_cast<int*>(node->user_data);
@ -101,6 +101,7 @@ TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
*buffer_idx = -1;
}
#endif
return kTfLiteOk;
}
@ -116,7 +117,7 @@ TfLiteStatus EvalQuantizedInt8(TfLiteContext* context, TfLiteNode* node,
const int filter_dim_count = filter_shape.DimensionsCount();
const int accum_depth = filter_shape.Dims(filter_dim_count - 1);
#if defined(__ARM_FEATURE_DSP)
#if defined(__ARM_FEATURE_DSP) || defined(__ARM_FEATURE_MVE)
int16_t* buf = nullptr;
auto* buffer_idx = reinterpret_cast<int*>(node->user_data);

View File

@ -106,7 +106,7 @@ TfLiteStatus AverageEvalInt8(TfLiteContext* context, const TfLiteNode* node,
TFLITE_DCHECK_LE(activation_min, activation_max);
#if defined(__ARM_FEATURE_DSP)
#if defined(__ARM_FEATURE_DSP) || defined(__ARM_FEATURE_MVE)
RuntimeShape input_shape = GetTensorShape(input);
TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
@ -283,7 +283,7 @@ void* Init(TfLiteContext* context, const char* buffer, size_t length) {
}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
#if defined(__ARM_FEATURE_DSP)
#if defined(__ARM_FEATURE_DSP) || defined(__ARM_FEATURE_MVE)
const TfLiteTensor* input = GetInput(context, node, kInputTensor);
const TfLiteTensor* output = GetOutput(context, node, kOutputTensor);

View File

@ -8,11 +8,6 @@ ifneq ($(filter cmsis-nn,$(ALL_TAGS)),)
THIRD_PARTY_DOWNLOADS += \
$(eval $(call add_third_party_download,$(CMSIS_URL),$(CMSIS_MD5),cmsis,patch_cmsis))
ifneq (,$(filter $(TARGET_ARCH), cortex-m55))
CCFLAGS += -DARM_MATH_MVEI
CXXFLAGS += -DARM_MATH_MVEI
endif
CMSIS_PATH = $(MAKEFILE_DIR)/downloads/cmsis/
# List of files generated with: