From eb974073a3bb6d34808d578c6f69e3a1c4f62867 Mon Sep 17 00:00:00 2001 From: Christophe Favergeon Date: Wed, 18 Nov 2026 10:18:42 +0100 Subject: [PATCH] Fix Zephyr build warnings with GCC and Arm Compiler 6 Change-Id: Ic70293edbf5cf3683d2460fe1e10ba47635bd8b2 Signed-off-by: Christophe Favergeon --- .../cortex_m/ops/op_quantize_per_tensor.cpp | 7 +- backends/cortex_m/ops/op_quantized_linear.cpp | 2 +- extension/tensor/tensor_ptr_maker.cpp | 18 ++- .../portable/cpu/op__adaptive_avg_pool2d.cpp | 6 +- .../portable/cpu/op__to_dim_order_copy.cpp | 5 +- kernels/portable/cpu/op_abs.cpp | 5 +- kernels/portable/cpu/op_allclose.cpp | 5 +- kernels/portable/cpu/op_cdist_forward.cpp | 3 +- kernels/portable/cpu/op_clamp.cpp | 6 +- kernels/portable/cpu/op_gelu.cpp | 12 +- kernels/portable/cpu/op_logit.cpp | 9 +- kernels/portable/cpu/op_mean.cpp | 5 +- kernels/portable/cpu/op_native_batch_norm.cpp | 3 +- kernels/portable/cpu/op_reciprocal.cpp | 3 +- kernels/portable/cpu/op_round.cpp | 6 +- kernels/portable/cpu/op_rsqrt.cpp | 3 +- .../portable/cpu/op_upsample_bilinear2d.cpp | 23 ++-- .../cpu/op_upsample_bilinear2d_aa.cpp | 9 +- kernels/portable/cpu/op_var.cpp | 6 +- kernels/portable/cpu/op_var_mean.cpp | 8 +- kernels/portable/cpu/util/distance_util.h | 3 +- kernels/portable/cpu/vec_ops.h | 5 +- kernels/quantized/cpu/embeddingxb.cpp | 3 +- kernels/quantized/cpu/op_add.cpp | 15 ++- kernels/quantized/cpu/op_choose_qparams.cpp | 15 +-- kernels/quantized/cpu/op_dequantize.cpp | 109 ++++++++++-------- kernels/quantized/cpu/op_embedding.cpp | 3 +- kernels/quantized/cpu/op_quantize.cpp | 14 ++- runtime/core/exec_aten/util/tensor_util.h | 25 ++-- .../c10/torch/headeronly/util/overflows.h | 5 +- runtime/executor/program.cpp | 2 + runtime/executor/program_validation.cpp | 22 ++-- runtime/executor/tensor_parser_exec_aten.cpp | 3 + 33 files changed, 229 insertions(+), 139 deletions(-) diff --git a/backends/cortex_m/ops/op_quantize_per_tensor.cpp b/backends/cortex_m/ops/op_quantize_per_tensor.cpp index d8bb34c6eb4..78c583fd953 100644 --- a/backends/cortex_m/ops/op_quantize_per_tensor.cpp +++ b/backends/cortex_m/ops/op_quantize_per_tensor.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -193,8 +194,8 @@ Tensor& quantize_per_tensor_out( int32x4_t out_CDEF = vsubq_s32(vreinterpretq_s32_f32(outf_CDEF), vmagic_int_less_zp); - int16x8_t out_04152637; - int16x8_t out_8C9DAEBF; + int16x8_t out_04152637{}; + int16x8_t out_8C9DAEBF{}; out_04152637 = vmovnbq_s32(out_04152637, out_0123); out_04152637 = vmovntq_s32(out_04152637, out_4567); out_8C9DAEBF = vmovnbq_s32(out_8C9DAEBF, out_89AB); @@ -205,7 +206,7 @@ Tensor& quantize_per_tensor_out( int16x8_t out_8C9DAEBF_clamped = vminq_s16(vmaxq_s16(out_8C9DAEBF, vqmin), vqmax); - int8x16_t out_084C195D2A6E3B7F; + int8x16_t out_084C195D2A6E3B7F{}; out_084C195D2A6E3B7F = vmovnbq_s16(out_084C195D2A6E3B7F, out_04152637_clamped); out_084C195D2A6E3B7F = diff --git a/backends/cortex_m/ops/op_quantized_linear.cpp b/backends/cortex_m/ops/op_quantized_linear.cpp index dd34d7a5530..86b5d1ad455 100644 --- a/backends/cortex_m/ops/op_quantized_linear.cpp +++ b/backends/cortex_m/ops/op_quantized_linear.cpp @@ -55,7 +55,7 @@ Tensor& quantized_linear_impl( auto in_feat = input.size(input.dim() - 1); auto out_feat = out.size(out.dim() - 1); auto batches = 1; - for (size_t i = 0; i < input.dim() - 1; i++) { + for (int64_t i = 0; i < input.dim() - 1; i++) { batches *= input.size(i); } ET_LOG( diff --git a/extension/tensor/tensor_ptr_maker.cpp b/extension/tensor/tensor_ptr_maker.cpp index 583f27a232d..404bfaaeb0d 100644 --- a/extension/tensor/tensor_ptr_maker.cpp +++ b/extension/tensor/tensor_ptr_maker.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -26,9 +27,16 @@ bool extract_scalar(executorch::aten::Scalar scalar, INT_T* out_val) { return false; } int64_t val = scalar.to(); - if (val < std::numeric_limits::lowest() || - val > std::numeric_limits::max()) { - return false; + if constexpr (std::is_signed_v) { + if (val < static_cast(std::numeric_limits::lowest()) || + val > static_cast(std::numeric_limits::max())) { + return false; + } + } else { + if (val < 0 || + static_cast(val) > std::numeric_limits::max()) { + return false; + } } *out_val = static_cast(val); return true; @@ -46,8 +54,8 @@ bool extract_scalar(executorch::aten::Scalar scalar, FLOAT_T* out_val) { if (scalar.isFloatingPoint()) { val = scalar.to(); if (std::isfinite(val) && - (val < std::numeric_limits::lowest() || - val > std::numeric_limits::max())) { + (val < static_cast(std::numeric_limits::lowest()) || + val > static_cast(std::numeric_limits::max()))) { return false; } } else if (scalar.isIntegral(/*includeBool=*/false)) { diff --git a/kernels/portable/cpu/op__adaptive_avg_pool2d.cpp b/kernels/portable/cpu/op__adaptive_avg_pool2d.cpp index 1ae679aa8c1..3520cf46830 100644 --- a/kernels/portable/cpu/op__adaptive_avg_pool2d.cpp +++ b/kernels/portable/cpu/op__adaptive_avg_pool2d.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -74,6 +75,7 @@ Tensor& _adaptive_avg_pool2d_out( static constexpr const char op_name[] = "_adaptive_avg_pool2d.out"; ET_SWITCH_FLOATHBF16_TYPES_AND(Long, in_type, ctx, op_name, CTYPE, [&]() { + using AccumulateType = decltype(float{} + CTYPE{}); const CTYPE* const in_ptr = in.const_data_ptr(); CTYPE* const out_ptr = out.mutable_data_ptr(); @@ -106,7 +108,9 @@ Tensor& _adaptive_avg_pool2d_out( float sum = 0; for (int64_t ih = ih0; ih < ih1; ++ih) { for (int64_t iw = iw0; iw < iw1; ++iw) { - sum += plane_in[ih * in_W + iw]; + sum = static_cast( + static_cast(sum) + + static_cast(plane_in[ih * in_W + iw])); } } diff --git a/kernels/portable/cpu/op__to_dim_order_copy.cpp b/kernels/portable/cpu/op__to_dim_order_copy.cpp index 14124d32a5f..b92254d2f95 100644 --- a/kernels/portable/cpu/op__to_dim_order_copy.cpp +++ b/kernels/portable/cpu/op__to_dim_order_copy.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -79,7 +80,9 @@ Tensor& _to_dim_order_copy_out( /*support_noncontiguous_input_tensors=*/true>( /*dummy output*/ self, self, out)) { (void)unused_index; - out_data[out_data_index].real_ = self_data[self_data_index]; + out_data[out_data_index].real_ = + static_cast( + self_data[self_data_index]); out_data[out_data_index].imag_ = 0; } }); diff --git a/kernels/portable/cpu/op_abs.cpp b/kernels/portable/cpu/op_abs.cpp index 75c38867f01..a45bd04e136 100644 --- a/kernels/portable/cpu/op_abs.cpp +++ b/kernels/portable/cpu/op_abs.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -49,8 +50,8 @@ Tensor& abs_out(KernelRuntimeContext& ctx, const Tensor& in, Tensor& out) { ET_SWITCH_FLOATH_TYPES(out.scalar_type(), ctx, op_name, CTYPE_OUT, [&] { apply_unary_map_fn( [](const CTYPE_IN val_in) -> CTYPE_OUT { - return sqrt( - val_in.real_ * val_in.real_ + val_in.imag_ * val_in.imag_); + return static_cast(sqrt( + val_in.real_ * val_in.real_ + val_in.imag_ * val_in.imag_)); }, in.const_data_ptr(), out.mutable_data_ptr(), diff --git a/kernels/portable/cpu/op_allclose.cpp b/kernels/portable/cpu/op_allclose.cpp index 32d81f1ad80..24a4f819c82 100644 --- a/kernels/portable/cpu/op_allclose.cpp +++ b/kernels/portable/cpu/op_allclose.cpp @@ -41,9 +41,10 @@ bool data_is_close( return false; } } else { - auto allowed_error = atol + std::fabs(rtol * b[i]); + auto allowed_error = atol + std::fabs(rtol * static_cast(b[i])); auto actual_error = std::fabs(a[i] - b[i]); - if (!std::isfinite(actual_error) || actual_error > allowed_error) { + if (!std::isfinite(actual_error) || + static_cast(actual_error) > allowed_error) { return false; } } diff --git a/kernels/portable/cpu/op_cdist_forward.cpp b/kernels/portable/cpu/op_cdist_forward.cpp index c4a026f9e29..2756f8581b7 100644 --- a/kernels/portable/cpu/op_cdist_forward.cpp +++ b/kernels/portable/cpu/op_cdist_forward.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -106,7 +107,7 @@ void cdist(const Tensor& x1, const Tensor& x2, Tensor& out, double p) { cdist>(x1, x2, out, p); } else if (p == 2.0) { cdist>(x1, x2, out, p); - } else if (p == INFINITY) { + } else if (p == static_cast(INFINITY)) { cdist>(x1, x2, out, p); } else { cdist>(x1, x2, out, p); diff --git a/kernels/portable/cpu/op_clamp.cpp b/kernels/portable/cpu/op_clamp.cpp index 9c67dddba92..c3dccade333 100644 --- a/kernels/portable/cpu/op_clamp.cpp +++ b/kernels/portable/cpu/op_clamp.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -29,8 +30,9 @@ namespace { template /** Check if val, when cast to CTYPE_CAST, is not in the range of CTYPE_OUT */ bool is_out_of_bounds(CTYPE_CAST val_cast) { - return val_cast < std::numeric_limits::lowest() || - val_cast > std::numeric_limits::max(); + return val_cast < + static_cast(std::numeric_limits::lowest()) || + val_cast > static_cast(std::numeric_limits::max()); } ET_NODISCARD bool check_bounds( diff --git a/kernels/portable/cpu/op_gelu.cpp b/kernels/portable/cpu/op_gelu.cpp index 0489d3d12b4..726a346dcc7 100644 --- a/kernels/portable/cpu/op_gelu.cpp +++ b/kernels/portable/cpu/op_gelu.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -47,11 +48,14 @@ Tensor& gelu_out( return std::numeric_limits::infinity(); } const CTYPE kBeta = M_SQRT2 * M_2_SQRTPI * 0.5; - const CTYPE kKappa = static_cast(0.044715); + const CTYPE kKappa = + static_cast(static_cast(0.044715)); const CTYPE x_cubed = x * x * x; const CTYPE inner = kBeta * (x + kKappa * x_cubed); - const CTYPE ret = 0.5 * x * (1.0 + std::tanh(inner)); + const CTYPE ret = static_cast( + 0.5 * static_cast(x) * + (1.0 + static_cast(std::tanh(inner)))); return ret; }, @@ -66,7 +70,9 @@ Tensor& gelu_out( } else if (x == std::numeric_limits::infinity()) { return std::numeric_limits::infinity(); } - return static_cast(0.5 * x * (1 + std::erf(x * M_SQRT1_2))); + return static_cast( + 0.5 * static_cast(x) * + (1 + std::erf(static_cast(x) * M_SQRT1_2))); }, in.const_data_ptr(), out.mutable_data_ptr(), diff --git a/kernels/portable/cpu/op_logit.cpp b/kernels/portable/cpu/op_logit.cpp index 8b3bbb38912..edf50663bd7 100644 --- a/kernels/portable/cpu/op_logit.cpp +++ b/kernels/portable/cpu/op_logit.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -41,10 +42,10 @@ Tensor& logit_out( [eps](const CTYPE_IN val_in) { CTYPE_OUT xi = static_cast(val_in); if (eps.has_value()) { - if (xi < eps.value()) { - xi = eps.value(); - } else if (xi > 1 - eps.value()) { - xi = 1 - eps.value(); + if (static_cast(xi) < eps.value()) { + xi = static_cast(eps.value()); + } else if (static_cast(xi) > 1 - eps.value()) { + xi = static_cast(1 - eps.value()); } } return static_cast( diff --git a/kernels/portable/cpu/op_mean.cpp b/kernels/portable/cpu/op_mean.cpp index 835beb978e6..d50a40b6fb6 100644 --- a/kernels/portable/cpu/op_mean.cpp +++ b/kernels/portable/cpu/op_mean.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -118,8 +119,8 @@ Tensor& mean_dim_out( ix /= out.size(d); } } - out_data[out_offset] = - static_cast(sum / static_cast(num)); + out_data[out_offset] = static_cast( + sum / static_cast(static_cast(num))); } }); ET_KERNEL_CHECK_MSG(ctx, success, Internal, , "parallel_for failed"); diff --git a/kernels/portable/cpu/op_native_batch_norm.cpp b/kernels/portable/cpu/op_native_batch_norm.cpp index b172d9c08bf..7044f9f64dc 100644 --- a/kernels/portable/cpu/op_native_batch_norm.cpp +++ b/kernels/portable/cpu/op_native_batch_norm.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -182,7 +183,7 @@ std::tuple _native_batch_norm_legit_no_training_out( for (size_t c = 0; c < C; ++c) { CTYPE mean = mean_data[c]; CTYPE var = var_data[c]; - CTYPE invstd = 1.0 / std::sqrt(var + eps); + CTYPE invstd = 1.0 / std::sqrt(static_cast(var) + eps); CTYPE weight_val = 1; if (weight.has_value()) { weight_val = weight.value().const_data_ptr()[c]; diff --git a/kernels/portable/cpu/op_reciprocal.cpp b/kernels/portable/cpu/op_reciprocal.cpp index 4713ce756bd..a5df39ceabc 100644 --- a/kernels/portable/cpu/op_reciprocal.cpp +++ b/kernels/portable/cpu/op_reciprocal.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -16,7 +17,7 @@ namespace { template T reciprocal(T x) { - return 1.0 / x; + return static_cast(1.0 / static_cast(x)); } } // namespace diff --git a/kernels/portable/cpu/op_round.cpp b/kernels/portable/cpu/op_round.cpp index 41ad6ac55b3..4adf581ea3d 100644 --- a/kernels/portable/cpu/op_round.cpp +++ b/kernels/portable/cpu/op_round.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -25,7 +26,10 @@ namespace { // the implementation from torch/src/jit/runtime/register_ops_utils.h. template inline CTYPE round_to_even(CTYPE a) { - return a - std::floor(a) == 0.5 ? (std::round(a * 0.5) * 2.0) : std::round(a); + return static_cast( + static_cast(a - std::floor(a)) == 0.5 + ? (std::round(static_cast(a) * 0.5) * 2.0) + : static_cast(std::round(a))); } } // namespace diff --git a/kernels/portable/cpu/op_rsqrt.cpp b/kernels/portable/cpu/op_rsqrt.cpp index c2a47ce4c26..9cd46a61b79 100644 --- a/kernels/portable/cpu/op_rsqrt.cpp +++ b/kernels/portable/cpu/op_rsqrt.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -16,7 +17,7 @@ namespace { template T rsqrt(T x) { - return 1.0 / std::sqrt(x); + return static_cast(1.0 / static_cast(std::sqrt(x))); } } // namespace diff --git a/kernels/portable/cpu/op_upsample_bilinear2d.cpp b/kernels/portable/cpu/op_upsample_bilinear2d.cpp index 1a1c16285ed..bc1857f4123 100644 --- a/kernels/portable/cpu/op_upsample_bilinear2d.cpp +++ b/kernels/portable/cpu/op_upsample_bilinear2d.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -22,6 +23,7 @@ void upsample_bilinear2d_kernel_impl_nchw( const float scale_h, const float scale_w, Tensor& out) { + using ComputeType = decltype(CTYPE{} * float{}); const auto in_data = in.const_data_ptr(); auto out_data = out.mutable_data_ptr(); @@ -68,10 +70,12 @@ void upsample_bilinear2d_kernel_impl_nchw( const auto bottom_right = in_plane[in_h2 * in.strides()[2] + in_w2 * in.strides()[3]]; - const auto top = top_left * weight_w + top_right * inv_weight_w; - const auto bottom = - bottom_left * weight_w + bottom_right * inv_weight_w; - const auto val = top * weight_h + bottom * inv_weight_h; + const auto top = top_left * static_cast(weight_w) + + top_right * static_cast(inv_weight_w); + const auto bottom = bottom_left * static_cast(weight_w) + + bottom_right * static_cast(inv_weight_w); + const auto val = top * static_cast(weight_h) + + bottom * static_cast(inv_weight_h); *out_data = val; out_data++; @@ -90,6 +94,7 @@ void upsample_bilinear2d_kernel_impl_nhwc( const float scale_h, const float scale_w, Tensor& out) { + using ComputeType = decltype(CTYPE{} * float{}); auto in_data = in.const_data_ptr(); auto out_data = out.mutable_data_ptr(); @@ -139,10 +144,12 @@ void upsample_bilinear2d_kernel_impl_nhwc( [in_h2 * in.strides()[2] + in_w2 * in.strides()[3] + c * in.strides()[1]]; - const auto top = top_left * weight_w + top_right * inv_weight_w; - const auto bottom = - bottom_left * weight_w + bottom_right * inv_weight_w; - const auto val = top * weight_h + bottom * inv_weight_h; + const auto top = top_left * static_cast(weight_w) + + top_right * static_cast(inv_weight_w); + const auto bottom = bottom_left * static_cast(weight_w) + + bottom_right * static_cast(inv_weight_w); + const auto val = top * static_cast(weight_h) + + bottom * static_cast(inv_weight_h); *out_data = val; out_data++; diff --git a/kernels/portable/cpu/op_upsample_bilinear2d_aa.cpp b/kernels/portable/cpu/op_upsample_bilinear2d_aa.cpp index 143a8162c1d..e7f9e34a237 100644 --- a/kernels/portable/cpu/op_upsample_bilinear2d_aa.cpp +++ b/kernels/portable/cpu/op_upsample_bilinear2d_aa.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -121,6 +122,7 @@ void upsample_bilinear2d_aa_kernel_impl( const float scale_h, const float scale_w, Tensor& out) { + using ComputeType = decltype(CTYPE{} * float{}); const auto in_data = in.const_data_ptr(); auto out_data = out.mutable_data_ptr(); @@ -153,7 +155,9 @@ void upsample_bilinear2d_aa_kernel_impl( const float w_weight = compute_normalized_aa_weight(w_params, iw); - value += in_plane[ih * in.size(3) + iw] * h_weight * w_weight; + value += in_plane[ih * in.size(3) + iw] * + static_cast(h_weight) * + static_cast(w_weight); } } @@ -188,7 +192,8 @@ void upsample_bilinear2d_aa_kernel_impl( compute_normalized_aa_weight(w_params, iw); value += in_batch[(ih * in.size(3) + iw) * in.size(1) + c] * - h_weight * w_weight; + static_cast(h_weight) * + static_cast(w_weight); } } diff --git a/kernels/portable/cpu/op_var.cpp b/kernels/portable/cpu/op_var.cpp index c3af26216c5..885e0767591 100644 --- a/kernels/portable/cpu/op_var.cpp +++ b/kernels/portable/cpu/op_var.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -36,7 +37,7 @@ void compute_variance( CTYPE_OUT* out_data = out.mutable_data_ptr(); if (num == 0 || denominator <= 0) { for (const auto out_ix : c10::irange(out.numel())) { - out_data[out_ix] = NAN; + out_data[out_ix] = static_cast(NAN); } } else if (in.numel() > 0) { MapReduceOverDimListPlan plan(in, dim_list); @@ -53,7 +54,8 @@ void compute_variance( }, [](ACC outv, ACC acc) { return acc + outv; }, out_ix); - out_data[out_ix] = static_cast(sum2 / denominator); + out_data[out_ix] = + static_cast(static_cast(sum2) / denominator); } }); ET_KERNEL_CHECK_MSG(ctx, success, Internal, , "parallel_for failed"); diff --git a/kernels/portable/cpu/op_var_mean.cpp b/kernels/portable/cpu/op_var_mean.cpp index 4a5d196c3e5..03344bfece9 100644 --- a/kernels/portable/cpu/op_var_mean.cpp +++ b/kernels/portable/cpu/op_var_mean.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -37,8 +38,8 @@ void compute_var_mean( CTYPE_OUT* mean_data = mean_out.mutable_data_ptr(); if (num == 0 || denominator <= 0) { for (const auto out_ix : c10::irange(var_out.numel())) { - var_data[out_ix] = NAN; - mean_data[out_ix] = NAN; + var_data[out_ix] = static_cast(NAN); + mean_data[out_ix] = static_cast(NAN); } } else if (in.numel() > 0) { // Fast path: contiguous tensor, single innermost dim reduction, same dtype. @@ -92,7 +93,8 @@ void compute_var_mean( }, [](ACC outv, ACC acc) { return acc + outv; }, out_ix); - var_data[out_ix] = static_cast(sum2 / denominator); + var_data[out_ix] = static_cast( + static_cast(sum2) / denominator); } }); ET_KERNEL_CHECK_MSG(ctx, success, Internal, , "parallel_for failed"); diff --git a/kernels/portable/cpu/util/distance_util.h b/kernels/portable/cpu/util/distance_util.h index a54e02dab28..9a9759e6450 100644 --- a/kernels/portable/cpu/util/distance_util.h +++ b/kernels/portable/cpu/util/distance_util.h @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -91,7 +92,7 @@ struct Lp { return agg + up; } static inline CTYPE finish(const CTYPE& agg, const CTYPE& p) { - return std::pow(agg, 1.0 / p); + return std::pow(agg, 1.0 / static_cast(p)); } }; diff --git a/kernels/portable/cpu/vec_ops.h b/kernels/portable/cpu/vec_ops.h index ef5580386d9..7e63b42530d 100644 --- a/kernels/portable/cpu/vec_ops.h +++ b/kernels/portable/cpu/vec_ops.h @@ -300,9 +300,12 @@ inline float reduce_add(const T* x, size_t size) { /// `size` elements. template inline float vec_powerf(const T* x, size_t size) { + using ComputeType = decltype(float{} * T{}); float sum = 0; for (const auto i : c10::irange(size)) { - sum += static_cast(x[i]) * x[i]; + sum = static_cast( + static_cast(sum) + + static_cast(static_cast(x[i])) * x[i]); } return sum; } diff --git a/kernels/quantized/cpu/embeddingxb.cpp b/kernels/quantized/cpu/embeddingxb.cpp index e3269777fb7..427a8220f47 100644 --- a/kernels/quantized/cpu/embeddingxb.cpp +++ b/kernels/quantized/cpu/embeddingxb.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -233,7 +234,7 @@ void resize_out_tensor( Tensor& out, int weight_nbit) { executorch::aten::SizesType expected_output_size[kTensorDimensionLimit]; - for (size_t i = 0; i < indices.dim(); i++) { + for (int64_t i = 0; i < indices.dim(); i++) { expected_output_size[i] = indices.size(i); } const size_t embedding_dim = get_embedding_dim(weight.size(1), weight_nbit); diff --git a/kernels/quantized/cpu/op_add.cpp b/kernels/quantized/cpu/op_add.cpp index dcaf1f1fe07..371c468a28c 100644 --- a/kernels/quantized/cpu/op_add.cpp +++ b/kernels/quantized/cpu/op_add.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -66,14 +67,18 @@ void add_tensors( for (size_t i = 0; i < n; ++i) { // Dq -> fp add -> Q. Can be optimized further - const auto dqa = - dequantize_val(a_scale, a_zero_point, data_a[i]); - const auto dqb = - dequantize_val(b_scale, b_zero_point, data_b[i]); + const auto dqa = dequantize_val( + static_cast(a_scale), a_zero_point, data_a[i]); + const auto dqb = dequantize_val( + static_cast(b_scale), b_zero_point, data_b[i]); const auto accumulate = dqa + dqb; data_out[i] = quantize_val( - out_scale, out_zero_point, accumulate, out_quant_min, out_quant_max); + static_cast(out_scale), + out_zero_point, + accumulate, + out_quant_min, + out_quant_max); } } diff --git a/kernels/quantized/cpu/op_choose_qparams.cpp b/kernels/quantized/cpu/op_choose_qparams.cpp index 7422b2603d8..d1f04598b81 100644 --- a/kernels/quantized/cpu/op_choose_qparams.cpp +++ b/kernels/quantized/cpu/op_choose_qparams.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -109,7 +110,7 @@ void calculate_scale_and_zero_point( // Use double precision for intermediate computation but use single precision // in final number to reflect the actual number used during quantization. - scale = (static_cast(max) - min) / (qmax - qmin); + scale = (static_cast(max) - static_cast(min)) / (qmax - qmin); // If scale is 0 or too small so its reciprocal is infinity, we arbitrary // adjust the scale to 0.1 . We want to avoid scale's reciprocal being // infinity because some of fbgemm code pre-computes scale's reciprocal to do @@ -120,9 +121,9 @@ void calculate_scale_and_zero_point( ET_CHECK_MSG(scale > 0, "quantization scale should be > 0"); // Cut off small scale - if (scale < SMALL_SCALE_THRESHOLD) { + if (scale < static_cast(SMALL_SCALE_THRESHOLD)) { float org_scale = scale; - scale = SMALL_SCALE_THRESHOLD; + scale = static_cast(SMALL_SCALE_THRESHOLD); // Adjust the min and max based on the new scale if (min == 0.0f) { max = SMALL_SCALE_THRESHOLD * (qmax - qmin); @@ -143,12 +144,12 @@ void calculate_scale_and_zero_point( // The arithmetic error on the zero point computed from either pair // will be roughly machine_epsilon * (sum of absolute values of terms) // so we want to use the variant that adds the smaller terms. - double zero_point_from_min = qmin - min / static_cast(scale); - double zero_point_from_max = qmax - max / static_cast(scale); + double zero_point_from_min = qmin - static_cast(min) / scale; + double zero_point_from_max = qmax - static_cast(max) / scale; double zero_point_from_min_error = - std::abs(qmin) - std::abs(min / static_cast(scale)); + std::abs(qmin) - std::abs(static_cast(min) / scale); double zero_point_from_max_error = - std::abs(qmax) - std::abs(max / static_cast(scale)); + std::abs(qmax) - std::abs(static_cast(max) / scale); double initial_zero_point = zero_point_from_min_error < zero_point_from_max_error ? zero_point_from_min diff --git a/kernels/quantized/cpu/op_dequantize.cpp b/kernels/quantized/cpu/op_dequantize.cpp index 2958aa79f85..25f5adc71e2 100644 --- a/kernels/quantized/cpu/op_dequantize.cpp +++ b/kernels/quantized/cpu/op_dequantize.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -11,6 +12,7 @@ #include #include #include +#include #if defined(__aarch64__) || defined(__ARM_NEON) #include #endif @@ -243,7 +245,8 @@ void dequantize_per_channel_optimized( SizesType numel, SizesType outer_idx, SizesType unpacked_dim_idx) { const int8_t* in_data_local = in_data + outer_idx * outer_stride + unpacked_dim_idx * axis_stride; - const double scale = get_scale(scales, unpacked_dim_idx); + const double scale = + static_cast(get_scale(scales, unpacked_dim_idx)); const int64_t zero_point = zero_points != nullptr ? get_zero_point(*zero_points, unpacked_dim_idx) : 0; @@ -299,7 +302,7 @@ Tensor& dequantize_per_tensor_out( auto* out_data_ptr = out.mutable_data_ptr(); \ const auto* input_data_ptr = input.const_data_ptr(); \ const auto input_numel = input.numel(); \ - for (size_t i = 0; i < input_numel; i++) { \ + for (int64_t i = 0; i < input_numel; i++) { \ out_data_ptr[i] = static_cast( \ (input_data_ptr[i] - static_cast(zero_point)) * \ static_cast(scale)); \ @@ -453,53 +456,59 @@ Tensor& dequantize_per_channel_out( // will be 0, 1, 2, ... C-1 // in_ix is the flat index of the element you are dequantizing. // in other words you are dequantizing in_data[in_ix] -#define DEQUANTIZE_IMPL(CTYPE_IN, CTYPE_OUT, out_dtype) \ - case ScalarType::out_dtype: \ - if (input.dim() == 1) { \ - auto* out_data_ptr = out.mutable_data_ptr(); \ - const auto* input_data_ptr = input.const_data_ptr(); \ - ET_CHECK_MSG( \ - axis == 0, "Axis must be 0 for a single dimensional tensors"); \ - const std::optional dim; \ - apply_over_dim( \ - [input_data_ptr, out_data_ptr, zero_point_tensor, &scale]( \ - size_t numel, size_t stride, size_t base_ix) { \ - for (size_t i = 0; i < numel; i++) { \ - size_t current_ix = base_ix * stride + i; \ - float _scale = get_scale(scale, current_ix); \ - int64_t zero_point = 0; \ - if (zero_point_tensor != nullptr) { \ - zero_point = get_zero_point(*zero_point_tensor, current_ix); \ - } \ - out_data_ptr[current_ix] = \ - static_cast( \ - input_data_ptr[current_ix] - \ - static_cast(zero_point)) * \ - _scale; \ - } \ - }, \ - input, \ - dim); \ - break; \ - } \ - for (size_t channel_ix = 0; channel_ix < input.size(axis); ++channel_ix) { \ - float _scale = get_scale(scale, channel_ix); \ - int64_t _zero_point = 0; \ - if (zero_point_tensor != nullptr) { \ - _zero_point = get_zero_point(*zero_point_tensor, channel_ix); \ - } \ - auto* out_data_ptr = out.mutable_data_ptr(); \ - const auto* input_data_ptr = input.const_data_ptr(); \ - apply_over_dim_list( \ - [input_data_ptr, out_data_ptr, _scale, _zero_point](size_t in_ix) { \ - out_data_ptr[in_ix] = static_cast( \ - (input_data_ptr[in_ix] - static_cast(_zero_point)) * \ - _scale); \ - }, \ - input, \ - optional_dim_list, \ - channel_ix); \ - } \ +#define DEQUANTIZE_IMPL(CTYPE_IN, CTYPE_OUT, out_dtype) \ + case ScalarType::out_dtype: \ + if (input.dim() == 1) { \ + auto* out_data_ptr = out.mutable_data_ptr(); \ + const auto* input_data_ptr = input.const_data_ptr(); \ + ET_CHECK_MSG( \ + axis == 0, "Axis must be 0 for a single dimensional tensors"); \ + const std::optional dim; \ + apply_over_dim( \ + [input_data_ptr, out_data_ptr, zero_point_tensor, &scale]( \ + size_t numel, size_t stride, size_t base_ix) { \ + for (size_t i = 0; i < numel; i++) { \ + size_t current_ix = base_ix * stride + i; \ + using ScaleType = std::conditional_t< \ + std::is_same_v, \ + double, \ + float>; \ + const auto _scale = \ + static_cast(get_scale(scale, current_ix)); \ + int64_t zero_point = 0; \ + if (zero_point_tensor != nullptr) { \ + zero_point = get_zero_point(*zero_point_tensor, current_ix); \ + } \ + out_data_ptr[current_ix] = \ + static_cast( \ + input_data_ptr[current_ix] - \ + static_cast(zero_point)) * \ + _scale; \ + } \ + }, \ + input, \ + dim); \ + break; \ + } \ + for (int64_t channel_ix = 0; channel_ix < input.size(axis); \ + ++channel_ix) { \ + float _scale = get_scale(scale, channel_ix); \ + int64_t _zero_point = 0; \ + if (zero_point_tensor != nullptr) { \ + _zero_point = get_zero_point(*zero_point_tensor, channel_ix); \ + } \ + auto* out_data_ptr = out.mutable_data_ptr(); \ + const auto* input_data_ptr = input.const_data_ptr(); \ + apply_over_dim_list( \ + [input_data_ptr, out_data_ptr, _scale, _zero_point](size_t in_ix) { \ + out_data_ptr[in_ix] = static_cast( \ + (input_data_ptr[in_ix] - static_cast(_zero_point)) * \ + _scale); \ + }, \ + input, \ + optional_dim_list, \ + channel_ix); \ + } \ break; #define CALCULATE_FLOAT_TYPE(CTYPE_IN, in_dtype) \ case ScalarType::in_dtype: \ @@ -603,7 +612,7 @@ Tensor& dequantize_per_token_out( Tensor& out) { // Refactor this into a util size_t num_channels = 1; - for (size_t i = 0; i < input.dim() - 1; i++) { + for (int64_t i = 0; i < input.dim() - 1; i++) { num_channels *= input.size(i); } // This unfortunate change is needed because we compile op_quantize for aten diff --git a/kernels/quantized/cpu/op_embedding.cpp b/kernels/quantized/cpu/op_embedding.cpp index b57d6612d30..c441c4f0112 100644 --- a/kernels/quantized/cpu/op_embedding.cpp +++ b/kernels/quantized/cpu/op_embedding.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -203,7 +204,7 @@ void resize_out_tensor( const Tensor& indices, Tensor& out) { executorch::aten::SizesType expected_output_size[kTensorDimensionLimit]; - for (size_t i = 0; i < indices.dim(); i++) { + for (int64_t i = 0; i < indices.dim(); i++) { expected_output_size[i] = indices.size(i); } const size_t embedding_dim = weight.size(1); diff --git a/kernels/quantized/cpu/op_quantize.cpp b/kernels/quantized/cpu/op_quantize.cpp index 72f08435665..59877f1d7e8 100644 --- a/kernels/quantized/cpu/op_quantize.cpp +++ b/kernels/quantized/cpu/op_quantize.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -11,6 +12,7 @@ #include #include #include +#include #if defined(__aarch64__) || defined(__ARM_NEON__) #include @@ -99,12 +101,16 @@ T quantize_val_with_inv_scale( K value, int64_t quant_min, int64_t quant_max) { - const float scaled_value = static_cast(inv_scale * value); + using ComputeType = + std::conditional_t, double, float>; + const float scaled_value = + static_cast(static_cast(inv_scale) * value); // Map NaN to the zero point and clamp infinities before integer conversion. // Double precision keeps int32 bounds exactly representable while clamping. const double qvalue = std::isnan(scaled_value) ? static_cast(zero_point) - : static_cast(zero_point) + std::nearbyint(scaled_value); + : static_cast(zero_point) + + static_cast(std::nearbyint(scaled_value)); const double clamped_value = std::min( static_cast(quant_max), std::max(static_cast(quant_min), qvalue)); @@ -320,7 +326,7 @@ Tensor& quantize_per_tensor_out( auto* out_data_ptr = out.mutable_data_ptr(); \ const auto* input_data_ptr = input.const_data_ptr(); \ const auto input_numel = input.numel(); \ - for (size_t i = 0; i < input_numel; i++) { \ + for (int64_t i = 0; i < input_numel; i++) { \ IN_CTYPE value = input_data_ptr[i]; \ out_data_ptr[i] = quantize_val( \ scale, zero_point, value, quant_min, quant_max); \ @@ -667,7 +673,7 @@ Tensor& quantize_per_token_out( ScalarType dtype, Tensor& out) { size_t num_tokens = 1; - for (size_t i = 0; i < input.dim() - 1; i++) { + for (int64_t i = 0; i < input.dim() - 1; i++) { num_tokens *= input.size(i); } // This unfortunate change is needed because we compile op_quantize for aten diff --git a/runtime/core/exec_aten/util/tensor_util.h b/runtime/core/exec_aten/util/tensor_util.h index 3f27613814b..9c2777acb19 100644 --- a/runtime/core/exec_aten/util/tensor_util.h +++ b/runtime/core/exec_aten/util/tensor_util.h @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -1111,18 +1112,18 @@ bool extract_scalar_tensor(executorch::aten::Tensor tensor, FLOAT_T* out_val) { if (tensor.numel() != 1) { return false; } -#define CASE_REAL_DTYPE(TENSOR_CTYPE, TENSOR_DTYPE) \ - case executorch::aten::ScalarType::TENSOR_DTYPE: { \ - /* ET_FORALL_REAL_TYPES guarantees TENSOR_CTYPE is a real type. */ \ - double val = \ - static_cast(tensor.const_data_ptr()[0]); \ - if (std::isfinite(val) && \ - (val < std::numeric_limits::lowest() || \ - val > std::numeric_limits::max())) { \ - return false; \ - } \ - *out_val = static_cast(val); \ - return true; \ +#define CASE_REAL_DTYPE(TENSOR_CTYPE, TENSOR_DTYPE) \ + case executorch::aten::ScalarType::TENSOR_DTYPE: { \ + /* ET_FORALL_REAL_TYPES guarantees TENSOR_CTYPE is a real type. */ \ + double val = \ + static_cast(tensor.const_data_ptr()[0]); \ + if (std::isfinite(val) && \ + (val < static_cast(std::numeric_limits::lowest()) || \ + val > static_cast(std::numeric_limits::max()))) { \ + return false; \ + } \ + *out_val = static_cast(val); \ + return true; \ } switch (tensor.scalar_type()) { diff --git a/runtime/core/portable_type/c10/torch/headeronly/util/overflows.h b/runtime/core/portable_type/c10/torch/headeronly/util/overflows.h index 6e68311a9a6..1b7f53752a1 100644 --- a/runtime/core/portable_type/c10/torch/headeronly/util/overflows.h +++ b/runtime/core/portable_type/c10/torch/headeronly/util/overflows.h @@ -84,7 +84,10 @@ std::enable_if_t, bool> overflows( static_cast(uint64_t{1} << (digits - 1)) * From{2}; return f < static_cast(limit::lowest()) || f >= upper; } - return f < limit::lowest() || f > limit::max(); + using CompareType = decltype(f + limit::lowest()); + return static_cast(f) < + static_cast(limit::lowest()) || + static_cast(f) > static_cast(limit::max()); } C10_CLANG_DIAGNOSTIC_POP() diff --git a/runtime/executor/program.cpp b/runtime/executor/program.cpp index 61b8ab73526..2392bd2d9be 100644 --- a/runtime/executor/program.cpp +++ b/runtime/executor/program.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -8,6 +9,7 @@ #include +#include #include #include diff --git a/runtime/executor/program_validation.cpp b/runtime/executor/program_validation.cpp index 27884c1c7d6..a2ad580cdf0 100644 --- a/runtime/executor/program_validation.cpp +++ b/runtime/executor/program_validation.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -8,6 +9,7 @@ #include +#include #include #include @@ -40,8 +42,8 @@ validate_tensor(const executorch_flatbuffer::Tensor* tensor) { if (size < 0) { ET_LOG( Error, - "Size must be non-negative, got %d at dimension %u", - static_cast(size), + "Size must be non-negative, got %" PRId32 " at dimension %u", + size, static_cast(i)); return Error::InvalidProgram; } @@ -196,10 +198,10 @@ validate_program(const executorch_flatbuffer::Program* program) { values->size()) { ET_LOG( Error, - "TensorList item %u has out-of-bounds index %d (values size " - "%u) in execution plan %u", + "TensorList item %u has out-of-bounds index %" PRId32 + " (values size %u) in execution plan %u", static_cast(item_idx), - static_cast(evalue_index), + evalue_index, static_cast(values->size()), static_cast(plan_idx)); return Error::InvalidProgram; @@ -210,10 +212,10 @@ validate_program(const executorch_flatbuffer::Program* program) { if (referenced_value == nullptr) { ET_LOG( Error, - "TensorList item %u references null evalue at index %d in " - "execution plan %u", + "TensorList item %u references null evalue at index %" PRId32 + " in execution plan %u", static_cast(item_idx), - static_cast(evalue_index), + evalue_index, static_cast(plan_idx)); return Error::InvalidProgram; } @@ -223,10 +225,10 @@ validate_program(const executorch_flatbuffer::Program* program) { ET_LOG( Error, "TensorList item %u references non-Tensor evalue (type %d) at " - "index %d in execution plan %u", + "index %" PRId32 " in execution plan %u", static_cast(item_idx), static_cast(referenced_value->val_type()), - static_cast(evalue_index), + evalue_index, static_cast(plan_idx)); return Error::InvalidProgram; } diff --git a/runtime/executor/tensor_parser_exec_aten.cpp b/runtime/executor/tensor_parser_exec_aten.cpp index 6636feaabc9..ca5ea27715e 100644 --- a/runtime/executor/tensor_parser_exec_aten.cpp +++ b/runtime/executor/tensor_parser_exec_aten.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. + * Copyright 2026 Arm Limited and/or its affiliates. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. @@ -8,6 +9,8 @@ #include +#include + #include #include #include