// Copyright 2021 Google LLC
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree.

$assert REQUANTIZATION == "FP32"
$assert DATATYPE in ["QC8", "QS8", "QU8"]
$assert VARIANT in ["LD64", "LD128"]
$assert MR <= 4
#include <assert.h>

#include <wasm_simd128.h>

#include <xnnpack/igemm.h>
#include <xnnpack/math.h>


$PARAMS_STRUCT = REQUANTIZATION.lower() + "_wasmsimd"
$PARAMS_UNION = "xnn_%s_conv_minmax_params" % DATATYPE.lower()
$XINT8_T = "uint8_t" if DATATYPE == "QU8" else "int8_t"
$WASM_X16X8_LOAD8X8 = "wasm_u16x8_load8x8" if DATATYPE == "QU8" else "wasm_i16x8_load8x8"
$WASM_X8X16_NARROW_I16X8 = "wasm_u8x16_narrow_i16x8" if DATATYPE == "QU8" else "wasm_i8x16_narrow_i16x8"
$WASM_X8X16_MIN = "wasm_u8x16_min" if DATATYPE == "QU8" else "wasm_i8x16_min"
void xnn_${DATATYPE.lower()}_igemm_minmax_fp32_ukernel_${MR}x4c2__wasmsimd_dot16x2_${VARIANT.lower()}(
    size_t mr,
    size_t nc,
    size_t kc,
    size_t ks,
    const ${XINT8_T}** restrict a,
    const void* restrict w,
    ${XINT8_T}* restrict c,
    size_t cm_stride,
    size_t cn_stride,
    size_t a_offset,
    const ${XINT8_T}* zero,
    const union ${PARAMS_UNION} params[restrict XNN_MIN_ELEMENTS(1)]) XNN_OOB_READS
{
  assert(mr != 0);
  assert(mr <= ${MR});
  assert(nc != 0);
  assert(kc != 0);
  assert(ks != 0);
  assert(ks % (${MR} * sizeof(void*)) == 0);
  assert(a_offset % sizeof(${XINT8_T}) == 0);
  assert(a != NULL);
  assert(w != NULL);
  assert(c != NULL);

  kc = round_up_po2(kc, 2);
  ${XINT8_T}* c0 = c;
  $for M in range(1, MR):
    ${XINT8_T}* c${M} = (${XINT8_T}*) ((uintptr_t) c${M-1} + cm_stride);
    $if M % 2 == 0:
      if XNN_UNPREDICTABLE(mr <= ${M}) {
        c${M} = c${M-1};
      }
    $elif M + 1 == MR:
      if XNN_UNPREDICTABLE(mr != ${M+1}) {
        c${M} = c${M-1};
      }
    $else:
      if XNN_UNPREDICTABLE(mr < ${M+1}) {
        c${M} = c${M-1};
      }

  do {
    v128_t vacc0x0123 = wasm_v128_load(w);
    $for M in range(1, MR):
      v128_t vacc${M}x0123 = vacc0x0123;
    w = (const void*) ((const int32_t*) w + 4);

    size_t p = ks;
    do {
      $for M in range(MR):
        const ${XINT8_T}* restrict a${M} = a[${M}];
        if XNN_UNPREDICTABLE(a${M} != zero) {
          a${M} = (const ${XINT8_T}*) ((uintptr_t) a${M} + a_offset);
        }
      a += ${MR};

      size_t k = kc;
      $if DATATYPE == "QU8":
        const v128_t vb_zero_point = wasm_v128_load64_splat(params->${PARAMS_STRUCT}.kernel_zero_point);
      while (k >= 8 * sizeof(${XINT8_T})) {
        $for M in range(MR):
          const v128_t vxa${M} = ${WASM_X16X8_LOAD8X8}(a${M});
          a${M} += 8;

        $if VARIANT == "LD128":
          $for K in range(0, 4, 2):
            $if K == 0:
              const v128_t vb${K}${K+1} = wasm_v128_load(w);
            $else:
              const v128_t vb${K}${K+1} = wasm_v128_load((const ${XINT8_T}*) w + ${K * 8});
            $if DATATYPE == "QU8":
              const v128_t vxb${K} = wasm_i16x8_sub(wasm_u16x8_extend_low_u8x16(vb${K}${K+1}), vb_zero_point);
              const v128_t vxb${K+1} = wasm_i16x8_sub(wasm_u16x8_extend_high_u8x16(vb${K}${K+1}), vb_zero_point);
            $else:
              const v128_t vxb${K} = wasm_i16x8_extend_low_i8x16(vb${K}${K+1});
              const v128_t vxb${K+1} = wasm_i16x8_extend_high_i8x16(vb${K}${K+1});

            $for M in range(MR):
              vacc${M}x0123 = wasm_i32x4_add(vacc${M}x0123,
                wasm_i32x4_dot_i16x8(wasm_v32x4_shuffle(vxa${M}, vxa${M}, ${K}, ${K}, ${K}, ${K}), vxb${K}));

            $for M in range(MR):
              vacc${M}x0123 = wasm_i32x4_add(vacc${M}x0123,
                wasm_i32x4_dot_i16x8(wasm_v32x4_shuffle(vxa${M}, vxa${M}, ${K+1}, ${K+1}, ${K+1}, ${K+1}), vxb${K+1}));
        $else:
          $for K in range(4):
            $if K == 0:
              $if DATATYPE == "QU8":
                const v128_t vxb${K} = wasm_i16x8_sub(wasm_u16x8_load8x8(w), vb_zero_point);
              $else:
                const v128_t vxb${K} = wasm_i16x8_load8x8(w);
            $else:
              $if DATATYPE == "QU8":
                const v128_t vxb${K} = wasm_i16x8_sub(wasm_u16x8_load8x8((const ${XINT8_T}*) w + ${K * 8}), vb_zero_point);
              $else:
                const v128_t vxb${K} = wasm_i16x8_load8x8((const ${XINT8_T}*) w + ${K * 8});

            $for M in range(MR):
              vacc${M}x0123 = wasm_i32x4_add(vacc${M}x0123,
                wasm_i32x4_dot_i16x8(wasm_v32x4_shuffle(vxa${M}, vxa${M}, ${K}, ${K}, ${K}, ${K}), vxb${K}));

        w = (const void*) ((const ${XINT8_T}*) w + 32);
        k -= 8 * sizeof(${XINT8_T});
      }
      if (k != 0) {
        $for M in range(MR):
          const v128_t vxa${M} = ${WASM_X16X8_LOAD8X8}(a${M});
          a${M} = (const ${XINT8_T}*) ((uintptr_t) a${M} + k);

        $if DATATYPE == "QU8":
          const v128_t vxb0 = wasm_i16x8_sub(wasm_u16x8_load8x8(w), vb_zero_point);
        $else:
          const v128_t vxb0 = wasm_i16x8_load8x8(w);
        w = (const void*) ((const ${XINT8_T}*) w + 8);

        $for M in range(MR):
          vacc${M}x0123 = wasm_i32x4_add(vacc${M}x0123,
            wasm_i32x4_dot_i16x8(wasm_v32x4_shuffle(vxa${M}, vxa${M}, 0, 0, 0, 0), vxb0));

        if (k > 2 * sizeof(${XINT8_T})) {
          $if DATATYPE == "QU8":
            const v128_t vxb1 = wasm_i16x8_sub(wasm_u16x8_load8x8(w), vb_zero_point);
          $else:
            const v128_t vxb1 = wasm_i16x8_load8x8(w);
          w = (const void*) ((const ${XINT8_T}*) w + 8);

          $for M in range(MR):
            vacc${M}x0123 = wasm_i32x4_add(vacc${M}x0123,
              wasm_i32x4_dot_i16x8(wasm_v32x4_shuffle(vxa${M}, vxa${M}, 1, 1, 1, 1), vxb1));

          if (k > 4 * sizeof(${XINT8_T})) {
            $if DATATYPE == "QU8":
              const v128_t vxb2 = wasm_i16x8_sub(wasm_u16x8_load8x8(w), vb_zero_point);
            $else:
              const v128_t vxb2 = wasm_i16x8_load8x8(w);
            w = (const void*) ((const ${XINT8_T}*) w + 8);

            $for M in range(MR):
              vacc${M}x0123 = wasm_i32x4_add(vacc${M}x0123,
                wasm_i32x4_dot_i16x8(wasm_v32x4_shuffle(vxa${M}, vxa${M}, 2, 2, 2, 2), vxb2));
          }
        }
      }
      p -= ${MR} * sizeof(void*);
    } while (p != 0);

    $for M in range(MR):
      vacc${M}x0123 = wasm_f32x4_convert_i32x4(vacc${M}x0123);

    $if DATATYPE == "QC8":
      const v128_t vscale0123 = wasm_v128_load(w);
      w = (const void*) ((const float*) w + 4);
      $for M in range(MR):
        vacc${M}x0123 = wasm_f32x4_mul(vacc${M}x0123, vscale0123);
    $else:
      const v128_t vscale = wasm_v128_load64_splat(params->${PARAMS_STRUCT}.scale);
      $for M in range(MR):
        vacc${M}x0123 = wasm_f32x4_mul(vacc${M}x0123, vscale);

    const v128_t vmagic_bias = wasm_v128_load64_splat(params->${PARAMS_STRUCT}.magic_bias);
    $for M in range(MR):
      vacc${M}x0123 = wasm_f32x4_add(vacc${M}x0123, vmagic_bias);

    const v128_t vmagic_min = wasm_v128_load64_splat(params->${PARAMS_STRUCT}.magic_min);
    $for M in range(MR):
      vacc${M}x0123 = wasm_i32x4_max(vacc${M}x0123, vmagic_min);

    const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load64_splat(params->${PARAMS_STRUCT}.magic_bias_less_output_zero_point);
    $for M in range(MR):
      vacc${M}x0123 = wasm_i32x4_sub(vacc${M}x0123, vmagic_bias_less_output_zero_point);

    $for M in range(0, MR, 2):
      v128_t vacc${M}${min(M+1, MR-1)}x0123 = wasm_i16x8_narrow_i32x4(vacc${M}x0123, vacc${min(M+1, MR-1)}x0123);

    $if MR > 2:
      v128_t vout = ${WASM_X8X16_NARROW_I16X8}(vacc0${min(1, MR-1)}x0123, vacc${min(2, MR-1)}${min(3, MR-1)}x0123);
    $else:
      v128_t vout = ${WASM_X8X16_NARROW_I16X8}(vacc0${min(1, MR-1)}x0123, vacc0${min(1, MR-1)}x0123);

    const v128_t voutput_max = wasm_v128_load64_splat(params->${PARAMS_STRUCT}.output_max);
    vout = ${WASM_X8X16_MIN}(vout, voutput_max);

    if (nc >= 4) {
      $for M in reversed(range(MR)):
        *((float*) c${M}) = (float) wasm_f32x4_extract_lane(vout, ${M});

      $for M in reversed(range(MR)):
        c${M} = (${XINT8_T}*) ((uintptr_t) c${M} + cn_stride);

      a = (const ${XINT8_T}**restrict) ((uintptr_t) a - ks);

      nc -= 4;
    } else {
      $for M in reversed(range(MR)):
        uint32_t vout${M} = wasm_i32x4_extract_lane(vout, ${M});
      if (nc & 2) {
        $for M in reversed(range(MR)):
          *((uint16_t*) c${M}) = (uint16_t) vout${M};
          vout${M} >>= 16;
          c${M} += 2;
      }
      if (nc & 1) {
        $for M in reversed(range(MR)):
          *c${M} = (${XINT8_T}) vout${M};
      }

      nc = 0;
    }
  } while (nc != 0);
}
