From 4659a124b62a5133968fd71cfa6849eaf0d692f8 Mon Sep 17 00:00:00 2001 From: Felix Thomasmathibalan Date: Thu, 21 Nov 2024 08:55:34 +0000 Subject: [PATCH 1/8] Add SME2 FP16 GEMV micro kernel RHS pack is required. LHS pack is not required Signed-off-by: Felix Thomasmathibalan --- CMakeLists.txt | 1 + ...clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.c | 918 ++++++++++++++++++ ...clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.h | 115 +++ 3 files changed, 1034 insertions(+) create mode 100644 kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.c create mode 100644 kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.h diff --git a/CMakeLists.txt b/CMakeLists.txt index d1a228df..f019a1b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -152,6 +152,7 @@ set(KLEIDIAI_FILES_SME2 kai/ukernels/matmul/matmul_clamp_f32_f32_f32p/kai_matmul_clamp_f32_f32_f32p16vlx1b_1x16vl_sme2_mla.c kai/ukernels/matmul/matmul_clamp_f32_f32_f32p/kai_matmul_clamp_f32_f32_f32p2vlx1b_1x16vl_sme2_mla.c kai/ukernels/matmul/matmul_clamp_f32_f32p_f32p/kai_matmul_clamp_f32_f32p2vlx1_f32p2vlx1biasf32_sme2_mopa.c + kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.c ) add_library(kleidiai) diff --git a/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.c b/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.c new file mode 100644 index 00000000..6e14b34f --- /dev/null +++ b/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.c @@ -0,0 +1,918 @@ +// +// SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 +// + +#if !defined(__aarch64__) || !defined(__ARM_FEATURE_SVE2) +#error This file must be compiled for AArch64, FEAT_SVE2. +#else // Architectural features check. + +#include "kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.h" + +#include +#include + +#include "kai/kai_common.h" + +static const size_t kai_mr = 1; +static const size_t kai_m_step = 1; +static const size_t kai_nr = 2; +static const size_t kai_n_step = 16; +static const size_t kai_kr = 2; +static const size_t kai_sr = 1; + +size_t kai_get_m_step_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(void) { + return kai_m_step * kai_get_sme_vector_length_u16() / kai_kr; + ; +} + +size_t kai_get_n_step_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(void) { + return kai_n_step * kai_get_sme_vector_length_u16() / kai_kr; +} + +size_t kai_get_mr_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(void) { + return kai_mr * kai_get_sme_vector_length_u16() / kai_kr; +} + +size_t kai_get_nr_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(void) { + return kai_nr * kai_get_sme_vector_length_u16() / kai_kr; +} + +size_t kai_get_kr_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(void) { + return kai_kr; +} + +size_t kai_get_sr_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(void) { + return kai_sr; +} + +size_t kai_get_lhs_packed_offset_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(size_t m_idx, size_t k) { + KAI_ASSUME(m_idx % kai_get_m_step_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot() == 0); + + return m_idx * k; +} + +static size_t kai_get_rhs_packed_stride_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(size_t k) { + return kai_get_n_step_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot() * + ((kai_roundup(k, kai_kr) * sizeof(uint16_t) + sizeof(uint16_t))); +} + +size_t kai_get_rhs_packed_offset_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(size_t n_idx, size_t k) { + KAI_ASSUME(n_idx % kai_get_n_step_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot() == 0); + + const size_t block_idx = n_idx / kai_get_n_step_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(); + return block_idx * kai_get_rhs_packed_stride_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(k); +} + +size_t kai_get_dst_offset_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot( + size_t m_idx, size_t n_idx, size_t dst_stride) { + KAI_ASSUME(m_idx % kai_get_m_step_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot() == 0); + KAI_ASSUME(n_idx % kai_get_n_step_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot() == 0); + + return (m_idx * dst_stride) + (n_idx * sizeof(uint16_t)); +} + +size_t kai_get_dst_size_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(size_t m, size_t n) { + return m * n * sizeof(uint16_t); +} + +void kai_run_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot( + size_t m, size_t n, size_t k, const void* lhs, size_t lhs_stride, const void* rhs_packed, void* dst, + size_t dst_stride_row, size_t dst_stride_col, __fp16 clamp_min, __fp16 clamp_max) { + KAI_UNUSED(dst_stride_row); + KAI_UNUSED(dst_stride_col); + KAI_UNUSED(lhs_stride); + KAI_ASSERT(m == 1); + + typedef struct { + __fp16 maxval; + __fp16 minval; + } KernelArgs; + + KernelArgs ka; + ka.maxval = clamp_max; + ka.minval = clamp_min; + + size_t N = n; + size_t K = k; + + const void* A_ptr = lhs; + const void* B_ptr = rhs_packed; + void* output_ptr = dst; + + uint64_t flags = 0; + + __asm__ __volatile__( + ".inst 0xd503477f // SMSTART ZA\n" + "mov x8, #0x0\n" + "mov x16, %x[B_ptr]\n" + "cntw x15, ALL, MUL #4\n" + "mov x14, %x[output_ptr]\n" + "add x13, %x[N], x15\n" + "ptrue p1.b\n" + "sub x13, x13, #0x1\n" + ".inst 0x25207811 // ptrue pn9.b\n" + "udiv x13, x13, x15\n" + "mov x22, #0x1\n" + "add x21, x13, #0x3\n" + "and x21, x21, #0xfffffffffffffffc\n" + "mul x21, x21, x15\n" + "mul x21, x21, %x[K]\n" + "lsl x21, x21, #0x1\n" + "1:" // RHS size check loop + "cmp x21, #0x200000\n" + "blt 2f\n" + "tbnz x21, #0, 3f\n" + "lsr x21, x21, #0x1\n" + "lsl x22, x22, #0x1\n" + "b 1b\n" + "2:" // RHS do prefetch + "lsl x20, x21, #0x26\n" + "sub x22, x22, #0x1\n" + "lsl x22, x22, #0x16\n" + "orr x21, x21, x20\n" + "orr x21, x21, x22\n" + ".inst 0xf8b54a1a // rprfm pldonce, x21, [x16]\n" + "3:" // RHS prefetch exit + "add x12, %x[K], #0x1\n" + "cnth x20, ALL, MUL #2\n" + "bic x12, x12, #0x1\n" + "lsl x12, x12, #0x1\n" + "add x12, x12, #0x2\n" + "mul x12, x12, x20\n" + "4:" // Column loop + "cmp x13, #0x4\n" + "bge 22f\n" + "cmp x13, #0x2\n" + "bgt 16f\n" + "beq 10f\n" + "cntw x20, ALL, MUL #2\n" + "add x22, x16, x12\n" + "ld1h { z0.s }, p1/Z, [x16]\n" + "cmp %x[N], x20\n" + "ld1h { z1.s }, p1/Z, [x16, #1, MUL VL]\n" + "mov x11, %x[K]\n" + "csel x22, x22, x16, GT\n" + "mov x21, %x[N]\n" + "ld1h { z2.s }, p1/Z, [x22]\n" + "fcvt z0.s, p1/m, z0.h\n" + "mov x10, %x[A_ptr]\n" + "lsl x20, %x[K], #0x1\n" + "ld1h { z3.s }, p1/Z, [x22, #1, MUL VL]\n" + "fcvt z1.s, p1/m, z1.h\n" + ".inst 0x257547f0 // whilelt p8.h, XZR, x21, VLx2\n" + "cmp x11, #0x8\n" + ".inst 0xf8b44958 // rprfm pldmany, x20, [x10]\n" + "inch x16, ALL, MUL #2\n" + "fcvt z2.s, p1/m, z2.h\n" + "inch x22, ALL, MUL #2\n" + "fcvt z3.s, p1/m, z3.h\n" + ".inst 0xc0040c00 // mova za.d[x8, #0], { z0.d-z3.d }\n" + "ble 6f\n" + "5:" // Width 1: Multiply loop: Main loop head + "whilelt p0.h, XZR, x11\n" + ".inst 0xa0402617 // ldnt1h { z22.h-z23.h }, pn9.b/Z, [x16]\n" + "addvl x16, x16, #2\n" + "ld1rqh { z9.h }, p0/Z, [x10]\n" + "sub x11, x11, #0x8\n" + "add x10, x10, #0x10\n" + ".inst 0xa04026d9 // ldnt1h { z24.h-z25.h }, pn9.b/Z, [x22]\n" + "addvl x22, x22, #2\n" + "cmp x11, #0x8\n" + ".inst 0xa040260f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x16]\n" + "addvl x16, x16, #2\n" + ".inst 0xa04026d1 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x22]\n" + "addvl x22, x22, #2\n" + ".inst 0xc1599288 // fdot za.s[x8, 0], { z22.h-z25.h }, z9.h[0]\n" + ".inst 0xa0402613 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x16]\n" + "addvl x16, x16, #2\n" + ".inst 0xa04026d5 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x22]\n" + "addvl x22, x22, #2\n" + ".inst 0xa040260b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x16]\n" + "addvl x16, x16, #2\n" + ".inst 0xa04026cd // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x22]\n" + "addvl x22, x22, #2\n" + ".inst 0xc1599588 // fdot za.s[x8, 0], { z14.h-z17.h }, z9.h[1]\n" + ".inst 0xc1599a08 // fdot za.s[x8, 0], { z18.h-z21.h }, z9.h[2]\n" + ".inst 0xc1599d08 // fdot za.s[x8, 0], { z10.h-z13.h }, z9.h[3]\n" + "bgt 5b\n" + "6:" // Width 1: Multiply loop: Single iteration only + "whilelt p0.h, XZR, x11\n" + ".inst 0xa040261f // ldnt1h { z30.h-z31.h }, pn9.b/Z, [x16]\n" + "subs x11, x11, #0x2\n" + "ld1rqh { z2.h }, p0/Z, [x10]\n" + "addvl x16, x16, #2\n" + ".inst 0xa04026c1 // ldnt1h { z0.h-z1.h }, pn9.b/Z, [x22]\n" + "addvl x22, x22, #2\n" + ".inst 0xc1529388 // fdot za.s[x8, 0], { z30.h-z1.h }, z2.h[0]\n" + "ble 7f\n" + ".inst 0xa0402605 // ldnt1h { z4.h-z5.h }, pn9.b/Z, [x16]\n" + "subs x11, x11, #0x2\n" + "addvl x16, x16, #2\n" + ".inst 0xa04026c7 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x22]\n" + "addvl x22, x22, #2\n" + ".inst 0xc1529488 // fdot za.s[x8, 0], { z4.h-z7.h }, z2.h[1]\n" + "ble 7f\n" + ".inst 0xa0402609 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x16]\n" + "subs x11, x11, #0x2\n" + "addvl x16, x16, #2\n" + ".inst 0xa04026cb // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x22]\n" + "addvl x22, x22, #2\n" + ".inst 0xc1529908 // fdot za.s[x8, 0], { z8.h-z11.h }, z2.h[2]\n" + "ble 7f\n" + ".inst 0xa040260b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x16]\n" + ".inst 0xa04026cd // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x22]\n" + ".inst 0xc1529d08 // fdot za.s[x8, 0], { z10.h-z13.h }, z2.h[3]\n" + "7:" // Width 1: Multiply loop: multiply skip + "tbz %x[flags], #1, 8f\n" + ".inst 0xc0060c08 // mova { z8.d-z11.d }, za.d[x8, #0]\n" + "add x21, %x[args_ptr], %[offset_min]\n" + "add x20, %x[args_ptr], %[offset_max]\n" + "ld1rh { z16.h }, p1/Z, [x21]\n" + "ld1rh { z15.h }, p1/Z, [x20]\n" + ".inst 0xc120e11a // fcvt z26.h, { z8.s-z9.s }\n" + ".inst 0xc120e15b // fcvt z27.h, { z10.s-z11.s }\n" + ".inst 0xc16fc21a // fclamp { z26.h-z27.h }, z16.h, z15.h\n" + ".inst 0xa06021da // st1h { z26.h-z27.h }, p8, [x14]\n" + "b 9f\n" + "8:" // Width 1: No activation + ".inst 0xc0060c18 // mova { z24.d-z27.d }, za.d[x8, #0]\n" + ".inst 0xc120e315 // fcvt z21.h, { z24.s-z25.s }\n" + ".inst 0xc120e35d // fcvt z29.h, { z26.s-z27.s }\n" + ".inst 0xa16021d5 // st1h { z21.h, z29.h }, p8, [x14]\n" + "9:" // Width 1: Output done + "b 28f\n" + "10:" // Width 2 + "add x24, x16, x12, LSL #1\n" + "cntw x20, ALL, MUL #6\n" + "ld1h { z0.s }, p1/Z, [x16]\n" + "add x23, x24, x12\n" + "cmp %x[N], x20\n" + "ld1h { z1.s }, p1/Z, [x16, #1, MUL VL]\n" + "add x22, x16, x12\n" + "csel x23, x23, x16, GT\n" + "ld1h { z16.s }, p1/Z, [x24]\n" + "ld1h { z2.s }, p1/Z, [x22]\n" + "fcvt z0.s, p1/m, z0.h\n" + "mov x11, %x[K]\n" + "sub x21, %x[N], x15\n" + "ld1h { z3.s }, p1/Z, [x22, #1, MUL VL]\n" + "fcvt z1.s, p1/m, z1.h\n" + "mov x10, %x[A_ptr]\n" + "lsl x20, %x[K], #0x1\n" + "ld1h { z17.s }, p1/Z, [x24, #1, MUL VL]\n" + "fcvt z16.s, p1/m, z16.h\n" + ".inst 0x257547f0 // whilelt p8.h, XZR, x21, VLx2\n" + "cmp x11, #0x8\n" + "ld1h { z18.s }, p1/Z, [x23]\n" + "fcvt z2.s, p1/m, z2.h\n" + ".inst 0xf8b44958 // rprfm pldmany, x20, [x10]\n" + "inch x16, ALL, MUL #2\n" + "ld1h { z19.s }, p1/Z, [x23, #1, MUL VL]\n" + "fcvt z3.s, p1/m, z3.h\n" + "inch x22, ALL, MUL #2\n" + "inch x24, ALL, MUL #2\n" + "fcvt z17.s, p1/m, z17.h\n" + "inch x23, ALL, MUL #2\n" + "fcvt z18.s, p1/m, z18.h\n" + "fcvt z19.s, p1/m, z19.h\n" + ".inst 0xc0040c00 // mova za.d[x8, #0], { z0.d-z3.d }\n" + ".inst 0xc0040e01 // mova za.d[x8, #1], { z16.d-z19.d }\n" + "ble 12f\n" + "11:" // Width 2: Multiply loop: Main loop head + "whilelt p0.h, XZR, x11\n" + ".inst 0xa0402609 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x16]\n" + "addvl x16, x16, #2\n" + "ld1rqh { z4.h }, p0/Z, [x10]\n" + "sub x11, x11, #0x8\n" + "add x10, x10, #0x10\n" + ".inst 0xa04026cb // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x22]\n" + "addvl x22, x22, #2\n" + "cmp x11, #0x8\n" + ".inst 0xa040270f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x24]\n" + "addvl x24, x24, #2\n" + ".inst 0xa04026f1 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x23]\n" + "addvl x23, x23, #2\n" + ".inst 0xc1549108 // fdot za.s[x8, 0], { z8.h-z11.h }, z4.h[0]\n" + ".inst 0xa040260b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x16]\n" + "addvl x16, x16, #2\n" + ".inst 0xa04026cd // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x22]\n" + "addvl x22, x22, #2\n" + ".inst 0xc1549189 // fdot za.s[x8, 1], { z14.h-z17.h }, z4.h[0]\n" + ".inst 0xa0402711 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x24]\n" + "addvl x24, x24, #2\n" + ".inst 0xa04026f3 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x23]\n" + "addvl x23, x23, #2\n" + ".inst 0xc1549508 // fdot za.s[x8, 0], { z10.h-z13.h }, z4.h[1]\n" + ".inst 0xa0402619 // ldnt1h { z24.h-z25.h }, pn9.b/Z, [x16]\n" + "addvl x16, x16, #2\n" + ".inst 0xa04026db // ldnt1h { z26.h-z27.h }, pn9.b/Z, [x22]\n" + "addvl x22, x22, #2\n" + ".inst 0xc1549609 // fdot za.s[x8, 1], { z16.h-z19.h }, z4.h[1]\n" + ".inst 0xa0402707 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x24]\n" + "addvl x24, x24, #2\n" + ".inst 0xa04026e9 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x23]\n" + "addvl x23, x23, #2\n" + ".inst 0xc1549b08 // fdot za.s[x8, 0], { z24.h-z27.h }, z4.h[2]\n" + ".inst 0xa040260d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x16]\n" + "addvl x16, x16, #2\n" + ".inst 0xa04026cf // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x22]\n" + "addvl x22, x22, #2\n" + ".inst 0xc1549889 // fdot za.s[x8, 1], { z6.h-z9.h }, z4.h[2]\n" + ".inst 0xa0402713 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x24]\n" + "addvl x24, x24, #2\n" + ".inst 0xa04026f5 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x23]\n" + "addvl x23, x23, #2\n" + ".inst 0xc1549d88 // fdot za.s[x8, 0], { z12.h-z15.h }, z4.h[3]\n" + ".inst 0xc1549e09 // fdot za.s[x8, 1], { z18.h-z21.h }, z4.h[3]\n" + "bgt 11b\n" + "12:" // Width 2: Multiply loop: Single iteration only + "whilelt p0.h, XZR, x11\n" + ".inst 0xa040261b // ldnt1h { z26.h-z27.h }, pn9.b/Z, [x16]\n" + "subs x11, x11, #0x2\n" + "ld1rqh { z2.h }, p0/Z, [x10]\n" + "addvl x16, x16, #2\n" + ".inst 0xa04026dd // ldnt1h { z28.h-z29.h }, pn9.b/Z, [x22]\n" + "addvl x22, x22, #2\n" + ".inst 0xa040271f // ldnt1h { z30.h-z31.h }, pn9.b/Z, [x24]\n" + "addvl x24, x24, #2\n" + ".inst 0xa04026e1 // ldnt1h { z0.h-z1.h }, pn9.b/Z, [x23]\n" + "addvl x23, x23, #2\n" + ".inst 0xc1529308 // fdot za.s[x8, 0], { z26.h-z29.h }, z2.h[0]\n" + ".inst 0xc1529389 // fdot za.s[x8, 1], { z30.h-z1.h }, z2.h[0]\n" + "ble 13f\n" + ".inst 0xa040261b // ldnt1h { z26.h-z27.h }, pn9.b/Z, [x16]\n" + "subs x11, x11, #0x2\n" + "addvl x16, x16, #2\n" + ".inst 0xa04026dd // ldnt1h { z28.h-z29.h }, pn9.b/Z, [x22]\n" + "addvl x22, x22, #2\n" + ".inst 0xa0402711 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x24]\n" + "addvl x24, x24, #2\n" + ".inst 0xa04026f3 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x23]\n" + "addvl x23, x23, #2\n" + ".inst 0xc1529708 // fdot za.s[x8, 0], { z26.h-z29.h }, z2.h[1]\n" + ".inst 0xc1529609 // fdot za.s[x8, 1], { z16.h-z19.h }, z2.h[1]\n" + "ble 13f\n" + ".inst 0xa0402613 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x16]\n" + "subs x11, x11, #0x2\n" + "addvl x16, x16, #2\n" + ".inst 0xa04026d5 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x22]\n" + "addvl x22, x22, #2\n" + ".inst 0xa040270f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x24]\n" + "addvl x24, x24, #2\n" + ".inst 0xa04026f1 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x23]\n" + "addvl x23, x23, #2\n" + ".inst 0xc1529a08 // fdot za.s[x8, 0], { z18.h-z21.h }, z2.h[2]\n" + ".inst 0xc1529989 // fdot za.s[x8, 1], { z14.h-z17.h }, z2.h[2]\n" + "ble 13f\n" + ".inst 0xa040261d // ldnt1h { z28.h-z29.h }, pn9.b/Z, [x16]\n" + ".inst 0xa04026df // ldnt1h { z30.h-z31.h }, pn9.b/Z, [x22]\n" + ".inst 0xa0402709 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x24]\n" + ".inst 0xa04026eb // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x23]\n" + ".inst 0xc1529f88 // fdot za.s[x8, 0], { z28.h-z31.h }, z2.h[3]\n" + ".inst 0xc1529d09 // fdot za.s[x8, 1], { z8.h-z11.h }, z2.h[3]\n" + "13:" // Width 2: Multiply loop: multiply skip + "tbz %x[flags], #1, 14f\n" + ".inst 0xc0060c0c // mova { z12.d-z15.d }, za.d[x8, #0]\n" + "add x21, %x[args_ptr], %[offset_min]\n" + "add x20, %x[args_ptr], %[offset_max]\n" + ".inst 0xc0060c28 // mova { z8.d-z11.d }, za.d[x8, #1]\n" + "ld1rh { z17.h }, p1/Z, [x21]\n" + "ld1rh { z5.h }, p1/Z, [x20]\n" + ".inst 0xc120e19c // fcvt z28.h, { z12.s-z13.s }\n" + ".inst 0xc120e1dd // fcvt z29.h, { z14.s-z15.s }\n" + ".inst 0xc120e10e // fcvt z14.h, { z8.s-z9.s }\n" + ".inst 0xc120e14f // fcvt z15.h, { z10.s-z11.s }\n" + ".inst 0xc165c23c // fclamp { z28.h-z29.h }, z17.h, z5.h\n" + ".inst 0xc165c22e // fclamp { z14.h-z15.h }, z17.h, z5.h\n" + ".inst 0xa06025dc // st1h { z28.h-z29.h }, pn9.b, [x14]\n" + ".inst 0xa06121ce // st1h { z14.h-z15.h }, p8, [x14, #0x2, MUL VL]\n" + "b 15f\n" + "14:" // Width 2: No activation + ".inst 0xc0060c10 // mova { z16.d-z19.d }, za.d[x8, #0]\n" + ".inst 0xc0060c24 // mova { z4.d-z7.d }, za.d[x8, #1]\n" + ".inst 0xc120e218 // fcvt z24.h, { z16.s-z17.s }\n" + ".inst 0xc120e259 // fcvt z25.h, { z18.s-z19.s }\n" + ".inst 0xa06025d8 // st1h { z24.h-z25.h }, pn9.b, [x14]\n" + ".inst 0xc120e091 // fcvt z17.h, { z4.s-z5.s }\n" + ".inst 0xc120e0d9 // fcvt z25.h, { z6.s-z7.s }\n" + ".inst 0xa16121d1 // st1h { z17.h, z25.h }, p8, [x14, #0x2, MUL VL]\n" + "15:" // Width 2: Output done + "b 28f\n" + "16:" // Width 3 + "add x26, x16, x12, LSL #2\n" + "cntw x20, ALL, MUL #10\n" + "ld1h { z0.s }, p1/Z, [x16]\n" + "add x25, x16, x12, LSL #1\n" + "add x24, x26, x12\n" + "ld1h { z1.s }, p1/Z, [x16, #1, MUL VL]\n" + "cmp %x[N], x20\n" + "add x23, x16, x12\n" + "ld1h { z8.s }, p1/Z, [x25]\n" + "add x22, x25, x12\n" + "csel x24, x24, x16, GT\n" + "ld1h { z2.s }, p1/Z, [x23]\n" + "fcvt z0.s, p1/m, z0.h\n" + "ld1h { z3.s }, p1/Z, [x23, #1, MUL VL]\n" + "fcvt z1.s, p1/m, z1.h\n" + "mov x20, #0x2\n" + "mov x11, %x[K]\n" + "ld1h { z9.s }, p1/Z, [x25, #1, MUL VL]\n" + "fcvt z8.s, p1/m, z8.h\n" + "msub x21, x15, x20, %x[N]\n" + "mov x10, %x[A_ptr]\n" + "ld1h { z10.s }, p1/Z, [x22]\n" + "fcvt z2.s, p1/m, z2.h\n" + "lsl x20, %x[K], #0x1\n" + ".inst 0x257547f0 // whilelt p8.h, XZR, x21, VLx2\n" + "ld1h { z11.s }, p1/Z, [x22, #1, MUL VL]\n" + "fcvt z3.s, p1/m, z3.h\n" + "cmp x11, #0x8\n" + ".inst 0xf8b44958 // rprfm pldmany, x20, [x10]\n" + "ld1h { z20.s }, p1/Z, [x26]\n" + "fcvt z9.s, p1/m, z9.h\n" + "inch x16, ALL, MUL #2\n" + "inch x23, ALL, MUL #2\n" + "ld1h { z21.s }, p1/Z, [x26, #1, MUL VL]\n" + "fcvt z10.s, p1/m, z10.h\n" + "inch x25, ALL, MUL #2\n" + "inch x22, ALL, MUL #2\n" + "ld1h { z22.s }, p1/Z, [x24]\n" + "fcvt z11.s, p1/m, z11.h\n" + "inch x26, ALL, MUL #2\n" + "ld1h { z23.s }, p1/Z, [x24, #1, MUL VL]\n" + "fcvt z20.s, p1/m, z20.h\n" + "inch x24, ALL, MUL #2\n" + ".inst 0xc0040c00 // mova za.d[x8, #0], { z0.d-z3.d }\n" + "fcvt z21.s, p1/m, z21.h\n" + "fcvt z22.s, p1/m, z22.h\n" + "fcvt z23.s, p1/m, z23.h\n" + ".inst 0xc0040d01 // mova za.d[x8, #1], { z8.d-z11.d }\n" + ".inst 0xc0040e82 // mova za.d[x8, #2], { z20.d-z23.d }\n" + "ble 18f\n" + "17:" // Width 3: Multiply loop: Main loop head + "whilelt p0.h, XZR, x11\n" + ".inst 0xa0402607 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x16]\n" + "addvl x16, x16, #2\n" + "ld1rqh { z2.h }, p0/Z, [x10]\n" + "sub x11, x11, #0x8\n" + "add x10, x10, #0x10\n" + ".inst 0xa04026e9 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x23]\n" + "addvl x23, x23, #2\n" + "cmp x11, #0x8\n" + ".inst 0xa040272d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x25]\n" + "addvl x25, x25, #2\n" + ".inst 0xa04026cf // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x22]\n" + "addvl x22, x22, #2\n" + ".inst 0xa0402755 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x26]\n" + ".inst 0xc1529088 // fdot za.s[x8, 0], { z6.h-z9.h }, z2.h[0]\n" + "addvl x26, x26, #2\n" + ".inst 0xa0402717 // ldnt1h { z22.h-z23.h }, pn9.b/Z, [x24]\n" + "addvl x24, x24, #2\n" + ".inst 0xc1529189 // fdot za.s[x8, 1], { z12.h-z15.h }, z2.h[0]\n" + ".inst 0xa0402605 // ldnt1h { z4.h-z5.h }, pn9.b/Z, [x16]\n" + "addvl x16, x16, #2\n" + ".inst 0xa04026e7 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x23]\n" + "addvl x23, x23, #2\n" + ".inst 0xc152928a // fdot za.s[x8, 2], { z20.h-z23.h }, z2.h[0]\n" + ".inst 0xa040272d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x25]\n" + "addvl x25, x25, #2\n" + ".inst 0xa04026cf // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x22]\n" + "addvl x22, x22, #2\n" + ".inst 0xa0402749 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x26]\n" + ".inst 0xc1529488 // fdot za.s[x8, 0], { z4.h-z7.h }, z2.h[1]\n" + "addvl x26, x26, #2\n" + ".inst 0xa040270b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x24]\n" + "addvl x24, x24, #2\n" + ".inst 0xc1529589 // fdot za.s[x8, 1], { z12.h-z15.h }, z2.h[1]\n" + ".inst 0xa040260d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x16]\n" + "addvl x16, x16, #2\n" + ".inst 0xa04026ef // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x23]\n" + "addvl x23, x23, #2\n" + ".inst 0xc152950a // fdot za.s[x8, 2], { z8.h-z11.h }, z2.h[1]\n" + ".inst 0xa0402735 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x25]\n" + "addvl x25, x25, #2\n" + ".inst 0xa04026d7 // ldnt1h { z22.h-z23.h }, pn9.b/Z, [x22]\n" + "addvl x22, x22, #2\n" + ".inst 0xa040275f // ldnt1h { z30.h-z31.h }, pn9.b/Z, [x26]\n" + ".inst 0xc1529988 // fdot za.s[x8, 0], { z12.h-z15.h }, z2.h[2]\n" + "addvl x26, x26, #2\n" + ".inst 0xa0402701 // ldnt1h { z0.h-z1.h }, pn9.b/Z, [x24]\n" + "addvl x24, x24, #2\n" + ".inst 0xc1529a89 // fdot za.s[x8, 1], { z20.h-z23.h }, z2.h[2]\n" + ".inst 0xa040260b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x16]\n" + "addvl x16, x16, #2\n" + ".inst 0xa04026ed // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x23]\n" + "addvl x23, x23, #2\n" + ".inst 0xc1529b8a // fdot za.s[x8, 2], { z30.h-z1.h }, z2.h[2]\n" + ".inst 0xa0402733 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x25]\n" + "addvl x25, x25, #2\n" + ".inst 0xa04026d5 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x22]\n" + "addvl x22, x22, #2\n" + ".inst 0xa040274f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x26]\n" + ".inst 0xc1529d08 // fdot za.s[x8, 0], { z10.h-z13.h }, z2.h[3]\n" + "addvl x26, x26, #2\n" + ".inst 0xa0402711 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x24]\n" + "addvl x24, x24, #2\n" + ".inst 0xc1529e09 // fdot za.s[x8, 1], { z18.h-z21.h }, z2.h[3]\n" + ".inst 0xc1529d8a // fdot za.s[x8, 2], { z14.h-z17.h }, z2.h[3]\n" + "bgt 17b\n" + "18:" // Width 3: Multiply loop: Single iteration only + "whilelt p0.h, XZR, x11\n" + ".inst 0xa0402605 // ldnt1h { z4.h-z5.h }, pn9.b/Z, [x16]\n" + "subs x11, x11, #0x2\n" + "ld1rqh { z2.h }, p0/Z, [x10]\n" + "addvl x16, x16, #2\n" + ".inst 0xa04026e7 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x23]\n" + "addvl x23, x23, #2\n" + ".inst 0xa040272f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x25]\n" + "addvl x25, x25, #2\n" + ".inst 0xa04026d1 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x22]\n" + "addvl x22, x22, #2\n" + ".inst 0xa040275b // ldnt1h { z26.h-z27.h }, pn9.b/Z, [x26]\n" + ".inst 0xc1529088 // fdot za.s[x8, 0], { z4.h-z7.h }, z2.h[0]\n" + "addvl x26, x26, #2\n" + ".inst 0xa040271d // ldnt1h { z28.h-z29.h }, pn9.b/Z, [x24]\n" + "addvl x24, x24, #2\n" + ".inst 0xc1529189 // fdot za.s[x8, 1], { z14.h-z17.h }, z2.h[0]\n" + ".inst 0xc152930a // fdot za.s[x8, 2], { z26.h-z29.h }, z2.h[0]\n" + "ble 19f\n" + ".inst 0xa040260d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x16]\n" + "subs x11, x11, #0x2\n" + "addvl x16, x16, #2\n" + ".inst 0xa04026ef // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x23]\n" + "addvl x23, x23, #2\n" + ".inst 0xa040273d // ldnt1h { z28.h-z29.h }, pn9.b/Z, [x25]\n" + "addvl x25, x25, #2\n" + ".inst 0xa04026df // ldnt1h { z30.h-z31.h }, pn9.b/Z, [x22]\n" + "addvl x22, x22, #2\n" + ".inst 0xa040274b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x26]\n" + ".inst 0xc1529588 // fdot za.s[x8, 0], { z12.h-z15.h }, z2.h[1]\n" + "addvl x26, x26, #2\n" + ".inst 0xa040270d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x24]\n" + "addvl x24, x24, #2\n" + ".inst 0xc1529789 // fdot za.s[x8, 1], { z28.h-z31.h }, z2.h[1]\n" + ".inst 0xc152950a // fdot za.s[x8, 2], { z10.h-z13.h }, z2.h[1]\n" + "ble 19f\n" + ".inst 0xa0402607 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x16]\n" + "subs x11, x11, #0x2\n" + "addvl x16, x16, #2\n" + ".inst 0xa04026e9 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x23]\n" + "addvl x23, x23, #2\n" + ".inst 0xa0402733 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x25]\n" + "addvl x25, x25, #2\n" + ".inst 0xa04026d5 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x22]\n" + "addvl x22, x22, #2\n" + ".inst 0xa040274f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x26]\n" + ".inst 0xc1529888 // fdot za.s[x8, 0], { z6.h-z9.h }, z2.h[2]\n" + "addvl x26, x26, #2\n" + ".inst 0xa0402711 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x24]\n" + "addvl x24, x24, #2\n" + ".inst 0xc1529a09 // fdot za.s[x8, 1], { z18.h-z21.h }, z2.h[2]\n" + ".inst 0xc152998a // fdot za.s[x8, 2], { z14.h-z17.h }, z2.h[2]\n" + "ble 19f\n" + ".inst 0xa040260f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x16]\n" + ".inst 0xa04026f1 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x23]\n" + ".inst 0xa0402729 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x25]\n" + ".inst 0xa04026cb // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x22]\n" + ".inst 0xa040274d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x26]\n" + ".inst 0xc1529d88 // fdot za.s[x8, 0], { z14.h-z17.h }, z2.h[3]\n" + ".inst 0xa040270f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x24]\n" + ".inst 0xc1529d09 // fdot za.s[x8, 1], { z8.h-z11.h }, z2.h[3]\n" + ".inst 0xc1529d8a // fdot za.s[x8, 2], { z12.h-z15.h }, z2.h[3]\n" + "19:" // Width 3: Multiply loop: multiply skip + "tbz %x[flags], #1, 20f\n" + ".inst 0xc0060c18 // mova { z24.d-z27.d }, za.d[x8, #0]\n" + "add x21, %x[args_ptr], %[offset_min]\n" + "add x20, %x[args_ptr], %[offset_max]\n" + ".inst 0xc0060c3c // mova { z28.d-z31.d }, za.d[x8, #1]\n" + "ld1rh { z19.h }, p1/Z, [x21]\n" + ".inst 0xc0060c44 // mova { z4.d-z7.d }, za.d[x8, #2]\n" + "ld1rh { z18.h }, p1/Z, [x20]\n" + ".inst 0xc120e30c // fcvt z12.h, { z24.s-z25.s }\n" + ".inst 0xc120e34d // fcvt z13.h, { z26.s-z27.s }\n" + ".inst 0xc120e390 // fcvt z16.h, { z28.s-z29.s }\n" + ".inst 0xc120e3d1 // fcvt z17.h, { z30.s-z31.s }\n" + ".inst 0xc172c26c // fclamp { z12.h-z13.h }, z19.h, z18.h\n" + ".inst 0xc120e08e // fcvt z14.h, { z4.s-z5.s }\n" + ".inst 0xc120e0cf // fcvt z15.h, { z6.s-z7.s }\n" + ".inst 0xc172c270 // fclamp { z16.h-z17.h }, z19.h, z18.h\n" + ".inst 0xc172c26e // fclamp { z14.h-z15.h }, z19.h, z18.h\n" + ".inst 0xa06025cc // st1h { z12.h-z13.h }, pn9.b, [x14]\n" + ".inst 0xa06125d0 // st1h { z16.h-z17.h }, pn9.b, [x14, #0x2, MUL VL]\n" + ".inst 0xa06221ce // st1h { z14.h-z15.h }, p8, [x14, #0x4, MUL VL]\n" + "b 21f\n" + "20:" // Width 3: No activation + ".inst 0xc0060c00 // mova { z0.d-z3.d }, za.d[x8, #0]\n" + ".inst 0xc0060c28 // mova { z8.d-z11.d }, za.d[x8, #1]\n" + ".inst 0xc0060c4c // mova { z12.d-z15.d }, za.d[x8, #2]\n" + ".inst 0xc120e011 // fcvt z17.h, { z0.s-z1.s }\n" + ".inst 0xc120e059 // fcvt z25.h, { z2.s-z3.s }\n" + ".inst 0xa16025d1 // st1h { z17.h, z25.h }, pn9.b, [x14]\n" + ".inst 0xc120e111 // fcvt z17.h, { z8.s-z9.s }\n" + ".inst 0xc120e159 // fcvt z25.h, { z10.s-z11.s }\n" + ".inst 0xa16125d1 // st1h { z17.h, z25.h }, pn9.b, [x14, #0x2, MUL VL]\n" + ".inst 0xc120e191 // fcvt z17.h, { z12.s-z13.s }\n" + ".inst 0xc120e1d9 // fcvt z25.h, { z14.s-z15.s }\n" + ".inst 0xa16221d1 // st1h { z17.h, z25.h }, p8, [x14, #0x4, MUL VL]\n" + "21:" // Width 3: Output done + "b 28f\n" + "22:" // Width 4 + "add x9, x16, x12, LSL #2\n" + "cntw x20, ALL, MUL #14\n" + "ld1h { z28.s }, p1/Z, [x16]\n" + "add x28, x9, x12, LSL #1\n" + "add x27, x16, x12, LSL #1\n" + "ld1h { z29.s }, p1/Z, [x16, #1, MUL VL]\n" + "add x26, x28, x12\n" + "cmp %x[N], x20\n" + "ld1h { z0.s }, p1/Z, [x27]\n" + "add x25, x16, x12\n" + "add x24, x27, x12\n" + "ld1h { z1.s }, p1/Z, [x27, #1, MUL VL]\n" + "fcvt z28.s, p1/m, z28.h\n" + "add x23, x9, x12\n" + "csel x26, x26, x16, GT\n" + "ld1h { z30.s }, p1/Z, [x25]\n" + "fcvt z29.s, p1/m, z29.h\n" + "ld1h { z31.s }, p1/Z, [x25, #1, MUL VL]\n" + "fcvt z0.s, p1/m, z0.h\n" + "mov x20, #0x3\n" + "mov x11, %x[K]\n" + "ld1h { z2.s }, p1/Z, [x24]\n" + "fcvt z1.s, p1/m, z1.h\n" + "msub x21, x15, x20, %x[N]\n" + "mov x10, %x[A_ptr]\n" + "ld1h { z3.s }, p1/Z, [x24, #1, MUL VL]\n" + "fcvt z30.s, p1/m, z30.h\n" + "lsl x20, %x[K], #0x1\n" + ".inst 0x257547f0 // whilelt p8.h, XZR, x21, VLx2\n" + "ld1h { z4.s }, p1/Z, [x9]\n" + "fcvt z31.s, p1/m, z31.h\n" + "cmp x11, #0x8\n" + ".inst 0xf8b44958 // rprfm pldmany, x20, [x10]\n" + "ld1h { z5.s }, p1/Z, [x9, #1, MUL VL]\n" + "fcvt z2.s, p1/m, z2.h\n" + "add x22, x16, x12, LSL #3\n" + "inch x16, ALL, MUL #2\n" + "ld1h { z6.s }, p1/Z, [x23]\n" + "fcvt z3.s, p1/m, z3.h\n" + "inch x25, ALL, MUL #2\n" + "inch x27, ALL, MUL #2\n" + "ld1h { z7.s }, p1/Z, [x23, #1, MUL VL]\n" + "fcvt z4.s, p1/m, z4.h\n" + "inch x24, ALL, MUL #2\n" + "inch x9, ALL, MUL #2\n" + "ld1h { z12.s }, p1/Z, [x28]\n" + "fcvt z5.s, p1/m, z5.h\n" + "inch x23, ALL, MUL #2\n" + ".inst 0xc0040f80 // mova za.d[x8, #0], { z28.d-z31.d }\n" + "ld1h { z13.s }, p1/Z, [x28, #1, MUL VL]\n" + "fcvt z6.s, p1/m, z6.h\n" + "inch x28, ALL, MUL #2\n" + "ld1h { z14.s }, p1/Z, [x26]\n" + "fcvt z7.s, p1/m, z7.h\n" + ".inst 0xc0040c01 // mova za.d[x8, #1], { z0.d-z3.d }\n" + "ld1h { z15.s }, p1/Z, [x26, #1, MUL VL]\n" + "fcvt z12.s, p1/m, z12.h\n" + "inch x26, ALL, MUL #2\n" + "fcvt z13.s, p1/m, z13.h\n" + "fcvt z14.s, p1/m, z14.h\n" + "fcvt z15.s, p1/m, z15.h\n" + ".inst 0xc0040c82 // mova za.d[x8, #2], { z4.d-z7.d }\n" + ".inst 0xc0040d83 // mova za.d[x8, #3], { z12.d-z15.d }\n" + "ble 24f\n" + "23:" // Width 4: Multiply loop: Main loop head + "whilelt p0.h, XZR, x11\n" + ".inst 0xa040260d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x16]\n" + "addvl x16, x16, #2\n" + "ld1rqh { z0.h }, p0/Z, [x10]\n" + "sub x11, x11, #0x8\n" + "add x10, x10, #0x10\n" + ".inst 0xa040272f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x25]\n" + "addvl x25, x25, #2\n" + "cmp x11, #0x8\n" + ".inst 0xa0402767 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x27]\n" + "addvl x27, x27, #2\n" + ".inst 0xa0402709 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x24]\n" + "addvl x24, x24, #2\n" + ".inst 0xa040252b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x9]\n" + ".inst 0xc1509188 // fdot za.s[x8, 0], { z12.h-z15.h }, z0.h[0]\n" + "addvl x9, x9, #2\n" + ".inst 0xa04026ed // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x23]\n" + "addvl x23, x23, #2\n" + ".inst 0xa040278f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x28]\n" + ".inst 0xc1509089 // fdot za.s[x8, 1], { z6.h-z9.h }, z0.h[0]\n" + "addvl x28, x28, #2\n" + ".inst 0xa0402751 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x26]\n" + "addvl x26, x26, #2\n" + ".inst 0xc150910a // fdot za.s[x8, 2], { z10.h-z13.h }, z0.h[0]\n" + ".inst 0xa040260b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x16]\n" + "addvl x16, x16, #2\n" + ".inst 0xa040272d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x25]\n" + "addvl x25, x25, #2\n" + ".inst 0xc150918b // fdot za.s[x8, 3], { z14.h-z17.h }, z0.h[0]\n" + ".inst 0xa0402767 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x27]\n" + "addvl x27, x27, #2\n" + ".inst 0xa0402709 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x24]\n" + "addvl x24, x24, #2\n" + ".inst 0xa040252f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x9]\n" + ".inst 0xc1509508 // fdot za.s[x8, 0], { z10.h-z13.h }, z0.h[1]\n" + "addvl x9, x9, #2\n" + ".inst 0xa04026f1 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x23]\n" + "addvl x23, x23, #2\n" + ".inst 0xa040278b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x28]\n" + ".inst 0xc1509489 // fdot za.s[x8, 1], { z6.h-z9.h }, z0.h[1]\n" + "addvl x28, x28, #2\n" + ".inst 0xa040274d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x26]\n" + "addvl x26, x26, #2\n" + ".inst 0xc150958a // fdot za.s[x8, 2], { z14.h-z17.h }, z0.h[1]\n" + ".inst 0xa040260f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x16]\n" + "addvl x16, x16, #2\n" + ".inst 0xa0402731 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x25]\n" + "addvl x25, x25, #2\n" + ".inst 0xc150950b // fdot za.s[x8, 3], { z10.h-z13.h }, z0.h[1]\n" + ".inst 0xa0402775 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x27]\n" + "addvl x27, x27, #2\n" + ".inst 0xa0402717 // ldnt1h { z22.h-z23.h }, pn9.b/Z, [x24]\n" + "addvl x24, x24, #2\n" + ".inst 0xa0402539 // ldnt1h { z24.h-z25.h }, pn9.b/Z, [x9]\n" + ".inst 0xc1509988 // fdot za.s[x8, 0], { z14.h-z17.h }, z0.h[2]\n" + "addvl x9, x9, #2\n" + ".inst 0xa04026fb // ldnt1h { z26.h-z27.h }, pn9.b/Z, [x23]\n" + "addvl x23, x23, #2\n" + ".inst 0xa0402787 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x28]\n" + ".inst 0xc1509a89 // fdot za.s[x8, 1], { z20.h-z23.h }, z0.h[2]\n" + "addvl x28, x28, #2\n" + ".inst 0xa0402749 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x26]\n" + "addvl x26, x26, #2\n" + ".inst 0xc1509b0a // fdot za.s[x8, 2], { z24.h-z27.h }, z0.h[2]\n" + ".inst 0xa040260d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x16]\n" + "addvl x16, x16, #2\n" + ".inst 0xa040272f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x25]\n" + "addvl x25, x25, #2\n" + ".inst 0xc150988b // fdot za.s[x8, 3], { z6.h-z9.h }, z0.h[2]\n" + ".inst 0xa0402771 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x27]\n" + "addvl x27, x27, #2\n" + ".inst 0xa0402713 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x24]\n" + "addvl x24, x24, #2\n" + ".inst 0xa0402529 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x9]\n" + ".inst 0xc1509d88 // fdot za.s[x8, 0], { z12.h-z15.h }, z0.h[3]\n" + "addvl x9, x9, #2\n" + ".inst 0xa04026eb // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x23]\n" + "addvl x23, x23, #2\n" + ".inst 0xa040278d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x28]\n" + ".inst 0xc1509e09 // fdot za.s[x8, 1], { z16.h-z19.h }, z0.h[3]\n" + "addvl x28, x28, #2\n" + ".inst 0xa040274f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x26]\n" + "addvl x26, x26, #2\n" + ".inst 0xc1509d0a // fdot za.s[x8, 2], { z8.h-z11.h }, z0.h[3]\n" + ".inst 0xc1509d8b // fdot za.s[x8, 3], { z12.h-z15.h }, z0.h[3]\n" + "bgt 23b\n" + "24:" // Width 4: Multiply loop: Single iteration only + "whilelt p0.h, XZR, x11\n" + ".inst 0xa0402609 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x16]\n" + "subs x11, x11, #0x2\n" + "ld1rqh { z2.h }, p0/Z, [x10]\n" + "addvl x16, x16, #2\n" + ".inst 0xa040272b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x25]\n" + "addvl x25, x25, #2\n" + ".inst 0xa040276d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x27]\n" + "addvl x27, x27, #2\n" + ".inst 0xa040270f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x24]\n" + "addvl x24, x24, #2\n" + ".inst 0xa0402531 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x9]\n" + ".inst 0xc1529108 // fdot za.s[x8, 0], { z8.h-z11.h }, z2.h[0]\n" + "addvl x9, x9, #2\n" + ".inst 0xa04026f3 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x23]\n" + "addvl x23, x23, #2\n" + ".inst 0xa040278b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x28]\n" + ".inst 0xc1529189 // fdot za.s[x8, 1], { z12.h-z15.h }, z2.h[0]\n" + "addvl x28, x28, #2\n" + ".inst 0xa040274d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x26]\n" + "addvl x26, x26, #2\n" + ".inst 0xc152920a // fdot za.s[x8, 2], { z16.h-z19.h }, z2.h[0]\n" + ".inst 0xc152910b // fdot za.s[x8, 3], { z10.h-z13.h }, z2.h[0]\n" + "ble 25f\n" + ".inst 0xa040260f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x16]\n" + "subs x11, x11, #0x2\n" + "addvl x16, x16, #2\n" + ".inst 0xa0402731 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x25]\n" + "addvl x25, x25, #2\n" + ".inst 0xa0402769 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x27]\n" + "addvl x27, x27, #2\n" + ".inst 0xa040270b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x24]\n" + "addvl x24, x24, #2\n" + ".inst 0xa0402533 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x9]\n" + ".inst 0xc1529588 // fdot za.s[x8, 0], { z14.h-z17.h }, z2.h[1]\n" + "addvl x9, x9, #2\n" + ".inst 0xa04026f5 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x23]\n" + "addvl x23, x23, #2\n" + ".inst 0xa040278f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x28]\n" + ".inst 0xc1529509 // fdot za.s[x8, 1], { z8.h-z11.h }, z2.h[1]\n" + "addvl x28, x28, #2\n" + ".inst 0xa0402751 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x26]\n" + "addvl x26, x26, #2\n" + ".inst 0xc152960a // fdot za.s[x8, 2], { z18.h-z21.h }, z2.h[1]\n" + ".inst 0xc152958b // fdot za.s[x8, 3], { z14.h-z17.h }, z2.h[1]\n" + "ble 25f\n" + ".inst 0xa040260d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x16]\n" + "subs x11, x11, #0x2\n" + "addvl x16, x16, #2\n" + ".inst 0xa040272f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x25]\n" + "addvl x25, x25, #2\n" + ".inst 0xa0402767 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x27]\n" + "addvl x27, x27, #2\n" + ".inst 0xa0402709 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x24]\n" + "addvl x24, x24, #2\n" + ".inst 0xa040252b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x9]\n" + ".inst 0xc1529988 // fdot za.s[x8, 0], { z12.h-z15.h }, z2.h[2]\n" + "addvl x9, x9, #2\n" + ".inst 0xa04026ed // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x23]\n" + "addvl x23, x23, #2\n" + ".inst 0xa040278f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x28]\n" + ".inst 0xc1529889 // fdot za.s[x8, 1], { z6.h-z9.h }, z2.h[2]\n" + "addvl x28, x28, #2\n" + ".inst 0xa0402751 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x26]\n" + "addvl x26, x26, #2\n" + ".inst 0xc152990a // fdot za.s[x8, 2], { z10.h-z13.h }, z2.h[2]\n" + ".inst 0xc152998b // fdot za.s[x8, 3], { z14.h-z17.h }, z2.h[2]\n" + "ble 25f\n" + ".inst 0xa0402611 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x16]\n" + ".inst 0xa0402733 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x25]\n" + ".inst 0xa040276b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x27]\n" + ".inst 0xa040270d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x24]\n" + ".inst 0xa040252f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x9]\n" + ".inst 0xc1529e08 // fdot za.s[x8, 0], { z16.h-z19.h }, z2.h[3]\n" + ".inst 0xa04026f1 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x23]\n" + ".inst 0xa0402793 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x28]\n" + ".inst 0xc1529d09 // fdot za.s[x8, 1], { z10.h-z13.h }, z2.h[3]\n" + ".inst 0xa0402755 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x26]\n" + ".inst 0xc1529d8a // fdot za.s[x8, 2], { z14.h-z17.h }, z2.h[3]\n" + ".inst 0xc1529e0b // fdot za.s[x8, 3], { z18.h-z21.h }, z2.h[3]\n" + "25:" // Width 4: Multiply loop: multiply skip + "tbz %x[flags], #1, 26f\n" + ".inst 0xc0060c1c // mova { z28.d-z31.d }, za.d[x8, #0]\n" + "add x21, %x[args_ptr], %[offset_min]\n" + "add x20, %x[args_ptr], %[offset_max]\n" + ".inst 0xc0060c2c // mova { z12.d-z15.d }, za.d[x8, #1]\n" + "ld1rh { z19.h }, p1/Z, [x21]\n" + ".inst 0xc0060c40 // mova { z0.d-z3.d }, za.d[x8, #2]\n" + "ld1rh { z18.h }, p1/Z, [x20]\n" + ".inst 0xc0060c64 // mova { z4.d-z7.d }, za.d[x8, #3]\n" + ".inst 0xc120e38a // fcvt z10.h, { z28.s-z29.s }\n" + ".inst 0xc120e3cb // fcvt z11.h, { z30.s-z31.s }\n" + ".inst 0xc120e18c // fcvt z12.h, { z12.s-z13.s }\n" + ".inst 0xc120e1cd // fcvt z13.h, { z14.s-z15.s }\n" + ".inst 0xc172c26a // fclamp { z10.h-z11.h }, z19.h, z18.h\n" + ".inst 0xc120e00e // fcvt z14.h, { z0.s-z1.s }\n" + ".inst 0xc120e04f // fcvt z15.h, { z2.s-z3.s }\n" + ".inst 0xc172c26c // fclamp { z12.h-z13.h }, z19.h, z18.h\n" + ".inst 0xc120e090 // fcvt z16.h, { z4.s-z5.s }\n" + ".inst 0xc120e0d1 // fcvt z17.h, { z6.s-z7.s }\n" + ".inst 0xc172c26e // fclamp { z14.h-z15.h }, z19.h, z18.h\n" + ".inst 0xc172c270 // fclamp { z16.h-z17.h }, z19.h, z18.h\n" + ".inst 0xa06025ca // st1h { z10.h-z11.h }, pn9.b, [x14]\n" + ".inst 0xa06125cc // st1h { z12.h-z13.h }, pn9.b, [x14, #0x2, MUL VL]\n" + ".inst 0xa06225ce // st1h { z14.h-z15.h }, pn9.b, [x14, #0x4, MUL VL]\n" + ".inst 0xa06321d0 // st1h { z16.h-z17.h }, p8, [x14, #0x6, MUL VL]\n" + "addvl x14, x14, #8\n" + "b 27f\n" + "26:" // Width 4: No activation + ".inst 0xc0060c0c // mova { z12.d-z15.d }, za.d[x8, #0]\n" + ".inst 0xc0060c30 // mova { z16.d-z19.d }, za.d[x8, #1]\n" + ".inst 0xc0060c5c // mova { z28.d-z31.d }, za.d[x8, #2]\n" + ".inst 0xc0060c68 // mova { z8.d-z11.d }, za.d[x8, #3]\n" + ".inst 0xc120e187 // fcvt z7.h, { z12.s-z13.s }\n" + ".inst 0xc120e1cf // fcvt z15.h, { z14.s-z15.s }\n" + ".inst 0xa16025c7 // st1h { z7.h, z15.h }, pn9.b, [x14]\n" + ".inst 0xc120e207 // fcvt z7.h, { z16.s-z17.s }\n" + ".inst 0xc120e24f // fcvt z15.h, { z18.s-z19.s }\n" + ".inst 0xa16125c7 // st1h { z7.h, z15.h }, pn9.b, [x14, #0x2, MUL VL]\n" + ".inst 0xc120e38e // fcvt z14.h, { z28.s-z29.s }\n" + ".inst 0xc120e3cf // fcvt z15.h, { z30.s-z31.s }\n" + ".inst 0xa06225ce // st1h { z14.h-z15.h }, pn9.b, [x14, #0x4, MUL VL]\n" + ".inst 0xc120e112 // fcvt z18.h, { z8.s-z9.s }\n" + ".inst 0xc120e15a // fcvt z26.h, { z10.s-z11.s }\n" + ".inst 0xa16321d2 // st1h { z18.h, z26.h }, p8, [x14, #0x6, MUL VL]\n" + "addvl x14, x14, #8\n" + "27:" // Width 4: Output done + "subs x13, x13, #0x4\n" + "mov x16, x22\n" + "sub %x[N], %x[N], x15, LSL #2\n" + "bgt 4b\n" + "28:" // Exit + ".inst 0xd503467f // SMSTOP\n" + : [N] "+&r"(N) + : [A_ptr] "r"(A_ptr), [B_ptr] "r"(B_ptr), [K] "r"(K), [args_ptr] "r"(&ka), [flags] "r"(flags), + [offset_max] "I"(offsetof(KernelArgs, maxval)), [offset_min] "I"(offsetof(KernelArgs, minval)), + [output_ptr] "r"(output_ptr) + : "cc", "memory", "p0", "p1", "p10", "p11", "p12", "p13", "p14", "p15", "p2", "p3", "p4", "p5", "p6", "p7", + "p8", "p9", "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x20", "x21", "x22", "x23", "x24", "x25", "x26", + "x27", "x28", "x8", "x9", "z0", "z1", "z10", "z11", "z12", "z13", "z14", "z15", "z16", "z17", "z18", "z19", + "z2", "z20", "z21", "z22", "z23", "z24", "z25", "z26", "z27", "z28", "z29", "z3", "z30", "z31", "z4", "z5", + "z6", "z7", "z8", "z9"); +} + +#endif // Architectural features check. diff --git a/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.h b/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.h new file mode 100644 index 00000000..40e3b9ca --- /dev/null +++ b/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.h @@ -0,0 +1,115 @@ +// +// SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +/// Micro-kernel dependencies +/// +/// -# kai_rhs_pack_kxn_x16p2vlx2b_x16_x16_sme + +/// -------------------------------------------------- + +/// Gets m step value. +/// +/// The starting row index must be divisible by `m_step`. +/// +/// @return The m step value. +size_t kai_get_m_step_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(void); + +/// Gets n step value. +/// +/// The starting column index must be divisible by `n_step`. +/// +/// @return The n step value. +size_t kai_get_n_step_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(void); + +/// Gets nr value. +/// +/// This is the packing parameter which must be used to pack the RHS matrix. +/// +/// @return The nr value. +size_t kai_get_nr_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(void); + +/// Gets kr value. +/// +/// This is the packing parameter which must be used to pack the RHS matrix. +/// +/// @return The kr value. +size_t kai_get_kr_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(void); + +/// Gets sr value. +/// +/// This is the packing parameter which must be used to pack the RHS matrix. +/// +/// @return The sr value. +size_t kai_get_sr_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(void); + +/// Gets the offset in bytes to the data element in the LHS matrix buffer. +/// +/// @param[in] m_idx Row index. +/// @param[in] stride Row stride in bytes. +/// +/// @return The offset in bytes to the data element. +size_t kai_get_lhs_offset_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(size_t m_idx, size_t stride); + +/// Gets the offset in bytes to the data element in the packed RHS matrix buffer. +/// +/// @param[in] n_idx Column index in the unpacked RHS matrix. +/// @param[in] k Number of rows in the unpacked RHS matrix. +/// +/// @return The offset in bytes to the data element. +size_t kai_get_rhs_packed_offset_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(size_t n_idx, size_t k); + +/// Gets the offset in bytes to the data element in the destination matrix buffer. +/// +/// @param[in] m_idx Row index. +/// @param[in] n_idx Column index. +/// @param[in] dst_stride Row stride in bytes. +/// +/// @return The offset in bytes to the data element. +size_t kai_get_dst_offset_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot( + size_t m_idx, size_t n_idx, size_t dst_stride); + +/// Gets the size in bytes of the destination matrix buffer. +/// +/// @param[in] m Number of rows. +/// @param[in] n Number of columns. +/// +/// @return The size in bytes of the destination matrix buffer. +size_t kai_get_dst_size_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(size_t m, size_t n); + +/// Runs the matrix multiplication microkernel followed by a clamp operation. +/// +/// The pointer of each buffers (LHS, packed RHS and output) needs to be added with offset +/// calculated using the following functions: +/// +/// * LHS: @ref kai_get_lhs_offset_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot. +/// * Packed RHS: @ref kai_get_rhs_packed_offset_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot. +/// * Output: @ref kai_get_dst_offset_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot. +/// +/// @param[in] m Number of output rows to be computed. This must be 1. +/// @param[in] n Number of output columns to be computed. +/// @param[in] k Common dimension of the LHS and RHS operand. +/// @param[in] lhs LHS matrix buffer. +/// @param[in] rhs_packed Packed RHS matrix buffer. +/// @param[out] dst Output matrix buffer. +/// @param[in] dst_stride_row Row stride in bytes of the output matrix. Currently, an unused parameter. +/// @param[in] dst_stride_col Column stride in bytes of the output matrix. Currently, an unused parameter. +/// @param[in] clamp_min Minimum value to clamp the final result. +/// @param[in] clamp_max Maximum value to clamp the final result. +void kai_run_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot( + size_t m, size_t n, size_t k, const void* lhs, size_t lhs_stride, const void* rhs_packed, void* dst, + size_t dst_stride_row, size_t dst_stride_col, __fp16 clamp_min, __fp16 clamp_max); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus -- GitLab From 0b77ec284fdc6f994ccec7e0e1404e73b6ec5465 Mon Sep 17 00:00:00 2001 From: Felix Thomasmathibalan Date: Thu, 28 Nov 2024 07:04:33 +0100 Subject: [PATCH 2/8] Address review comment Signed-off-by: Felix Thomasmathibalan --- ...clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.c | 715 +++++++++--------- 1 file changed, 357 insertions(+), 358 deletions(-) diff --git a/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.c b/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.c index 6e14b34f..4acca99d 100644 --- a/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.c +++ b/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.c @@ -24,7 +24,6 @@ static const size_t kai_sr = 1; size_t kai_get_m_step_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(void) { return kai_m_step * kai_get_sme_vector_length_u16() / kai_kr; - ; } size_t kai_get_n_step_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(void) { @@ -136,7 +135,7 @@ void kai_run_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot( ".inst 0xf8b54a1a // rprfm pldonce, x21, [x16]\n" "3:" // RHS prefetch exit "add x12, %x[K], #0x1\n" - "cnth x20, ALL, MUL #2\n" + "cntw x20, ALL, MUL #2\n" "bic x12, x12, #0x1\n" "lsl x12, x12, #0x1\n" "add x12, x12, #0x2\n" @@ -149,438 +148,438 @@ void kai_run_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot( "beq 10f\n" "cntw x20, ALL, MUL #2\n" "add x22, x16, x12\n" - "ld1h { z0.s }, p1/Z, [x16]\n" + "ld1h { z8.s }, p1/Z, [x16]\n" "cmp %x[N], x20\n" - "ld1h { z1.s }, p1/Z, [x16, #1, MUL VL]\n" + "ld1h { z9.s }, p1/Z, [x16, #1, MUL VL]\n" "mov x11, %x[K]\n" "csel x22, x22, x16, GT\n" "mov x21, %x[N]\n" - "ld1h { z2.s }, p1/Z, [x22]\n" - "fcvt z0.s, p1/m, z0.h\n" + "ld1h { z10.s }, p1/Z, [x22]\n" + "fcvt z8.s, p1/m, z8.h\n" "mov x10, %x[A_ptr]\n" "lsl x20, %x[K], #0x1\n" - "ld1h { z3.s }, p1/Z, [x22, #1, MUL VL]\n" - "fcvt z1.s, p1/m, z1.h\n" + "ld1h { z11.s }, p1/Z, [x22, #1, MUL VL]\n" + "fcvt z9.s, p1/m, z9.h\n" ".inst 0x257547f0 // whilelt p8.h, XZR, x21, VLx2\n" "cmp x11, #0x8\n" ".inst 0xf8b44958 // rprfm pldmany, x20, [x10]\n" "inch x16, ALL, MUL #2\n" - "fcvt z2.s, p1/m, z2.h\n" + "fcvt z10.s, p1/m, z10.h\n" "inch x22, ALL, MUL #2\n" - "fcvt z3.s, p1/m, z3.h\n" - ".inst 0xc0040c00 // mova za.d[x8, #0], { z0.d-z3.d }\n" + "fcvt z11.s, p1/m, z11.h\n" + ".inst 0xc0040d00 // mova za.d[x8, #0], { z8.d-z11.d }\n" "ble 6f\n" "5:" // Width 1: Multiply loop: Main loop head "whilelt p0.h, XZR, x11\n" - ".inst 0xa0402617 // ldnt1h { z22.h-z23.h }, pn9.b/Z, [x16]\n" + ".inst 0xa0402615 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x16]\n" "addvl x16, x16, #2\n" - "ld1rqh { z9.h }, p0/Z, [x10]\n" + "ld1rqh { z4.h }, p0/Z, [x10]\n" "sub x11, x11, #0x8\n" "add x10, x10, #0x10\n" - ".inst 0xa04026d9 // ldnt1h { z24.h-z25.h }, pn9.b/Z, [x22]\n" + ".inst 0xa04026d7 // ldnt1h { z22.h-z23.h }, pn9.b/Z, [x22]\n" "addvl x22, x22, #2\n" "cmp x11, #0x8\n" - ".inst 0xa040260f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x16]\n" + ".inst 0xa0402609 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x16]\n" "addvl x16, x16, #2\n" - ".inst 0xa04026d1 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x22]\n" + ".inst 0xa04026cb // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x22]\n" "addvl x22, x22, #2\n" - ".inst 0xc1599288 // fdot za.s[x8, 0], { z22.h-z25.h }, z9.h[0]\n" - ".inst 0xa0402613 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x16]\n" + ".inst 0xc1549288 // fdot za.s[x8, 0], { z20.h-z23.h }, z4.h[0]\n" + ".inst 0xa040260d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x16]\n" "addvl x16, x16, #2\n" - ".inst 0xa04026d5 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x22]\n" + ".inst 0xa04026cf // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x22]\n" "addvl x22, x22, #2\n" - ".inst 0xa040260b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x16]\n" + ".inst 0xa0402615 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x16]\n" "addvl x16, x16, #2\n" - ".inst 0xa04026cd // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x22]\n" + ".inst 0xa04026d7 // ldnt1h { z22.h-z23.h }, pn9.b/Z, [x22]\n" "addvl x22, x22, #2\n" - ".inst 0xc1599588 // fdot za.s[x8, 0], { z14.h-z17.h }, z9.h[1]\n" - ".inst 0xc1599a08 // fdot za.s[x8, 0], { z18.h-z21.h }, z9.h[2]\n" - ".inst 0xc1599d08 // fdot za.s[x8, 0], { z10.h-z13.h }, z9.h[3]\n" + ".inst 0xc1549508 // fdot za.s[x8, 0], { z8.h-z11.h }, z4.h[1]\n" + ".inst 0xc1549988 // fdot za.s[x8, 0], { z12.h-z15.h }, z4.h[2]\n" + ".inst 0xc1549e88 // fdot za.s[x8, 0], { z20.h-z23.h }, z4.h[3]\n" "bgt 5b\n" "6:" // Width 1: Multiply loop: Single iteration only "whilelt p0.h, XZR, x11\n" - ".inst 0xa040261f // ldnt1h { z30.h-z31.h }, pn9.b/Z, [x16]\n" + ".inst 0xa040260d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x16]\n" "subs x11, x11, #0x2\n" - "ld1rqh { z2.h }, p0/Z, [x10]\n" + "ld1rqh { z3.h }, p0/Z, [x10]\n" "addvl x16, x16, #2\n" - ".inst 0xa04026c1 // ldnt1h { z0.h-z1.h }, pn9.b/Z, [x22]\n" + ".inst 0xa04026cf // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x22]\n" "addvl x22, x22, #2\n" - ".inst 0xc1529388 // fdot za.s[x8, 0], { z30.h-z1.h }, z2.h[0]\n" + ".inst 0xc1539188 // fdot za.s[x8, 0], { z12.h-z15.h }, z3.h[0]\n" "ble 7f\n" ".inst 0xa0402605 // ldnt1h { z4.h-z5.h }, pn9.b/Z, [x16]\n" "subs x11, x11, #0x2\n" "addvl x16, x16, #2\n" ".inst 0xa04026c7 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x22]\n" "addvl x22, x22, #2\n" - ".inst 0xc1529488 // fdot za.s[x8, 0], { z4.h-z7.h }, z2.h[1]\n" + ".inst 0xc1539488 // fdot za.s[x8, 0], { z4.h-z7.h }, z3.h[1]\n" "ble 7f\n" - ".inst 0xa0402609 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x16]\n" + ".inst 0xa040260d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x16]\n" "subs x11, x11, #0x2\n" "addvl x16, x16, #2\n" - ".inst 0xa04026cb // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x22]\n" + ".inst 0xa04026cf // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x22]\n" "addvl x22, x22, #2\n" - ".inst 0xc1529908 // fdot za.s[x8, 0], { z8.h-z11.h }, z2.h[2]\n" + ".inst 0xc1539988 // fdot za.s[x8, 0], { z12.h-z15.h }, z3.h[2]\n" "ble 7f\n" - ".inst 0xa040260b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x16]\n" - ".inst 0xa04026cd // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x22]\n" - ".inst 0xc1529d08 // fdot za.s[x8, 0], { z10.h-z13.h }, z2.h[3]\n" + ".inst 0xa0402611 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x16]\n" + ".inst 0xa04026d3 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x22]\n" + ".inst 0xc1539e08 // fdot za.s[x8, 0], { z16.h-z19.h }, z3.h[3]\n" "7:" // Width 1: Multiply loop: multiply skip "tbz %x[flags], #1, 8f\n" - ".inst 0xc0060c08 // mova { z8.d-z11.d }, za.d[x8, #0]\n" + ".inst 0xc0060c04 // mova { z4.d-z7.d }, za.d[x8, #0]\n" "add x21, %x[args_ptr], %[offset_min]\n" "add x20, %x[args_ptr], %[offset_max]\n" - "ld1rh { z16.h }, p1/Z, [x21]\n" - "ld1rh { z15.h }, p1/Z, [x20]\n" - ".inst 0xc120e11a // fcvt z26.h, { z8.s-z9.s }\n" - ".inst 0xc120e15b // fcvt z27.h, { z10.s-z11.s }\n" - ".inst 0xc16fc21a // fclamp { z26.h-z27.h }, z16.h, z15.h\n" - ".inst 0xa06021da // st1h { z26.h-z27.h }, p8, [x14]\n" + "ld1rh { z19.h }, p1/Z, [x21]\n" + "ld1rh { z22.h }, p1/Z, [x20]\n" + ".inst 0xc120e094 // fcvt z20.h, { z4.s-z5.s }\n" + ".inst 0xc120e0d5 // fcvt z21.h, { z6.s-z7.s }\n" + ".inst 0xc176c274 // fclamp { z20.h-z21.h }, z19.h, z22.h\n" + ".inst 0xa06021d4 // st1h { z20.h-z21.h }, p8, [x14]\n" "b 9f\n" "8:" // Width 1: No activation - ".inst 0xc0060c18 // mova { z24.d-z27.d }, za.d[x8, #0]\n" - ".inst 0xc120e315 // fcvt z21.h, { z24.s-z25.s }\n" - ".inst 0xc120e35d // fcvt z29.h, { z26.s-z27.s }\n" - ".inst 0xa16021d5 // st1h { z21.h, z29.h }, p8, [x14]\n" + ".inst 0xc0060c04 // mova { z4.d-z7.d }, za.d[x8, #0]\n" + ".inst 0xc120e084 // fcvt z4.h, { z4.s-z5.s }\n" + ".inst 0xc120e0c5 // fcvt z5.h, { z6.s-z7.s }\n" + ".inst 0xa06021c4 // st1h { z4.h-z5.h }, p8, [x14]\n" "9:" // Width 1: Output done "b 28f\n" "10:" // Width 2 "add x24, x16, x12, LSL #1\n" "cntw x20, ALL, MUL #6\n" - "ld1h { z0.s }, p1/Z, [x16]\n" + "ld1h { z24.s }, p1/Z, [x16]\n" "add x23, x24, x12\n" "cmp %x[N], x20\n" - "ld1h { z1.s }, p1/Z, [x16, #1, MUL VL]\n" + "ld1h { z25.s }, p1/Z, [x16, #1, MUL VL]\n" "add x22, x16, x12\n" "csel x23, x23, x16, GT\n" - "ld1h { z16.s }, p1/Z, [x24]\n" - "ld1h { z2.s }, p1/Z, [x22]\n" - "fcvt z0.s, p1/m, z0.h\n" + "ld1h { z0.s }, p1/Z, [x24]\n" + "ld1h { z26.s }, p1/Z, [x22]\n" + "fcvt z24.s, p1/m, z24.h\n" "mov x11, %x[K]\n" "sub x21, %x[N], x15\n" - "ld1h { z3.s }, p1/Z, [x22, #1, MUL VL]\n" - "fcvt z1.s, p1/m, z1.h\n" + "ld1h { z27.s }, p1/Z, [x22, #1, MUL VL]\n" + "fcvt z25.s, p1/m, z25.h\n" "mov x10, %x[A_ptr]\n" "lsl x20, %x[K], #0x1\n" - "ld1h { z17.s }, p1/Z, [x24, #1, MUL VL]\n" - "fcvt z16.s, p1/m, z16.h\n" + "ld1h { z1.s }, p1/Z, [x24, #1, MUL VL]\n" + "fcvt z0.s, p1/m, z0.h\n" ".inst 0x257547f0 // whilelt p8.h, XZR, x21, VLx2\n" "cmp x11, #0x8\n" - "ld1h { z18.s }, p1/Z, [x23]\n" - "fcvt z2.s, p1/m, z2.h\n" + "ld1h { z2.s }, p1/Z, [x23]\n" + "fcvt z26.s, p1/m, z26.h\n" ".inst 0xf8b44958 // rprfm pldmany, x20, [x10]\n" "inch x16, ALL, MUL #2\n" - "ld1h { z19.s }, p1/Z, [x23, #1, MUL VL]\n" - "fcvt z3.s, p1/m, z3.h\n" + "ld1h { z3.s }, p1/Z, [x23, #1, MUL VL]\n" + "fcvt z27.s, p1/m, z27.h\n" "inch x22, ALL, MUL #2\n" "inch x24, ALL, MUL #2\n" - "fcvt z17.s, p1/m, z17.h\n" + "fcvt z1.s, p1/m, z1.h\n" "inch x23, ALL, MUL #2\n" - "fcvt z18.s, p1/m, z18.h\n" - "fcvt z19.s, p1/m, z19.h\n" - ".inst 0xc0040c00 // mova za.d[x8, #0], { z0.d-z3.d }\n" - ".inst 0xc0040e01 // mova za.d[x8, #1], { z16.d-z19.d }\n" + "fcvt z2.s, p1/m, z2.h\n" + "fcvt z3.s, p1/m, z3.h\n" + ".inst 0xc0040f00 // mova za.d[x8, #0], { z24.d-z27.d }\n" + ".inst 0xc0040c01 // mova za.d[x8, #1], { z0.d-z3.d }\n" "ble 12f\n" "11:" // Width 2: Multiply loop: Main loop head "whilelt p0.h, XZR, x11\n" - ".inst 0xa0402609 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x16]\n" + ".inst 0xa0402615 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x16]\n" "addvl x16, x16, #2\n" "ld1rqh { z4.h }, p0/Z, [x10]\n" "sub x11, x11, #0x8\n" "add x10, x10, #0x10\n" - ".inst 0xa04026cb // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x22]\n" + ".inst 0xa04026d7 // ldnt1h { z22.h-z23.h }, pn9.b/Z, [x22]\n" "addvl x22, x22, #2\n" "cmp x11, #0x8\n" - ".inst 0xa040270f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x24]\n" + ".inst 0xa0402709 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x24]\n" "addvl x24, x24, #2\n" - ".inst 0xa04026f1 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x23]\n" + ".inst 0xa04026eb // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x23]\n" "addvl x23, x23, #2\n" - ".inst 0xc1549108 // fdot za.s[x8, 0], { z8.h-z11.h }, z4.h[0]\n" - ".inst 0xa040260b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x16]\n" + ".inst 0xc1549288 // fdot za.s[x8, 0], { z20.h-z23.h }, z4.h[0]\n" + ".inst 0xa0402615 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x16]\n" "addvl x16, x16, #2\n" - ".inst 0xa04026cd // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x22]\n" + ".inst 0xa04026d7 // ldnt1h { z22.h-z23.h }, pn9.b/Z, [x22]\n" "addvl x22, x22, #2\n" - ".inst 0xc1549189 // fdot za.s[x8, 1], { z14.h-z17.h }, z4.h[0]\n" - ".inst 0xa0402711 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x24]\n" + ".inst 0xc1549109 // fdot za.s[x8, 1], { z8.h-z11.h }, z4.h[0]\n" + ".inst 0xa040270d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x24]\n" "addvl x24, x24, #2\n" - ".inst 0xa04026f3 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x23]\n" + ".inst 0xa04026ef // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x23]\n" "addvl x23, x23, #2\n" - ".inst 0xc1549508 // fdot za.s[x8, 0], { z10.h-z13.h }, z4.h[1]\n" - ".inst 0xa0402619 // ldnt1h { z24.h-z25.h }, pn9.b/Z, [x16]\n" + ".inst 0xc1549688 // fdot za.s[x8, 0], { z20.h-z23.h }, z4.h[1]\n" + ".inst 0xa0402611 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x16]\n" "addvl x16, x16, #2\n" - ".inst 0xa04026db // ldnt1h { z26.h-z27.h }, pn9.b/Z, [x22]\n" + ".inst 0xa04026d3 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x22]\n" "addvl x22, x22, #2\n" - ".inst 0xc1549609 // fdot za.s[x8, 1], { z16.h-z19.h }, z4.h[1]\n" - ".inst 0xa0402707 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x24]\n" + ".inst 0xc1549589 // fdot za.s[x8, 1], { z12.h-z15.h }, z4.h[1]\n" + ".inst 0xa0402719 // ldnt1h { z24.h-z25.h }, pn9.b/Z, [x24]\n" "addvl x24, x24, #2\n" - ".inst 0xa04026e9 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x23]\n" + ".inst 0xa04026fb // ldnt1h { z26.h-z27.h }, pn9.b/Z, [x23]\n" "addvl x23, x23, #2\n" - ".inst 0xc1549b08 // fdot za.s[x8, 0], { z24.h-z27.h }, z4.h[2]\n" - ".inst 0xa040260d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x16]\n" + ".inst 0xc1549a08 // fdot za.s[x8, 0], { z16.h-z19.h }, z4.h[2]\n" + ".inst 0xa0402615 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x16]\n" "addvl x16, x16, #2\n" - ".inst 0xa04026cf // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x22]\n" + ".inst 0xa04026d7 // ldnt1h { z22.h-z23.h }, pn9.b/Z, [x22]\n" "addvl x22, x22, #2\n" - ".inst 0xc1549889 // fdot za.s[x8, 1], { z6.h-z9.h }, z4.h[2]\n" - ".inst 0xa0402713 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x24]\n" + ".inst 0xc1549b09 // fdot za.s[x8, 1], { z24.h-z27.h }, z4.h[2]\n" + ".inst 0xa0402709 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x24]\n" "addvl x24, x24, #2\n" - ".inst 0xa04026f5 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x23]\n" + ".inst 0xa04026eb // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x23]\n" "addvl x23, x23, #2\n" - ".inst 0xc1549d88 // fdot za.s[x8, 0], { z12.h-z15.h }, z4.h[3]\n" - ".inst 0xc1549e09 // fdot za.s[x8, 1], { z18.h-z21.h }, z4.h[3]\n" + ".inst 0xc1549e88 // fdot za.s[x8, 0], { z20.h-z23.h }, z4.h[3]\n" + ".inst 0xc1549d09 // fdot za.s[x8, 1], { z8.h-z11.h }, z4.h[3]\n" "bgt 11b\n" "12:" // Width 2: Multiply loop: Single iteration only "whilelt p0.h, XZR, x11\n" - ".inst 0xa040261b // ldnt1h { z26.h-z27.h }, pn9.b/Z, [x16]\n" + ".inst 0xa0402615 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x16]\n" "subs x11, x11, #0x2\n" - "ld1rqh { z2.h }, p0/Z, [x10]\n" + "ld1rqh { z3.h }, p0/Z, [x10]\n" "addvl x16, x16, #2\n" - ".inst 0xa04026dd // ldnt1h { z28.h-z29.h }, pn9.b/Z, [x22]\n" + ".inst 0xa04026d7 // ldnt1h { z22.h-z23.h }, pn9.b/Z, [x22]\n" "addvl x22, x22, #2\n" - ".inst 0xa040271f // ldnt1h { z30.h-z31.h }, pn9.b/Z, [x24]\n" + ".inst 0xa040270d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x24]\n" "addvl x24, x24, #2\n" - ".inst 0xa04026e1 // ldnt1h { z0.h-z1.h }, pn9.b/Z, [x23]\n" + ".inst 0xa04026ef // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x23]\n" "addvl x23, x23, #2\n" - ".inst 0xc1529308 // fdot za.s[x8, 0], { z26.h-z29.h }, z2.h[0]\n" - ".inst 0xc1529389 // fdot za.s[x8, 1], { z30.h-z1.h }, z2.h[0]\n" + ".inst 0xc1539288 // fdot za.s[x8, 0], { z20.h-z23.h }, z3.h[0]\n" + ".inst 0xc1539189 // fdot za.s[x8, 1], { z12.h-z15.h }, z3.h[0]\n" "ble 13f\n" - ".inst 0xa040261b // ldnt1h { z26.h-z27.h }, pn9.b/Z, [x16]\n" + ".inst 0xa0402611 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x16]\n" "subs x11, x11, #0x2\n" "addvl x16, x16, #2\n" - ".inst 0xa04026dd // ldnt1h { z28.h-z29.h }, pn9.b/Z, [x22]\n" + ".inst 0xa04026d3 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x22]\n" "addvl x22, x22, #2\n" - ".inst 0xa0402711 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x24]\n" + ".inst 0xa0402709 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x24]\n" "addvl x24, x24, #2\n" - ".inst 0xa04026f3 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x23]\n" + ".inst 0xa04026eb // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x23]\n" "addvl x23, x23, #2\n" - ".inst 0xc1529708 // fdot za.s[x8, 0], { z26.h-z29.h }, z2.h[1]\n" - ".inst 0xc1529609 // fdot za.s[x8, 1], { z16.h-z19.h }, z2.h[1]\n" + ".inst 0xc1539608 // fdot za.s[x8, 0], { z16.h-z19.h }, z3.h[1]\n" + ".inst 0xc1539509 // fdot za.s[x8, 1], { z8.h-z11.h }, z3.h[1]\n" "ble 13f\n" - ".inst 0xa0402613 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x16]\n" + ".inst 0xa0402619 // ldnt1h { z24.h-z25.h }, pn9.b/Z, [x16]\n" "subs x11, x11, #0x2\n" "addvl x16, x16, #2\n" - ".inst 0xa04026d5 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x22]\n" + ".inst 0xa04026db // ldnt1h { z26.h-z27.h }, pn9.b/Z, [x22]\n" "addvl x22, x22, #2\n" - ".inst 0xa040270f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x24]\n" + ".inst 0xa0402711 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x24]\n" "addvl x24, x24, #2\n" - ".inst 0xa04026f1 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x23]\n" + ".inst 0xa04026f3 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x23]\n" "addvl x23, x23, #2\n" - ".inst 0xc1529a08 // fdot za.s[x8, 0], { z18.h-z21.h }, z2.h[2]\n" - ".inst 0xc1529989 // fdot za.s[x8, 1], { z14.h-z17.h }, z2.h[2]\n" + ".inst 0xc1539b08 // fdot za.s[x8, 0], { z24.h-z27.h }, z3.h[2]\n" + ".inst 0xc1539a09 // fdot za.s[x8, 1], { z16.h-z19.h }, z3.h[2]\n" "ble 13f\n" - ".inst 0xa040261d // ldnt1h { z28.h-z29.h }, pn9.b/Z, [x16]\n" - ".inst 0xa04026df // ldnt1h { z30.h-z31.h }, pn9.b/Z, [x22]\n" - ".inst 0xa0402709 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x24]\n" - ".inst 0xa04026eb // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x23]\n" - ".inst 0xc1529f88 // fdot za.s[x8, 0], { z28.h-z31.h }, z2.h[3]\n" - ".inst 0xc1529d09 // fdot za.s[x8, 1], { z8.h-z11.h }, z2.h[3]\n" + ".inst 0xa0402609 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x16]\n" + ".inst 0xa04026cb // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x22]\n" + ".inst 0xa0402705 // ldnt1h { z4.h-z5.h }, pn9.b/Z, [x24]\n" + ".inst 0xa04026e7 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x23]\n" + ".inst 0xc1539d08 // fdot za.s[x8, 0], { z8.h-z11.h }, z3.h[3]\n" + ".inst 0xc1539c89 // fdot za.s[x8, 1], { z4.h-z7.h }, z3.h[3]\n" "13:" // Width 2: Multiply loop: multiply skip "tbz %x[flags], #1, 14f\n" - ".inst 0xc0060c0c // mova { z12.d-z15.d }, za.d[x8, #0]\n" + ".inst 0xc0060c08 // mova { z8.d-z11.d }, za.d[x8, #0]\n" "add x21, %x[args_ptr], %[offset_min]\n" "add x20, %x[args_ptr], %[offset_max]\n" - ".inst 0xc0060c28 // mova { z8.d-z11.d }, za.d[x8, #1]\n" - "ld1rh { z17.h }, p1/Z, [x21]\n" - "ld1rh { z5.h }, p1/Z, [x20]\n" - ".inst 0xc120e19c // fcvt z28.h, { z12.s-z13.s }\n" - ".inst 0xc120e1dd // fcvt z29.h, { z14.s-z15.s }\n" - ".inst 0xc120e10e // fcvt z14.h, { z8.s-z9.s }\n" - ".inst 0xc120e14f // fcvt z15.h, { z10.s-z11.s }\n" - ".inst 0xc165c23c // fclamp { z28.h-z29.h }, z17.h, z5.h\n" - ".inst 0xc165c22e // fclamp { z14.h-z15.h }, z17.h, z5.h\n" - ".inst 0xa06025dc // st1h { z28.h-z29.h }, pn9.b, [x14]\n" - ".inst 0xa06121ce // st1h { z14.h-z15.h }, p8, [x14, #0x2, MUL VL]\n" + ".inst 0xc0060c2c // mova { z12.d-z15.d }, za.d[x8, #1]\n" + "ld1rh { z6.h }, p1/Z, [x21]\n" + "ld1rh { z22.h }, p1/Z, [x20]\n" + ".inst 0xc120e112 // fcvt z18.h, { z8.s-z9.s }\n" + ".inst 0xc120e153 // fcvt z19.h, { z10.s-z11.s }\n" + ".inst 0xc120e190 // fcvt z16.h, { z12.s-z13.s }\n" + ".inst 0xc120e1d1 // fcvt z17.h, { z14.s-z15.s }\n" + ".inst 0xc176c0d2 // fclamp { z18.h-z19.h }, z6.h, z22.h\n" + ".inst 0xc176c0d0 // fclamp { z16.h-z17.h }, z6.h, z22.h\n" + ".inst 0xa06025d2 // st1h { z18.h-z19.h }, pn9.b, [x14]\n" + ".inst 0xa06121d0 // st1h { z16.h-z17.h }, p8, [x14, #0x2, MUL VL]\n" "b 15f\n" "14:" // Width 2: No activation - ".inst 0xc0060c10 // mova { z16.d-z19.d }, za.d[x8, #0]\n" - ".inst 0xc0060c24 // mova { z4.d-z7.d }, za.d[x8, #1]\n" - ".inst 0xc120e218 // fcvt z24.h, { z16.s-z17.s }\n" - ".inst 0xc120e259 // fcvt z25.h, { z18.s-z19.s }\n" - ".inst 0xa06025d8 // st1h { z24.h-z25.h }, pn9.b, [x14]\n" - ".inst 0xc120e091 // fcvt z17.h, { z4.s-z5.s }\n" - ".inst 0xc120e0d9 // fcvt z25.h, { z6.s-z7.s }\n" + ".inst 0xc0060c1c // mova { z28.d-z31.d }, za.d[x8, #0]\n" + ".inst 0xc0060c34 // mova { z20.d-z23.d }, za.d[x8, #1]\n" + ".inst 0xc120e39a // fcvt z26.h, { z28.s-z29.s }\n" + ".inst 0xc120e3db // fcvt z27.h, { z30.s-z31.s }\n" + ".inst 0xa06025da // st1h { z26.h-z27.h }, pn9.b, [x14]\n" + ".inst 0xc120e291 // fcvt z17.h, { z20.s-z21.s }\n" + ".inst 0xc120e2d9 // fcvt z25.h, { z22.s-z23.s }\n" ".inst 0xa16121d1 // st1h { z17.h, z25.h }, p8, [x14, #0x2, MUL VL]\n" "15:" // Width 2: Output done "b 28f\n" "16:" // Width 3 "add x26, x16, x12, LSL #2\n" "cntw x20, ALL, MUL #10\n" - "ld1h { z0.s }, p1/Z, [x16]\n" + "ld1h { z28.s }, p1/Z, [x16]\n" "add x25, x16, x12, LSL #1\n" "add x24, x26, x12\n" - "ld1h { z1.s }, p1/Z, [x16, #1, MUL VL]\n" + "ld1h { z29.s }, p1/Z, [x16, #1, MUL VL]\n" "cmp %x[N], x20\n" "add x23, x16, x12\n" - "ld1h { z8.s }, p1/Z, [x25]\n" + "ld1h { z4.s }, p1/Z, [x25]\n" "add x22, x25, x12\n" "csel x24, x24, x16, GT\n" - "ld1h { z2.s }, p1/Z, [x23]\n" - "fcvt z0.s, p1/m, z0.h\n" - "ld1h { z3.s }, p1/Z, [x23, #1, MUL VL]\n" - "fcvt z1.s, p1/m, z1.h\n" + "ld1h { z30.s }, p1/Z, [x23]\n" + "fcvt z28.s, p1/m, z28.h\n" + "ld1h { z31.s }, p1/Z, [x23, #1, MUL VL]\n" + "fcvt z29.s, p1/m, z29.h\n" "mov x20, #0x2\n" "mov x11, %x[K]\n" - "ld1h { z9.s }, p1/Z, [x25, #1, MUL VL]\n" - "fcvt z8.s, p1/m, z8.h\n" + "ld1h { z5.s }, p1/Z, [x25, #1, MUL VL]\n" + "fcvt z4.s, p1/m, z4.h\n" "msub x21, x15, x20, %x[N]\n" "mov x10, %x[A_ptr]\n" - "ld1h { z10.s }, p1/Z, [x22]\n" - "fcvt z2.s, p1/m, z2.h\n" + "ld1h { z6.s }, p1/Z, [x22]\n" + "fcvt z30.s, p1/m, z30.h\n" "lsl x20, %x[K], #0x1\n" ".inst 0x257547f0 // whilelt p8.h, XZR, x21, VLx2\n" - "ld1h { z11.s }, p1/Z, [x22, #1, MUL VL]\n" - "fcvt z3.s, p1/m, z3.h\n" + "ld1h { z7.s }, p1/Z, [x22, #1, MUL VL]\n" + "fcvt z31.s, p1/m, z31.h\n" "cmp x11, #0x8\n" ".inst 0xf8b44958 // rprfm pldmany, x20, [x10]\n" - "ld1h { z20.s }, p1/Z, [x26]\n" - "fcvt z9.s, p1/m, z9.h\n" + "ld1h { z8.s }, p1/Z, [x26]\n" + "fcvt z5.s, p1/m, z5.h\n" "inch x16, ALL, MUL #2\n" "inch x23, ALL, MUL #2\n" - "ld1h { z21.s }, p1/Z, [x26, #1, MUL VL]\n" - "fcvt z10.s, p1/m, z10.h\n" + "ld1h { z9.s }, p1/Z, [x26, #1, MUL VL]\n" + "fcvt z6.s, p1/m, z6.h\n" "inch x25, ALL, MUL #2\n" "inch x22, ALL, MUL #2\n" - "ld1h { z22.s }, p1/Z, [x24]\n" - "fcvt z11.s, p1/m, z11.h\n" + "ld1h { z10.s }, p1/Z, [x24]\n" + "fcvt z7.s, p1/m, z7.h\n" "inch x26, ALL, MUL #2\n" - "ld1h { z23.s }, p1/Z, [x24, #1, MUL VL]\n" - "fcvt z20.s, p1/m, z20.h\n" + "ld1h { z11.s }, p1/Z, [x24, #1, MUL VL]\n" + "fcvt z8.s, p1/m, z8.h\n" "inch x24, ALL, MUL #2\n" - ".inst 0xc0040c00 // mova za.d[x8, #0], { z0.d-z3.d }\n" - "fcvt z21.s, p1/m, z21.h\n" - "fcvt z22.s, p1/m, z22.h\n" - "fcvt z23.s, p1/m, z23.h\n" - ".inst 0xc0040d01 // mova za.d[x8, #1], { z8.d-z11.d }\n" - ".inst 0xc0040e82 // mova za.d[x8, #2], { z20.d-z23.d }\n" + ".inst 0xc0040f80 // mova za.d[x8, #0], { z28.d-z31.d }\n" + "fcvt z9.s, p1/m, z9.h\n" + "fcvt z10.s, p1/m, z10.h\n" + "fcvt z11.s, p1/m, z11.h\n" + ".inst 0xc0040c81 // mova za.d[x8, #1], { z4.d-z7.d }\n" + ".inst 0xc0040d02 // mova za.d[x8, #2], { z8.d-z11.d }\n" "ble 18f\n" "17:" // Width 3: Multiply loop: Main loop head "whilelt p0.h, XZR, x11\n" - ".inst 0xa0402607 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x16]\n" + ".inst 0xa040260d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x16]\n" "addvl x16, x16, #2\n" - "ld1rqh { z2.h }, p0/Z, [x10]\n" + "ld1rqh { z4.h }, p0/Z, [x10]\n" "sub x11, x11, #0x8\n" "add x10, x10, #0x10\n" - ".inst 0xa04026e9 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x23]\n" + ".inst 0xa04026ef // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x23]\n" "addvl x23, x23, #2\n" "cmp x11, #0x8\n" - ".inst 0xa040272d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x25]\n" + ".inst 0xa0402731 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x25]\n" "addvl x25, x25, #2\n" - ".inst 0xa04026cf // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x22]\n" + ".inst 0xa04026d3 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x22]\n" "addvl x22, x22, #2\n" - ".inst 0xa0402755 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x26]\n" - ".inst 0xc1529088 // fdot za.s[x8, 0], { z6.h-z9.h }, z2.h[0]\n" + ".inst 0xa0402741 // ldnt1h { z0.h-z1.h }, pn9.b/Z, [x26]\n" + ".inst 0xc1549188 // fdot za.s[x8, 0], { z12.h-z15.h }, z4.h[0]\n" "addvl x26, x26, #2\n" - ".inst 0xa0402717 // ldnt1h { z22.h-z23.h }, pn9.b/Z, [x24]\n" + ".inst 0xa0402703 // ldnt1h { z2.h-z3.h }, pn9.b/Z, [x24]\n" "addvl x24, x24, #2\n" - ".inst 0xc1529189 // fdot za.s[x8, 1], { z12.h-z15.h }, z2.h[0]\n" - ".inst 0xa0402605 // ldnt1h { z4.h-z5.h }, pn9.b/Z, [x16]\n" + ".inst 0xc1549209 // fdot za.s[x8, 1], { z16.h-z19.h }, z4.h[0]\n" + ".inst 0xa0402611 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x16]\n" "addvl x16, x16, #2\n" - ".inst 0xa04026e7 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x23]\n" + ".inst 0xa04026f3 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x23]\n" "addvl x23, x23, #2\n" - ".inst 0xc152928a // fdot za.s[x8, 2], { z20.h-z23.h }, z2.h[0]\n" + ".inst 0xc154900a // fdot za.s[x8, 2], { z0.h-z3.h }, z4.h[0]\n" ".inst 0xa040272d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x25]\n" "addvl x25, x25, #2\n" ".inst 0xa04026cf // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x22]\n" "addvl x22, x22, #2\n" - ".inst 0xa0402749 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x26]\n" - ".inst 0xc1529488 // fdot za.s[x8, 0], { z4.h-z7.h }, z2.h[1]\n" + ".inst 0xa0402755 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x26]\n" + ".inst 0xc1549608 // fdot za.s[x8, 0], { z16.h-z19.h }, z4.h[1]\n" "addvl x26, x26, #2\n" - ".inst 0xa040270b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x24]\n" + ".inst 0xa0402717 // ldnt1h { z22.h-z23.h }, pn9.b/Z, [x24]\n" "addvl x24, x24, #2\n" - ".inst 0xc1529589 // fdot za.s[x8, 1], { z12.h-z15.h }, z2.h[1]\n" + ".inst 0xc1549589 // fdot za.s[x8, 1], { z12.h-z15.h }, z4.h[1]\n" ".inst 0xa040260d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x16]\n" "addvl x16, x16, #2\n" ".inst 0xa04026ef // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x23]\n" "addvl x23, x23, #2\n" - ".inst 0xc152950a // fdot za.s[x8, 2], { z8.h-z11.h }, z2.h[1]\n" - ".inst 0xa0402735 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x25]\n" + ".inst 0xc154968a // fdot za.s[x8, 2], { z20.h-z23.h }, z4.h[1]\n" + ".inst 0xa0402729 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x25]\n" "addvl x25, x25, #2\n" - ".inst 0xa04026d7 // ldnt1h { z22.h-z23.h }, pn9.b/Z, [x22]\n" + ".inst 0xa04026cb // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x22]\n" "addvl x22, x22, #2\n" - ".inst 0xa040275f // ldnt1h { z30.h-z31.h }, pn9.b/Z, [x26]\n" - ".inst 0xc1529988 // fdot za.s[x8, 0], { z12.h-z15.h }, z2.h[2]\n" + ".inst 0xa0402751 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x26]\n" + ".inst 0xc1549988 // fdot za.s[x8, 0], { z12.h-z15.h }, z4.h[2]\n" "addvl x26, x26, #2\n" - ".inst 0xa0402701 // ldnt1h { z0.h-z1.h }, pn9.b/Z, [x24]\n" + ".inst 0xa0402713 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x24]\n" "addvl x24, x24, #2\n" - ".inst 0xc1529a89 // fdot za.s[x8, 1], { z20.h-z23.h }, z2.h[2]\n" - ".inst 0xa040260b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x16]\n" + ".inst 0xc1549909 // fdot za.s[x8, 1], { z8.h-z11.h }, z4.h[2]\n" + ".inst 0xa0402619 // ldnt1h { z24.h-z25.h }, pn9.b/Z, [x16]\n" "addvl x16, x16, #2\n" - ".inst 0xa04026ed // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x23]\n" + ".inst 0xa04026fb // ldnt1h { z26.h-z27.h }, pn9.b/Z, [x23]\n" "addvl x23, x23, #2\n" - ".inst 0xc1529b8a // fdot za.s[x8, 2], { z30.h-z1.h }, z2.h[2]\n" - ".inst 0xa0402733 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x25]\n" + ".inst 0xc1549a0a // fdot za.s[x8, 2], { z16.h-z19.h }, z4.h[2]\n" + ".inst 0xa0402731 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x25]\n" "addvl x25, x25, #2\n" - ".inst 0xa04026d5 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x22]\n" + ".inst 0xa04026d3 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x22]\n" "addvl x22, x22, #2\n" - ".inst 0xa040274f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x26]\n" - ".inst 0xc1529d08 // fdot za.s[x8, 0], { z10.h-z13.h }, z2.h[3]\n" + ".inst 0xa040274d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x26]\n" + ".inst 0xc1549f08 // fdot za.s[x8, 0], { z24.h-z27.h }, z4.h[3]\n" "addvl x26, x26, #2\n" - ".inst 0xa0402711 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x24]\n" + ".inst 0xa040270f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x24]\n" "addvl x24, x24, #2\n" - ".inst 0xc1529e09 // fdot za.s[x8, 1], { z18.h-z21.h }, z2.h[3]\n" - ".inst 0xc1529d8a // fdot za.s[x8, 2], { z14.h-z17.h }, z2.h[3]\n" + ".inst 0xc1549e09 // fdot za.s[x8, 1], { z16.h-z19.h }, z4.h[3]\n" + ".inst 0xc1549d8a // fdot za.s[x8, 2], { z12.h-z15.h }, z4.h[3]\n" "bgt 17b\n" "18:" // Width 3: Multiply loop: Single iteration only "whilelt p0.h, XZR, x11\n" ".inst 0xa0402605 // ldnt1h { z4.h-z5.h }, pn9.b/Z, [x16]\n" "subs x11, x11, #0x2\n" - "ld1rqh { z2.h }, p0/Z, [x10]\n" + "ld1rqh { z3.h }, p0/Z, [x10]\n" "addvl x16, x16, #2\n" ".inst 0xa04026e7 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x23]\n" "addvl x23, x23, #2\n" - ".inst 0xa040272f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x25]\n" + ".inst 0xa040272d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x25]\n" "addvl x25, x25, #2\n" - ".inst 0xa04026d1 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x22]\n" + ".inst 0xa04026cf // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x22]\n" "addvl x22, x22, #2\n" - ".inst 0xa040275b // ldnt1h { z26.h-z27.h }, pn9.b/Z, [x26]\n" - ".inst 0xc1529088 // fdot za.s[x8, 0], { z4.h-z7.h }, z2.h[0]\n" + ".inst 0xa0402759 // ldnt1h { z24.h-z25.h }, pn9.b/Z, [x26]\n" + ".inst 0xc1539088 // fdot za.s[x8, 0], { z4.h-z7.h }, z3.h[0]\n" "addvl x26, x26, #2\n" - ".inst 0xa040271d // ldnt1h { z28.h-z29.h }, pn9.b/Z, [x24]\n" + ".inst 0xa040271b // ldnt1h { z26.h-z27.h }, pn9.b/Z, [x24]\n" "addvl x24, x24, #2\n" - ".inst 0xc1529189 // fdot za.s[x8, 1], { z14.h-z17.h }, z2.h[0]\n" - ".inst 0xc152930a // fdot za.s[x8, 2], { z26.h-z29.h }, z2.h[0]\n" + ".inst 0xc1539189 // fdot za.s[x8, 1], { z12.h-z15.h }, z3.h[0]\n" + ".inst 0xc153930a // fdot za.s[x8, 2], { z24.h-z27.h }, z3.h[0]\n" "ble 19f\n" - ".inst 0xa040260d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x16]\n" + ".inst 0xa0402619 // ldnt1h { z24.h-z25.h }, pn9.b/Z, [x16]\n" "subs x11, x11, #0x2\n" "addvl x16, x16, #2\n" - ".inst 0xa04026ef // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x23]\n" + ".inst 0xa04026fb // ldnt1h { z26.h-z27.h }, pn9.b/Z, [x23]\n" "addvl x23, x23, #2\n" - ".inst 0xa040273d // ldnt1h { z28.h-z29.h }, pn9.b/Z, [x25]\n" + ".inst 0xa0402729 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x25]\n" "addvl x25, x25, #2\n" - ".inst 0xa04026df // ldnt1h { z30.h-z31.h }, pn9.b/Z, [x22]\n" + ".inst 0xa04026cb // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x22]\n" "addvl x22, x22, #2\n" - ".inst 0xa040274b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x26]\n" - ".inst 0xc1529588 // fdot za.s[x8, 0], { z12.h-z15.h }, z2.h[1]\n" + ".inst 0xa0402751 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x26]\n" + ".inst 0xc1539708 // fdot za.s[x8, 0], { z24.h-z27.h }, z3.h[1]\n" "addvl x26, x26, #2\n" - ".inst 0xa040270d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x24]\n" + ".inst 0xa0402713 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x24]\n" "addvl x24, x24, #2\n" - ".inst 0xc1529789 // fdot za.s[x8, 1], { z28.h-z31.h }, z2.h[1]\n" - ".inst 0xc152950a // fdot za.s[x8, 2], { z10.h-z13.h }, z2.h[1]\n" + ".inst 0xc1539509 // fdot za.s[x8, 1], { z8.h-z11.h }, z3.h[1]\n" + ".inst 0xc153960a // fdot za.s[x8, 2], { z16.h-z19.h }, z3.h[1]\n" "ble 19f\n" - ".inst 0xa0402607 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x16]\n" + ".inst 0xa040260d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x16]\n" "subs x11, x11, #0x2\n" "addvl x16, x16, #2\n" - ".inst 0xa04026e9 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x23]\n" + ".inst 0xa04026ef // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x23]\n" "addvl x23, x23, #2\n" - ".inst 0xa0402733 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x25]\n" + ".inst 0xa0402729 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x25]\n" "addvl x25, x25, #2\n" - ".inst 0xa04026d5 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x22]\n" + ".inst 0xa04026cb // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x22]\n" "addvl x22, x22, #2\n" - ".inst 0xa040274f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x26]\n" - ".inst 0xc1529888 // fdot za.s[x8, 0], { z6.h-z9.h }, z2.h[2]\n" + ".inst 0xa0402745 // ldnt1h { z4.h-z5.h }, pn9.b/Z, [x26]\n" + ".inst 0xc1539988 // fdot za.s[x8, 0], { z12.h-z15.h }, z3.h[2]\n" "addvl x26, x26, #2\n" - ".inst 0xa0402711 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x24]\n" + ".inst 0xa0402707 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x24]\n" "addvl x24, x24, #2\n" - ".inst 0xc1529a09 // fdot za.s[x8, 1], { z18.h-z21.h }, z2.h[2]\n" - ".inst 0xc152998a // fdot za.s[x8, 2], { z14.h-z17.h }, z2.h[2]\n" + ".inst 0xc1539909 // fdot za.s[x8, 1], { z8.h-z11.h }, z3.h[2]\n" + ".inst 0xc153988a // fdot za.s[x8, 2], { z4.h-z7.h }, z3.h[2]\n" "ble 19f\n" - ".inst 0xa040260f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x16]\n" - ".inst 0xa04026f1 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x23]\n" - ".inst 0xa0402729 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x25]\n" - ".inst 0xa04026cb // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x22]\n" + ".inst 0xa0402619 // ldnt1h { z24.h-z25.h }, pn9.b/Z, [x16]\n" + ".inst 0xa04026fb // ldnt1h { z26.h-z27.h }, pn9.b/Z, [x23]\n" + ".inst 0xa040273d // ldnt1h { z28.h-z29.h }, pn9.b/Z, [x25]\n" + ".inst 0xa04026df // ldnt1h { z30.h-z31.h }, pn9.b/Z, [x22]\n" ".inst 0xa040274d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x26]\n" - ".inst 0xc1529d88 // fdot za.s[x8, 0], { z14.h-z17.h }, z2.h[3]\n" + ".inst 0xc1539f08 // fdot za.s[x8, 0], { z24.h-z27.h }, z3.h[3]\n" ".inst 0xa040270f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x24]\n" - ".inst 0xc1529d09 // fdot za.s[x8, 1], { z8.h-z11.h }, z2.h[3]\n" - ".inst 0xc1529d8a // fdot za.s[x8, 2], { z12.h-z15.h }, z2.h[3]\n" + ".inst 0xc1539f89 // fdot za.s[x8, 1], { z28.h-z31.h }, z3.h[3]\n" + ".inst 0xc1539d8a // fdot za.s[x8, 2], { z12.h-z15.h }, z3.h[3]\n" "19:" // Width 3: Multiply loop: multiply skip "tbz %x[flags], #1, 20f\n" ".inst 0xc0060c18 // mova { z24.d-z27.d }, za.d[x8, #0]\n" @@ -588,31 +587,31 @@ void kai_run_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot( "add x20, %x[args_ptr], %[offset_max]\n" ".inst 0xc0060c3c // mova { z28.d-z31.d }, za.d[x8, #1]\n" "ld1rh { z19.h }, p1/Z, [x21]\n" - ".inst 0xc0060c44 // mova { z4.d-z7.d }, za.d[x8, #2]\n" + ".inst 0xc0060c40 // mova { z0.d-z3.d }, za.d[x8, #2]\n" "ld1rh { z18.h }, p1/Z, [x20]\n" - ".inst 0xc120e30c // fcvt z12.h, { z24.s-z25.s }\n" - ".inst 0xc120e34d // fcvt z13.h, { z26.s-z27.s }\n" - ".inst 0xc120e390 // fcvt z16.h, { z28.s-z29.s }\n" - ".inst 0xc120e3d1 // fcvt z17.h, { z30.s-z31.s }\n" - ".inst 0xc172c26c // fclamp { z12.h-z13.h }, z19.h, z18.h\n" - ".inst 0xc120e08e // fcvt z14.h, { z4.s-z5.s }\n" - ".inst 0xc120e0cf // fcvt z15.h, { z6.s-z7.s }\n" - ".inst 0xc172c270 // fclamp { z16.h-z17.h }, z19.h, z18.h\n" + ".inst 0xc120e314 // fcvt z20.h, { z24.s-z25.s }\n" + ".inst 0xc120e355 // fcvt z21.h, { z26.s-z27.s }\n" + ".inst 0xc120e38e // fcvt z14.h, { z28.s-z29.s }\n" + ".inst 0xc120e3cf // fcvt z15.h, { z30.s-z31.s }\n" + ".inst 0xc172c274 // fclamp { z20.h-z21.h }, z19.h, z18.h\n" + ".inst 0xc120e010 // fcvt z16.h, { z0.s-z1.s }\n" + ".inst 0xc120e051 // fcvt z17.h, { z2.s-z3.s }\n" ".inst 0xc172c26e // fclamp { z14.h-z15.h }, z19.h, z18.h\n" - ".inst 0xa06025cc // st1h { z12.h-z13.h }, pn9.b, [x14]\n" - ".inst 0xa06125d0 // st1h { z16.h-z17.h }, pn9.b, [x14, #0x2, MUL VL]\n" - ".inst 0xa06221ce // st1h { z14.h-z15.h }, p8, [x14, #0x4, MUL VL]\n" + ".inst 0xc172c270 // fclamp { z16.h-z17.h }, z19.h, z18.h\n" + ".inst 0xa06025d4 // st1h { z20.h-z21.h }, pn9.b, [x14]\n" + ".inst 0xa06125ce // st1h { z14.h-z15.h }, pn9.b, [x14, #0x2, MUL VL]\n" + ".inst 0xa06221d0 // st1h { z16.h-z17.h }, p8, [x14, #0x4, MUL VL]\n" "b 21f\n" "20:" // Width 3: No activation - ".inst 0xc0060c00 // mova { z0.d-z3.d }, za.d[x8, #0]\n" + ".inst 0xc0060c04 // mova { z4.d-z7.d }, za.d[x8, #0]\n" ".inst 0xc0060c28 // mova { z8.d-z11.d }, za.d[x8, #1]\n" ".inst 0xc0060c4c // mova { z12.d-z15.d }, za.d[x8, #2]\n" - ".inst 0xc120e011 // fcvt z17.h, { z0.s-z1.s }\n" - ".inst 0xc120e059 // fcvt z25.h, { z2.s-z3.s }\n" + ".inst 0xc120e091 // fcvt z17.h, { z4.s-z5.s }\n" + ".inst 0xc120e0d9 // fcvt z25.h, { z6.s-z7.s }\n" ".inst 0xa16025d1 // st1h { z17.h, z25.h }, pn9.b, [x14]\n" - ".inst 0xc120e111 // fcvt z17.h, { z8.s-z9.s }\n" - ".inst 0xc120e159 // fcvt z25.h, { z10.s-z11.s }\n" - ".inst 0xa16125d1 // st1h { z17.h, z25.h }, pn9.b, [x14, #0x2, MUL VL]\n" + ".inst 0xc120e112 // fcvt z18.h, { z8.s-z9.s }\n" + ".inst 0xc120e153 // fcvt z19.h, { z10.s-z11.s }\n" + ".inst 0xa06125d2 // st1h { z18.h-z19.h }, pn9.b, [x14, #0x2, MUL VL]\n" ".inst 0xc120e191 // fcvt z17.h, { z12.s-z13.s }\n" ".inst 0xc120e1d9 // fcvt z25.h, { z14.s-z15.s }\n" ".inst 0xa16221d1 // st1h { z17.h, z25.h }, p8, [x14, #0x4, MUL VL]\n" @@ -621,67 +620,67 @@ void kai_run_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot( "22:" // Width 4 "add x9, x16, x12, LSL #2\n" "cntw x20, ALL, MUL #14\n" - "ld1h { z28.s }, p1/Z, [x16]\n" + "ld1h { z12.s }, p1/Z, [x16]\n" "add x28, x9, x12, LSL #1\n" "add x27, x16, x12, LSL #1\n" - "ld1h { z29.s }, p1/Z, [x16, #1, MUL VL]\n" + "ld1h { z13.s }, p1/Z, [x16, #1, MUL VL]\n" "add x26, x28, x12\n" "cmp %x[N], x20\n" - "ld1h { z0.s }, p1/Z, [x27]\n" + "ld1h { z8.s }, p1/Z, [x27]\n" "add x25, x16, x12\n" "add x24, x27, x12\n" - "ld1h { z1.s }, p1/Z, [x27, #1, MUL VL]\n" - "fcvt z28.s, p1/m, z28.h\n" + "ld1h { z9.s }, p1/Z, [x27, #1, MUL VL]\n" + "fcvt z12.s, p1/m, z12.h\n" "add x23, x9, x12\n" "csel x26, x26, x16, GT\n" - "ld1h { z30.s }, p1/Z, [x25]\n" - "fcvt z29.s, p1/m, z29.h\n" - "ld1h { z31.s }, p1/Z, [x25, #1, MUL VL]\n" - "fcvt z0.s, p1/m, z0.h\n" + "ld1h { z14.s }, p1/Z, [x25]\n" + "fcvt z13.s, p1/m, z13.h\n" + "ld1h { z15.s }, p1/Z, [x25, #1, MUL VL]\n" + "fcvt z8.s, p1/m, z8.h\n" "mov x20, #0x3\n" "mov x11, %x[K]\n" - "ld1h { z2.s }, p1/Z, [x24]\n" - "fcvt z1.s, p1/m, z1.h\n" + "ld1h { z10.s }, p1/Z, [x24]\n" + "fcvt z9.s, p1/m, z9.h\n" "msub x21, x15, x20, %x[N]\n" "mov x10, %x[A_ptr]\n" - "ld1h { z3.s }, p1/Z, [x24, #1, MUL VL]\n" - "fcvt z30.s, p1/m, z30.h\n" + "ld1h { z11.s }, p1/Z, [x24, #1, MUL VL]\n" + "fcvt z14.s, p1/m, z14.h\n" "lsl x20, %x[K], #0x1\n" ".inst 0x257547f0 // whilelt p8.h, XZR, x21, VLx2\n" "ld1h { z4.s }, p1/Z, [x9]\n" - "fcvt z31.s, p1/m, z31.h\n" + "fcvt z15.s, p1/m, z15.h\n" "cmp x11, #0x8\n" ".inst 0xf8b44958 // rprfm pldmany, x20, [x10]\n" "ld1h { z5.s }, p1/Z, [x9, #1, MUL VL]\n" - "fcvt z2.s, p1/m, z2.h\n" + "fcvt z10.s, p1/m, z10.h\n" "add x22, x16, x12, LSL #3\n" "inch x16, ALL, MUL #2\n" "ld1h { z6.s }, p1/Z, [x23]\n" - "fcvt z3.s, p1/m, z3.h\n" + "fcvt z11.s, p1/m, z11.h\n" "inch x25, ALL, MUL #2\n" "inch x27, ALL, MUL #2\n" "ld1h { z7.s }, p1/Z, [x23, #1, MUL VL]\n" "fcvt z4.s, p1/m, z4.h\n" "inch x24, ALL, MUL #2\n" "inch x9, ALL, MUL #2\n" - "ld1h { z12.s }, p1/Z, [x28]\n" + "ld1h { z0.s }, p1/Z, [x28]\n" "fcvt z5.s, p1/m, z5.h\n" "inch x23, ALL, MUL #2\n" - ".inst 0xc0040f80 // mova za.d[x8, #0], { z28.d-z31.d }\n" - "ld1h { z13.s }, p1/Z, [x28, #1, MUL VL]\n" + ".inst 0xc0040d80 // mova za.d[x8, #0], { z12.d-z15.d }\n" + "ld1h { z1.s }, p1/Z, [x28, #1, MUL VL]\n" "fcvt z6.s, p1/m, z6.h\n" "inch x28, ALL, MUL #2\n" - "ld1h { z14.s }, p1/Z, [x26]\n" + "ld1h { z2.s }, p1/Z, [x26]\n" "fcvt z7.s, p1/m, z7.h\n" - ".inst 0xc0040c01 // mova za.d[x8, #1], { z0.d-z3.d }\n" - "ld1h { z15.s }, p1/Z, [x26, #1, MUL VL]\n" - "fcvt z12.s, p1/m, z12.h\n" + ".inst 0xc0040d01 // mova za.d[x8, #1], { z8.d-z11.d }\n" + "ld1h { z3.s }, p1/Z, [x26, #1, MUL VL]\n" + "fcvt z0.s, p1/m, z0.h\n" "inch x26, ALL, MUL #2\n" - "fcvt z13.s, p1/m, z13.h\n" - "fcvt z14.s, p1/m, z14.h\n" - "fcvt z15.s, p1/m, z15.h\n" + "fcvt z1.s, p1/m, z1.h\n" + "fcvt z2.s, p1/m, z2.h\n" + "fcvt z3.s, p1/m, z3.h\n" ".inst 0xc0040c82 // mova za.d[x8, #2], { z4.d-z7.d }\n" - ".inst 0xc0040d83 // mova za.d[x8, #3], { z12.d-z15.d }\n" + ".inst 0xc0040c03 // mova za.d[x8, #3], { z0.d-z3.d }\n" "ble 24f\n" "23:" // Width 4: Multiply loop: Main loop head "whilelt p0.h, XZR, x11\n" @@ -693,164 +692,164 @@ void kai_run_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot( ".inst 0xa040272f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x25]\n" "addvl x25, x25, #2\n" "cmp x11, #0x8\n" - ".inst 0xa0402767 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x27]\n" + ".inst 0xa0402765 // ldnt1h { z4.h-z5.h }, pn9.b/Z, [x27]\n" "addvl x27, x27, #2\n" - ".inst 0xa0402709 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x24]\n" + ".inst 0xa0402707 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x24]\n" "addvl x24, x24, #2\n" - ".inst 0xa040252b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x9]\n" + ".inst 0xa0402529 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x9]\n" ".inst 0xc1509188 // fdot za.s[x8, 0], { z12.h-z15.h }, z0.h[0]\n" "addvl x9, x9, #2\n" - ".inst 0xa04026ed // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x23]\n" + ".inst 0xa04026eb // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x23]\n" "addvl x23, x23, #2\n" - ".inst 0xa040278f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x28]\n" - ".inst 0xc1509089 // fdot za.s[x8, 1], { z6.h-z9.h }, z0.h[0]\n" + ".inst 0xa040278d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x28]\n" + ".inst 0xc1509089 // fdot za.s[x8, 1], { z4.h-z7.h }, z0.h[0]\n" "addvl x28, x28, #2\n" - ".inst 0xa0402751 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x26]\n" + ".inst 0xa040274f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x26]\n" "addvl x26, x26, #2\n" - ".inst 0xc150910a // fdot za.s[x8, 2], { z10.h-z13.h }, z0.h[0]\n" - ".inst 0xa040260b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x16]\n" + ".inst 0xc150910a // fdot za.s[x8, 2], { z8.h-z11.h }, z0.h[0]\n" + ".inst 0xa0402609 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x16]\n" "addvl x16, x16, #2\n" - ".inst 0xa040272d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x25]\n" + ".inst 0xa040272b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x25]\n" "addvl x25, x25, #2\n" - ".inst 0xc150918b // fdot za.s[x8, 3], { z14.h-z17.h }, z0.h[0]\n" - ".inst 0xa0402767 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x27]\n" + ".inst 0xc150918b // fdot za.s[x8, 3], { z12.h-z15.h }, z0.h[0]\n" + ".inst 0xa0402765 // ldnt1h { z4.h-z5.h }, pn9.b/Z, [x27]\n" "addvl x27, x27, #2\n" - ".inst 0xa0402709 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x24]\n" + ".inst 0xa0402707 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x24]\n" "addvl x24, x24, #2\n" - ".inst 0xa040252f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x9]\n" - ".inst 0xc1509508 // fdot za.s[x8, 0], { z10.h-z13.h }, z0.h[1]\n" + ".inst 0xa040252d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x9]\n" + ".inst 0xc1509508 // fdot za.s[x8, 0], { z8.h-z11.h }, z0.h[1]\n" "addvl x9, x9, #2\n" - ".inst 0xa04026f1 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x23]\n" + ".inst 0xa04026ef // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x23]\n" "addvl x23, x23, #2\n" - ".inst 0xa040278b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x28]\n" - ".inst 0xc1509489 // fdot za.s[x8, 1], { z6.h-z9.h }, z0.h[1]\n" + ".inst 0xa0402789 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x28]\n" + ".inst 0xc1509489 // fdot za.s[x8, 1], { z4.h-z7.h }, z0.h[1]\n" "addvl x28, x28, #2\n" - ".inst 0xa040274d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x26]\n" + ".inst 0xa040274b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x26]\n" "addvl x26, x26, #2\n" - ".inst 0xc150958a // fdot za.s[x8, 2], { z14.h-z17.h }, z0.h[1]\n" - ".inst 0xa040260f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x16]\n" + ".inst 0xc150958a // fdot za.s[x8, 2], { z12.h-z15.h }, z0.h[1]\n" + ".inst 0xa040260d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x16]\n" "addvl x16, x16, #2\n" - ".inst 0xa0402731 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x25]\n" + ".inst 0xa040272f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x25]\n" "addvl x25, x25, #2\n" - ".inst 0xc150950b // fdot za.s[x8, 3], { z10.h-z13.h }, z0.h[1]\n" - ".inst 0xa0402775 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x27]\n" + ".inst 0xc150950b // fdot za.s[x8, 3], { z8.h-z11.h }, z0.h[1]\n" + ".inst 0xa0402765 // ldnt1h { z4.h-z5.h }, pn9.b/Z, [x27]\n" "addvl x27, x27, #2\n" - ".inst 0xa0402717 // ldnt1h { z22.h-z23.h }, pn9.b/Z, [x24]\n" + ".inst 0xa0402707 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x24]\n" "addvl x24, x24, #2\n" - ".inst 0xa0402539 // ldnt1h { z24.h-z25.h }, pn9.b/Z, [x9]\n" - ".inst 0xc1509988 // fdot za.s[x8, 0], { z14.h-z17.h }, z0.h[2]\n" + ".inst 0xa0402529 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x9]\n" + ".inst 0xc1509988 // fdot za.s[x8, 0], { z12.h-z15.h }, z0.h[2]\n" "addvl x9, x9, #2\n" - ".inst 0xa04026fb // ldnt1h { z26.h-z27.h }, pn9.b/Z, [x23]\n" + ".inst 0xa04026eb // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x23]\n" "addvl x23, x23, #2\n" - ".inst 0xa0402787 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x28]\n" - ".inst 0xc1509a89 // fdot za.s[x8, 1], { z20.h-z23.h }, z0.h[2]\n" + ".inst 0xa040278d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x28]\n" + ".inst 0xc1509889 // fdot za.s[x8, 1], { z4.h-z7.h }, z0.h[2]\n" "addvl x28, x28, #2\n" - ".inst 0xa0402749 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x26]\n" + ".inst 0xa040274f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x26]\n" "addvl x26, x26, #2\n" - ".inst 0xc1509b0a // fdot za.s[x8, 2], { z24.h-z27.h }, z0.h[2]\n" - ".inst 0xa040260d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x16]\n" + ".inst 0xc150990a // fdot za.s[x8, 2], { z8.h-z11.h }, z0.h[2]\n" + ".inst 0xa040261d // ldnt1h { z28.h-z29.h }, pn9.b/Z, [x16]\n" "addvl x16, x16, #2\n" - ".inst 0xa040272f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x25]\n" + ".inst 0xa040273f // ldnt1h { z30.h-z31.h }, pn9.b/Z, [x25]\n" "addvl x25, x25, #2\n" - ".inst 0xc150988b // fdot za.s[x8, 3], { z6.h-z9.h }, z0.h[2]\n" - ".inst 0xa0402771 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x27]\n" + ".inst 0xc150998b // fdot za.s[x8, 3], { z12.h-z15.h }, z0.h[2]\n" + ".inst 0xa0402769 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x27]\n" "addvl x27, x27, #2\n" - ".inst 0xa0402713 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x24]\n" + ".inst 0xa040270b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x24]\n" "addvl x24, x24, #2\n" - ".inst 0xa0402529 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x9]\n" - ".inst 0xc1509d88 // fdot za.s[x8, 0], { z12.h-z15.h }, z0.h[3]\n" + ".inst 0xa0402535 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x9]\n" + ".inst 0xc1509f88 // fdot za.s[x8, 0], { z28.h-z31.h }, z0.h[3]\n" "addvl x9, x9, #2\n" - ".inst 0xa04026eb // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x23]\n" + ".inst 0xa04026f7 // ldnt1h { z22.h-z23.h }, pn9.b/Z, [x23]\n" "addvl x23, x23, #2\n" - ".inst 0xa040278d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x28]\n" - ".inst 0xc1509e09 // fdot za.s[x8, 1], { z16.h-z19.h }, z0.h[3]\n" + ".inst 0xa0402791 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x28]\n" + ".inst 0xc1509d09 // fdot za.s[x8, 1], { z8.h-z11.h }, z0.h[3]\n" "addvl x28, x28, #2\n" - ".inst 0xa040274f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x26]\n" + ".inst 0xa0402753 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x26]\n" "addvl x26, x26, #2\n" - ".inst 0xc1509d0a // fdot za.s[x8, 2], { z8.h-z11.h }, z0.h[3]\n" - ".inst 0xc1509d8b // fdot za.s[x8, 3], { z12.h-z15.h }, z0.h[3]\n" + ".inst 0xc1509e8a // fdot za.s[x8, 2], { z20.h-z23.h }, z0.h[3]\n" + ".inst 0xc1509e0b // fdot za.s[x8, 3], { z16.h-z19.h }, z0.h[3]\n" "bgt 23b\n" "24:" // Width 4: Multiply loop: Single iteration only "whilelt p0.h, XZR, x11\n" - ".inst 0xa0402609 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x16]\n" + ".inst 0xa0402615 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x16]\n" "subs x11, x11, #0x2\n" - "ld1rqh { z2.h }, p0/Z, [x10]\n" + "ld1rqh { z3.h }, p0/Z, [x10]\n" "addvl x16, x16, #2\n" - ".inst 0xa040272b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x25]\n" + ".inst 0xa0402737 // ldnt1h { z22.h-z23.h }, pn9.b/Z, [x25]\n" "addvl x25, x25, #2\n" ".inst 0xa040276d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x27]\n" "addvl x27, x27, #2\n" ".inst 0xa040270f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x24]\n" "addvl x24, x24, #2\n" ".inst 0xa0402531 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x9]\n" - ".inst 0xc1529108 // fdot za.s[x8, 0], { z8.h-z11.h }, z2.h[0]\n" + ".inst 0xc1539288 // fdot za.s[x8, 0], { z20.h-z23.h }, z3.h[0]\n" "addvl x9, x9, #2\n" ".inst 0xa04026f3 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x23]\n" "addvl x23, x23, #2\n" - ".inst 0xa040278b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x28]\n" - ".inst 0xc1529189 // fdot za.s[x8, 1], { z12.h-z15.h }, z2.h[0]\n" + ".inst 0xa040279d // ldnt1h { z28.h-z29.h }, pn9.b/Z, [x28]\n" + ".inst 0xc1539189 // fdot za.s[x8, 1], { z12.h-z15.h }, z3.h[0]\n" "addvl x28, x28, #2\n" - ".inst 0xa040274d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x26]\n" + ".inst 0xa040275f // ldnt1h { z30.h-z31.h }, pn9.b/Z, [x26]\n" "addvl x26, x26, #2\n" - ".inst 0xc152920a // fdot za.s[x8, 2], { z16.h-z19.h }, z2.h[0]\n" - ".inst 0xc152910b // fdot za.s[x8, 3], { z10.h-z13.h }, z2.h[0]\n" + ".inst 0xc153920a // fdot za.s[x8, 2], { z16.h-z19.h }, z3.h[0]\n" + ".inst 0xc153938b // fdot za.s[x8, 3], { z28.h-z31.h }, z3.h[0]\n" "ble 25f\n" - ".inst 0xa040260f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x16]\n" + ".inst 0xa0402609 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x16]\n" "subs x11, x11, #0x2\n" "addvl x16, x16, #2\n" - ".inst 0xa0402731 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x25]\n" + ".inst 0xa040272b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x25]\n" "addvl x25, x25, #2\n" - ".inst 0xa0402769 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x27]\n" + ".inst 0xa0402765 // ldnt1h { z4.h-z5.h }, pn9.b/Z, [x27]\n" "addvl x27, x27, #2\n" - ".inst 0xa040270b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x24]\n" + ".inst 0xa0402707 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x24]\n" "addvl x24, x24, #2\n" - ".inst 0xa0402533 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x9]\n" - ".inst 0xc1529588 // fdot za.s[x8, 0], { z14.h-z17.h }, z2.h[1]\n" + ".inst 0xa040252d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x9]\n" + ".inst 0xc1539508 // fdot za.s[x8, 0], { z8.h-z11.h }, z3.h[1]\n" "addvl x9, x9, #2\n" - ".inst 0xa04026f5 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x23]\n" + ".inst 0xa04026ef // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x23]\n" "addvl x23, x23, #2\n" - ".inst 0xa040278f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x28]\n" - ".inst 0xc1529509 // fdot za.s[x8, 1], { z8.h-z11.h }, z2.h[1]\n" + ".inst 0xa0402795 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x28]\n" + ".inst 0xc1539489 // fdot za.s[x8, 1], { z4.h-z7.h }, z3.h[1]\n" "addvl x28, x28, #2\n" - ".inst 0xa0402751 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x26]\n" + ".inst 0xa0402757 // ldnt1h { z22.h-z23.h }, pn9.b/Z, [x26]\n" "addvl x26, x26, #2\n" - ".inst 0xc152960a // fdot za.s[x8, 2], { z18.h-z21.h }, z2.h[1]\n" - ".inst 0xc152958b // fdot za.s[x8, 3], { z14.h-z17.h }, z2.h[1]\n" + ".inst 0xc153958a // fdot za.s[x8, 2], { z12.h-z15.h }, z3.h[1]\n" + ".inst 0xc153968b // fdot za.s[x8, 3], { z20.h-z23.h }, z3.h[1]\n" "ble 25f\n" ".inst 0xa040260d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x16]\n" "subs x11, x11, #0x2\n" "addvl x16, x16, #2\n" ".inst 0xa040272f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x25]\n" "addvl x25, x25, #2\n" - ".inst 0xa0402767 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x27]\n" + ".inst 0xa0402769 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x27]\n" "addvl x27, x27, #2\n" - ".inst 0xa0402709 // ldnt1h { z8.h-z9.h }, pn9.b/Z, [x24]\n" + ".inst 0xa040270b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x24]\n" "addvl x24, x24, #2\n" - ".inst 0xa040252b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x9]\n" - ".inst 0xc1529988 // fdot za.s[x8, 0], { z12.h-z15.h }, z2.h[2]\n" + ".inst 0xa0402535 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x9]\n" + ".inst 0xc1539988 // fdot za.s[x8, 0], { z12.h-z15.h }, z3.h[2]\n" "addvl x9, x9, #2\n" - ".inst 0xa04026ed // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x23]\n" + ".inst 0xa04026f7 // ldnt1h { z22.h-z23.h }, pn9.b/Z, [x23]\n" "addvl x23, x23, #2\n" - ".inst 0xa040278f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x28]\n" - ".inst 0xc1529889 // fdot za.s[x8, 1], { z6.h-z9.h }, z2.h[2]\n" + ".inst 0xa0402791 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x28]\n" + ".inst 0xc1539909 // fdot za.s[x8, 1], { z8.h-z11.h }, z3.h[2]\n" "addvl x28, x28, #2\n" - ".inst 0xa0402751 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x26]\n" + ".inst 0xa0402753 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x26]\n" "addvl x26, x26, #2\n" - ".inst 0xc152990a // fdot za.s[x8, 2], { z10.h-z13.h }, z2.h[2]\n" - ".inst 0xc152998b // fdot za.s[x8, 3], { z14.h-z17.h }, z2.h[2]\n" + ".inst 0xc1539a8a // fdot za.s[x8, 2], { z20.h-z23.h }, z3.h[2]\n" + ".inst 0xc1539a0b // fdot za.s[x8, 3], { z16.h-z19.h }, z3.h[2]\n" "ble 25f\n" - ".inst 0xa0402611 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x16]\n" - ".inst 0xa0402733 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x25]\n" - ".inst 0xa040276b // ldnt1h { z10.h-z11.h }, pn9.b/Z, [x27]\n" - ".inst 0xa040270d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x24]\n" - ".inst 0xa040252f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x9]\n" - ".inst 0xc1529e08 // fdot za.s[x8, 0], { z16.h-z19.h }, z2.h[3]\n" - ".inst 0xa04026f1 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x23]\n" - ".inst 0xa0402793 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x28]\n" - ".inst 0xc1529d09 // fdot za.s[x8, 1], { z10.h-z13.h }, z2.h[3]\n" - ".inst 0xa0402755 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x26]\n" - ".inst 0xc1529d8a // fdot za.s[x8, 2], { z14.h-z17.h }, z2.h[3]\n" - ".inst 0xc1529e0b // fdot za.s[x8, 3], { z18.h-z21.h }, z2.h[3]\n" + ".inst 0xa0402605 // ldnt1h { z4.h-z5.h }, pn9.b/Z, [x16]\n" + ".inst 0xa0402727 // ldnt1h { z6.h-z7.h }, pn9.b/Z, [x25]\n" + ".inst 0xa040276d // ldnt1h { z12.h-z13.h }, pn9.b/Z, [x27]\n" + ".inst 0xa040270f // ldnt1h { z14.h-z15.h }, pn9.b/Z, [x24]\n" + ".inst 0xa0402531 // ldnt1h { z16.h-z17.h }, pn9.b/Z, [x9]\n" + ".inst 0xc1539c88 // fdot za.s[x8, 0], { z4.h-z7.h }, z3.h[3]\n" + ".inst 0xa04026f3 // ldnt1h { z18.h-z19.h }, pn9.b/Z, [x23]\n" + ".inst 0xa0402795 // ldnt1h { z20.h-z21.h }, pn9.b/Z, [x28]\n" + ".inst 0xc1539d89 // fdot za.s[x8, 1], { z12.h-z15.h }, z3.h[3]\n" + ".inst 0xa0402757 // ldnt1h { z22.h-z23.h }, pn9.b/Z, [x26]\n" + ".inst 0xc1539e0a // fdot za.s[x8, 2], { z16.h-z19.h }, z3.h[3]\n" + ".inst 0xc1539e8b // fdot za.s[x8, 3], { z20.h-z23.h }, z3.h[3]\n" "25:" // Width 4: Multiply loop: multiply skip "tbz %x[flags], #1, 26f\n" ".inst 0xc0060c1c // mova { z28.d-z31.d }, za.d[x8, #0]\n" -- GitLab From b39caa496b1ad52a592e37fab91e50374da6072b Mon Sep 17 00:00:00 2001 From: Felix Thomasmathibalan Date: Thu, 28 Nov 2024 07:33:27 +0100 Subject: [PATCH 3/8] Addon patch: Fix build Signed-off-by: Felix Thomasmathibalan --- kai/ukernels/matmul/BUILD.bazel | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kai/ukernels/matmul/BUILD.bazel b/kai/ukernels/matmul/BUILD.bazel index 682b5b44..6c9e6202 100644 --- a/kai/ukernels/matmul/BUILD.bazel +++ b/kai/ukernels/matmul/BUILD.bazel @@ -106,9 +106,11 @@ kai_c_library( kai_c_library( name = "kai_files_sme2", srcs = [ + "matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.c", "matmul_clamp_f16_f16p_f16p/kai_matmul_clamp_f16_f16p2vlx2_f16p2vlx2_2vlx2vl_sme2_mopa.c", ], hdrs = [ + "matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.h", "matmul_clamp_f16_f16p_f16p/kai_matmul_clamp_f16_f16p2vlx2_f16p2vlx2_2vlx2vl_sme2_mopa.h", ], cpu_uarch = kai_cpu_sme(), -- GitLab From 9c3af3ed448d5eace65820e29ef070af25516717 Mon Sep 17 00:00:00 2001 From: Felix Thomasmathibalan Date: Thu, 28 Nov 2024 07:55:52 +0100 Subject: [PATCH 4/8] Fix documentation Signed-off-by: Felix Thomasmathibalan --- .../kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.h | 1 + 1 file changed, 1 insertion(+) diff --git a/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.h b/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.h index 40e3b9ca..9db5d4d1 100644 --- a/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.h +++ b/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.h @@ -100,6 +100,7 @@ size_t kai_get_dst_size_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(size_t m /// @param[in] n Number of output columns to be computed. /// @param[in] k Common dimension of the LHS and RHS operand. /// @param[in] lhs LHS matrix buffer. +/// @param[in] lhs_stride Row stride in bytes of the LHS matrix. Unused parameter. /// @param[in] rhs_packed Packed RHS matrix buffer. /// @param[out] dst Output matrix buffer. /// @param[in] dst_stride_row Row stride in bytes of the output matrix. Currently, an unused parameter. -- GitLab From 5997535fd1e25527aacb28bcaba45d1133adc652 Mon Sep 17 00:00:00 2001 From: Felix Thomasmathibalan Date: Thu, 28 Nov 2024 10:55:49 +0100 Subject: [PATCH 5/8] Address review comments Signed-off-by: Felix Thomasmathibalan --- .../kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.h b/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.h index 9db5d4d1..8223b42f 100644 --- a/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.h +++ b/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.h @@ -59,7 +59,7 @@ size_t kai_get_sr_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(void); /// @param[in] stride Row stride in bytes. /// /// @return The offset in bytes to the data element. -size_t kai_get_lhs_offset_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(size_t m_idx, size_t stride); +size_t kai_get_lhs_packed_offset_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(size_t m_idx, size_t stride); /// Gets the offset in bytes to the data element in the packed RHS matrix buffer. /// -- GitLab From db848e69c1dd76388f12d863b2d11a9f147a6f6e Mon Sep 17 00:00:00 2001 From: Felix Thomasmathibalan Date: Thu, 28 Nov 2024 12:11:25 +0100 Subject: [PATCH 6/8] fix clang-tidy warning Signed-off-by: Felix Thomasmathibalan --- .../kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.h b/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.h index 8223b42f..d7a8c945 100644 --- a/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.h +++ b/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.h @@ -56,10 +56,10 @@ size_t kai_get_sr_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(void); /// Gets the offset in bytes to the data element in the LHS matrix buffer. /// /// @param[in] m_idx Row index. -/// @param[in] stride Row stride in bytes. +/// @param[in] k Number of columns in unpacked LHS. /// /// @return The offset in bytes to the data element. -size_t kai_get_lhs_packed_offset_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(size_t m_idx, size_t stride); +size_t kai_get_lhs_packed_offset_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(size_t m_idx, size_t k); /// Gets the offset in bytes to the data element in the packed RHS matrix buffer. /// -- GitLab From fa0e7e694e99dd7c04eb9356d16f57712546308e Mon Sep 17 00:00:00 2001 From: Felix Thomasmathibalan Date: Thu, 28 Nov 2024 12:57:34 +0100 Subject: [PATCH 7/8] Fix m_step Signed-off-by: Felix Thomasmathibalan --- .../kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.c b/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.c index 4acca99d..41128f5b 100644 --- a/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.c +++ b/kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.c @@ -15,7 +15,6 @@ #include "kai/kai_common.h" -static const size_t kai_mr = 1; static const size_t kai_m_step = 1; static const size_t kai_nr = 2; static const size_t kai_n_step = 16; @@ -23,17 +22,13 @@ static const size_t kai_kr = 2; static const size_t kai_sr = 1; size_t kai_get_m_step_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(void) { - return kai_m_step * kai_get_sme_vector_length_u16() / kai_kr; + return kai_m_step; } size_t kai_get_n_step_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(void) { return kai_n_step * kai_get_sme_vector_length_u16() / kai_kr; } -size_t kai_get_mr_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(void) { - return kai_mr * kai_get_sme_vector_length_u16() / kai_kr; -} - size_t kai_get_nr_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot(void) { return kai_nr * kai_get_sme_vector_length_u16() / kai_kr; } -- GitLab From 636192a69cc08fc30f1c9d5770b31a104d877ae7 Mon Sep 17 00:00:00 2001 From: Emil Ohlsson Date: Thu, 28 Nov 2024 12:50:40 +0100 Subject: [PATCH 8/8] Add FP16 GEMV SME unit tests Signed-off-by: Emil Ohlsson --- test/tests/matmul_test.cpp | 85 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/test/tests/matmul_test.cpp b/test/tests/matmul_test.cpp index 859bc733..5efade70 100644 --- a/test/tests/matmul_test.cpp +++ b/test/tests/matmul_test.cpp @@ -41,6 +41,9 @@ #include "kai/ukernels/matmul/pack/kai_lhs_pack_x16p2vlx2_x16_sme.h" #include "kai/ukernels/matmul/pack/kai_rhs_pack_kxn_x16p2vlx2b_x16_x16_sme.h" +// matmul_clamp_f16_f16_f16p +#include "kai/ukernels/matmul/matmul_clamp_f16_f16_f16p/kai_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot.h" + // matmul_nt_nt_fp32_fp32_fp32_2vlx2vl_sme2_mopa #include "kai/ukernels/matmul/matmul_clamp_f32_f32p_f32p/kai_matmul_clamp_f32_f32p2vlx1_f32p2vlx1biasf32_sme2_mopa.h" #include "kai/ukernels/matmul/pack/kai_lhs_pack_f32p2vlx1_f32_sme.h" @@ -277,6 +280,68 @@ static const std::array matmul_methods = { }, }; +/// List of supported vector by meatrix multiplication methods +static const std::array vecmul_methods{ + MatMulMethod{ + .name = "vecmul_kxn_f16_f16_f16p2vlx2b_1x16vl_sme2_dot", + + .m0 = 1, + .n0 = 16 * get_sme_vector_length(), + + .dst_format = DataFormat(DataType::FP16), + .lhs_format = DataFormat(DataType::FP16), + .packed_lhs_format = DataFormat(DataType::UNKNOWN), + .rhs_format = DataFormat(DataType::FP16), + .packed_rhs_format = DataFormat( + DataType::FP16, // Output type + 2 * get_sme_vector_length(), 2, // Block size + DataFormat::PackFormat::BIAS_PER_ROW, // Data layout + DataType::FP16, // Bias format + DataType::UNKNOWN, // Scaling type + 2 * get_sme_vector_length(), 2), // Sub-block + .bias_format = DataFormat(DataType::FP16), + + .fn_is_supported = cpu_has_sme2, + .fn_get_mr = nullptr, + .fn_get_nr = kai_get_nr_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot, + .fn_get_kr = kai_get_kr_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot, + .fn_get_sr = kai_get_sr_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot, + + .fn_get_main_m_step = kai_get_m_step_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot, + .fn_get_pack_rhs_n_step = kai_get_n_step_rhs_pack_kxn_x16p2vlx2b_x16_x16_sme, + .fn_get_main_n_step = kai_get_n_step_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot, + + .fn_get_lhs_offset = kai_get_lhs_offset_lhs_pack_x16p2vlx2_x16_sme, + .fn_get_packed_lhs_size = nullptr, + .fn_get_packed_lhs_offset = nullptr, + .fn_pack_lhs = nullptr, + + .fn_get_rhs_offset = kai_get_rhs_offset_rhs_pack_kxn_x16p2vlx2b_x16_x16_sme, + .fn_get_packed_rhs_size = kai_get_rhs_packed_size_rhs_pack_kxn_x16p2vlx2b_x16_x16_sme, + .fn_get_pack_rhs_packed_rhs_offset = kai_get_rhs_packed_offset_rhs_pack_kxn_x16p2vlx2b_x16_x16_sme, + .fn_get_main_packed_rhs_offset = kai_get_rhs_packed_offset_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot, + .fn_pack_rhs = kai_run_rhs_pack_kxn_x16p2vlx2b_x16_x16_sme, + + .fn_pack_rhs_nxk_get_n_step = nullptr, + .fn_pack_rhs_nxk_get_rhs_offset = nullptr, + .fn_pack_rhs_nxk_get_bias_offset = nullptr, + .fn_pack_rhs_nxk_get_packed_rhs_offset = nullptr, + .fn_pack_rhs_nxk_get_packed_rhs_size = nullptr, + .fn_pack_rhs_nxk = nullptr, + + .fn_get_bias_offset = kai_get_bias_offset_rhs_pack_kxn_x16p2vlx2b_x16_x16_sme, + + .fn_get_dst_offset = kai_get_dst_offset_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot, + .fn_get_dst_size = kai_get_dst_size_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot, + + .fn_matmul_f16_f16_f16p = kai_run_matmul_clamp_f16_f16_f16p2vlx2b_1x16vl_sme2_dot, + .fn_matmul_f32_f32_f32p = nullptr, + .fn_matmul_f16_f16p_f16p = nullptr, + .fn_matmul_f32_f32p_f32p = nullptr, + }, + +}; + /// Matrix multiplication test fixture. class MatMulTest : public testing::TestWithParam { private: @@ -691,4 +756,24 @@ INSTANTIATE_TEST_SUITE_P( )), testing::PrintToStringParamName()); +INSTANTIATE_TEST_SUITE_P( + VecMul, MatMulTest, + testing::Combine( + testing::ValuesIn(vecmul_methods), + testing::Values( + MatMulShape{1, 16, 16}, // + MatMulShape{1, 1, 20}, // + MatMulShape{1, 16, 32}, // + MatMulShape{1, 32, 17}, // + MatMulShape{1, 33, 23}, // + MatMulShape{1, 93, 56} // + ), + testing::Values( + MatrixPortion(0, 0, 1, 1), // Full row. + MatrixPortion(0, 0, 1, 0.5), // First half + MatrixPortion(0, .25, 1, 0.5), // mid row-section. + MatrixPortion(0, 0.75, 1, 1) // right row section + )), + testing::PrintToStringParamName()); + } // namespace kai::test -- GitLab