24 #if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && defined(ENABLE_FP16_KERNELS)
36 void matrix_addition_f16(
const ITensor *
src, ITensor *
dst,
const Window &window,
float beta)
39 const float16x8_t beta_f16 = vdupq_n_f16(beta);
41 constexpr
int window_step_x = 16;
42 const auto window_start_x =
static_cast<int>(window.x().start());
43 const auto window_end_x =
static_cast<int>(window.x().end());
45 Window win = window.collapse_if_possible(window,
Window::DimZ);
48 Iterator in(
src, win);
49 Iterator out(
dst, win);
53 [&](
const Coordinates &)
55 const auto in_ptr =
reinterpret_cast<const float16_t *
>(in.ptr());
56 const auto out_ptr =
reinterpret_cast<float16_t *
>(out.ptr());
58 int x = window_start_x;
59 for (; x < (window_end_x - window_step_x); x += window_step_x)
61 float16x8x2_t alpha_ab = vld2q_f16(out_ptr + x);
62 const float16x8x2_t c = vld2q_f16(in_ptr + x);
67 vst2q_f16(out_ptr + x, alpha_ab);
71 for (; x < window_end_x; ++x)
73 *(out_ptr + x) += *(in_ptr + x) *
static_cast<float16_t
>(beta);
81 return matrix_addition_f16(
src,
dst, window, beta);