udot

Unsigned Dot Product (Multi-vector)

UDOT ZA.<T>[<Wv>, <offs>{, VGx2}], { <Zn1>.<Tb>-<Zn2>.<Tb> }, <Zm>.<Tb>

Multi-vector unsigned dot product into ZA (SME2).

Pseudocode Operation

vec = (Wv + offs) MOD (VL_bytes / 2)
for r = 0 to 1
  for each ZA element e of 32 bits (64 when sz = 1)
    acc = ZA_vector[vec][e]
    for i = 0 to 3
      acc = acc + UInt(Zn[n+r].part[4*e+i]) * UInt(Zm.part[4*e+i])
    ZA_vector[vec][e] = acc
  vec = vec + VL_bytes / 2

Example

UDOT ZA.S[W8, 0, VGx2], { Z0.B-Z1.B }, Z2.B

Encoding

Binary Layout
110000010
31:23
sz
22
10
21:20
Zm
19:16
0
15
Rv
14:13
101
12:10
Zn
9:5
10
4:3
off3
2:0
 
Format SME2 DotProd
Opcode 0xC1201410
Extension SME2

Operands

  • Wv
    32-bit vector select register, W8 to W11
  • offs
    Vector select offset, 0 to 7
  • Zn1
    First of the two consecutive source vector registers
  • Zn2
    Second of the two consecutive source vector registers
  • Zm
    Source vector register shared by both, Z0 to Z15

Related

Other forms of udot

  • udot SVE Unsigned Dot Product
  • udot SVE2p1 Unsigned Dot Product (2-way)
  • udot Unsigned Dot Product (NEON)

More in SME2

Reference

Instruction Forms

Encoding Instruction ISA Bit pattern
0x2F00E000 UDOT <Vd>.<Ta>, <Vn>.<Tb>, <Vm>.4B[<index>] A64 0 | Q | 1 | 01111 | size | L | M | Rm | 1110 | H | 0 | Rn | Rd
0x2E009400 UDOT <Vd>.<Ta>, <Vn>.<Tb>, <Vm>.<Tb> A64 0 | Q | 1 | 01110 | size | 0 | Rm | 1 | 0010 | 1 | Rn | Rd
0x4400CC00 UDOT <Zda>.S, <Zn>.H, <Zm>.H A64 01000100000 | Zm | 11001 | 1 | Zn | Zda
0x4480CC00 UDOT <Zda>.S, <Zn>.H, <Zm>.H[<imm>] A64 01000100100 | i2 | Zm | 11001 | 1 | Zn | Zda
0x44000400 UDOT <Zda>.<T>, <Zn>.<Tb>, <Zm>.<Tb> A64 01000100 | size | 0 | Zm | 00000 | 1 | Zn | Zda
0x44A00400 UDOT <Zda>.S, <Zn>.B, <Zm>.B[<imm>] A64 01000100 | 1 | 0 | 1 | i2 | Zm | 00000 | 1 | Zn | Zda
0x44E00400 UDOT <Zda>.D, <Zn>.H, <Zm>.H[<imm>] A64 01000100 | 1 | 1 | 1 | i1 | Zm | 00000 | 1 | Zn | Zda
0xC1501010 UDOT ZA.S[<Wv>, <offs>{, VGx2}], { <Zn1>.H-<Zn2>.H }, <Zm>.H[<index>] A64 110000010101 | Zm | 0 | Rv | 1 | i2 | Zn | 0 | 1 | 0 | off3
0xC1509010 UDOT ZA.S[<Wv>, <offs>{, VGx4}], { <Zn1>.H-<Zn4>.H }, <Zm>.H[<index>] A64 110000010101 | Zm | 1 | Rv | 1 | i2 | Zn | 0 | 0 | 1 | 0 | off3
0xC1601418 UDOT ZA.S[<Wv>, <offs>{, VGx2}], { <Zn1>.H-<Zn2>.H }, <Zm>.H A64 11 | 0000010110 | Zm | 0 | Rv | 101 | Zn | 1 | 1 | off3
0xC1701418 UDOT ZA.S[<Wv>, <offs>{, VGx4}], { <Zn1>.H-<Zn4>.H }, <Zm>.H A64 11 | 0000010111 | Zm | 0 | Rv | 101 | Zn | 1 | 1 | off3
0xC1E01418 UDOT ZA.S[<Wv>, <offs>{, VGx2}], { <Zn1>.H-<Zn2>.H }, { <Zm1>.H-<Zm2>.H } A64 11 | 000001111 | Zm | 00 | Rv | 101 | Zn | 0 | 1 | 1 | off3
0xC1E11418 UDOT ZA.S[<Wv>, <offs>{, VGx4}], { <Zn1>.H-<Zn4>.H }, { <Zm1>.H-<Zm4>.H } A64 11 | 000001111 | Zm | 010 | Rv | 101 | Zn | 00 | 1 | 1 | off3
0xC1501030 UDOT ZA.S[<Wv>, <offs>{, VGx2}], { <Zn1>.B-<Zn2>.B }, <Zm>.B[<index>] A64 110000010101 | Zm | 0 | Rv | 1 | i2 | Zn | 1 | 1 | 0 | off3

Description

The unsigned integer dot product instruction computes the dot product of a group of four unsigned 8-bit or 16-bit integer values held in each 32-bit or 64-bit element of the first source vector multiplied by a group of four unsigned 8-bit or 16-bit integer values in the corresponding 32-bit or 64-bit element of the second source vector, and then destructively adds the widened dot product to the corresponding 32-bit or 64-bit element of the destination vector. This instruction is unpredicated.

Operation

CheckSVEEnabled();
constant integer VL = CurrentVL;
constant integer PL = VL DIV 8;
constant integer elements = VL DIV esize;
bits(VL) operand1 = Z[n, VL];
bits(VL) operand2 = Z[m, VL];
bits(VL) operand3 = Z[da, VL];
bits(VL) result;

for e = 0 to elements-1
    bits(esize) res = Elem[operand3, e, esize];
    for i = 0 to 3
        integer element1 = UInt(Elem[operand1, 4 * e + i, esize DIV 4]);
        integer element2 = UInt(Elem[operand2, 4 * e + i, esize DIV 4]);
        res = res + element1 * element2;
    Elem[result, e, esize] = res;

Z[da, VL] = result;