Skip to content

Commit edf579f

Browse files
committed
docs(example): the clang route does pass one flag, and the README should say which
The README claimed "no CUDA host header in the way", which stopped being true the moment a device unit includes <cuda_runtime.h>. It says what the flag is, why the guard fires on a compiler it was not written about, and why this example's own kernel never showed it.
1 parent e5b3867 commit edf579f

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

examples/09-cuda-kernel/README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,16 @@ The rule package compiles the device unit either way:
102102

103103
- **clang** (`-x cuda --cuda-path=<payload>`) is the default and what
104104
`[toolchain] default = "llvm@22.1.8"` selects. The compiler that builds the
105-
rest of the project builds the device unit too. There is no second host
106-
compiler, no host-compiler bound, and no CUDA host header in the way.
105+
rest of the project builds the device unit too: no second host compiler and
106+
no host-compiler bound.
107+
108+
It does pass one flag of NVIDIA's own. A device unit that includes
109+
`<cuda_runtime.h>` stops at `crt/host_defines.h:67` with `"libc++ is not
110+
supported on x86 system"`, because that guard reads `__CUDACC__` — which
111+
clang defines when it compiles CUDA — and an LLVM toolchain's clang uses
112+
libc++. The refusal is about nvcc's host pass, so the rule passes
113+
`-D_ALLOW_UNSUPPORTED_LIBCPP` on this route only. This example's own kernel
114+
never showed it: a bare kernel includes no toolkit header at all.
107115
- **nvcc** (`-ccbin <host g++>`) is taken when the project's toolchain is GCC.
108116
It drives a second compiler, and that is where its constraints come from.
109117

0 commit comments

Comments
 (0)