一键导入
libcudacxx-style
Make the code in libcudacxx/include, cudax/include compliant with the coding style
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Make the code in libcudacxx/include, cudax/include compliant with the coding style
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | libcudacxx-style |
| description | Make the code in libcudacxx/include, cudax/include compliant with the coding style |
MY_MACRO.MyParameter.my_variable.All non-public symbols must be C++ reserved identifiers:
_ for macros and template parameters, e.g. _MY_MACRO., _MyParameter.
__ for all other symbols, e.g. __my_variable.
Avoid single letter names for template parameters. Wrong: _T, correct: _Tp.
const. This includes variables initialized by casts (static_cast, reinterpret_cast, bit_cast), function return values, and loop-invariant computations.constexpr.int values[4] instead of int value[4].Declaration/Definition:
_CCCL_HOST_API, _CCCL_DEVICE_API, or _CCCL_API.constexpr functions must use inline.[[nodiscard]]. Exceptions are functions with known side effects, e.g. cuda::std::copynoexceptconstexpr must be used for all functions that don't depend on run-time features, e.g. pointers.auto), then a trailing return type is strongly preferred, e.g. auto abs(float) -> floatFunction call:
::cuda::ceil_div. This includes calls to functions defined in the same namespace, e.g. inside cuda::, call ::cuda::ceil_div(...), not ceil_div(...). This does not apply to (static) member functions of classes.::cuda::std::size_t, ::cuda::std::uintptr_t, ::cuda::std::int32_t, etc.) and any other cuda::std or standard library types. A local using declaration (e.g. using ::cuda::std::size_t;) is acceptable to avoid repetition within a function body.All header inclusions must use the syntax <header>.
Files must include all headers related to the symbols that they are using.
No transitive header inclusion are allowed.
Unneeded headers must be removed.
The headers must be the most precise one, e.g. #include <cuda/std/__type_traits/is_array.h>.
Headers in cuda/std/__cccl/ must not be included directly (they are provided by __config or the prologue/epilogue mechanism).
All headers must have the correct license. If the file is ported from LLVM libc++ then we must use the LLVM license.
All headers must have the include guard, with the correct name: uppercase full path from the root, separated by _.
The closing #endif always carries a comment repeating the guard name.
Right after the include guard, the code must include:
#include <cuda/std/detail/__config>
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
# pragma GCC system_header
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
# pragma clang system_header
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
# pragma system_header
#endif // no system header
#include <cuda/std/__cccl/prologue.h> before the code, and #include <cuda/std/__cccl/epilogue.h> at the end of a file.//! @brief comments.//! @brief, //! @param[in/out/in,out] for every parameter, and //! @return for non-void functions.@brief/@param/@return description must accurately reflect the current functionality of the function.cuda/ or cuda/std functionalities as much as possible, including macros.#if !_CCCL_COMPILER(NVRTC).cuda::std::is_unsigned_v<T> ? false : (var < 0) instead.