Index: clang/docs/AMDGPUSupport.rst =================================================================== --- /dev/null +++ clang/docs/AMDGPUSupport.rst @@ -0,0 +1,69 @@ +.. raw:: html + + + +.. role:: none +.. role:: part +.. role:: good + +.. contents:: + :local: + +============== +AMDGPU Support +============== + +Clang supports OpenCL, HIP and OpenMP on amdgpu target. + + +Predefined Macros +================= + +AMDGPU Predefined Macros +======================== + +.. list-table:: + :header-rows: 1 + + * - Macro + - Description + * - ``__AMD__`` + - Indicates that the code is being compiled for an AMD GPU. + * - ``__AMDGPU__`` + - Indicates that the code is being compiled for an AMD GPU. + * - ``__AMDGCN__`` + - Defined if the GPU target is AMDGCN. + * - ``__R600__`` + - Defined if the GPU target is R600. + * - ``____`` + - Defined with the name of the architecture (e.g., ``__gfx906__`` for the gfx906 architecture). + * - ``____`` + - Defines the GFX family (e.g., for gfx906, this macro would be ``__GFX9__``). + * - ``__amdgcn_processor__`` + - Defined with the processor name as a string (e.g., ``"gfx906"``). + * - ``__amdgcn_target_id__`` + - Defined with the target ID as a string. + * - ``__amdgcn_feature___`` + - Defined for each supported target feature. The value is 1 if the feature is enabled and 0 if it is disabled. Allowed feature names are sramecc and xnack. + * - ``__AMDGCN_UNSAFE_FP_ATOMICS__`` + - Defined if unsafe floating-point atomics are allowed. + * - ``__HAS_FMAF__`` + - Defined if FMAF instruction is available (deprecated). + * - ``FP_FAST_FMAF`` + - Defined if fast FMAF instruction is available. + * - ``__HAS_LDEXPF__`` + - Defined if LDEXPF instruction is available (deprecated). + * - ``__HAS_FP64__`` + - Defined if FP64 instruction is available (deprecated). + * - ``FP_FAST_FMA`` + - Defined if fast FMA instruction is available. + * - ``__AMDGCN_WAVEFRONT_SIZE`` + - Defines the wavefront size. Allowed values are 32 and 64. + * - ``__AMDGCN_CUMODE__`` + - Defines as 1 if the CU mode is enabled and 0 if the WGP mode is enabled. + +Please note that the specific architecture and feature names will vary depending on the GPU. Also, some macros are deprecated and may be removed in future releases.