diff --git a/backends/cadence/fusion_g3/operators/op_add.cpp b/backends/cadence/fusion_g3/operators/op_add.cpp index b78cc33890b..7ef7bdde3b1 100644 --- a/backends/cadence/fusion_g3/operators/op_add.cpp +++ b/backends/cadence/fusion_g3/operators/op_add.cpp @@ -162,7 +162,7 @@ Tensor& add_out( float alpha_val; torch::executor::native::utils::extract_scalar(alpha, &alpha_val); - if ((a.numel() == 1) && (alpha_val == 1.0)) { + if ((a.numel() == 1) && (alpha_val == 1.0f)) { XT_KERNEL_CHECK( ctx, out, diff --git a/backends/cadence/hifi/kernels/kernels.cpp b/backends/cadence/hifi/kernels/kernels.cpp index 237c605443f..07f0ac960b1 100644 --- a/backends/cadence/hifi/kernels/kernels.cpp +++ b/backends/cadence/hifi/kernels/kernels.cpp @@ -39,8 +39,8 @@ void* allocate_temp_memory(KernelRuntimeContext& ctx, size_t size) { template __attribute__((always_inline)) T quantize(const float x, float scale, int32_t zero_point) { - constexpr float min_val = std::numeric_limits::min(); - constexpr float max_val = std::numeric_limits::max(); + constexpr float min_val = static_cast(std::numeric_limits::min()); + constexpr float max_val = static_cast(std::numeric_limits::max()); float tmp = roundf(x * scale + zero_point); return std::max(std::min(tmp, max_val), min_val); } @@ -56,8 +56,8 @@ void quantize( xtfloatx2 scale_vec = (xtfloatx2)scale; xtfloatx2 zero_vec = XT_FLOAT_SX2(zero_point, 0); - constexpr float min_val = std::numeric_limits::min(); - constexpr float max_val = std::numeric_limits::max(); + constexpr float min_val = static_cast(std::numeric_limits::min()); + constexpr float max_val = static_cast(std::numeric_limits::max()); const xtfloatx2* __restrict__ p0 = (const xtfloatx2* __restrict__)x; ae_valign va0 = XT_LASX2PP(p0); diff --git a/backends/cadence/hifi/operators/op_quantized_relu_out.cpp b/backends/cadence/hifi/operators/op_quantized_relu_out.cpp index d3dcce1d5f4..29e2fb00ce4 100644 --- a/backends/cadence/hifi/operators/op_quantized_relu_out.cpp +++ b/backends/cadence/hifi/operators/op_quantized_relu_out.cpp @@ -9,14 +9,14 @@ #include #include -using executorch::aten::ScalarType; -using executorch::aten::Tensor; -using torch::executor::KernelRuntimeContext; - namespace impl { namespace HiFi { namespace native { +using ::executorch::aten::ScalarType; +using ::executorch::aten::Tensor; +using ::executorch::runtime::KernelRuntimeContext; + void quantized_relu_per_tensor_out( KernelRuntimeContext& ctx, const Tensor& input, diff --git a/backends/cadence/hifi/third-party/nnlib/targets.bzl b/backends/cadence/hifi/third-party/nnlib/targets.bzl index a63a4dd3954..2ad9d6568ac 100644 --- a/backends/cadence/hifi/third-party/nnlib/targets.bzl +++ b/backends/cadence/hifi/third-party/nnlib/targets.bzl @@ -13,6 +13,10 @@ def define_common_targets(): "@EXECUTORCH_CLIENTS", ], compatible_with = ["ovr_config//cpu:xtensa"], + compiler_flags = [ + "-Wno-pointer-sign", + "-Wno-incompatible-pointer-types-discards-qualifiers", + ], deps = [ "fbsource//third-party/nnlib-hifi4/xa_nnlib:libxa_nnlib", ], diff --git a/backends/cadence/hifi/third-party/nnlib/xa_nn_elm_atan2_f32.c b/backends/cadence/hifi/third-party/nnlib/xa_nn_elm_atan2_f32.c index 2f1d2071777..68a51223cde 100644 --- a/backends/cadence/hifi/third-party/nnlib/xa_nn_elm_atan2_f32.c +++ b/backends/cadence/hifi/third-party/nnlib/xa_nn_elm_atan2_f32.c @@ -21,7 +21,7 @@ ******************************************************************************/ #include -#include "../include/NatureDSP_Signal_math.h" +#include "NatureDSP_Signal_math.h" #include "NatureDSP_types.h" #include "xa_nn_common.h" diff --git a/backends/cadence/hifi/third-party/nnlib/xa_nn_elm_pow_f32.c b/backends/cadence/hifi/third-party/nnlib/xa_nn_elm_pow_f32.c index aa81d695784..5fb69113ee7 100644 --- a/backends/cadence/hifi/third-party/nnlib/xa_nn_elm_pow_f32.c +++ b/backends/cadence/hifi/third-party/nnlib/xa_nn_elm_pow_f32.c @@ -20,7 +20,7 @@ ******************************************************************************/ -#include "../include/NatureDSP_Signal_math.h" +#include "NatureDSP_Signal_math.h" #include "NatureDSP_types.h" #include "xa_nn_common.h" diff --git a/backends/cadence/hifi/third-party/nnlib/xa_nn_elm_where_f32xf32_f32.c b/backends/cadence/hifi/third-party/nnlib/xa_nn_elm_where_f32xf32_f32.c index e7e83846484..840a027f7a7 100644 --- a/backends/cadence/hifi/third-party/nnlib/xa_nn_elm_where_f32xf32_f32.c +++ b/backends/cadence/hifi/third-party/nnlib/xa_nn_elm_where_f32xf32_f32.c @@ -117,6 +117,7 @@ WORD32 xa_nn_elm_where_f32xf32_f32(FLOAT32 * __restrict__ p_out, XT_MOVF_S(a, a2, s); XT_SSI(a, (xtfloat *)out, 0); } + return 0; } static void internal_elm_where_broadcast_f32xf32_f32(FLOAT32 * __restrict__ p_out,