mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
AMDHSA: Put old assembler docs back
Until we switch to code object v3 by default. Follow up for https://reviews.llvm.org/D47736. Differential Revision: https://reviews.llvm.org/D48497 llvm-svn: 335378
This commit is contained in:
parent
e75ab22b2d
commit
16061dcfd6
@ -4303,8 +4303,103 @@ VOP_SDWA examples:
|
||||
|
||||
For full list of supported instructions, refer to "Vector ALU instructions".
|
||||
|
||||
Predefined Symbols
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
.. TODO
|
||||
Remove once we switch to code object v3 by default.
|
||||
|
||||
HSA Code Object Directives
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
AMDGPU ABI defines auxiliary data in output code object. In assembly source,
|
||||
one can specify them with assembler directives.
|
||||
|
||||
.hsa_code_object_version major, minor
|
||||
+++++++++++++++++++++++++++++++++++++
|
||||
|
||||
*major* and *minor* are integers that specify the version of the HSA code
|
||||
object that will be generated by the assembler.
|
||||
|
||||
.hsa_code_object_isa [major, minor, stepping, vendor, arch]
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
|
||||
*major*, *minor*, and *stepping* are all integers that describe the instruction
|
||||
set architecture (ISA) version of the assembly program.
|
||||
|
||||
*vendor* and *arch* are quoted strings. *vendor* should always be equal to
|
||||
"AMD" and *arch* should always be equal to "AMDGPU".
|
||||
|
||||
By default, the assembler will derive the ISA version, *vendor*, and *arch*
|
||||
from the value of the -mcpu option that is passed to the assembler.
|
||||
|
||||
.amdgpu_hsa_kernel (name)
|
||||
+++++++++++++++++++++++++
|
||||
|
||||
This directives specifies that the symbol with given name is a kernel entry point
|
||||
(label) and the object should contain corresponding symbol of type STT_AMDGPU_HSA_KERNEL.
|
||||
|
||||
.amd_kernel_code_t
|
||||
++++++++++++++++++
|
||||
|
||||
This directive marks the beginning of a list of key / value pairs that are used
|
||||
to specify the amd_kernel_code_t object that will be emitted by the assembler.
|
||||
The list must be terminated by the *.end_amd_kernel_code_t* directive. For
|
||||
any amd_kernel_code_t values that are unspecified a default value will be
|
||||
used. The default value for all keys is 0, with the following exceptions:
|
||||
|
||||
- *kernel_code_version_major* defaults to 1.
|
||||
- *machine_kind* defaults to 1.
|
||||
- *machine_version_major*, *machine_version_minor*, and
|
||||
*machine_version_stepping* are derived from the value of the -mcpu option
|
||||
that is passed to the assembler.
|
||||
- *kernel_code_entry_byte_offset* defaults to 256.
|
||||
- *wavefront_size* defaults to 6.
|
||||
- *kernarg_segment_alignment*, *group_segment_alignment*, and
|
||||
*private_segment_alignment* default to 4. Note that alignments are specified
|
||||
as a power of two, so a value of **n** means an alignment of 2^ **n**.
|
||||
|
||||
The *.amd_kernel_code_t* directive must be placed immediately after the
|
||||
function label and before any instructions.
|
||||
|
||||
For a full list of amd_kernel_code_t keys, refer to AMDGPU ABI document,
|
||||
comments in lib/Target/AMDGPU/AmdKernelCodeT.h and test/CodeGen/AMDGPU/hsa.s.
|
||||
|
||||
Here is an example of a minimal amd_kernel_code_t specification:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
.hsa_code_object_version 1,0
|
||||
.hsa_code_object_isa
|
||||
|
||||
.hsatext
|
||||
.globl hello_world
|
||||
.p2align 8
|
||||
.amdgpu_hsa_kernel hello_world
|
||||
|
||||
hello_world:
|
||||
|
||||
.amd_kernel_code_t
|
||||
enable_sgpr_kernarg_segment_ptr = 1
|
||||
is_ptr64 = 1
|
||||
compute_pgm_rsrc1_vgprs = 0
|
||||
compute_pgm_rsrc1_sgprs = 0
|
||||
compute_pgm_rsrc2_user_sgpr = 2
|
||||
kernarg_segment_byte_size = 8
|
||||
wavefront_sgpr_count = 2
|
||||
workitem_vgpr_count = 3
|
||||
.end_amd_kernel_code_t
|
||||
|
||||
s_load_dwordx2 s[0:1], s[0:1] 0x0
|
||||
v_mov_b32 v0, 3.14159
|
||||
s_waitcnt lgkmcnt(0)
|
||||
v_mov_b32 v1, s0
|
||||
v_mov_b32 v2, s1
|
||||
flat_store_dword v[1:2], v0
|
||||
s_endpgm
|
||||
.Lfunc_end0:
|
||||
.size hello_world, .Lfunc_end0-hello_world
|
||||
|
||||
Predefined Symbols (-mattr=+code-object-v3)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The AMDGPU assembler defines and updates some symbols automatically. These
|
||||
symbols do not affect code generation.
|
||||
@ -4343,8 +4438,8 @@ May be used to set the `.amdhsa_next_free_spgr` directive in
|
||||
|
||||
May be set at any time, e.g. manually set to zero at the start of each kernel.
|
||||
|
||||
Code Object Directives
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
Code Object Directives (-mattr=+code-object-v3)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Directives which begin with ``.amdgcn`` are valid for all ``amdgcn``
|
||||
architecture processors, and are not OS-specific. Directives which begin with
|
||||
@ -4473,8 +4568,8 @@ terminated by an ``.end_amdhsa_kernel`` directive.
|
||||
:ref:`amdgpu-amdhsa-compute_pgm_rsrc2-gfx6-gfx9-table`.
|
||||
======================================================== ================ ============ ===================
|
||||
|
||||
Example HSA Source Code
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Example HSA Source Code (-mattr=+code-object-v3)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Here is an example of a minimal assembly source file, defining one HSA kernel:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user