-
Notifications
You must be signed in to change notification settings - Fork 359
CCCL Internal macro documentation #3238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
2b38c61
add main macro documentation
fbusato 0d1ca80
convert to rst
fbusato 7994f35
Update docs/cpp.rst
fbusato de8ddab
Update docs/cccl_development/macro.rst
fbusato 407c298
Update docs/cccl_development/macro.rst
fbusato d960a19
Update docs/cccl_development/macro.rst
fbusato a24940d
Update docs/cccl_development/macro.rst
fbusato 97f9146
Update docs/cccl_development/index.rst
fbusato ab12995
use tables instead of lists and fix suggetions
fbusato c056df4
add other relevant macros
fbusato f9d6012
Update docs/cccl_development/macro.rst
fbusato 6b19b96
Update docs/cccl_development/macro.rst
fbusato 946fe10
Update docs/cccl_development/macro.rst
fbusato 091673f
Update docs/cccl_development/macro.rst
fbusato a352d9d
Update docs/cccl_development/macro.rst
fbusato ef4a4d7
Update docs/cccl_development/macro.rst
fbusato e5cdb56
fix tables
fbusato File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| .. _cccl-development-module: | ||
|
|
||
| CCCL Development Guide | ||
| ====================== | ||
|
|
||
| .. toctree:: | ||
| :hidden: | ||
| :maxdepth: 1 | ||
|
|
||
| macro | ||
|
|
||
| This living document serves to describe the internal details and the development process of CCCL libraries. | ||
|
|
||
| Documentation: | ||
|
|
||
| - `CCCL Internal macro <https://nvidia.github.io/cccl/cccl_development/macro/>`__ | ||
fbusato marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| .. _cccl-macro: | ||
fbusato marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| CCCL Internal Macros | ||
| ==================== | ||
|
|
||
| The document describes the main *internal* macros used by CCCL. They are not intended to be used by end users. | ||
fbusato marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Compiler Macros | ||
| --------------- | ||
|
|
||
| **Host compiler macros**: | ||
|
|
||
| - ``_CCCL_COMPILER(MSVC)``: Microsoft Visual Studio | ||
| - ``_CCCL_COMPILER(CLANG)``: Clang | ||
| - ``_CCCL_COMPILER(GCC)``: GCC | ||
| - ``_CCCL_COMPILER(NVHPC)``: Nvidia HPC compiler | ||
|
|
||
| ``_CCCL_COMPILER`` function-like macro can also be used to check the version of a compiler. | ||
fbusato marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| .. code:: cpp | ||
|
|
||
| _CCCL_COMPILER(MSVC, <, 19, 24) | ||
| _CCCL_COMPILER(GCC, >=, 9) | ||
|
|
||
| *Pitfalls*: ``_CCCL_COMPILER(GCC, >, 9)`` matches GCC 9.x. | ||
fbusato marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| **CUDA compiler macros**: | ||
|
|
||
| - ``_CCCL_CUDA_COMPILER(NVCC)``: Nvidia compiler | ||
| - ``_CCCL_CUDA_COMPILER(NVHPC)``: Nvidia HPC compiler | ||
| - ``_CCCL_CUDA_COMPILER(NVRTC)``: Nvidia Runtime Compiler | ||
| - ``_CCCL_CUDA_COMPILER(CLANG)``: Clang | ||
fbusato marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| **CUDA identification/version macros**: | ||
|
|
||
| - ``_CCCL_HAS_CUDA_COMPILER``: CUDA compiler is available | ||
| - ``_CCCL_CUDACC_BELOW(12, 7)``: CUDA version below 12.7 | ||
| - ``_CCCL_CUDACC_AT_LEAST(12, 7)``: CUDA version at least 12.7 | ||
|
|
||
| Platform Macros | ||
| --------------- | ||
|
|
||
| - ``_CCCL_ARCH(ARM64)``: ARM 64-bit | ||
| - ``_CCCL_ARCH(X86)``: X86 both 32 and 64 bit | ||
| - ``_CCCL_ARCH(X86_64)``: X86 64-bit | ||
| - ``_CCCL_ARCH(X86_32)``: X86 64-bit | ||
| - ``_CCCL_ARCH(64BIT)``: Any 64-bit OS (supported by CUDA) | ||
| - ``_CCCL_ARCH(32BIT)``: Any 32-bit OS (supported by CUDA) | ||
|
|
||
| OS Macros | ||
| --------- | ||
|
|
||
| - ``_CCCL_OS(WINDOWS)``: Windows | ||
| - ``_CCCL_OS(LINUX)``: Linux | ||
| - ``_CCCL_OS(ANDROID)``: Android | ||
| - ``_CCCL_OS(QNX)``: QNX | ||
|
|
||
| Attribute Macros | ||
| ---------------- | ||
|
|
||
| - ``_CCCL_FALLTHROUGH()``: Portable `[[fallthrough]]` attribute | ||
| - ``_CCCL_NO_UNIQUE_ADDRESS``: Portable `[[no_unique_address]]` attribute | ||
| - ``_CCCL_NODISCARD``: Portable `[[nodiscard]]` attribute | ||
| - ``_CCCL_NODISCARD_FRIEND``: Portable `[[nodiscard]]` attribute for `friend` functions | ||
| - ``_CCCL_NORETURN``: Portable `[[noreturn]]` attribute | ||
| - ``_CCCL_RESTRICT``: Portable `restrict` keyword | ||
| - ``CCCL_DEPRECATED``: Portable `[[deprecated]]` attribute | ||
| - ``CCCL_DEPRECATED_BECAUSE(MSG)``: Portable `[[deprecated]]` attribute with custom message | ||
fbusato marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| CUDA Extension Macros | ||
| --------------------- | ||
|
|
||
| **Execution space**: | ||
|
|
||
| - ``_CCCL_HOST``: Host function | ||
| - ``_CCCL_DEVICE``: Device function | ||
| - ``_CCCL_HOST_DEVICE``: Host/Device function | ||
|
|
||
| **Other CUDA attributes**: | ||
|
|
||
| - ``_CCCL_GRID_CONSTANT``: Grid constant kernel parameter | ||
| - ``_CCCL_GLOBAL_CONSTANT``: Host/device global scope constant (inline constexpr) | ||
| - ``_CCCL_EXEC_CHECK_DISABLE``: Disable execution space check for the NVHPC compiler | ||
|
|
||
| C++ Language Macros | ||
| ------------------- | ||
|
|
||
| - ``_CCCL_STD_VER``: C++ standard version, e.g.`#if _CCCL_STD_VER >= 2017` | ||
| - ``_CCCL_IF_CONSTEXPR``: Portable `if constexpr` | ||
| - ``_CCCL_CONSTEXPR_CXX14``: Enable `constexpr` for C++14 | ||
| - ``_CCCL_CONSTEXPR_CXX17``: Enable `constexpr` for C++17 | ||
| - ``_CCCL_CONSTEXPR_CXX20``: Enable `constexpr` for C++20 | ||
| - ``_CCCL_CONSTEXPR_CXX23``: Enable `constexpr` for C++23 | ||
fbusato marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - ``_CCCL_INLINE_VAR``: Portable `inline constexpr` variable | ||
| - ``_CCCL_HAS_BUILTIN``: Portable `__has_builtin` | ||
| - ``_CCCL_HAS_FEATURE``: Portable `__has_feature` | ||
fbusato marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
fbusato marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Compiler Specific Macros | ||
| ------------------------ | ||
|
|
||
| - ``_CCCL_UNREACHABLE()``: Portable `__builtin_unreachable` | ||
|
|
||
| Libcu++ Specific Macros | ||
| ----------------------- | ||
|
|
||
| - ``_LIBCUDACXX_HIDE_FROM_ABI`` Host/device function with hidden visibility | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remark: Because the content of this developer guide is "living" I wondered whether it would be better to host it in the wiki instead of the public documentation. But maybe putting it in the source tree makes it more discoverable when we make source code changes, since the documentation appears when searching or grepping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a strong opinion on that. This not the only document that is "living". The content is common among all libraries, so the current position is also fine.