| Issue |
181074
|
| Summary |
[clang][cuda][regression] Crash when compiling __syncthreads() in __global__ kernel with --cuda-device-only and -S -emit-llvm
|
| Labels |
bug,
cuda,
clang:codegen,
regression
|
| Assignees |
|
| Reporter |
woruyu
|
## Summary
A crash occurs in clang when compiling a CUDA kernel containing the `__syncthreads()` function using `--cuda-device-only` and `-S -emit-llvm`. The crash appears to be an assertion failure related to function signatures in LLVM IR generation.
## Reproducible Example
Source code:
```cuda
__global__ void add_one_kernel() {
__syncthreads();
}
```
Build command:
```
build/bin/clang++ -x cuda --cuda-device-only -S -emit-llvm 12345.cu -o 12345.ll
```
## Compiler Output and Crash
```
clang++: warning: CUDA version 12.9 is only partially supported [-Wunknown-cuda-version]
clang++: /home/woruyu/github/llvm-project/llvm/lib/IR/Instructions.cpp:757: void llvm::CallInst::init(FunctionType *, Value *, ArrayRef<Value *>, ArrayRef<OperandBundleDef>, const Twine &): Assertion `(Args.size() == FTy->getNumParams() || (FTy->isVarArg() && Args.size() > FTy->getNumParams())) && "Calling a function with bad signature!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: build/bin/clang++ -x cuda --cuda-device-only -S -emit-llvm 12345.cu -o 12345.ll
1. <eof> parser at end of file
2. 12345.cu:1:17: LLVM IR generation of declaration 'add_one_kernel'
3. 12345.cu:1:17: Generating code for declaration 'add_one_kernel'
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 23.0.0git (https://github.com/woruyu/llvm-project.git 80662c1de160c94e93086f8337255e219752468c)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/woruyu/github/llvm-project/build/bin
Build config: +unoptimized, +assertions
```
## Environment
- clang version: 23.0.0git (commit 80662c1de160c94e93086f8337255e219752468c)
- CUDA version: 12.9 (warning: only partially supported)
- Host: x86_64-unknown-linux-gnu
## Suggested labels
- bug
- regression
- cuda
- clang:codegen
---
Please advise on workarounds and whether additional debugging info is needed.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs