Skip to content

Commit 434b278

Browse files
committed
[AMDGPU][MC][NFC][DOC] Updated AMD GPU assembler syntax description.
Summary of changes: - added description of GFX90A; - minor bugfixing and improvements.
1 parent 7cd2833 commit 434b278

File tree

120 files changed

+4409
-41
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+4409
-41
lines changed

llvm/docs/AMDGPU/AMDGPUAsmGFX90a.rst

+2,103
Large diffs are not rendered by default.

llvm/docs/AMDGPU/gfx10_offset_smem_buf.rst

+2-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@
1010
soffset
1111
===========================
1212

13-
An unsigned byte offset added to the base address to get memory address.
14-
15-
.. WARNING:: Assembler currently supports 20-bit offsets only. Use :ref:`uimm20<amdgpu_synid_uimm20>` instead of :ref:`uimm21<amdgpu_synid_uimm21>`.
13+
An unsigned 20-bit offset added to the base address to get memory address.
1614

1715
*Size:* 1 dword.
1816

19-
*Operands:* :ref:`s<amdgpu_synid_s>`, :ref:`vcc<amdgpu_synid_vcc>`, :ref:`ttmp<amdgpu_synid_ttmp>`, :ref:`null<amdgpu_synid_null>`, :ref:`m0<amdgpu_synid_m0>`, :ref:`uimm21<amdgpu_synid_uimm21>`
17+
*Operands:* :ref:`s<amdgpu_synid_s>`, :ref:`vcc<amdgpu_synid_vcc>`, :ref:`ttmp<amdgpu_synid_ttmp>`, :ref:`null<amdgpu_synid_null>`, :ref:`m0<amdgpu_synid_m0>`, :ref:`uimm20<amdgpu_synid_uimm20>`

llvm/docs/AMDGPU/gfx10_offset_smem_plain.rst

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ An offset added to the base address to get memory address.
1515
* If offset is specified as a register, it supplies an unsigned byte offset.
1616
* If offset is specified as a 21-bit immediate, it supplies a signed byte offset.
1717

18-
.. WARNING:: Assembler currently supports 20-bit unsigned offsets only. Use :ref:`uimm20<amdgpu_synid_uimm20>` instead of :ref:`simm21<amdgpu_synid_simm21>`.
19-
2018
*Size:* 1 dword.
2119

2220
*Operands:* :ref:`s<amdgpu_synid_s>`, :ref:`vcc<amdgpu_synid_vcc>`, :ref:`ttmp<amdgpu_synid_ttmp>`, :ref:`null<amdgpu_synid_null>`, :ref:`m0<amdgpu_synid_m0>`, :ref:`simm21<amdgpu_synid_simm21>`

llvm/docs/AMDGPU/gfx90a_dst.rst

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
..
2+
**************************************************
3+
* *
4+
* Automatically generated file, do not edit! *
5+
* *
6+
**************************************************
7+
8+
.. _amdgpu_synid_gfx90a_dst:
9+
10+
dst
11+
===
12+
13+
This is an input operand. It may optionally serve as a destination if :ref:`glc<amdgpu_synid_glc>` is specified.
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
..
2+
**************************************************
3+
* *
4+
* Automatically generated file, do not edit! *
5+
* *
6+
**************************************************
7+
8+
.. _amdgpu_synid_gfx90a_fx_operand:
9+
10+
FX Operand
11+
==========
12+
13+
This is an *f32* or *f16* operand depending on instruction modifiers:
14+
15+
* Operand size is controlled by :ref:`m_op_sel_hi<amdgpu_synid_mad_mix_op_sel_hi>`.
16+
* Location of 16-bit operand is controlled by :ref:`m_op_sel<amdgpu_synid_mad_mix_op_sel>`.

llvm/docs/AMDGPU/gfx90a_hwreg.rst

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
..
2+
**************************************************
3+
* *
4+
* Automatically generated file, do not edit! *
5+
* *
6+
**************************************************
7+
8+
.. _amdgpu_synid_gfx90a_hwreg:
9+
10+
hwreg
11+
=====
12+
13+
Bits of a hardware register being accessed.
14+
15+
The bits of this operand have the following meaning:
16+
17+
======= ===================== ============
18+
Bits Description Value Range
19+
======= ===================== ============
20+
5:0 Register *id*. 0..63
21+
10:6 First bit *offset*. 0..31
22+
15:11 *Size* in bits. 1..32
23+
======= ===================== ============
24+
25+
This operand may be specified as one of the following:
26+
27+
* An :ref:`integer_number<amdgpu_synid_integer_number>` or an :ref:`absolute_expression<amdgpu_synid_absolute_expression>`. The value must be in the range 0..0xFFFF.
28+
* An *hwreg* value described below.
29+
30+
==================================== ============================================================================
31+
Hwreg Value Syntax Description
32+
==================================== ============================================================================
33+
hwreg({0..63}) All bits of a register indicated by its *id*.
34+
hwreg(<*name*>) All bits of a register indicated by its *name*.
35+
hwreg({0..63}, {0..31}, {1..32}) Register bits indicated by register *id*, first bit *offset* and *size*.
36+
hwreg(<*name*>, {0..31}, {1..32}) Register bits indicated by register *name*, first bit *offset* and *size*.
37+
==================================== ============================================================================
38+
39+
Numeric values may be specified as positive :ref:`integer numbers<amdgpu_synid_integer_number>`
40+
or :ref:`absolute expressions<amdgpu_synid_absolute_expression>`.
41+
42+
Defined register *names* include:
43+
44+
=================== ==========================================
45+
Name Description
46+
=================== ==========================================
47+
HW_REG_MODE Shader writeable mode bits.
48+
HW_REG_STATUS Shader read-only status.
49+
HW_REG_TRAPSTS Trap status.
50+
HW_REG_HW_ID Id of wave, simd, compute unit, etc.
51+
HW_REG_GPR_ALLOC Per-wave SGPR and VGPR allocation.
52+
HW_REG_LDS_ALLOC Per-wave LDS allocation.
53+
HW_REG_IB_STS Counters of outstanding instructions.
54+
HW_REG_SH_MEM_BASES Memory aperture.
55+
=================== ==========================================
56+
57+
Examples:
58+
59+
.. parsed-literal::
60+
61+
reg = 1
62+
offset = 2
63+
size = 4
64+
hwreg_enc = reg | (offset << 6) | ((size - 1) << 11)
65+
66+
s_getreg_b32 s2, 0x1881
67+
s_getreg_b32 s2, hwreg_enc // the same as above
68+
s_getreg_b32 s2, hwreg(1, 2, 4) // the same as above
69+
s_getreg_b32 s2, hwreg(reg, offset, size) // the same as above
70+
71+
s_getreg_b32 s2, hwreg(15)
72+
s_getreg_b32 s2, hwreg(51, 1, 31)
73+
s_getreg_b32 s2, hwreg(HW_REG_LDS_ALLOC, 0, 1)

llvm/docs/AMDGPU/gfx90a_imask.rst

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
..
2+
**************************************************
3+
* *
4+
* Automatically generated file, do not edit! *
5+
* *
6+
**************************************************
7+
8+
.. _amdgpu_synid_gfx90a_imask:
9+
10+
imask
11+
=====
12+
13+
This operand is a mask which controls indexing mode for operands of subsequent instructions.
14+
Bits 0, 1 and 2 control indexing of *src0*, *src1* and *src2*, while bit 3 controls indexing of *dst*.
15+
Value 1 enables indexing and value 0 disables it.
16+
17+
===== ========================================
18+
Bit Meaning
19+
===== ========================================
20+
0 Enables or disables *src0* indexing.
21+
1 Enables or disables *src1* indexing.
22+
2 Enables or disables *src2* indexing.
23+
3 Enables or disables *dst* indexing.
24+
===== ========================================
25+
26+
This operand may be specified as one of the following:
27+
28+
* An :ref:`integer_number<amdgpu_synid_integer_number>` or an :ref:`absolute_expression<amdgpu_synid_absolute_expression>`. The value must be in the range 0..15.
29+
* A *gpr_idx* value described below.
30+
31+
==================================== ===========================================
32+
Gpr_idx Value Syntax Description
33+
==================================== ===========================================
34+
gpr_idx(*<operands>*) Enable indexing for specified *operands*
35+
and disable it for the rest.
36+
*Operands* is a comma-separated list of
37+
values which may include:
38+
39+
* "SRC0" - enable *src0* indexing.
40+
41+
* "SRC1" - enable *src1* indexing.
42+
43+
* "SRC2" - enable *src2* indexing.
44+
45+
* "DST" - enable *dst* indexing.
46+
47+
Each of these values may be specified only
48+
once.
49+
50+
*Operands* list may be empty; this syntax
51+
disables indexing for all operands.
52+
==================================== ===========================================
53+
54+
Examples:
55+
56+
.. parsed-literal::
57+
58+
s_set_gpr_idx_mode 0
59+
s_set_gpr_idx_mode gpr_idx() // the same as above
60+
61+
s_set_gpr_idx_mode 15
62+
s_set_gpr_idx_mode gpr_idx(DST,SRC0,SRC1,SRC2) // the same as above
63+
s_set_gpr_idx_mode gpr_idx(SRC0,SRC1,SRC2,DST) // the same as above
64+
65+
s_set_gpr_idx_mode gpr_idx(DST,SRC1)

llvm/docs/AMDGPU/gfx90a_imm16.rst

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
..
2+
**************************************************
3+
* *
4+
* Automatically generated file, do not edit! *
5+
* *
6+
**************************************************
7+
8+
.. _amdgpu_synid_gfx90a_imm16:
9+
10+
imm16
11+
=====
12+
13+
An :ref:`integer_number<amdgpu_synid_integer_number>` or an :ref:`absolute_expression<amdgpu_synid_absolute_expression>`. The value must be in the range -32768..65535.

llvm/docs/AMDGPU/gfx90a_imm16_1.rst

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
..
2+
**************************************************
3+
* *
4+
* Automatically generated file, do not edit! *
5+
* *
6+
**************************************************
7+
8+
.. _amdgpu_synid_gfx90a_imm16_1:
9+
10+
imm16
11+
=====
12+
13+
An :ref:`integer_number<amdgpu_synid_integer_number>` or an :ref:`absolute_expression<amdgpu_synid_absolute_expression>`. The value must be in the range 0..65535.

llvm/docs/AMDGPU/gfx90a_imm16_2.rst

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
..
2+
**************************************************
3+
* *
4+
* Automatically generated file, do not edit! *
5+
* *
6+
**************************************************
7+
8+
.. _amdgpu_synid_gfx90a_imm16_2:
9+
10+
imm16
11+
=====
12+
13+
A 16-bit :ref:`integer_number<amdgpu_synid_integer_number>` or an :ref:`absolute_expression<amdgpu_synid_absolute_expression>`. The value must be in the range -32768..65535.

llvm/docs/AMDGPU/gfx90a_label.rst

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
..
2+
**************************************************
3+
* *
4+
* Automatically generated file, do not edit! *
5+
* *
6+
**************************************************
7+
8+
.. _amdgpu_synid_gfx90a_label:
9+
10+
label
11+
=====
12+
13+
A branch target which is a 16-bit signed integer treated as a PC-relative dword offset.
14+
15+
This operand may be specified as one of the following:
16+
17+
* An :ref:`integer_number<amdgpu_synid_integer_number>` or an :ref:`absolute_expression<amdgpu_synid_absolute_expression>`. The value must be in the range -32768..65535.
18+
* A :ref:`symbol<amdgpu_synid_symbol>` (for example, a label) representing a relocatable address in the same compilation unit where it is referred from. The value is handled as a 16-bit PC-relative dword offset to be resolved by a linker.
19+
20+
Examples:
21+
22+
.. parsed-literal::
23+
24+
offset = 30
25+
label_1:
26+
label_2 = . + 4
27+
28+
s_branch 32
29+
s_branch offset + 2
30+
s_branch label_1
31+
s_branch label_2
32+
s_branch label_3
33+
s_branch label_4
34+
35+
label_3 = label_2 + 4
36+
label_4:

llvm/docs/AMDGPU/gfx90a_m.rst

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
..
2+
**************************************************
3+
* *
4+
* Automatically generated file, do not edit! *
5+
* *
6+
**************************************************
7+
8+
.. _amdgpu_synid_gfx90a_m:
9+
10+
m
11+
=
12+
13+
This operand may be used with integer operand modifier :ref:`sext<amdgpu_synid_sext>`.

llvm/docs/AMDGPU/gfx90a_m_1.rst

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
..
2+
**************************************************
3+
* *
4+
* Automatically generated file, do not edit! *
5+
* *
6+
**************************************************
7+
8+
.. _amdgpu_synid_gfx90a_m_1:
9+
10+
m
11+
=
12+
13+
This operand may be used with floating point operand modifiers :ref:`abs<amdgpu_synid_abs>` and :ref:`neg<amdgpu_synid_neg>`.

llvm/docs/AMDGPU/gfx90a_msg.rst

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
..
2+
**************************************************
3+
* *
4+
* Automatically generated file, do not edit! *
5+
* *
6+
**************************************************
7+
8+
.. _amdgpu_synid_gfx90a_msg:
9+
10+
msg
11+
===
12+
13+
A 16-bit message code. The bits of this operand have the following meaning:
14+
15+
============ =============================== ===============
16+
Bits Description Value Range
17+
============ =============================== ===============
18+
3:0 Message *type*. 0..15
19+
6:4 Optional *operation*. 0..7
20+
7:7 Unused. \-
21+
9:8 Optional *stream*. 0..3
22+
15:10 Unused. \-
23+
============ =============================== ===============
24+
25+
This operand may be specified as one of the following:
26+
27+
* An :ref:`integer_number<amdgpu_synid_integer_number>` or an :ref:`absolute_expression<amdgpu_synid_absolute_expression>`. The value must be in the range 0..0xFFFF.
28+
* A *sendmsg* value described below.
29+
30+
==================================== ====================================================
31+
Sendmsg Value Syntax Description
32+
==================================== ====================================================
33+
sendmsg(<*type*>) A message identified by its *type*.
34+
sendmsg(<*type*>,<*op*>) A message identified by its *type* and *operation*.
35+
sendmsg(<*type*>,<*op*>,<*stream*>) A message identified by its *type* and *operation*
36+
with a stream *id*.
37+
==================================== ====================================================
38+
39+
*Type* may be specified using message *name* or message *id*.
40+
41+
*Op* may be specified using operation *name* or operation *id*.
42+
43+
Stream *id* is an integer in the range 0..3.
44+
45+
Numeric values may be specified as positive :ref:`integer numbers<amdgpu_synid_integer_number>`
46+
or :ref:`absolute expressions<amdgpu_synid_absolute_expression>`.
47+
48+
Each message type supports specific operations:
49+
50+
================= ========== ============================== ============ ==========
51+
Message name Message Id Supported Operations Operation Id Stream Id
52+
================= ========== ============================== ============ ==========
53+
MSG_INTERRUPT 1 \- \- \-
54+
MSG_GS 2 GS_OP_CUT 1 Optional
55+
\ GS_OP_EMIT 2 Optional
56+
\ GS_OP_EMIT_CUT 3 Optional
57+
MSG_GS_DONE 3 GS_OP_NOP 0 \-
58+
\ GS_OP_CUT 1 Optional
59+
\ GS_OP_EMIT 2 Optional
60+
\ GS_OP_EMIT_CUT 3 Optional
61+
MSG_GS_ALLOC_REQ 9 \- \- \-
62+
MSG_GET_DOORBELL 10 \- \- \-
63+
MSG_SYSMSG 15 SYSMSG_OP_ECC_ERR_INTERRUPT 1 \-
64+
\ SYSMSG_OP_REG_RD 2 \-
65+
\ SYSMSG_OP_HOST_TRAP_ACK 3 \-
66+
\ SYSMSG_OP_TTRACE_PC 4 \-
67+
================= ========== ============================== ============ ==========
68+
69+
*Sendmsg* arguments are validated depending on how *type* value is specified:
70+
71+
* If message *type* is specified by name, arguments values must satisfy limitations detailed in the table above.
72+
* If message *type* is specified as a number, each argument must not exceed corresponding value range (see the first table).
73+
74+
Examples:
75+
76+
.. parsed-literal::
77+
78+
// numeric message code
79+
msg = 0x10
80+
s_sendmsg 0x12
81+
s_sendmsg msg + 2
82+
83+
// sendmsg with strict arguments validation
84+
s_sendmsg sendmsg(MSG_INTERRUPT)
85+
s_sendmsg sendmsg(MSG_GS, GS_OP_EMIT)
86+
s_sendmsg sendmsg(MSG_GS, 2)
87+
s_sendmsg sendmsg(MSG_GS_DONE, GS_OP_EMIT_CUT, 1)
88+
s_sendmsg sendmsg(MSG_SYSMSG, SYSMSG_OP_TTRACE_PC)
89+
s_sendmsg sendmsg(MSG_GET_DOORBELL)
90+
91+
// sendmsg with validation of value range only
92+
msg = 2
93+
op = 3
94+
stream = 1
95+
s_sendmsg sendmsg(msg, op, stream)
96+
s_sendmsg sendmsg(2, GS_OP_CUT)

0 commit comments

Comments
 (0)