1616#include < executorch/kernels/portable/cpu/util/kernel_ops_util.h>
1717#include < executorch/runtime/platform/assert.h>
1818
19+ #include < cinttypes>
1920#include < limits>
2021#include < optional>
2122
22- extern " C" {
2323#include " arm_nn_types.h"
24- }
24+ # include " arm_nnfunctions.h "
2525
2626using Tensor = torch::executor::Tensor;
2727using ScalarType = executorch::aten::ScalarType;
@@ -47,19 +47,19 @@ inline void validate_cmsis_nn_tensor_requirements(
4747 // Basic dtype validation
4848 ET_CHECK_MSG (
4949 input1.scalar_type () == expected_dtype,
50- " Input1 dtype must be %hhd , got %hhd " ,
51- expected_dtype,
52- input1.scalar_type ());
50+ " Input1 dtype must be %d , got %d " ,
51+ static_cast < int >( expected_dtype) ,
52+ static_cast < int >( input1.scalar_type () ));
5353 ET_CHECK_MSG (
5454 input2.scalar_type () == expected_dtype,
55- " Input2 dtype must be %hhd , got %hhd " ,
56- expected_dtype,
57- input2.scalar_type ());
55+ " Input2 dtype must be %d , got %d " ,
56+ static_cast < int >( expected_dtype) ,
57+ static_cast < int >( input2.scalar_type () ));
5858 ET_CHECK_MSG (
5959 output.scalar_type () == expected_dtype,
60- " Output dtype must be %hhd , got %hhd " ,
61- expected_dtype,
62- output.scalar_type ());
60+ " Output dtype must be %d , got %d " ,
61+ static_cast < int >( expected_dtype) ,
62+ static_cast < int >( output.scalar_type () ));
6363 if (require_same_sizes) {
6464 ET_CHECK_MSG (
6565 input1.sizes () == input2.sizes (),
@@ -78,16 +78,17 @@ inline void validate_single_quant_params(
7878 const int64_t multiplier,
7979 const int64_t shift,
8080 const char * param_name) {
81+ (void )zero_point;
8182 ET_CHECK_MSG (
8283 multiplier >= std::numeric_limits<int32_t >::min () &&
8384 multiplier <= std::numeric_limits<int32_t >::max (),
84- " %s multiplier must be in int32 range [Value: %d ]" ,
85+ " %s multiplier must be in int32 range [Value: %" PRIi64 " ]" ,
8586 param_name,
8687 multiplier);
8788
8889 ET_CHECK_MSG (
8990 shift >= -31 && shift <= 31 ,
90- " %s shift must be in range [-31, 31] [Value: %d ]" ,
91+ " %s shift must be in range [-31, 31] [Value: %" PRIi64 " ]" ,
9192 param_name,
9293 shift);
9394}
@@ -172,7 +173,7 @@ inline bool check_int32_within_range(
172173 value > std::numeric_limits<int32_t >::max ()) {
173174 ET_LOG (
174175 Error,
175- " %s: %s value (%ld ) exceeds int32_t range" ,
176+ " %s: %s value (%" PRIi64 " ) exceeds int32_t range" ,
176177 op_name,
177178 value_name,
178179 value);
@@ -354,14 +355,14 @@ inline bool validate_per_channel_quant_params(
354355 if (multipliers[i] <= ARM_NN_Q31_MIN || multipliers[i] > ARM_NN_Q31_MAX) {
355356 ET_LOG (
356357 Error,
357- " weight_multiplier[%d] out of CMSIS-NN range: %d " ,
358+ " weight_multiplier[%d] out of CMSIS-NN range: %" PRIi64 ,
358359 i,
359360 multipliers[i]);
360361 return false ;
361362 }
362363 // Shift: {-31, 30} for arm_nn_requantize
363364 if (shifts[i] < -31 || shifts[i] > 30 ) {
364- ET_LOG (Error, " weight_shift[%d] out of range: %d " , i, shifts[i]);
365+ ET_LOG (Error, " weight_shift[%d] out of range: %" PRIi64 , i, shifts[i]);
365366 return false ;
366367 }
367368 }
0 commit comments