huggingface / huggingface/candle
candle-kernels 0.10.2 fails to build with CUDA 13.2 on Windows (CCCL requires /Zc:preprocessor)
- Dominant language
- Rust
- Stars
- 21k
- Forks
- 1.8k
- Avg merge
- 16h 42m
- Merged PRs (30d)
- 25
Description
## Describe the bug
`candle-kernels` fails to compile on Windows with CUDA 13.2 due to a CCCL preprocessor check.
The build aborts with:
```
fatal error C1189:
#error: MSVC/cl.exe with traditional preprocessor is used.
This may lead to unexpected compilation errors.
Please switch to the standard conforming preprocessor by passing /Zc:preprocessor to cl.exe.
You can define CCCL_IGNORE_MSVC_TRADITIONAL_PREPROCESSOR_WARNING to suppress this warning.
```
The error originates from:
```
include/cccl/cuda/std/__cccl/preprocessor.h
```
and is triggered while compiling `candle-kernels`.
---
## Environment
- OS: Windows 11 x64
- Rust: (stable)
- MSVC: 19.44.35225
- CUDA Toolkit: 13.2.78
- NVCC:
```
Cuda compilation tools, release 13.2, V13.2.78
```
- candle-core: 0.10.2
- candle-nn: 0.10.2
- candle-transformers: 0.10.2
- candle-kernels: 0.10.2
---
## Reproduction
Simply build a project that depends on Candle with CUDA enabled:
```bash
cargo build --release
```
The build fails while compiling `candle-kernels`.
---
## Build output
```
warning: candle-kernels@0.10.2: Compiling 11 of 11 PTX kernels
fatal error C1189:
#error: MSVC/cl.exe with traditional preprocessor is used.
Please switch to the standard conforming preprocessor by passing /Zc:preprocessor to cl.exe.
Error: CompilationFailed {
path: "src\\reduce.cu",
message: "nvcc error:"
}
```
---
## Additional information
MSVC itself is recent and supports `/Zc:preprocessor`.
```
Microsoft (R) C/C++ Optimizing Compiler Version 19.44.35225 for x64
```
This appears to be caused by `nvcc` invoking `cl.exe` without forwarding `/Zc:preprocessor`.
CUDA 13.2's CCCL headers now require the standard-conforming preprocessor and emit a hard error otherwise.
Would it make sense for `candle-kernels`' build script to pass:
```
-Xcompiler=/Zc:preprocessor
```
when compiling CUDA kernels on Windows, or is CUDA 13.2 currently unsupported?
Thanks!
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by running `cargo build --release` with CUDA enabled and trace how candle-kernels invokes nvcc for `src\reduce.cu` on Windows. Inspect the path reaching `include/cccl/cuda/std/__cccl/preprocessor.h` and verify whether compiler flags are forwarded to cl.exe. Done means candle-kernels builds successfully with CUDA 13.2 on Windows or documents that version as unsupported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100