[llvm] r295745 - AMDGPU : AMDGPU : Update AMDGPU Trap Handler ABI.
Wei Ding via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 21 10:48:01 PST 2017
Author: wdng
Date: Tue Feb 21 12:48:01 2017
New Revision: 295745
URL: http://llvm.org/viewvc/llvm-project?rev=295745&view=rev
Log:
AMDGPU : AMDGPU : Update AMDGPU Trap Handler ABI.
Differential Revision: http://reviews.llvm.org/D29913
Modified:
llvm/trunk/docs/AMDGPUUsage.rst
Modified: llvm/trunk/docs/AMDGPUUsage.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/AMDGPUUsage.rst?rev=295745&r1=295744&r2=295745&view=diff
==============================================================================
--- llvm/trunk/docs/AMDGPUUsage.rst (original)
+++ llvm/trunk/docs/AMDGPUUsage.rst Tue Feb 21 12:48:01 2017
@@ -33,6 +33,55 @@ The AMDGPU back-end uses the following a
The terminology in the table, aside from the region memory space, is from the
OpenCL standard.
+Trap Handler ABI
+----------------
+The OS element of the target triple controls the trap handler behavior.
+
+HSA OS
+^^^^^^
+For code objects generated by AMDGPU back-end for the HSA OS, the runtime
+installs a trap handler that supports the s_trap instruction with the following
+usage:
+
+ +--------------+-------------+-------------------+----------------------------+
+ |Usage |Code Sequence|Trap Handler Inputs|Description |
+ +==============+=============+===================+============================+
+ |reserved |s_trap 0x00 | |Reserved by hardware. |
+ +--------------+-------------+-------------------+----------------------------+
+ |HSA debugtrap |s_trap 0x01 |SGPR0-1: queue_ptr |Reserved for HSA debugtrap |
+ |(arg) | |VGPR0: arg |intrinsic (not implemented).|
+ +--------------+-------------+-------------------+----------------------------+
+ |llvm.trap |s_trap 0x02 |SGPR0-1: queue_ptr |Causes dispatch to be |
+ | | | |terminated and its |
+ | | | |associated queue put into |
+ | | | |the error state. |
+ +--------------+-------------+-------------------+----------------------------+
+ |llvm.debugtrap| s_trap 0x03 |SGPR0-1: queue_ptr |If debugger not installed |
+ | | | |handled same as llvm.trap. |
+ +--------------+-------------+-------------------+----------------------------+
+ |debugger |s_trap 0x07 | |Reserved for debugger |
+ |breakpoint | | |breakpoints. |
+ +--------------+-------------+-------------------+----------------------------+
+ |debugger |s_trap 0x08 | |Reserved for debugger. |
+ +--------------+-------------+-------------------+----------------------------+
+ |debugger |s_trap 0xfe | |Reserved for debugger. |
+ +--------------+-------------+-------------------+----------------------------+
+ |debugger |s_trap 0xff | |Reserved for debugger. |
+ +--------------+-------------+-------------------+----------------------------+
+
+Non-HSA OS
+^^^^^^^^^^
+For code objects generated by AMDGPU back-end for non-HSA OS, the runtime does
+not install a trap handler. The llvm.trap and llvm.debugtrap instructions are
+handler as follows:
+
+ =============== ============= ===============================================
+ Usage Code Sequence Description
+ =============== ============= ===============================================
+ llvm.trap s_endpgm Causes wavefront to be terminated.
+ llvm.debugtrap s_nop No operation. Compiler warning generated that
+ there is no trap handler installed.
+ =============== ============= ===============================================
Assembler
=========
@@ -261,47 +310,6 @@ VOP_SDWA examples:
For full list of supported instructions, refer to "Vector ALU instructions".
-Trap Handler ABI
-----------------
-The Trap Handler suppored is implemented differently based on the host OS. OS
-is obtained from the appropriate element of the target triple HSA OS:
-
-.. code-block:: c++
-
- enum TrapHandlerAbi {
- TrapHandlerAbiNone = 0,
- TrapHandlerAbiHsa = 1
- };
-
- TrapHandlerAbi getTrapHandlerAbi() const {
- return isAmdHsaOS() ? TrapHandlerAbiHsa : TrapHandlerAbiNone;
- }
-
-For HSA OS, a trap handler is always enabled and that the following S_TRAP immediate
-operand codes are supported:
-
-.. code-block:: c++
-
- enum TrapCode {
- TrapCodeBreakPoint = 0,
- TrapCodeLLVMTrap = 1,
- TrapCodeLLVMDebugTrap = 2,
- TrapCodeHSADebugTrap = 3
- };
-
-- 0: Used for debugger breakpoint. If debugger is not installed causes dispatch
- to be terminated and its associated queue put into the error state.
-- 1: Used for llvm.trap..queue_ptr is in SGPR0-1. Causes dispatch to be
- terminated and its associated queue put into the error state.
-- 2: Used for llvm.debugtrap. queue_ptr is in SGPR0-1. If debugger not installed
- handled same as llvm.trap.
-- 3: Used for HSA DEBUGTRAP. queue_ptr is in SGPR0-1, the user code is in VGPR0.
-
-Graphics
-^^^^^^^^
-For Graphics, S_ENDPGM is generated for llvm.trap. S_NOP is generated for
-llvm.debugtrap together with a warning that there is no trap handler installed.
-
HSA Code Object Directives
--------------------------
More information about the llvm-commits
mailing list