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 / evidence / AMD-GFX942-HOST-20261112T210312Z / gate / flipped.isa

113 lines · 5455 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# F id words format id (1..8) has this many 32-bit words (1 or 2)
8# B id word lsb width value fixed encoding bits of format id
9# D id k word lsb width operand field k (0..63, in order) of format id
10# I id v0 v1 ... one instruction of format id, one value per operand field
11# L value a 32-bit literal word that follows the previous instruction
12# T 1 the one branch label at the current code position
13# Operand @1 is the forward SOPP word displacement to label 1 from the next instruction.
14# Every value must fit its field; fixed bits and fields must not overlap.
15#
16# Field positions: LLVM 18.1.3 llvm/lib/Target/AMDGPU (SMInstructions.td SMEM_Real_vi,
17# SOPInstructions.td SOP2_Real32 / SOP1_Real / SOPP_Real_32, VOP2Instructions.td VOP2e,
18# VOP1Instructions.td VOP1e, VOPCInstructions.td VOPCe, FLATInstructions.td FLAT_Real + FLAT_Real_gfx940).
19# _vi / gfx6-gfx10 / gfx9 Real definitions in the same files (gfx940 uses the GFX9 encodings).
20# Operand codes: SGPR n = n, vcc_lo = 106, inline integer k (0..64) = 128 + k, literal = 255,
21# VGPR n as a 9-bit source = 256 + n, VGPR n in an 8-bit field = n.
22
23F 1 2 # SMEM
24B 1 0 26 6 0x30 # encoding
25D 1 0 0 0 6 # sbase (SGPR pair number / 2)
26D 1 1 0 6 7 # sdata
27D 1 2 0 16 1 # glc
28D 1 3 0 17 1 # imm (offset is an immediate)
29D 1 4 0 18 8 # op
30D 1 5 1 0 21 # offset
31
32F 2 1 # SOP2
33B 2 0 30 2 2 # encoding
34D 2 0 0 0 8 # ssrc0
35D 2 1 0 8 8 # ssrc1
36D 2 2 0 16 7 # sdst
37D 2 3 0 23 7 # op
38
39F 3 1 # SOP1
40B 3 0 23 9 0x17d # encoding
41D 3 0 0 0 8 # ssrc0
42D 3 1 0 8 8 # op
43D 3 2 0 16 7 # sdst
44
45F 4 1 # SOPP
46B 4 0 23 9 0x17f # encoding
47D 4 0 0 0 16 # simm16
48D 4 1 0 16 7 # op
49
50F 5 1 # VOP2 (e32)
51B 5 0 31 1 0 # encoding
52D 5 0 0 0 9 # src0
53D 5 1 0 9 8 # vsrc1
54D 5 2 0 17 8 # vdst
55D 5 3 0 25 6 # op
56
57F 6 1 # VOPC (e32)
58B 6 0 25 7 0x3e # encoding
59D 6 0 0 0 9 # src0
60D 6 1 0 9 8 # vsrc1
61D 6 2 0 17 8 # op
62
63F 7 2 # FLAT / GLOBAL (gfx940)
64B 7 0 26 6 0x37 # encoding
65D 7 0 0 0 13 # offset
66D 7 1 0 13 1 # sve
67D 7 2 0 14 2 # seg (2 = global)
68D 7 3 0 16 1 # sc0
69D 7 4 0 17 1 # nt
70D 7 5 0 18 7 # op
71D 7 6 0 25 1 # sc1
72D 7 7 1 0 8 # vaddr
73D 7 8 1 8 8 # vdata
74D 7 9 1 16 7 # saddr
75D 7 10 1 23 1 # acc
76D 7 11 1 24 8 # vdst
77
78F 8 1 # VOP1 (e32)
79B 8 0 25 7 0x3f # encoding
80D 8 0 0 0 9 # src0
81D 8 1 0 9 8 # op
82D 8 2 0 17 8 # vdst
83
84# vadd: c[gid] = a[gid] + b[gid] for gid < count (kernarg a @0, b @8, c @16, count @24)
85I 1 0 4 0 1 2 0 # s_load_dwordx4 s[4:7], s[0:1], 0x0 op 0x02
86I 1 0 8 0 1 1 16 # s_load_dwordx2 s[8:9], s[0:1], 0x10 op 0x01
87I 1 0 10 0 1 0 24 # s_load_dword s10, s[0:1], 0x18 op 0x00
88I 5 255 0 0 0x13 # v_and_b32_e32 v0, 0x3ff, v0 op 0x13
89L 0x3ff
90I 2 2 134 11 0x1c # s_lshl_b32 s11, s2, 6 op 0x1c
91I 5 11 0 1 0x34 # v_add_u32_e32 v1, s11, v0 op 0x34 (gfx9)
92I 4 0xc07f 0x0c # s_waitcnt lgkmcnt(0) op 0x0c
93I 6 10 1 0xcc # v_cmp_gt_u32_e32 vcc, s10, v1 op 0xcc
94I 3 106 0x20 12 # s_and_saveexec_b64 s[12:13], vcc op 0x20
95I 4 @1 0x08 # s_cbranch_execz label 1 op 0x08
96I 5 130 1 2 0x12 # v_lshlrev_b32_e32 v2, 2, v1 op 0x12
97I 5 158 1 3 0x10 # v_lshrrev_b32_e32 v3, 30, v1
98I 8 5 1 5 # v_mov_b32_e32 v5, s5
99I 5 4 2 6 0x19 # v_add_co_u32_e32 v6, vcc, s4, v2
100I 5 261 3 7 0x1c # v_addc_co_u32_e32 v7, vcc, v5, v3, vcc
101I 7 0 0 2 0 0 0x14 0 6 0 127 0 4 # global_load_dword v4, v[6:7], off
102I 8 7 1 5 # v_mov_b32_e32 v5, s7
103I 5 6 2 6 0x19 # v_add_co_u32_e32 v6, vcc, s6, v2
104I 5 261 3 7 0x1c # v_addc_co_u32_e32 v7, vcc, v5, v3, vcc
105I 7 0 0 2 0 0 0x14 0 6 0 127 0 8 # global_load_dword v8, v[6:7], off
106I 4 0x0f70 0x0c # s_waitcnt vmcnt(0)
107I 5 261 8 4 0x01 # v_add_f32_e32 v4, v4, v8
108I 8 9 1 5 # v_mov_b32_e32 v5, s9
109I 5 8 2 6 0x19 # v_add_co_u32_e32 v6, vcc, s8, v2
110I 5 261 3 7 0x1c # v_addc_co_u32_e32 v7, vcc, v5, v3, vcc
111I 7 0 0 2 0 0 0x1c 0 6 4 127 0 0 # global_store_dword v[6:7], v4, off
112T 1
113I 4 0 0x01 # s_endpgm op 0x01