CUDApp
CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.
Brought by drakestapleton
CUDApp / backend / amd / gfx942 / vadd.isa
| 1 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | # vadd.isa: gfx942 (CDNA3) instruction table for the FP32 vadd kernel. DATA, read by |
| 3 | # backend/amd/gfx942/hsaco.om, which packs every instruction word from these rows. No LLVM tool |
| 4 | # reads this file; tests/amd/run.sh compares the packed words with llvm-mc-18 -mcpu=gfx942. |
| 5 | # |
| 6 | # Rows (first token; numbers are decimal or lowercase 0x hex; '#' starts a comment): |
| 7 | # K name size align group private sgprs vgprs agprs maxgroup wave rsrc3 rsrc1 rsrc2 properties |
| 8 | # A name offset size kind contiguous kernargs; kind 0=global pointer, 1=u32 value |
| 9 | # K is required once before all other rows. Names are identifiers. Resources are gfx942 descriptor fields. |
| 10 | # F id words format id (1..8) has this many 32-bit words (1 or 2) |
| 11 | # B id word lsb width value fixed encoding bits of format id |
| 12 | # D id k word lsb width operand field k (0..63, in order) of format id |
| 13 | # I id v0 v1 ... one instruction of format id, one value per operand field |
| 14 | # L value a 32-bit literal word that follows the previous instruction |
| 15 | # T id numeric branch label at the current code position |
| 16 | # Operand @id is a checked signed-16-bit SOPP word displacement from the next instruction. |
| 17 | # Every value must fit its field; fixed bits and fields must not overlap. |
| 18 | # |
| 19 | # Field positions: LLVM 18.1.3 llvm/lib/Target/AMDGPU (SMInstructions.td SMEM_Real_vi, |
| 20 | # SOPInstructions.td SOP2_Real32 / SOP1_Real / SOPP_Real_32, VOP2Instructions.td VOP2e, |
| 21 | # VOP1Instructions.td VOP1e, VOPCInstructions.td VOPCe, FLATInstructions.td FLAT_Real + FLAT_Real_gfx940). |
| 22 | # _vi / gfx6-gfx10 / gfx9 Real definitions in the same files (gfx940 uses the GFX9 encodings). |
| 23 | # Operand codes: SGPR n = n, vcc_lo = 106, inline integer k (0..64) = 128 + k, literal = 255, |
| 24 | # VGPR n as a 9-bit source = 256 + n, VGPR n in an 8-bit field = n. |
| 25 | K vadd 28 8 0 0 20 9 0 64 64 2 0xaf0081 0x84 8 |
| 26 | A a 0 8 0 |
| 27 | A b 8 8 0 |
| 28 | A c 16 8 0 |
| 29 | A count 24 4 1 |
| 30 | |
| 31 | F 1 2 # SMEM |
| 32 | B 1 0 26 6 0x30 # encoding |
| 33 | D 1 0 0 0 6 # sbase (SGPR pair number / 2) |
| 34 | D 1 1 0 6 7 # sdata |
| 35 | D 1 2 0 16 1 # glc |
| 36 | D 1 3 0 17 1 # imm (offset is an immediate) |
| 37 | D 1 4 0 18 8 # op |
| 38 | D 1 5 1 0 21 # offset |
| 39 | |
| 40 | F 2 1 # SOP2 |
| 41 | B 2 0 30 2 2 # encoding |
| 42 | D 2 0 0 0 8 # ssrc0 |
| 43 | D 2 1 0 8 8 # ssrc1 |
| 44 | D 2 2 0 16 7 # sdst |
| 45 | D 2 3 0 23 7 # op |
| 46 | |
| 47 | F 3 1 # SOP1 |
| 48 | B 3 0 23 9 0x17d # encoding |
| 49 | D 3 0 0 0 8 # ssrc0 |
| 50 | D 3 1 0 8 8 # op |
| 51 | D 3 2 0 16 7 # sdst |
| 52 | |
| 53 | F 4 1 # SOPP |
| 54 | B 4 0 23 9 0x17f # encoding |
| 55 | D 4 0 0 0 16 # simm16 |
| 56 | D 4 1 0 16 7 # op |
| 57 | |
| 58 | F 5 1 # VOP2 (e32) |
| 59 | B 5 0 31 1 0 # encoding |
| 60 | D 5 0 0 0 9 # src0 |
| 61 | D 5 1 0 9 8 # vsrc1 |
| 62 | D 5 2 0 17 8 # vdst |
| 63 | D 5 3 0 25 6 # op |
| 64 | |
| 65 | F 6 1 # VOPC (e32) |
| 66 | B 6 0 25 7 0x3e # encoding |
| 67 | D 6 0 0 0 9 # src0 |
| 68 | D 6 1 0 9 8 # vsrc1 |
| 69 | D 6 2 0 17 8 # op |
| 70 | |
| 71 | F 7 2 # FLAT / GLOBAL (gfx940) |
| 72 | B 7 0 26 6 0x37 # encoding |
| 73 | D 7 0 0 0 13 # offset |
| 74 | D 7 1 0 13 1 # sve |
| 75 | D 7 2 0 14 2 # seg (2 = global) |
| 76 | D 7 3 0 16 1 # sc0 |
| 77 | D 7 4 0 17 1 # nt |
| 78 | D 7 5 0 18 7 # op |
| 79 | D 7 6 0 25 1 # sc1 |
| 80 | D 7 7 1 0 8 # vaddr |
| 81 | D 7 8 1 8 8 # vdata |
| 82 | D 7 9 1 16 7 # saddr |
| 83 | D 7 10 1 23 1 # acc |
| 84 | D 7 11 1 24 8 # vdst |
| 85 | |
| 86 | F 8 1 # VOP1 (e32) |
| 87 | B 8 0 25 7 0x3f # encoding |
| 88 | D 8 0 0 0 9 # src0 |
| 89 | D 8 1 0 9 8 # op |
| 90 | D 8 2 0 17 8 # vdst |
| 91 | |
| 92 | # vadd: c[gid] = a[gid] + b[gid] for gid < count (kernarg a @0, b @8, c @16, count @24) |
| 93 | I 1 0 4 0 1 2 0 # s_load_dwordx4 s[4:7], s[0:1], 0x0 op 0x02 |
| 94 | I 1 0 8 0 1 1 16 # s_load_dwordx2 s[8:9], s[0:1], 0x10 op 0x01 |
| 95 | I 1 0 10 0 1 0 24 # s_load_dword s10, s[0:1], 0x18 op 0x00 |
| 96 | I 5 255 0 0 0x13 # v_and_b32_e32 v0, 0x3ff, v0 op 0x13 |
| 97 | L 0x3ff |
| 98 | I 2 2 134 11 0x1c # s_lshl_b32 s11, s2, 6 op 0x1c |
| 99 | I 5 11 0 1 0x34 # v_add_u32_e32 v1, s11, v0 op 0x34 (gfx9) |
| 100 | I 4 0xc07f 0x0c # s_waitcnt lgkmcnt(0) op 0x0c |
| 101 | I 6 10 1 0xcc # v_cmp_gt_u32_e32 vcc, s10, v1 op 0xcc |
| 102 | I 3 106 0x20 12 # s_and_saveexec_b64 s[12:13], vcc op 0x20 |
| 103 | I 4 @1 0x08 # s_cbranch_execz label 1 op 0x08 |
| 104 | I 5 130 1 2 0x12 # v_lshlrev_b32_e32 v2, 2, v1 op 0x12 |
| 105 | I 5 158 1 3 0x10 # v_lshrrev_b32_e32 v3, 30, v1 |
| 106 | I 8 5 1 5 # v_mov_b32_e32 v5, s5 |
| 107 | I 5 4 2 6 0x19 # v_add_co_u32_e32 v6, vcc, s4, v2 |
| 108 | I 5 261 3 7 0x1c # v_addc_co_u32_e32 v7, vcc, v5, v3, vcc |
| 109 | I 7 0 0 2 0 0 0x14 0 6 0 127 0 4 # global_load_dword v4, v[6:7], off |
| 110 | I 8 7 1 5 # v_mov_b32_e32 v5, s7 |
| 111 | I 5 6 2 6 0x19 # v_add_co_u32_e32 v6, vcc, s6, v2 |
| 112 | I 5 261 3 7 0x1c # v_addc_co_u32_e32 v7, vcc, v5, v3, vcc |
| 113 | I 7 0 0 2 0 0 0x14 0 6 0 127 0 8 # global_load_dword v8, v[6:7], off |
| 114 | I 4 0x0f70 0x0c # s_waitcnt vmcnt(0) |
| 115 | I 5 260 8 4 0x01 # v_add_f32_e32 v4, v4, v8 |
| 116 | I 8 9 1 5 # v_mov_b32_e32 v5, s9 |
| 117 | I 5 8 2 6 0x19 # v_add_co_u32_e32 v6, vcc, s8, v2 |
| 118 | I 5 261 3 7 0x1c # v_addc_co_u32_e32 v7, vcc, v5, v3, vcc |
| 119 | I 7 0 0 2 0 0 0x1c 0 6 4 127 0 0 # global_store_dword v[6:7], v4, off |
| 120 | T 1 |
| 121 | I 4 0 0x01 # s_endpgm op 0x01 |