Closed
Description
A simple example showing the usage of static library with kernel which fails at runtime with CUDA BE:
Here is the content of file sycl_lib.cpp:
#include<CL/sycl.hpp>
using namespace sycl;
void func() {
queue q;
q.submit([&](sycl::handler &h) {
sycl::stream os(1024, 768, h);
h.parallel_for(32, [=](sycl::id<1> i) {
os<<i<<"\n";
});
});
}
and a simple main code:
void func();
int main() {
func();
return 0;
}
Compilation of sycl_lib.cpp, static library creation and linking works fine:
clang++ -fsycl -fsycl-targets=nvptx64-nvidia-cuda-sycldevice -fsycl-unnamed-lambda -c sycl_lib.cpp
ar rvs sycl_lib.a sycl_lib.o
clang++ -fsycl -fsycl-targets=nvptx64-nvidia-cuda-sycldevice main.cpp -o test-lib sycl_lib.a
SYCL_BE=PI_CUDA ./test-lib
The application crashes at runtime with following error:
PI CUDA ERROR:
Value: 500
Name: CUDA_ERROR_NOT_FOUND
Description: named symbol not found
Function: cuda_piKernelCreate
Source Location: /llvm/sycl/plugins/cuda/pi_cuda.cpp:2380
terminate called after throwing an instance of 'cl::sycl::runtime_error'
what(): Native API failed. Native API returns: -999 (Unknown OpenCL error code) -999 (Unknown OpenCL error code)
Note that ahead of time compilation and linking works fine for CPU or Intel GPU devices. This looks like a limitation of CUDA BE.