Issue 97898
Summary An error occurred in the backend when compiling CUDA code with clang18
Labels new issue
Assignees
Reporter yanan-sjh
    I encountered an error while compiling **CUDA** code using **clang++-18**. The error message is as follows:
```
fatal error: error in backend: Cannot select: 0x55722baf9d20: i64,ch = stacksave 0x55722baf9cb0
In function: _Z5entrydPdS_PimP4int2i
clang++-18: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Ubuntu clang version 18.1.0 (++20240220094926+390dcd4cbbf5-1~exp1~20240220214944.50)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang++-18: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang++-18: note: diagnostic msg: /tmp/host-b24319.cu
clang++-18: note: diagnostic msg: /tmp/host-sm_75-8d8351.cu
clang++-18: note: diagnostic msg: /tmp/host-b24319.sh
clang++-18: note: diagnostic msg: 
```
The kernel code is as follows. The following code can be successfully compiled using **nvcc**.
```cpp
#define MAX_THREAD_PER_BLOCK 899
#define MIN_BLOCK_PER_MULTIPROCESSOR 8
static const int SIZE = 2448;
static const int FN = 5;

__host__ void host_callee(ulonglong* param_15, ulonglong* param_17) { }
__device__ __forceinline__ void func_53(const int deep) {
	if ((deep) > (1)) {
	}
	const uint len1 = 1U;
	uchar* p1 = (uchar*)alloca(sizeof(uchar) * (len1));
}

__global__ __launch_bounds__(MAX_THREAD_PER_BLOCK, MIN_BLOCK_PER_MULTIPROCESSOR) void entry(const double input, double* result, double* oval, int* fence, ulong fptr, int2* ldst, const int deep) {
	func_53((1));
}
```
The CUDA version is 12.1.The program consists of two parts: `kernel.cu` and `host.cu`and it is compiled using the following command:
```
clang++-18 -v -x cuda -I/usr/local/cuda-12.1/lib64 -I/usr/local/cuda-12.1/targets/x86_64-linux/include/ --cuda-path=/usr/local/cuda-12.1/ -c host.cu --cuda-gpu-arch=sm_75
```

All files are attached. 


[Uploading fatal_error.zip…]()

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to