Skip to content

Commit cdd94ad

Browse files
authored
A few improvements for internal macro documentation (#3554)
* add MVSV 2017 deprecation * add ARM64 emulation note * Add behavior of NVRTC with OS macros * add FP8 identification macro
1 parent 81b1af6 commit cdd94ad

File tree

2 files changed

+65
-50
lines changed

2 files changed

+65
-50
lines changed

docs/cccl_development/macro.rst

Lines changed: 64 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@ Compiler Macros
1212

1313
**Host compiler macros**:
1414

15-
+------------------------------+--------------------------------+
16-
| ``_CCCL_COMPILER(CLANG)`` | Clang |
17-
+------------------------------+--------------------------------+
18-
| ``_CCCL_COMPILER(GCC)`` | GCC |
19-
+------------------------------+--------------------------------+
20-
| ``_CCCL_COMPILER(NVHPC)`` | Nvidia HPC compiler |
21-
+------------------------------+--------------------------------+
22-
| ``_CCCL_COMPILER(MSVC)`` | Microsoft Visual Studio |
23-
+------------------------------+--------------------------------+
24-
| ``_CCCL_COMPILER(MSVC2017)`` | Microsoft Visual Studio 2017 |
25-
+------------------------------+--------------------------------+
26-
| ``_CCCL_COMPILER(MSVC2019)`` | Microsoft Visual Studio 2019 |
27-
+------------------------------+--------------------------------+
28-
| ``_CCCL_COMPILER(MSVC2022)`` | Microsoft Visual Studio 2022 |
29-
+------------------------------+--------------------------------+
15+
+------------------------------+---------------------------------------------+
16+
| ``_CCCL_COMPILER(CLANG)`` | Clang |
17+
+------------------------------+---------------------------------------------+
18+
| ``_CCCL_COMPILER(GCC)`` | GCC |
19+
+------------------------------+---------------------------------------------+
20+
| ``_CCCL_COMPILER(NVHPC)`` | Nvidia HPC compiler |
21+
+------------------------------+---------------------------------------------+
22+
| ``_CCCL_COMPILER(MSVC)`` | Microsoft Visual Studio |
23+
+------------------------------+---------------------------------------------+
24+
| ``_CCCL_COMPILER(MSVC2017)`` | Microsoft Visual Studio 2017 (deprecated) |
25+
+------------------------------+---------------------------------------------+
26+
| ``_CCCL_COMPILER(MSVC2019)`` | Microsoft Visual Studio 2019 |
27+
+------------------------------+---------------------------------------------+
28+
| ``_CCCL_COMPILER(MSVC2022)`` | Microsoft Visual Studio 2022 |
29+
+------------------------------+---------------------------------------------+
3030

3131
The ``_CCCL_COMPILER`` function-like macro can also be used to check the version of a compiler.
3232

@@ -68,11 +68,11 @@ The ``_CCCL_CUDA_COMPILER`` function-like macro can also be used to check the ve
6868

6969
**PTX macros**:
7070

71-
+-------------------------+-------------------------------------------------------------------------------------------------------------------+
72-
| ``_CCCL_PTX_ARCH`` | Alias of ``__CUDA_ARCH__`` with value equal to 0 if cuda compiler is not available |
73-
+-------------------------+-------------------------------------------------------------------------------------------------------------------+
74-
| ``__cccl_ptx_isa`` | PTX ISA version available with the current CUDA compiler, e.g. PTX ISA 8.4 (``840``) is available from CUDA 12.4 |
75-
+-------------------------+-------------------------------------------------------------------------------------------------------------------+
71+
+--------------------+-------------------------------------------------------------------------------------------------------------------+
72+
| ``_CCCL_PTX_ARCH`` | Alias of ``__CUDA_ARCH__`` with value equal to 0 if cuda compiler is not available |
73+
+--------------------+-------------------------------------------------------------------------------------------------------------------+
74+
| ``__cccl_ptx_isa`` | PTX ISA version available with the current CUDA compiler, e.g. PTX ISA 8.4 (``840``) is available from CUDA 12.4 |
75+
+--------------------+-------------------------------------------------------------------------------------------------------------------+
7676

7777
----
7878

@@ -81,26 +81,26 @@ Architecture Macros
8181

8282
The following macros are used to check the target architecture. They comply with the compiler supported by the CUDA toolkit. Compilers outside the CUDA toolkit may define such macros in a different way.
8383

84-
+-------------------------+-------------------------------------+
85-
| ``_CCCL_ARCH(ARM64)`` | ARM 64-bit |
86-
+-------------------------+-------------------------------------+
87-
| ``_CCCL_ARCH(X86_64)`` | X86 64-bit |
88-
+-------------------------+-------------------------------------+
84+
+-------------------------+---------------------------------------------------+
85+
| ``_CCCL_ARCH(ARM64)`` | ARM 64-bit, including MSVC emulation |
86+
+-------------------------+---------------------------------------------------+
87+
| ``_CCCL_ARCH(X86_64)`` | X86 64-bit. False on ARM 64-bit MSVC emulation |
88+
+-------------------------+---------------------------------------------------+
8989

9090
----
9191

9292
OS Macros
9393
---------
9494

95-
+-----------------------+---------+
96-
| ``_CCCL_OS(WINDOWS)`` | Windows |
97-
+-----------------------+---------+
98-
| ``_CCCL_OS(LINUX)`` | Linux |
99-
+-----------------------+---------+
100-
| ``_CCCL_OS(ANDROID)`` | Android |
101-
+-----------------------+---------+
102-
| ``_CCCL_OS(QNX)`` | QNX |
103-
+-----------------------+---------+
95+
+-----------------------+---------------------------------+
96+
| ``_CCCL_OS(WINDOWS)`` | Windows, including NVRTC LLP64 |
97+
+-----------------------+---------------------------------+
98+
| ``_CCCL_OS(LINUX)`` | Linux, including NVRTC LP64 |
99+
+-----------------------+---------------------------------+
100+
| ``_CCCL_OS(ANDROID)`` | Android |
101+
+-----------------------+---------------------------------+
102+
| ``_CCCL_OS(QNX)`` | QNX |
103+
+-----------------------+---------------------------------+
104104

105105
----
106106

@@ -131,6 +131,8 @@ In addition, ``_CCCL_EXEC_CHECK_DISABLE`` disables the execution space check for
131131

132132
Possible ``TARGET`` values:
133133

134+
+---------------------------+-------------------------------------------------------------------+
135+
| ``NV_ANY_TARGET`` | Any target |
134136
+---------------------------+-------------------------------------------------------------------+
135137
| ``NV_IS_HOST`` | Host-code target |
136138
+---------------------------+-------------------------------------------------------------------+
@@ -159,30 +161,41 @@ Usage example:
159161

160162
----
161163

162-
CUDA Extension Macros
163-
---------------------
164-
165-
**CUDA attributes**:
164+
CUDA attributes
165+
---------------
166166

167167
+------------------------------+----------------------------------------------------------+
168168
| ``_CCCL_GRID_CONSTANT`` | Grid constant kernel parameter |
169169
+------------------------------+----------------------------------------------------------+
170170
| ``_CCCL_GLOBAL_CONSTANT`` | Host/device global scope constant (``inline constexpr``) |
171171
+------------------------------+----------------------------------------------------------+
172172

173-
**Extended floating-point types**:
173+
----
174174

175-
+------------------------------+-----------------------------------------------------------------------------------------------------------------+
176-
| ``_CCCL_HAS_NVFP16`` | `__half/__half2` data types are supported and enabled. Prefer over ``__CUDA_FP16_TYPES_EXIST__`` |
177-
+------------------------------+-----------------------------------------------------------------------------------------------------------------+
178-
| ``_CCCL_HAS_NVBF16`` | `__nv_bfloat16/__nv_bfloat162` data types are supported and enabled. Prefer over ``__CUDA_BF16_TYPES_EXIST__`` |
179-
+------------------------------+-----------------------------------------------------------------------------------------------------------------+
175+
Non-standard Types Support
176+
--------------------------
180177

181-
+------------------------------+----------------------------------------------------------------+
182-
| ``_LIBCUDACXX_HAS_NVFP16`` | `__half/__half2` host/device support (CUDA 12.2) |
183-
+------------------------------+----------------------------------------------------------------+
184-
| ``_LIBCUDACXX_HAS_NVBF16`` | `__nv_bfloat16/__nv_bfloat162` host/device support (CUDA 12.2) |
185-
+------------------------------+----------------------------------------------------------------+
178+
+------------------------------+-------------------------------------------------------------------------------------------------------------------------------+
179+
| ``_CCCL_HAS_INT128()`` | ``__int128`` and ``__uint128_t`` for 128-bit integer are supported and enabled |
180+
+------------------------------+-------------------------------------------------------------------------------------------------------------------------------+
181+
| ``_CCCL_HAS_FLOAT128()`` | ``__float128`` for 128-bit floating-point are supported and enabled |
182+
+------------------------------+-------------------------------------------------------------------------------------------------------------------------------+
183+
| ``_CCCL_HAS_NVFP16`` | ``__half/__half2`` data types are supported and enabled. Prefer over ``__CUDA_FP16_TYPES_EXIST__`` |
184+
+------------------------------+-------------------------------------------------------------------------------------------------------------------------------+
185+
| ``_CCCL_HAS_NVBF16`` | ``__nv_bfloat16/__nv_bfloat162`` data types are supported and enabled. Prefer over ``__CUDA_BF16_TYPES_EXIST__`` |
186+
+------------------------------+-------------------------------------------------------------------------------------------------------------------------------+
187+
| ``_CCCL_HAS_FP8()`` | ``__nv_fp8_e5m2/__nv_fp8_e4m3/__nv_fp8_e8m0`` data types are supported and enabled. Prefer over ``__CUDA_FP8_TYPES_EXIST__`` |
188+
+------------------------------+-------------------------------------------------------------------------------------------------------------------------------+
189+
190+
+------------------------------+-------------------------------------------------------------------------+
191+
| ``_CCCL_DISABLE_INT128`` | Disable ``__int128/__uint128_t`` support |
192+
+------------------------------+-------------------------------------------------------------------------+
193+
| ``_CCCL_DISABLE_FLOAT128`` | Disable ``__float128`` support |
194+
+------------------------------+-------------------------------------------------------------------------+
195+
| ``_LIBCUDACXX_HAS_NVFP16`` | ``__half/__half2`` host/device are supported (CUDA 12.2+) |
196+
+------------------------------+-------------------------------------------------------------------------+
197+
| ``_LIBCUDACXX_HAS_NVBF16`` | ``__nv_bfloat16/__nv_bfloat162`` host/device are supported (CUDA 12.2+) |
198+
+------------------------------+-------------------------------------------------------------------------+
186199

187200
----
188201

@@ -244,6 +257,8 @@ Usage example:
244257

245258
**Portable attributes**:
246259

260+
+----------------------------------+------------------------------------------------------------------------------+
261+
| ``_CCCL_ASSUME()`` | Portable ``[[assume]]`` attribute (before C++23) |
247262
+----------------------------------+------------------------------------------------------------------------------+
248263
| ``_CCCL_FALLTHROUGH()`` | Portable ``[[fallthrough]]`` attribute (before C++17) |
249264
+----------------------------------+------------------------------------------------------------------------------+

docs/cpp.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ CUDA C++ Core Libraries
1111
CUB <https://nvidia.github.io/cccl/cub/>
1212
Thrust <https://nvidia.github.io/cccl/thrust/>
1313
Cuda Experimental <https://nvidia.github.io/cccl/cudax/>
14-
CCCL development <cccl_development/index>
14+
CCCL Development <cccl_development/index>
1515

1616
Welcome to the CUDA Core Compute Libraries (CCCL) libraries for C++.
1717

0 commit comments

Comments
 (0)