From 600e5073ed7e2e440c41b31c9356c9ee62fc9ce1 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Fri, 19 Sep 2025 15:21:41 -0700 Subject: [PATCH 1/4] Updated docker to use clang-21 --- ci/Dockerfile.micro | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ci/Dockerfile.micro b/ci/Dockerfile.micro index 80b6e6c81ff..325ade362a5 100644 --- a/ci/Dockerfile.micro +++ b/ci/Dockerfile.micro @@ -37,12 +37,12 @@ RUN apt-get install -y zip xxd sudo RUN apt install -y lsb-release wget software-properties-common gnupg RUN wget https://apt.llvm.org/llvm.sh RUN chmod +x llvm.sh -RUN ./llvm.sh 16 -RUN ln -s /usr/bin/clang-16 /usr/bin/clang -RUN ln -s /usr/bin/clang++-16 /usr/bin/clang++ +RUN ./llvm.sh 21 +RUN ln -s /usr/bin/clang-21 /usr/bin/clang +RUN ln -s /usr/bin/clang++-21 /usr/bin/clang++ -RUN apt-get install clang-format-16 -RUN ln -s /usr/bin/clang-format-16 /usr/bin/clang-format +RUN apt-get install clang-format-21 +RUN ln -s /usr/bin/clang-format-21 /usr/bin/clang-format # Needed when using the Dockerfile locally. RUN git config --global --add safe.directory /opt/tflm From d332bb8fe210a51387fa4be00656506874a057b0 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 19 Aug 2025 09:35:07 -0700 Subject: [PATCH 2/4] clang-format some existing files --- signal/micro/kernels/stacker_test.cc | 18 ++++----- .../compiler/mlir/lite/schema/schema_utils.h | 4 +- .../microfrontend/lib/filterbank_test.cc | 34 ++++++++++------- .../microfrontend/lib/noise_reduction_test.cc | 10 +++-- .../lib/pcan_gain_control_test.cc | 5 ++- .../internal/reference/integer_ops/conv.h | 1 - .../cortex_m_corstone_300/system_setup.cc | 4 +- .../arc_mli/mli_function_specializations.h | 38 ++++++++++--------- .../micro/kernels/arc_mli/mli_interface.h | 2 +- .../lite/micro/kernels/circular_buffer.cc | 4 +- .../lite/micro/kernels/reduce_common.cc | 2 +- .../micro/kernels/resize_bilinear_test.cc | 12 ++++-- .../kernels/resize_nearest_neighbor_test.cc | 18 ++++++--- .../micro/kernels/xtensa/lstm_eval_hifi.cc | 20 +++++----- 14 files changed, 96 insertions(+), 76 deletions(-) diff --git a/signal/micro/kernels/stacker_test.cc b/signal/micro/kernels/stacker_test.cc index d236c7539a8..e45eab39b03 100644 --- a/signal/micro/kernels/stacker_test.cc +++ b/signal/micro/kernels/stacker_test.cc @@ -32,15 +32,15 @@ class StackerKernelRunner { StackerKernelRunner(int* input_dims_data, const int16_t* input_data, int* output_dims_data, int16_t* output_data, int* output_ready_dims_data, bool* ouput_ready_data) - : tensors_{testing::CreateTensor( - input_data, - tflite::testing::IntArrayFromInts(input_dims_data)), - testing::CreateTensor( - output_data, - tflite::testing::IntArrayFromInts(output_dims_data)), - testing::CreateTensor( - ouput_ready_data, - testing::IntArrayFromInts(output_ready_dims_data))}, + : tensors_{ + testing::CreateTensor( + input_data, tflite::testing::IntArrayFromInts(input_dims_data)), + testing::CreateTensor( + output_data, + tflite::testing::IntArrayFromInts(output_dims_data)), + testing::CreateTensor( + ouput_ready_data, + testing::IntArrayFromInts(output_ready_dims_data))}, inputs_array_{testing::IntArrayFromInts(inputs_array_data_)}, outputs_array_{testing::IntArrayFromInts(outputs_array_data_)}, kernel_runner_{*registration_, tensors_, kTensorsSize, diff --git a/tensorflow/compiler/mlir/lite/schema/schema_utils.h b/tensorflow/compiler/mlir/lite/schema/schema_utils.h index 7498aa02ebe..4a71a878430 100644 --- a/tensorflow/compiler/mlir/lite/schema/schema_utils.h +++ b/tensorflow/compiler/mlir/lite/schema/schema_utils.h @@ -24,9 +24,9 @@ namespace tflite { // problem. The new builtin operator will be assigned to the extended builtin // code field in the flatbuffer schema. Those methods helps to hide builtin code // details. -BuiltinOperator GetBuiltinCode(const OperatorCode *op_code); +BuiltinOperator GetBuiltinCode(const OperatorCode* op_code); -BuiltinOperator GetBuiltinCode(const OperatorCodeT *op_code); +BuiltinOperator GetBuiltinCode(const OperatorCodeT* op_code); } // namespace tflite diff --git a/tensorflow/lite/experimental/microfrontend/lib/filterbank_test.cc b/tensorflow/lite/experimental/microfrontend/lib/filterbank_test.cc index 050d43359b6..350a34d3783 100644 --- a/tensorflow/lite/experimental/microfrontend/lib/filterbank_test.cc +++ b/tensorflow/lite/experimental/microfrontend/lib/filterbank_test.cc @@ -76,8 +76,9 @@ TF_LITE_MICRO_TEST(FilterbankTest_CheckChannelFrequencyStarts) { kSampleRate, kSpectrumSize)); const int16_t expected[] = {0, 4, 8}; - TF_LITE_MICRO_EXPECT_EQ(state.num_channels + 1, - static_cast(sizeof(expected) / sizeof(expected[0]))); + TF_LITE_MICRO_EXPECT_EQ( + state.num_channels + 1, + static_cast(sizeof(expected) / sizeof(expected[0]))); int i; for (i = 0; i <= state.num_channels; ++i) { TF_LITE_MICRO_EXPECT_EQ(state.channel_frequency_starts[i], expected[i]); @@ -93,8 +94,9 @@ TF_LITE_MICRO_TEST(FilterbankTest_CheckChannelWeightStarts) { kSampleRate, kSpectrumSize)); const int16_t expected[] = {0, 8, 16}; - TF_LITE_MICRO_EXPECT_EQ(state.num_channels + 1, - static_cast(sizeof(expected) / sizeof(expected[0]))); + TF_LITE_MICRO_EXPECT_EQ( + state.num_channels + 1, + static_cast(sizeof(expected) / sizeof(expected[0]))); int i; for (i = 0; i <= state.num_channels; ++i) { TF_LITE_MICRO_EXPECT_EQ(state.channel_weight_starts[i], expected[i]); @@ -110,8 +112,9 @@ TF_LITE_MICRO_TEST(FilterbankTest_CheckChannelWidths) { kSampleRate, kSpectrumSize)); const int16_t expected[] = {8, 8, 8}; - TF_LITE_MICRO_EXPECT_EQ(state.num_channels + 1, - static_cast(sizeof(expected) / sizeof(expected[0]))); + TF_LITE_MICRO_EXPECT_EQ( + state.num_channels + 1, + static_cast(sizeof(expected) / sizeof(expected[0]))); int i; for (i = 0; i <= state.num_channels; ++i) { TF_LITE_MICRO_EXPECT_EQ(state.channel_widths[i], expected[i]); @@ -129,9 +132,10 @@ TF_LITE_MICRO_TEST(FilterbankTest_CheckWeights) { const int16_t expected[] = {0, 3277, 2217, 1200, 222, 0, 0, 0, 0, 3376, 2468, 1591, 744, 0, 0, 0, 0, 4020, 3226, 2456, 1708, 983, 277, 0}; - TF_LITE_MICRO_EXPECT_EQ(state.channel_weight_starts[state.num_channels] + - state.channel_widths[state.num_channels], - static_cast(sizeof(expected) / sizeof(expected[0]))); + TF_LITE_MICRO_EXPECT_EQ( + state.channel_weight_starts[state.num_channels] + + state.channel_widths[state.num_channels], + static_cast(sizeof(expected) / sizeof(expected[0]))); for (size_t i = 0; i < sizeof(expected) / sizeof(expected[0]); ++i) { TF_LITE_MICRO_EXPECT_EQ(state.weights[i], expected[i]); } @@ -148,9 +152,10 @@ TF_LITE_MICRO_TEST(FilterbankTest_CheckUnweights) { const int16_t expected[] = {0, 819, 1879, 2896, 3874, 0, 0, 0, 0, 720, 1628, 2505, 3352, 0, 0, 0, 0, 76, 870, 1640, 2388, 3113, 3819, 0}; - TF_LITE_MICRO_EXPECT_EQ(state.channel_weight_starts[state.num_channels] + - state.channel_widths[state.num_channels], - static_cast(sizeof(expected) / sizeof(expected[0]))); + TF_LITE_MICRO_EXPECT_EQ( + state.channel_weight_starts[state.num_channels] + + state.channel_widths[state.num_channels], + static_cast(sizeof(expected) / sizeof(expected[0]))); for (size_t i = 0; i < sizeof(expected) / sizeof(expected[0]); ++i) { TF_LITE_MICRO_EXPECT_EQ(state.unweights[i], expected[i]); } @@ -204,8 +209,9 @@ TF_LITE_MICRO_TEST(FilterbankTest_CheckSqrt) { uint32_t* scaled_filterbank = FilterbankSqrt(&state, kScaleShift); const uint32_t expected[] = {247311, 508620}; - TF_LITE_MICRO_EXPECT_EQ(state.num_channels, - static_cast(sizeof(expected) / sizeof(expected[0]))); + TF_LITE_MICRO_EXPECT_EQ( + state.num_channels, + static_cast(sizeof(expected) / sizeof(expected[0]))); int i; for (i = 0; i < state.num_channels; ++i) { TF_LITE_MICRO_EXPECT_EQ(scaled_filterbank[i], expected[i]); diff --git a/tensorflow/lite/experimental/microfrontend/lib/noise_reduction_test.cc b/tensorflow/lite/experimental/microfrontend/lib/noise_reduction_test.cc index cdfb4c97248..e2941010864 100644 --- a/tensorflow/lite/experimental/microfrontend/lib/noise_reduction_test.cc +++ b/tensorflow/lite/experimental/microfrontend/lib/noise_reduction_test.cc @@ -48,8 +48,9 @@ TF_LITE_MICRO_TEST(NoiseReductionTest_TestNoiseReductionEstimate) { NoiseReductionApply(&state, signal); const uint32_t expected[] = {6321887, 31248341}; - TF_LITE_MICRO_EXPECT_EQ(state.num_channels, - static_cast(sizeof(expected) / sizeof(expected[0]))); + TF_LITE_MICRO_EXPECT_EQ( + state.num_channels, + static_cast(sizeof(expected) / sizeof(expected[0]))); int i; for (i = 0; i < state.num_channels; ++i) { TF_LITE_MICRO_EXPECT_EQ(state.estimate[i], expected[i]); @@ -68,8 +69,9 @@ TF_LITE_MICRO_TEST(NoiseReductionTest_TestNoiseReduction) { NoiseReductionApply(&state, signal); const uint32_t expected[] = {241137, 478104}; - TF_LITE_MICRO_EXPECT_EQ(state.num_channels, - static_cast(sizeof(expected) / sizeof(expected[0]))); + TF_LITE_MICRO_EXPECT_EQ( + state.num_channels, + static_cast(sizeof(expected) / sizeof(expected[0]))); int i; for (i = 0; i < state.num_channels; ++i) { TF_LITE_MICRO_EXPECT_EQ(signal[i], expected[i]); diff --git a/tensorflow/lite/experimental/microfrontend/lib/pcan_gain_control_test.cc b/tensorflow/lite/experimental/microfrontend/lib/pcan_gain_control_test.cc index 21f9aef6c04..ead6cccbb58 100644 --- a/tensorflow/lite/experimental/microfrontend/lib/pcan_gain_control_test.cc +++ b/tensorflow/lite/experimental/microfrontend/lib/pcan_gain_control_test.cc @@ -52,8 +52,9 @@ TF_LITE_MICRO_TEST(PcanGainControlTest_TestPcanGainControl) { PcanGainControlApply(&state, signal); const uint32_t expected[] = {3578, 1533}; - TF_LITE_MICRO_EXPECT_EQ(state.num_channels, - static_cast(sizeof(expected) / sizeof(expected[0]))); + TF_LITE_MICRO_EXPECT_EQ( + state.num_channels, + static_cast(sizeof(expected) / sizeof(expected[0]))); int i; for (i = 0; i < state.num_channels; ++i) { TF_LITE_MICRO_EXPECT_EQ(signal[i], expected[i]); diff --git a/tensorflow/lite/kernels/internal/reference/integer_ops/conv.h b/tensorflow/lite/kernels/internal/reference/integer_ops/conv.h index eac00576a25..5638c7eee2f 100644 --- a/tensorflow/lite/kernels/internal/reference/integer_ops/conv.h +++ b/tensorflow/lite/kernels/internal/reference/integer_ops/conv.h @@ -135,7 +135,6 @@ inline void ConvPerChannel( } } - // Fixed-point per-channel-quantization convolution reference kernel. // 16-bit data and 8-bit filter template diff --git a/tensorflow/lite/micro/cortex_m_corstone_300/system_setup.cc b/tensorflow/lite/micro/cortex_m_corstone_300/system_setup.cc index 3ff84214309..cc87200c1c3 100644 --- a/tensorflow/lite/micro/cortex_m_corstone_300/system_setup.cc +++ b/tensorflow/lite/micro/cortex_m_corstone_300/system_setup.cc @@ -104,8 +104,8 @@ uint32_t GetCurrentTimeTicks() { #ifdef ETHOS_U #if defined(ETHOSU_FAST_MEMORY_SIZE) && ETHOSU_FAST_MEMORY_SIZE > 0 -__attribute__((aligned(16), section(".bss.ethosu_scratch"))) -uint8_t ethosu0_scratch[ETHOSU_FAST_MEMORY_SIZE]; +__attribute__((aligned(16), section(".bss.ethosu_scratch"))) uint8_t + ethosu0_scratch[ETHOSU_FAST_MEMORY_SIZE]; #else #define ethosu0_scratch 0 #define ETHOSU_FAST_MEMORY_SIZE 0 diff --git a/tensorflow/lite/micro/kernels/arc_mli/mli_function_specializations.h b/tensorflow/lite/micro/kernels/arc_mli/mli_function_specializations.h index 6276fe73380..94d2a48cf27 100644 --- a/tensorflow/lite/micro/kernels/arc_mli/mli_function_specializations.h +++ b/tensorflow/lite/micro/kernels/arc_mli/mli_function_specializations.h @@ -25,8 +25,8 @@ typedef mli_status (*conv_func_ptr)(const mli_tensor* /*in*/, mli_tensor* /*out*/); #ifdef MLI_2_0 -conv_func_ptr __attribute__((weak)) -mli_krn_conv2d_hwcn(const mli_tensor* weights) { +conv_func_ptr + __attribute__((weak)) mli_krn_conv2d_hwcn(const mli_tensor* weights) { int filter_w = weights->shape[KRNL_W_DIM_HWCN]; int filter_h = weights->shape[KRNL_H_DIM_HWCN]; @@ -41,8 +41,9 @@ mli_krn_conv2d_hwcn(const mli_tensor* weights) { } } #else -conv_func_ptr __attribute__((weak)) -mli_krn_conv2d_hwcn(const mli_tensor* weights, const mli_conv2d_cfg* cfg) { +conv_func_ptr + __attribute__((weak)) mli_krn_conv2d_hwcn(const mli_tensor* weights, + const mli_conv2d_cfg* cfg) { return mli_krn_conv2d_nhwc_sa8_sa8_sa32; } #endif @@ -55,8 +56,8 @@ typedef mli_status (*depthwise_func_ptr)(const mli_tensor* /*in*/, mli_tensor* /*out*/); #ifdef MLI_2_0 -depthwise_func_ptr __attribute__((weak)) -mli_krn_depthwise_conv2d(const mli_tensor* weights) { +depthwise_func_ptr + __attribute__((weak)) mli_krn_depthwise_conv2d(const mli_tensor* weights) { int filter_w = weights->shape[KRNL_DW_W_DIM_HW1N]; int filter_h = weights->shape[KRNL_DW_H_DIM_HW1N]; @@ -69,15 +70,16 @@ mli_krn_depthwise_conv2d(const mli_tensor* weights) { } } #else -depthwise_func_ptr __attribute__((weak)) -mli_krn_depthwise_conv2d(const mli_tensor* weights, const mli_conv2d_cfg* cfg) { +depthwise_func_ptr + __attribute__((weak)) mli_krn_depthwise_conv2d(const mli_tensor* weights, + const mli_conv2d_cfg* cfg) { return mli_krn_depthwise_conv2d_hwcn_sa8_sa8_sa32; } #endif #ifdef MLI_2_0 -depthwise_func_ptr __attribute__((weak)) -mli_krn_group_conv2d(const mli_tensor* weights) { +depthwise_func_ptr + __attribute__((weak)) mli_krn_group_conv2d(const mli_tensor* weights) { int filter_w = weights->shape[KRNL_DW_W_DIM_HW1N]; int filter_h = weights->shape[KRNL_DW_H_DIM_HW1N]; @@ -97,8 +99,8 @@ typedef mli_status (*pooling_func_ptr)(const mli_tensor* /*in*/, mli_tensor* /*out*/); #ifdef MLI_2_0 -pooling_func_ptr __attribute__((weak)) -mli_krn_avepool(const mli_pool_cfg* cfg) { +pooling_func_ptr + __attribute__((weak)) mli_krn_avepool(const mli_pool_cfg* cfg) { int filter_w = cfg->kernel_width; int filter_h = cfg->kernel_height; @@ -111,15 +113,15 @@ mli_krn_avepool(const mli_pool_cfg* cfg) { } } #else -pooling_func_ptr __attribute__((weak)) -mli_krn_avepool(const mli_pool_cfg* cfg) { +pooling_func_ptr + __attribute__((weak)) mli_krn_avepool(const mli_pool_cfg* cfg) { return mli_krn_avepool_hwc_sa8; } #endif #ifdef MLI_2_0 -pooling_func_ptr __attribute__((weak)) -mli_krn_maxpool(const mli_pool_cfg* cfg) { +pooling_func_ptr + __attribute__((weak)) mli_krn_maxpool(const mli_pool_cfg* cfg) { int filter_w = cfg->kernel_width; int filter_h = cfg->kernel_height; @@ -132,8 +134,8 @@ mli_krn_maxpool(const mli_pool_cfg* cfg) { } } #else -pooling_func_ptr __attribute__((weak)) -mli_krn_maxpool(const mli_pool_cfg* cfg) { +pooling_func_ptr + __attribute__((weak)) mli_krn_maxpool(const mli_pool_cfg* cfg) { return mli_krn_maxpool_hwc_sa8; } #endif diff --git a/tensorflow/lite/micro/kernels/arc_mli/mli_interface.h b/tensorflow/lite/micro/kernels/arc_mli/mli_interface.h index b4087f3b87b..e260774570f 100644 --- a/tensorflow/lite/micro/kernels/arc_mli/mli_interface.h +++ b/tensorflow/lite/micro/kernels/arc_mli/mli_interface.h @@ -33,7 +33,7 @@ class MliTensorInterface { public: // Make sure that lifetime of MliTensorInterface instance isn't bigger than // related mli_tensor. - MliTensorInterface(mli_tensor* tensor) : tensor_(tensor){}; + MliTensorInterface(mli_tensor* tensor) : tensor_(tensor) {}; MliTensorInterface() = default; ~MliTensorInterface() = default; diff --git a/tensorflow/lite/micro/kernels/circular_buffer.cc b/tensorflow/lite/micro/kernels/circular_buffer.cc index 3e901047bbc..0d3d4b41b90 100644 --- a/tensorflow/lite/micro/kernels/circular_buffer.cc +++ b/tensorflow/lite/micro/kernels/circular_buffer.cc @@ -91,8 +91,8 @@ TfLiteStatus CircularBufferEval(TfLiteContext* context, TfLiteNode* node) { EvalInt8(tflite::micro::GetTensorData(input), num_slots, depth, tflite::micro::GetTensorData(output)); } else { - MicroPrintf("Type %s (%d) not supported.", - TfLiteTypeGetName(input->type), input->type); + MicroPrintf("Type %s (%d) not supported.", TfLiteTypeGetName(input->type), + input->type); return kTfLiteError; } diff --git a/tensorflow/lite/micro/kernels/reduce_common.cc b/tensorflow/lite/micro/kernels/reduce_common.cc index 8aeb529d757..cdc95d89424 100644 --- a/tensorflow/lite/micro/kernels/reduce_common.cc +++ b/tensorflow/lite/micro/kernels/reduce_common.cc @@ -120,7 +120,7 @@ enum MinMaxEvalType { kEvalMin, kEvalMax }; template struct MinMaxReducerCompare { MinMaxReducerCompare() = delete; - MinMaxReducerCompare(MinMaxEvalType evalType) : type_(evalType){}; + MinMaxReducerCompare(MinMaxEvalType evalType) : type_(evalType) {}; constexpr T initialValue() const { return (type_ == kEvalMin) ? std::numeric_limits::max() diff --git a/tensorflow/lite/micro/kernels/resize_bilinear_test.cc b/tensorflow/lite/micro/kernels/resize_bilinear_test.cc index b52cebeb668..3208acde5c6 100644 --- a/tensorflow/lite/micro/kernels/resize_bilinear_test.cc +++ b/tensorflow/lite/micro/kernels/resize_bilinear_test.cc @@ -168,8 +168,10 @@ TF_LITE_MICRO_TEST(VerticalResizeInt8) { TF_LITE_MICRO_TEST(TwoDimensionalResize) { int input_dims[] = {4, 1, 2, 2, 1}; const float input_data[] = { - 3, 6, // - 9, 12, // + 3, + 6, // + 9, + 12, // }; const int32_t expected_size_data[] = {3, 3}; const float expected_output_data[] = { @@ -194,8 +196,10 @@ TF_LITE_MICRO_TEST(TwoDimensionalResize) { TF_LITE_MICRO_TEST(TwoDimensionalResizeInt8) { int input_dims[] = {4, 1, 2, 2, 1}; const int8_t input_data[] = { - 3, 6, // - 9, 12, // + 3, + 6, // + 9, + 12, // }; const int32_t expected_size_data[] = {3, 3}; const int8_t expected_output_data[] = { diff --git a/tensorflow/lite/micro/kernels/resize_nearest_neighbor_test.cc b/tensorflow/lite/micro/kernels/resize_nearest_neighbor_test.cc index 3e06da8fac0..818cafc2fa8 100644 --- a/tensorflow/lite/micro/kernels/resize_nearest_neighbor_test.cc +++ b/tensorflow/lite/micro/kernels/resize_nearest_neighbor_test.cc @@ -156,8 +156,10 @@ TF_LITE_MICRO_TEST(VerticalResizeInt16) { TF_LITE_MICRO_TEST(TwoDimensionalResize) { int input_dims[] = {4, 1, 2, 2, 1}; const float input_data[] = { - 3, 6, // - 9, 12, // + 3, + 6, // + 9, + 12, // }; const int32_t expected_size_data[] = {3, 3}; const float expected_output_data[] = { @@ -177,8 +179,10 @@ TF_LITE_MICRO_TEST(TwoDimensionalResize) { TF_LITE_MICRO_TEST(TwoDimensionalResizeInt8) { int input_dims[] = {4, 1, 2, 2, 1}; const int8_t input_data[] = { - 3, -6, // - 9, 12, // + 3, + -6, // + 9, + 12, // }; const int32_t expected_size_data[] = {3, 3}; const int8_t expected_output_data[] = { @@ -197,8 +201,10 @@ TF_LITE_MICRO_TEST(TwoDimensionalResizeInt8) { TF_LITE_MICRO_TEST(TwoDimensionalResizeInt16) { int input_dims[] = {4, 1, 2, 2, 1}; const int16_t input_data[] = { - 3, -6, // - 9, 12, // + 3, + -6, // + 9, + 12, // }; const int32_t expected_size_data[] = {3, 3}; const int16_t expected_output_data[] = { diff --git a/tensorflow/lite/micro/kernels/xtensa/lstm_eval_hifi.cc b/tensorflow/lite/micro/kernels/xtensa/lstm_eval_hifi.cc index f8b6fd806f0..84aa63228c3 100644 --- a/tensorflow/lite/micro/kernels/xtensa/lstm_eval_hifi.cc +++ b/tensorflow/lite/micro/kernels/xtensa/lstm_eval_hifi.cc @@ -162,7 +162,7 @@ void calc_cell_state_without_cifg(int16_t* cell_state, // residue iterations #pragma concurrent #pragma loop_count max = 7 - for (i = 0; i < ((num_elms)&7); i++) { + for (i = 0; i < ((num_elms) & 7); i++) { d_cs_r_0 = p16_cs_r[i]; d_fg_0 = p16_fg_r[i]; d_cg_0 = p16_cg_r[i]; @@ -227,7 +227,7 @@ void calc_cell_state_without_cifg(int16_t* cell_state, // residue iterations #pragma concurrent #pragma loop_count max = 7 - for (i = 0; i < ((num_elms)&7); i++) { + for (i = 0; i < ((num_elms) & 7); i++) { d_cs_r_0 = p16_cs_r[i]; d_fg_0 = p16_fg_r[i]; d_cg_0 = p16_cg_r[i]; @@ -336,7 +336,7 @@ void calc_cell_state_with_cifg(int16_t* cell_state, const int16_t* forget_gate, // residue iterations #pragma concurrent #pragma loop_count max = 7 - for (i = 0; i < ((num_elms)&7); i++) { + for (i = 0; i < ((num_elms) & 7); i++) { d_cs_r_0 = p16_cs_r[i]; d_fg_0 = p16_fg_r[i]; d_cg_0 = p16_cg_r[i]; @@ -401,7 +401,7 @@ void calc_cell_state_with_cifg(int16_t* cell_state, const int16_t* forget_gate, // residue iterations #pragma concurrent #pragma loop_count max = 7 - for (i = 0; i < ((num_elms)&7); i++) { + for (i = 0; i < ((num_elms) & 7); i++) { d_cs_r_0 = p16_cs_r[i]; d_fg_0 = p16_fg_r[i]; d_cg_0 = p16_cg_r[i]; @@ -481,7 +481,7 @@ void xa_nn_elm_mul_16x16_asym8s(int8_t* output, const int16_t* input_1, // residue iterations #pragma concurrent #pragma loop_count max = 7 - for (int j = 0; j < ((num_elms)&7); j++) { + for (int j = 0; j < ((num_elms) & 7); j++) { AE_L16_IP(data_a_0, (ae_int16*)tmp_input_1, 2); AE_L16_IP(data_b_0, (ae_int16*)tmp_input_2, 2); @@ -668,7 +668,7 @@ void calc_cell_state_without_cifg(int16_t* cell_state, // residue iterations #pragma concurrent #pragma loop_count max = 7 - for (i = 0; i < ((num_elms)&7); i++) { + for (i = 0; i < ((num_elms) & 7); i++) { d_cs_r_0 = p16_cs_r[i]; d_fg_0 = p16_fg_r[i]; d_cg_0 = p16_cg_r[i]; @@ -738,7 +738,7 @@ void calc_cell_state_without_cifg(int16_t* cell_state, // residue iterations #pragma concurrent #pragma loop_count max = 7 - for (i = 0; i < ((num_elms)&7); i++) { + for (i = 0; i < ((num_elms) & 7); i++) { d_cs_r_0 = p16_cs_r[i]; d_fg_0 = p16_fg_r[i]; d_cg_0 = p16_cg_r[i]; @@ -851,7 +851,7 @@ void calc_cell_state_with_cifg(int16_t* cell_state, const int16_t* forget_gate, // residue iterations #pragma concurrent #pragma loop_count max = 7 - for (i = 0; i < ((num_elms)&7); i++) { + for (i = 0; i < ((num_elms) & 7); i++) { d_cs_r_0 = p16_cs_r[i]; d_fg_0 = p16_fg_r[i]; d_cg_0 = p16_cg_r[i]; @@ -920,7 +920,7 @@ void calc_cell_state_with_cifg(int16_t* cell_state, const int16_t* forget_gate, // residue iterations #pragma concurrent #pragma loop_count max = 7 - for (i = 0; i < ((num_elms)&7); i++) { + for (i = 0; i < ((num_elms) & 7); i++) { d_cs_r_0 = p16_cs_r[i]; d_fg_0 = p16_fg_r[i]; d_cg_0 = p16_cg_r[i]; @@ -996,7 +996,7 @@ void xa_nn_elm_mul_16x16_asym8s(int8_t* output, const int16_t* input_1, // residue iterations #pragma concurrent #pragma loop_count max = 3 - for (int j = 0; j < ((num_elms)&3); j++) { + for (int j = 0; j < ((num_elms) & 3); j++) { AE_L16_IP(data_a_0, (ae_int16*)tmp_input_1, 2); AE_L16_IP(data_b_0, (ae_int16*)tmp_input_2, 2); From eec0aa6efeab3500263e9f9a2010c1aadd77befa Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Sat, 20 Sep 2025 09:18:22 -0700 Subject: [PATCH 3/4] Fix --- signal/micro/kernels/stacker_test.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/signal/micro/kernels/stacker_test.cc b/signal/micro/kernels/stacker_test.cc index e45eab39b03..d236c7539a8 100644 --- a/signal/micro/kernels/stacker_test.cc +++ b/signal/micro/kernels/stacker_test.cc @@ -32,15 +32,15 @@ class StackerKernelRunner { StackerKernelRunner(int* input_dims_data, const int16_t* input_data, int* output_dims_data, int16_t* output_data, int* output_ready_dims_data, bool* ouput_ready_data) - : tensors_{ - testing::CreateTensor( - input_data, tflite::testing::IntArrayFromInts(input_dims_data)), - testing::CreateTensor( - output_data, - tflite::testing::IntArrayFromInts(output_dims_data)), - testing::CreateTensor( - ouput_ready_data, - testing::IntArrayFromInts(output_ready_dims_data))}, + : tensors_{testing::CreateTensor( + input_data, + tflite::testing::IntArrayFromInts(input_dims_data)), + testing::CreateTensor( + output_data, + tflite::testing::IntArrayFromInts(output_dims_data)), + testing::CreateTensor( + ouput_ready_data, + testing::IntArrayFromInts(output_ready_dims_data))}, inputs_array_{testing::IntArrayFromInts(inputs_array_data_)}, outputs_array_{testing::IntArrayFromInts(outputs_array_data_)}, kernel_runner_{*registration_, tensors_, kTensorsSize, From ad15031bf7ac201fe51a44008e26bf6fe41a2d88 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Sat, 20 Sep 2025 09:19:09 -0700 Subject: [PATCH 4/4] Undo tflite files --- tensorflow/compiler/mlir/lite/schema/schema_utils.h | 4 ++-- tensorflow/lite/kernels/internal/reference/integer_ops/conv.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tensorflow/compiler/mlir/lite/schema/schema_utils.h b/tensorflow/compiler/mlir/lite/schema/schema_utils.h index 4a71a878430..7498aa02ebe 100644 --- a/tensorflow/compiler/mlir/lite/schema/schema_utils.h +++ b/tensorflow/compiler/mlir/lite/schema/schema_utils.h @@ -24,9 +24,9 @@ namespace tflite { // problem. The new builtin operator will be assigned to the extended builtin // code field in the flatbuffer schema. Those methods helps to hide builtin code // details. -BuiltinOperator GetBuiltinCode(const OperatorCode* op_code); +BuiltinOperator GetBuiltinCode(const OperatorCode *op_code); -BuiltinOperator GetBuiltinCode(const OperatorCodeT* op_code); +BuiltinOperator GetBuiltinCode(const OperatorCodeT *op_code); } // namespace tflite diff --git a/tensorflow/lite/kernels/internal/reference/integer_ops/conv.h b/tensorflow/lite/kernels/internal/reference/integer_ops/conv.h index 5638c7eee2f..eac00576a25 100644 --- a/tensorflow/lite/kernels/internal/reference/integer_ops/conv.h +++ b/tensorflow/lite/kernels/internal/reference/integer_ops/conv.h @@ -135,6 +135,7 @@ inline void ConvPerChannel( } } + // Fixed-point per-channel-quantization convolution reference kernel. // 16-bit data and 8-bit filter template