Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

Add option to opt out CDP #586

Merged
merged 2 commits into from
Nov 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# https://clangd.llvm.org/config

# Apply a config conditionally to all C files
If:
PathMatch: .*\.(c|h)$

---

# Apply a config conditionally to all C++ files
If:
PathMatch: .*\.(c|h)pp

---

# Apply a config conditionally to all CUDA files
If:
PathMatch: .*\.cuh?
CompileFlags:
Add:
# Allow variadic CUDA functions
- "-Xclang=-fcuda-allow-variadic-functions"

---

# Tweak the clangd parse settings for all files
CompileFlags:
Compiler: clang++
CompilationDatabase: .
Add:
- -x
- cuda
# report all errors
- "-ferror-limit=0"
- "-ftemplate-backtrace-limit=0"
Remove:
- -stdpar
# strip CUDA fatbin args
- "-Xfatbin*"
- "-gpu=*"
- "--diag_suppress*"
# strip CUDA arch flags
- "-gencode*"
- "--generate-code*"
# strip gcc's -fcoroutines
- -fcoroutines
# strip CUDA flags unknown to clang
- "-ccbin*"
- "--compiler-options*"
- "--expt-extended-lambda"
- "--expt-relaxed-constexpr"
- "-forward-unknown-to-host-compiler"
- "-Werror=cross-execution-space-call"
Diagnostics:
Suppress:
- "variadic_device_fn"
- "attributes_not_allowed"
# The NVHPC version of _NVCXX_EXPAND_PACK macro triggers this clang error.
# Temporarily suppressing it, but should probably fix
- "template_param_shadow"
11 changes: 9 additions & 2 deletions cub/detail/detect_cuda_runtime.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,17 @@ namespace detail

#ifdef DOXYGEN_SHOULD_SKIP_THIS // Only parse this during doxygen passes:

/**
* \def CUB_DISABLE_CDP
*
* If defined, support for device-side usage of CUB is disabled.
*/
#define CUB_DISABLE_CDP

/**
* \def CUB_RDC_ENABLED
*
* Defined if RDC is enabled.
* Defined if RDC is enabled and CUB_DISABLE_CDP is not defined.
*/
#define CUB_RDC_ENABLED

Expand Down Expand Up @@ -76,7 +83,7 @@ namespace detail

#ifndef CUB_RUNTIME_FUNCTION

#if defined(__CUDACC_RDC__)
#if defined(__CUDACC_RDC__) && !defined(CUB_DISABLE_CDP)

#define CUB_RDC_ENABLED
#define CUB_RUNTIME_FUNCTION __host__ __device__
Expand Down