interplane.Get Omega
Read in your language

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

branch main Branches Tags History

CUDApp / backend / amd / gfx942 / vadd.isa

121 lines · 5846 bytes Raw Blame History
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.
25K vadd 28 8 0 0 20 9 0 64 64 2 0xaf0081 0x84 8
26A a 0 8 0
27A b 8 8 0
28A c 16 8 0
29A count 24 4 1
30
31F 1 2 # SMEM
32B 1 0 26 6 0x30 # encoding
33D 1 0 0 0 6 # sbase (SGPR pair number / 2)
34D 1 1 0 6 7 # sdata
35D 1 2 0 16 1 # glc
36D 1 3 0 17 1 # imm (offset is an immediate)
37D 1 4 0 18 8 # op
38D 1 5 1 0 21 # offset
39
40F 2 1 # SOP2
41B 2 0 30 2 2 # encoding
42D 2 0 0 0 8 # ssrc0
43D 2 1 0 8 8 # ssrc1
44D 2 2 0 16 7 # sdst
45D 2 3 0 23 7 # op
46
47F 3 1 # SOP1
48B 3 0 23 9 0x17d # encoding
49D 3 0 0 0 8 # ssrc0
50D 3 1 0 8 8 # op
51D 3 2 0 16 7 # sdst
52
53F 4 1 # SOPP
54B 4 0 23 9 0x17f # encoding
55D 4 0 0 0 16 # simm16
56D 4 1 0 16 7 # op
57
58F 5 1 # VOP2 (e32)
59B 5 0 31 1 0 # encoding
60D 5 0 0 0 9 # src0
61D 5 1 0 9 8 # vsrc1
62D 5 2 0 17 8 # vdst
63D 5 3 0 25 6 # op
64
65F 6 1 # VOPC (e32)
66B 6 0 25 7 0x3e # encoding
67D 6 0 0 0 9 # src0
68D 6 1 0 9 8 # vsrc1
69D 6 2 0 17 8 # op
70
71F 7 2 # FLAT / GLOBAL (gfx940)
72B 7 0 26 6 0x37 # encoding
73D 7 0 0 0 13 # offset
74D 7 1 0 13 1 # sve
75D 7 2 0 14 2 # seg (2 = global)
76D 7 3 0 16 1 # sc0
77D 7 4 0 17 1 # nt
78D 7 5 0 18 7 # op
79D 7 6 0 25 1 # sc1
80D 7 7 1 0 8 # vaddr
81D 7 8 1 8 8 # vdata
82D 7 9 1 16 7 # saddr
83D 7 10 1 23 1 # acc
84D 7 11 1 24 8 # vdst
85
86F 8 1 # VOP1 (e32)
87B 8 0 25 7 0x3f # encoding
88D 8 0 0 0 9 # src0
89D 8 1 0 9 8 # op
90D 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)
93I 1 0 4 0 1 2 0 # s_load_dwordx4 s[4:7], s[0:1], 0x0 op 0x02
94I 1 0 8 0 1 1 16 # s_load_dwordx2 s[8:9], s[0:1], 0x10 op 0x01
95I 1 0 10 0 1 0 24 # s_load_dword s10, s[0:1], 0x18 op 0x00
96I 5 255 0 0 0x13 # v_and_b32_e32 v0, 0x3ff, v0 op 0x13
97L 0x3ff
98I 2 2 134 11 0x1c # s_lshl_b32 s11, s2, 6 op 0x1c
99I 5 11 0 1 0x34 # v_add_u32_e32 v1, s11, v0 op 0x34 (gfx9)
100I 4 0xc07f 0x0c # s_waitcnt lgkmcnt(0) op 0x0c
101I 6 10 1 0xcc # v_cmp_gt_u32_e32 vcc, s10, v1 op 0xcc
102I 3 106 0x20 12 # s_and_saveexec_b64 s[12:13], vcc op 0x20
103I 4 @1 0x08 # s_cbranch_execz label 1 op 0x08
104I 5 130 1 2 0x12 # v_lshlrev_b32_e32 v2, 2, v1 op 0x12
105I 5 158 1 3 0x10 # v_lshrrev_b32_e32 v3, 30, v1
106I 8 5 1 5 # v_mov_b32_e32 v5, s5
107I 5 4 2 6 0x19 # v_add_co_u32_e32 v6, vcc, s4, v2
108I 5 261 3 7 0x1c # v_addc_co_u32_e32 v7, vcc, v5, v3, vcc
109I 7 0 0 2 0 0 0x14 0 6 0 127 0 4 # global_load_dword v4, v[6:7], off
110I 8 7 1 5 # v_mov_b32_e32 v5, s7
111I 5 6 2 6 0x19 # v_add_co_u32_e32 v6, vcc, s6, v2
112I 5 261 3 7 0x1c # v_addc_co_u32_e32 v7, vcc, v5, v3, vcc
113I 7 0 0 2 0 0 0x14 0 6 0 127 0 8 # global_load_dword v8, v[6:7], off
114I 4 0x0f70 0x0c # s_waitcnt vmcnt(0)
115I 5 260 8 4 0x01 # v_add_f32_e32 v4, v4, v8
116I 8 9 1 5 # v_mov_b32_e32 v5, s9
117I 5 8 2 6 0x19 # v_add_co_u32_e32 v6, vcc, s8, v2
118I 5 261 3 7 0x1c # v_addc_co_u32_e32 v7, vcc, v5, v3, vcc
119I 7 0 0 2 0 0 0x1c 0 6 4 127 0 0 # global_store_dword v[6:7], v4, off
120T 1
121I 4 0 0x01 # s_endpgm op 0x01