/* * Copyright (c) 2022 Arm Limited. * * SPDX-License-Identifier: MIT * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifdef __ARM_FEATURE_SVE #ifdef ARM_COMPUTE_ENABLE_SME2 #include "arm_gemm.hpp" #include "../../utils.hpp" #include #include namespace arm_gemm { void sme2_gemv_s8qa_dot_16VL ( const int8_t *A_ptr, const int8_t *B_ptr, int8_t *output_ptr, size_t N, size_t K, const Requantize32 *qp, const int32_t *col_bias, unsigned int col_base ) { ARM_COMPUTE_UNUSED(col_base); struct KernelArgs { const int8_t *B_ptr = {}; size_t output_offset = {}; unsigned int input_initial_col = {}; } ka; unsigned long flags=0; ka.B_ptr = B_ptr; if (qp->c_offset > qp->minval) { flags |= 0x20; } __asm__ __volatile__( "ptrue p2.b\n" ".inst 0xd503477f // SMSTART ZA\n" "cntw x27, ALL, MUL #4\n" "add x26, %x[N], x27\n" "sub x26, x26, #0x1\n" "udiv x26, x26, x27\n" "add x21, x26, #0x3\n" "and x21, x21, #0xfffffffffffffffc\n" "mul x21, x21, x27\n" "mov x9, #0x0\n" "mov x25, %x[B_ptr]\n" "mov x24, %x[output_ptr]\n" "ptrue p2.b\n" ".inst 0x25207810 // ptrue pn8.b\n" "mul x21, x21, %x[K]\n" "mov x20, #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 x20, x20, #0x1\n" "b 1b\n" "2:" // RHS do prefetch "lsl x19, x21, #0x26\n" "sub x20, x20, #0x1\n" "lsl x20, x20, #0x16\n" "orr x21, x21, x19\n" "orr x21, x21, x20\n" ".inst 0xf8b54b3a // rprfm pldonce, x21, [x25]\n" "3:" // RHS prefetch exit "mov x23, %x[col_bias]\n" "mov z26.s, #0x0\n" "mov z24.b, #0x1\n" "bic %x[flags], %x[flags], #0x80000000\n" "4:" // Column loop "cmp x26, #0x4\n" "bge 34f\n" "cmp x26, #0x2\n" "bgt 24f\n" "beq 14f\n" "mov x22, %x[A_ptr]\n" "mov x21, %x[K]\n" "mov x19, %x[N]\n" "mov x20, %x[K]\n" ".inst 0xf8b54ad8 // rprfm pldmany, x21, [x22]\n" "whilelt p1.b, XZR, x19\n" "cbz x23, 5f\n" ".inst 0xa040c2e4 // ld1w { z4.s-z7.s }, pn8.b/Z, [x23]\n" ".inst 0xc0042c80 // mova za.d[x9, #0], { z4.d-z7.d }\n" "b 6f\n" "5:" // Width 1: no bias ".inst 0xc00800ff // zero { zad0, zad1, zad2, zad3, zad4, zad5, zad6, zad7 }\n" "6:" // Width 1: setup done "cmp x20, #0x10\n" "ble 9f\n" "7:" // Width 1: Multiply loop: Main loop head "whilelt p0.b, XZR, x20\n" "ld1rqb { z3.b }, p0/Z, [x22]\n" "add x22, x22, #0x10\n" ".inst 0xa0408331 // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25]\n" ".inst 0xc153b220 // sdot za.s[x9, 0], { z16.b-z19.b }, z3.b[0]\n" "addvl x25, x25, #16\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" ".inst 0xc153b6a0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[1]\n" "addvl x25, x25, #16\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" ".inst 0xc153baa0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[2]\n" "addvl x25, x25, #16\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" ".inst 0xc153bea0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[3]\n" "addvl x25, x25, #16\n" "tbnz %x[flags], #31, 8f\n" "sdot z26.s, z3.b, z24.b\n" "8:" // Width 1: Multiply loop: unique 1: skip row sum "sub x20, x20, #0x10\n" "cmp x20, #0x10\n" "bgt 7b\n" "9:" // Width 1: Multiply loop: Single iteration only "whilelt p0.b, XZR, x20\n" "ld1rqb { z3.b }, p0/Z, [x22]\n" "subs x20, x20, #0x4\n" ".inst 0xa0408331 // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25]\n" "add x22, x22, #0x10\n" ".inst 0xc153b220 // sdot za.s[x9, 0], { z16.b-z19.b }, z3.b[0]\n" "addvl x25, x25, #16\n" "ble 10f\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" "subs x20, x20, #0x4\n" ".inst 0xc153b6a0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[1]\n" "addvl x25, x25, #16\n" "ble 10f\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" "subs x20, x20, #0x4\n" ".inst 0xc153baa0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[2]\n" "addvl x25, x25, #16\n" "ble 10f\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" ".inst 0xc153bea0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[3]\n" "addvl x25, x25, #16\n" "10:" // Width 1: Multiply loop: multiply skip "tbnz %x[flags], #31, 11f\n" "sdot z26.s, z3.b, z24.b\n" "11:" // Width 1: Multiply loop: unique 2: skip row sum "tbnz %x[flags], #31, 12f\n" "add x20, %x[qp], %[b_offset]\n" "mov x19, #0x4\n" "ld1rw { z10.s }, p2/Z, [x20]\n" "neg z10.s, p2/M, z10.s\n" "whilelt p0.s, XZR, x19\n" "saddv d26, p0, z26.s\n" "mov z26.s, z26.s[0]\n" "mul z26.s, p2/M, z26.s, z10.s\n" "orr %x[flags], %x[flags], #0x80000000\n" "12:" // Width 1: skip row sum fixup ".inst 0xc0904b40 // addha za0.s, p2/M, p2/M, z26.s\n" "add x19, %x[qp], %[per_layer_mul]\n" "ld1rw { z5.s }, p2/Z, [x19]\n" "add x19, %x[qp], %[per_layer_right_shift]\n" ".inst 0xc0904b41 // addha za1.s, p2/M, p2/M, z26.s\n" "ld1rw { z4.s }, p2/Z, [x19]\n" "add x19, %x[qp], %[c_offset]\n" "add x20, %x[qp], %[minval]\n" ".inst 0xc0904b42 // addha za2.s, p2/M, p2/M, z26.s\n" "ld1rw { z6.s }, p2/Z, [x19]\n" "add x19, %x[qp], %[maxval]\n" ".inst 0xc0904b43 // addha za3.s, p2/M, p2/M, z26.s\n" "ld1rw { z21.s }, p2/Z, [x20]\n" ".inst 0xc0062c1c // mova { z28.d-z31.d }, za.d[x9, #0]\n" ".inst 0xc1a5ac1c // sqdmulh { z28.s-z31.s }, { z28.s-z31.s }, z5.s\n" ".inst 0xc1a4aa3c // srshl { z28.s-z31.s }, { z28.s-z31.s }, z4.s\n" "ld1rw { z16.s }, p2/Z, [x19]\n" ".inst 0xc1a6ab1c // add { z28.s-z31.s }, { z28.s-z31.s }, z6.s\n" ".inst 0xc1b0cebc // sclamp { z28.s-z31.s }, z21.s, z16.s\n" "uzp1 z28.h, z28.h, z29.h\n" "uzp1 z29.h, z30.h, z31.h\n" "uzp1 z28.b, z28.b, z29.b\n" "st1b { z28.b }, p1, [x24]\n" "addvl x24, x24, #1\n" "13:" // Width 1: Output done "b 44f\n" "14:" // Width 2 "mov x22, %x[A_ptr]\n" "mov x21, %x[K]\n" "sub x19, %x[N], x27\n" "mov x20, %x[K]\n" ".inst 0xf8b54ad8 // rprfm pldmany, x21, [x22]\n" "whilelt p1.b, XZR, x19\n" "cbz x23, 15f\n" ".inst 0xa040c2e4 // ld1w { z4.s-z7.s }, pn8.b/Z, [x23]\n" ".inst 0xc0042c80 // mova za.d[x9, #0], { z4.d-z7.d }\n" ".inst 0xa041c2f4 // ld1w { z20.s-z23.s }, pn8.b/Z, [x23, #0x4, MUL VL]\n" ".inst 0xc0042e81 // mova za.d[x9, #1], { z20.d-z23.d }\n" "b 16f\n" "15:" // Width 2: no bias ".inst 0xc00800ff // zero { zad0, zad1, zad2, zad3, zad4, zad5, zad6, zad7 }\n" "16:" // Width 2: setup done "cmp x20, #0x10\n" "ble 19f\n" "17:" // Width 2: Multiply loop: Main loop head "whilelt p0.b, XZR, x20\n" "ld1rqb { z3.b }, p0/Z, [x22]\n" "add x22, x22, #0x10\n" ".inst 0xa0408331 // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25]\n" ".inst 0xc153b220 // sdot za.s[x9, 0], { z16.b-z19.b }, z3.b[0]\n" ".inst 0xa0418325 // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153b0a1 // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[0]\n" "addvl x25, x25, #16\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" ".inst 0xc153b6a0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[1]\n" ".inst 0xa0418329 // ldnt1b { z8.b-z11.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153b521 // sdot za.s[x9, 1], { z8.b-z11.b }, z3.b[1]\n" "addvl x25, x25, #16\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" ".inst 0xc153baa0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[2]\n" ".inst 0xa0418325 // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153b8a1 // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[2]\n" "addvl x25, x25, #16\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" ".inst 0xc153bea0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[3]\n" ".inst 0xa0418335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153bea1 // sdot za.s[x9, 1], { z20.b-z23.b }, z3.b[3]\n" "addvl x25, x25, #16\n" "tbnz %x[flags], #31, 18f\n" "sdot z26.s, z3.b, z24.b\n" "18:" // Width 2: Multiply loop: unique 3: skip row sum "sub x20, x20, #0x10\n" "cmp x20, #0x10\n" "bgt 17b\n" "19:" // Width 2: Multiply loop: Single iteration only "whilelt p0.b, XZR, x20\n" "ld1rqb { z3.b }, p0/Z, [x22]\n" "subs x20, x20, #0x4\n" ".inst 0xa0408331 // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25]\n" "add x22, x22, #0x10\n" ".inst 0xc153b220 // sdot za.s[x9, 0], { z16.b-z19.b }, z3.b[0]\n" ".inst 0xa0418325 // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153b0a1 // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[0]\n" "addvl x25, x25, #16\n" "ble 20f\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" "subs x20, x20, #0x4\n" ".inst 0xc153b6a0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[1]\n" ".inst 0xa0418329 // ldnt1b { z8.b-z11.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153b521 // sdot za.s[x9, 1], { z8.b-z11.b }, z3.b[1]\n" "addvl x25, x25, #16\n" "ble 20f\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" "subs x20, x20, #0x4\n" ".inst 0xc153baa0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[2]\n" ".inst 0xa0418325 // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153b8a1 // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[2]\n" "addvl x25, x25, #16\n" "ble 20f\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" ".inst 0xc153bea0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[3]\n" ".inst 0xa0418335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153bea1 // sdot za.s[x9, 1], { z20.b-z23.b }, z3.b[3]\n" "addvl x25, x25, #16\n" "20:" // Width 2: Multiply loop: multiply skip "tbnz %x[flags], #31, 21f\n" "sdot z26.s, z3.b, z24.b\n" "21:" // Width 2: Multiply loop: unique 4: skip row sum "tbnz %x[flags], #31, 22f\n" "add x20, %x[qp], %[b_offset]\n" "mov x19, #0x4\n" "ld1rw { z10.s }, p2/Z, [x20]\n" "neg z10.s, p2/M, z10.s\n" "whilelt p0.s, XZR, x19\n" "saddv d26, p0, z26.s\n" "mov z26.s, z26.s[0]\n" "mul z26.s, p2/M, z26.s, z10.s\n" "orr %x[flags], %x[flags], #0x80000000\n" "22:" // Width 2: skip row sum fixup ".inst 0xc0904b40 // addha za0.s, p2/M, p2/M, z26.s\n" "add x19, %x[qp], %[per_layer_mul]\n" "ld1rw { z5.s }, p2/Z, [x19]\n" "add x19, %x[qp], %[per_layer_right_shift]\n" ".inst 0xc0904b41 // addha za1.s, p2/M, p2/M, z26.s\n" "ld1rw { z4.s }, p2/Z, [x19]\n" "add x19, %x[qp], %[c_offset]\n" "add x20, %x[qp], %[minval]\n" ".inst 0xc0904b42 // addha za2.s, p2/M, p2/M, z26.s\n" "ld1rw { z6.s }, p2/Z, [x19]\n" "add x19, %x[qp], %[maxval]\n" ".inst 0xc0904b43 // addha za3.s, p2/M, p2/M, z26.s\n" "ld1rw { z21.s }, p2/Z, [x20]\n" ".inst 0xc0062c1c // mova { z28.d-z31.d }, za.d[x9, #0]\n" ".inst 0xc1a5ac1c // sqdmulh { z28.s-z31.s }, { z28.s-z31.s }, z5.s\n" ".inst 0xc0062c2c // mova { z12.d-z15.d }, za.d[x9, #1]\n" ".inst 0xc1a5ac0c // sqdmulh { z12.s-z15.s }, { z12.s-z15.s }, z5.s\n" ".inst 0xc1a4aa3c // srshl { z28.s-z31.s }, { z28.s-z31.s }, z4.s\n" "ld1rw { z16.s }, p2/Z, [x19]\n" ".inst 0xc1a4aa2c // srshl { z12.s-z15.s }, { z12.s-z15.s }, z4.s\n" ".inst 0xc1a6ab1c // add { z28.s-z31.s }, { z28.s-z31.s }, z6.s\n" ".inst 0xc1a6ab0c // add { z12.s-z15.s }, { z12.s-z15.s }, z6.s\n" ".inst 0xc1b0cebc // sclamp { z28.s-z31.s }, z21.s, z16.s\n" ".inst 0xc1b0ceac // sclamp { z12.s-z15.s }, z21.s, z16.s\n" "uzp1 z28.h, z28.h, z29.h\n" "uzp1 z29.h, z30.h, z31.h\n" "uzp1 z12.h, z12.h, z13.h\n" "uzp1 z13.h, z14.h, z15.h\n" "uzp1 z28.b, z28.b, z29.b\n" "st1b { z28.b }, p2, [x24]\n" "uzp1 z12.b, z12.b, z13.b\n" "st1b { z12.b }, p1, [x24, #1, MUL VL]\n" "addvl x24, x24, #2\n" "23:" // Width 2: Output done "b 44f\n" "24:" // Width 3 "mov x19, #0x2\n" "mov x22, %x[A_ptr]\n" "mov x21, %x[K]\n" "msub x19, x27, x19, %x[N]\n" "mov x20, %x[K]\n" ".inst 0xf8b54ad8 // rprfm pldmany, x21, [x22]\n" "whilelt p1.b, XZR, x19\n" "cbz x23, 25f\n" ".inst 0xa040c2e4 // ld1w { z4.s-z7.s }, pn8.b/Z, [x23]\n" ".inst 0xc0042c80 // mova za.d[x9, #0], { z4.d-z7.d }\n" ".inst 0xa041c2f4 // ld1w { z20.s-z23.s }, pn8.b/Z, [x23, #0x4, MUL VL]\n" ".inst 0xc0042e81 // mova za.d[x9, #1], { z20.d-z23.d }\n" ".inst 0xa042c2f4 // ld1w { z20.s-z23.s }, pn8.b/Z, [x23, #0x8, MUL VL]\n" ".inst 0xc0042e82 // mova za.d[x9, #2], { z20.d-z23.d }\n" "b 26f\n" "25:" // Width 3: no bias ".inst 0xc00800ff // zero { zad0, zad1, zad2, zad3, zad4, zad5, zad6, zad7 }\n" "26:" // Width 3: setup done "cmp x20, #0x10\n" "ble 29f\n" "27:" // Width 3: Multiply loop: Main loop head "whilelt p0.b, XZR, x20\n" "ld1rqb { z3.b }, p0/Z, [x22]\n" "add x22, x22, #0x10\n" ".inst 0xa0408331 // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25]\n" ".inst 0xc153b220 // sdot za.s[x9, 0], { z16.b-z19.b }, z3.b[0]\n" ".inst 0xa0418325 // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153b0a1 // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[0]\n" ".inst 0xa042832d // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n" ".inst 0xc153b1a2 // sdot za.s[x9, 2], { z12.b-z15.b }, z3.b[0]\n" "addvl x25, x25, #16\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" ".inst 0xc153b6a0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[1]\n" ".inst 0xa0418329 // ldnt1b { z8.b-z11.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153b521 // sdot za.s[x9, 1], { z8.b-z11.b }, z3.b[1]\n" ".inst 0xa0428331 // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n" ".inst 0xc153b622 // sdot za.s[x9, 2], { z16.b-z19.b }, z3.b[1]\n" "addvl x25, x25, #16\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" ".inst 0xc153baa0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[2]\n" ".inst 0xa0418325 // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153b8a1 // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[2]\n" ".inst 0xa042832d // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n" ".inst 0xc153b9a2 // sdot za.s[x9, 2], { z12.b-z15.b }, z3.b[2]\n" "addvl x25, x25, #16\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" ".inst 0xc153bea0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[3]\n" ".inst 0xa0418335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153bea1 // sdot za.s[x9, 1], { z20.b-z23.b }, z3.b[3]\n" ".inst 0xa0428331 // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n" ".inst 0xc153be22 // sdot za.s[x9, 2], { z16.b-z19.b }, z3.b[3]\n" "addvl x25, x25, #16\n" "tbnz %x[flags], #31, 28f\n" "sdot z26.s, z3.b, z24.b\n" "28:" // Width 3: Multiply loop: unique 5: skip row sum "sub x20, x20, #0x10\n" "cmp x20, #0x10\n" "bgt 27b\n" "29:" // Width 3: Multiply loop: Single iteration only "whilelt p0.b, XZR, x20\n" "ld1rqb { z3.b }, p0/Z, [x22]\n" "subs x20, x20, #0x4\n" ".inst 0xa0408331 // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25]\n" "add x22, x22, #0x10\n" ".inst 0xc153b220 // sdot za.s[x9, 0], { z16.b-z19.b }, z3.b[0]\n" ".inst 0xa0418325 // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153b0a1 // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[0]\n" ".inst 0xa042832d // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n" ".inst 0xc153b1a2 // sdot za.s[x9, 2], { z12.b-z15.b }, z3.b[0]\n" "addvl x25, x25, #16\n" "ble 30f\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" "subs x20, x20, #0x4\n" ".inst 0xc153b6a0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[1]\n" ".inst 0xa0418329 // ldnt1b { z8.b-z11.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153b521 // sdot za.s[x9, 1], { z8.b-z11.b }, z3.b[1]\n" ".inst 0xa0428331 // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n" ".inst 0xc153b622 // sdot za.s[x9, 2], { z16.b-z19.b }, z3.b[1]\n" "addvl x25, x25, #16\n" "ble 30f\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" "subs x20, x20, #0x4\n" ".inst 0xc153baa0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[2]\n" ".inst 0xa0418325 // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153b8a1 // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[2]\n" ".inst 0xa042832d // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n" ".inst 0xc153b9a2 // sdot za.s[x9, 2], { z12.b-z15.b }, z3.b[2]\n" "addvl x25, x25, #16\n" "ble 30f\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" ".inst 0xc153bea0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[3]\n" ".inst 0xa0418335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153bea1 // sdot za.s[x9, 1], { z20.b-z23.b }, z3.b[3]\n" ".inst 0xa0428331 // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n" ".inst 0xc153be22 // sdot za.s[x9, 2], { z16.b-z19.b }, z3.b[3]\n" "addvl x25, x25, #16\n" "30:" // Width 3: Multiply loop: multiply skip "tbnz %x[flags], #31, 31f\n" "sdot z26.s, z3.b, z24.b\n" "31:" // Width 3: Multiply loop: unique 6: skip row sum "tbnz %x[flags], #31, 32f\n" "add x20, %x[qp], %[b_offset]\n" "mov x19, #0x4\n" "ld1rw { z10.s }, p2/Z, [x20]\n" "neg z10.s, p2/M, z10.s\n" "whilelt p0.s, XZR, x19\n" "saddv d26, p0, z26.s\n" "mov z26.s, z26.s[0]\n" "mul z26.s, p2/M, z26.s, z10.s\n" "orr %x[flags], %x[flags], #0x80000000\n" "32:" // Width 3: skip row sum fixup ".inst 0xc0904b40 // addha za0.s, p2/M, p2/M, z26.s\n" "add x19, %x[qp], %[per_layer_mul]\n" "ld1rw { z5.s }, p2/Z, [x19]\n" "add x19, %x[qp], %[per_layer_right_shift]\n" ".inst 0xc0904b41 // addha za1.s, p2/M, p2/M, z26.s\n" "ld1rw { z4.s }, p2/Z, [x19]\n" "add x19, %x[qp], %[c_offset]\n" "add x20, %x[qp], %[minval]\n" ".inst 0xc0904b42 // addha za2.s, p2/M, p2/M, z26.s\n" "ld1rw { z6.s }, p2/Z, [x19]\n" "add x19, %x[qp], %[maxval]\n" ".inst 0xc0904b43 // addha za3.s, p2/M, p2/M, z26.s\n" "ld1rw { z21.s }, p2/Z, [x20]\n" ".inst 0xc0062c1c // mova { z28.d-z31.d }, za.d[x9, #0]\n" ".inst 0xc1a5ac1c // sqdmulh { z28.s-z31.s }, { z28.s-z31.s }, z5.s\n" ".inst 0xc0062c2c // mova { z12.d-z15.d }, za.d[x9, #1]\n" ".inst 0xc1a5ac0c // sqdmulh { z12.s-z15.s }, { z12.s-z15.s }, z5.s\n" ".inst 0xc0062c40 // mova { z0.d-z3.d }, za.d[x9, #2]\n" ".inst 0xc1a5ac00 // sqdmulh { z0.s-z3.s }, { z0.s-z3.s }, z5.s\n" ".inst 0xc1a4aa3c // srshl { z28.s-z31.s }, { z28.s-z31.s }, z4.s\n" "ld1rw { z16.s }, p2/Z, [x19]\n" ".inst 0xc1a4aa2c // srshl { z12.s-z15.s }, { z12.s-z15.s }, z4.s\n" ".inst 0xc1a4aa20 // srshl { z0.s-z3.s }, { z0.s-z3.s }, z4.s\n" ".inst 0xc1a6ab1c // add { z28.s-z31.s }, { z28.s-z31.s }, z6.s\n" ".inst 0xc1a6ab0c // add { z12.s-z15.s }, { z12.s-z15.s }, z6.s\n" ".inst 0xc1a6ab00 // add { z0.s-z3.s }, { z0.s-z3.s }, z6.s\n" ".inst 0xc1b0cebc // sclamp { z28.s-z31.s }, z21.s, z16.s\n" ".inst 0xc1b0ceac // sclamp { z12.s-z15.s }, z21.s, z16.s\n" "uzp1 z28.h, z28.h, z29.h\n" ".inst 0xc1b0cea0 // sclamp { z0.s-z3.s }, z21.s, z16.s\n" "uzp1 z29.h, z30.h, z31.h\n" "uzp1 z12.h, z12.h, z13.h\n" "uzp1 z13.h, z14.h, z15.h\n" "uzp1 z0.h, z0.h, z1.h\n" "uzp1 z1.h, z2.h, z3.h\n" "uzp1 z28.b, z28.b, z29.b\n" "st1b { z28.b }, p2, [x24]\n" "uzp1 z12.b, z12.b, z13.b\n" "st1b { z12.b }, p2, [x24, #1, MUL VL]\n" "uzp1 z0.b, z0.b, z1.b\n" "st1b { z0.b }, p1, [x24, #2, MUL VL]\n" "addvl x24, x24, #3\n" "33:" // Width 3: Output done "b 44f\n" "34:" // Width 4 "mov x19, #0x3\n" "mov x22, %x[A_ptr]\n" "mov x21, %x[K]\n" "msub x19, x27, x19, %x[N]\n" "mov x20, %x[K]\n" ".inst 0xf8b54ad8 // rprfm pldmany, x21, [x22]\n" "whilelt p1.b, XZR, x19\n" "cbz x23, 35f\n" ".inst 0xa040c2e4 // ld1w { z4.s-z7.s }, pn8.b/Z, [x23]\n" ".inst 0xc0042c80 // mova za.d[x9, #0], { z4.d-z7.d }\n" ".inst 0xa041c2f4 // ld1w { z20.s-z23.s }, pn8.b/Z, [x23, #0x4, MUL VL]\n" ".inst 0xc0042e81 // mova za.d[x9, #1], { z20.d-z23.d }\n" ".inst 0xa042c2f4 // ld1w { z20.s-z23.s }, pn8.b/Z, [x23, #0x8, MUL VL]\n" ".inst 0xc0042e82 // mova za.d[x9, #2], { z20.d-z23.d }\n" ".inst 0xa043c2f0 // ld1w { z16.s-z19.s }, pn8.b/Z, [x23, #0xc, MUL VL]\n" ".inst 0xc0042e03 // mova za.d[x9, #3], { z16.d-z19.d }\n" "addvl x23, x23, #16\n" "b 36f\n" "35:" // Width 4: no bias ".inst 0xc00800ff // zero { zad0, zad1, zad2, zad3, zad4, zad5, zad6, zad7 }\n" "36:" // Width 4: setup done "cmp x20, #0x10\n" "ble 39f\n" "37:" // Width 4: Multiply loop: Main loop head "whilelt p0.b, XZR, x20\n" "ld1rqb { z3.b }, p0/Z, [x22]\n" "add x22, x22, #0x10\n" ".inst 0xa0408331 // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25]\n" ".inst 0xc153b220 // sdot za.s[x9, 0], { z16.b-z19.b }, z3.b[0]\n" ".inst 0xa0418325 // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153b0a1 // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[0]\n" ".inst 0xa042832d // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n" ".inst 0xc153b1a2 // sdot za.s[x9, 2], { z12.b-z15.b }, z3.b[0]\n" ".inst 0xa043832d // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0xc, MUL VL]\n" ".inst 0xc153b1a3 // sdot za.s[x9, 3], { z12.b-z15.b }, z3.b[0]\n" "addvl x25, x25, #16\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" ".inst 0xc153b6a0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[1]\n" ".inst 0xa0418329 // ldnt1b { z8.b-z11.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153b521 // sdot za.s[x9, 1], { z8.b-z11.b }, z3.b[1]\n" ".inst 0xa0428331 // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n" ".inst 0xc153b622 // sdot za.s[x9, 2], { z16.b-z19.b }, z3.b[1]\n" ".inst 0xa043832d // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0xc, MUL VL]\n" ".inst 0xc153b5a3 // sdot za.s[x9, 3], { z12.b-z15.b }, z3.b[1]\n" "addvl x25, x25, #16\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" ".inst 0xc153baa0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[2]\n" ".inst 0xa0418325 // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153b8a1 // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[2]\n" ".inst 0xa042832d // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n" ".inst 0xc153b9a2 // sdot za.s[x9, 2], { z12.b-z15.b }, z3.b[2]\n" ".inst 0xa043833d // ldnt1b { z28.b-z31.b }, pn8.b/Z, [x25, #0xc, MUL VL]\n" ".inst 0xc153bba3 // sdot za.s[x9, 3], { z28.b-z31.b }, z3.b[2]\n" "addvl x25, x25, #16\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" ".inst 0xc153bea0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[3]\n" ".inst 0xa0418335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153bea1 // sdot za.s[x9, 1], { z20.b-z23.b }, z3.b[3]\n" ".inst 0xa0428331 // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n" ".inst 0xc153be22 // sdot za.s[x9, 2], { z16.b-z19.b }, z3.b[3]\n" ".inst 0xa0438331 // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25, #0xc, MUL VL]\n" ".inst 0xc153be23 // sdot za.s[x9, 3], { z16.b-z19.b }, z3.b[3]\n" "addvl x25, x25, #16\n" "tbnz %x[flags], #31, 38f\n" "sdot z26.s, z3.b, z24.b\n" "38:" // Width 4: Multiply loop: unique 7: skip row sum "sub x20, x20, #0x10\n" "cmp x20, #0x10\n" "bgt 37b\n" "39:" // Width 4: Multiply loop: Single iteration only "whilelt p0.b, XZR, x20\n" "ld1rqb { z3.b }, p0/Z, [x22]\n" "subs x20, x20, #0x4\n" ".inst 0xa0408331 // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25]\n" "add x22, x22, #0x10\n" ".inst 0xc153b220 // sdot za.s[x9, 0], { z16.b-z19.b }, z3.b[0]\n" ".inst 0xa0418325 // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153b0a1 // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[0]\n" ".inst 0xa042832d // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n" ".inst 0xc153b1a2 // sdot za.s[x9, 2], { z12.b-z15.b }, z3.b[0]\n" ".inst 0xa043832d // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0xc, MUL VL]\n" ".inst 0xc153b1a3 // sdot za.s[x9, 3], { z12.b-z15.b }, z3.b[0]\n" "addvl x25, x25, #16\n" "ble 40f\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" "subs x20, x20, #0x4\n" ".inst 0xc153b6a0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[1]\n" ".inst 0xa0418329 // ldnt1b { z8.b-z11.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153b521 // sdot za.s[x9, 1], { z8.b-z11.b }, z3.b[1]\n" ".inst 0xa0428331 // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n" ".inst 0xc153b622 // sdot za.s[x9, 2], { z16.b-z19.b }, z3.b[1]\n" ".inst 0xa043832d // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0xc, MUL VL]\n" ".inst 0xc153b5a3 // sdot za.s[x9, 3], { z12.b-z15.b }, z3.b[1]\n" "addvl x25, x25, #16\n" "ble 40f\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" "subs x20, x20, #0x4\n" ".inst 0xc153baa0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[2]\n" ".inst 0xa0418325 // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153b8a1 // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[2]\n" ".inst 0xa042832d // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n" ".inst 0xc153b9a2 // sdot za.s[x9, 2], { z12.b-z15.b }, z3.b[2]\n" ".inst 0xa043833d // ldnt1b { z28.b-z31.b }, pn8.b/Z, [x25, #0xc, MUL VL]\n" ".inst 0xc153bba3 // sdot za.s[x9, 3], { z28.b-z31.b }, z3.b[2]\n" "addvl x25, x25, #16\n" "ble 40f\n" ".inst 0xa0408335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n" ".inst 0xc153bea0 // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[3]\n" ".inst 0xa0418335 // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n" ".inst 0xc153bea1 // sdot za.s[x9, 1], { z20.b-z23.b }, z3.b[3]\n" ".inst 0xa0428331 // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n" ".inst 0xc153be22 // sdot za.s[x9, 2], { z16.b-z19.b }, z3.b[3]\n" ".inst 0xa0438331 // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25, #0xc, MUL VL]\n" ".inst 0xc153be23 // sdot za.s[x9, 3], { z16.b-z19.b }, z3.b[3]\n" "addvl x25, x25, #16\n" "40:" // Width 4: Multiply loop: multiply skip "tbnz %x[flags], #31, 41f\n" "sdot z26.s, z3.b, z24.b\n" "41:" // Width 4: Multiply loop: unique 8: skip row sum "tbnz %x[flags], #31, 42f\n" "add x20, %x[qp], %[b_offset]\n" "mov x19, #0x4\n" "ld1rw { z10.s }, p2/Z, [x20]\n" "neg z10.s, p2/M, z10.s\n" "whilelt p0.s, XZR, x19\n" "saddv d26, p0, z26.s\n" "mov z26.s, z26.s[0]\n" "mul z26.s, p2/M, z26.s, z10.s\n" "orr %x[flags], %x[flags], #0x80000000\n" "42:" // Width 4: skip row sum fixup ".inst 0xc0904b40 // addha za0.s, p2/M, p2/M, z26.s\n" "add x19, %x[qp], %[per_layer_mul]\n" "ld1rw { z5.s }, p2/Z, [x19]\n" "add x19, %x[qp], %[per_layer_right_shift]\n" ".inst 0xc0904b41 // addha za1.s, p2/M, p2/M, z26.s\n" "ld1rw { z4.s }, p2/Z, [x19]\n" "add x19, %x[qp], %[c_offset]\n" "add x20, %x[qp], %[minval]\n" ".inst 0xc0904b42 // addha za2.s, p2/M, p2/M, z26.s\n" "ld1rw { z6.s }, p2/Z, [x19]\n" "add x19, %x[qp], %[maxval]\n" ".inst 0xc0904b43 // addha za3.s, p2/M, p2/M, z26.s\n" "ld1rw { z21.s }, p2/Z, [x20]\n" ".inst 0xc0062c1c // mova { z28.d-z31.d }, za.d[x9, #0]\n" ".inst 0xc1a5ac1c // sqdmulh { z28.s-z31.s }, { z28.s-z31.s }, z5.s\n" ".inst 0xc0062c2c // mova { z12.d-z15.d }, za.d[x9, #1]\n" ".inst 0xc1a5ac0c // sqdmulh { z12.s-z15.s }, { z12.s-z15.s }, z5.s\n" ".inst 0xc0062c40 // mova { z0.d-z3.d }, za.d[x9, #2]\n" ".inst 0xc1a5ac00 // sqdmulh { z0.s-z3.s }, { z0.s-z3.s }, z5.s\n" ".inst 0xc0062c68 // mova { z8.d-z11.d }, za.d[x9, #3]\n" ".inst 0xc1a5ac08 // sqdmulh { z8.s-z11.s }, { z8.s-z11.s }, z5.s\n" ".inst 0xc1a4aa3c // srshl { z28.s-z31.s }, { z28.s-z31.s }, z4.s\n" "ld1rw { z16.s }, p2/Z, [x19]\n" ".inst 0xc1a4aa2c // srshl { z12.s-z15.s }, { z12.s-z15.s }, z4.s\n" ".inst 0xc1a4aa20 // srshl { z0.s-z3.s }, { z0.s-z3.s }, z4.s\n" ".inst 0xc1a4aa28 // srshl { z8.s-z11.s }, { z8.s-z11.s }, z4.s\n" ".inst 0xc1a6ab1c // add { z28.s-z31.s }, { z28.s-z31.s }, z6.s\n" ".inst 0xc1a6ab0c // add { z12.s-z15.s }, { z12.s-z15.s }, z6.s\n" ".inst 0xc1a6ab00 // add { z0.s-z3.s }, { z0.s-z3.s }, z6.s\n" ".inst 0xc1a6ab08 // add { z8.s-z11.s }, { z8.s-z11.s }, z6.s\n" ".inst 0xc1b0cebc // sclamp { z28.s-z31.s }, z21.s, z16.s\n" ".inst 0xc1b0ceac // sclamp { z12.s-z15.s }, z21.s, z16.s\n" "uzp1 z28.h, z28.h, z29.h\n" ".inst 0xc1b0cea0 // sclamp { z0.s-z3.s }, z21.s, z16.s\n" ".inst 0xc1b0cea8 // sclamp { z8.s-z11.s }, z21.s, z16.s\n" "uzp1 z29.h, z30.h, z31.h\n" "uzp1 z12.h, z12.h, z13.h\n" "uzp1 z13.h, z14.h, z15.h\n" "uzp1 z0.h, z0.h, z1.h\n" "uzp1 z1.h, z2.h, z3.h\n" "uzp1 z8.h, z8.h, z9.h\n" "uzp1 z9.h, z10.h, z11.h\n" "uzp1 z28.b, z28.b, z29.b\n" "st1b { z28.b }, p2, [x24]\n" "uzp1 z12.b, z12.b, z13.b\n" "st1b { z12.b }, p2, [x24, #1, MUL VL]\n" "uzp1 z0.b, z0.b, z1.b\n" "uzp1 z8.b, z8.b, z9.b\n" "st1b { z0.b }, p2, [x24, #2, MUL VL]\n" "st1b { z8.b }, p1, [x24, #3, MUL VL]\n" "addvl x24, x24, #4\n" "43:" // Width 4: Output done "subs x26, x26, #0x4\n" "sub %x[N], %x[N], x27, LSL #2\n" "bgt 4b\n" "44:" // Exit ".inst 0xd503467f // SMSTOP\n" "ptrue p2.b\n" : [N] "+&r" (N), [flags] "+&r" (flags) : [A_ptr] "r" (A_ptr), [B_ptr] "r" (B_ptr), [K] "r" (K), [b_offset] "I" (offsetof(Requantize32, b_offset)), [c_offset] "I" (offsetof(Requantize32, c_offset)), [col_bias] "r" (col_bias), [maxval] "I" (offsetof(Requantize32, maxval)), [minval] "I" (offsetof(Requantize32, minval)), [output_ptr] "r" (output_ptr), [per_layer_mul] "I" (offsetof(Requantize32, per_layer_mul)), [per_layer_right_shift] "I" (offsetof(Requantize32, per_layer_right_shift)), [qp] "r" (qp) : "cc", "memory", "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15", "x9", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "z16", "z17", "z18", "z19", "z20", "z21", "z22", "z23", "z24", "z25", "z26", "z27", "z28", "z29", "z30", "z31" ); } } // namespace arm_gemm #endif // ARM_COMPUTE_ENABLE_SME2 #endif