Dcompute OpenCL problem: invalidKernelName
unDEFER
undefer at gmail.com
Mon May 29 10:31:12 UTC 2023
Hello!
I'm trying to make working OpenCL test example in dcompute
~master branch.
All is good, but I get invalidKernelName error.
When I add debug to program.c:59:
writefln("%s", name);
I see mangled name of saxpy function:
_D12dummykernels5saxpyFS3ldc8dcompute__T7PointerVEQBaQz9AddrSpacei1TfZQBefQBzQCcmZv
And if I run
$ spirv-dis .dub/obj/kernels_ocl220_64.spv | grep
"_D12dummykernels5saxpyFS3ldc8dcompute__T7PointerVEQBaQz9AddrSpacei1TfZQBefQBzQCcmZv"
I see two definitions of this symbol:
- as OpEntryPoint
and
- as opFunction
In https://github.com/bashbaug/SimpleOpenCLSamples I found good
05_spirvkernelfromfile example and there are building logs. If I
run
$ ./spirvkernelfromfile -p 1 --file
/home/undefer/MyFiles/Projects/TEST/D/gpu/.dub/obj/kernels_ocl220_64.spv
I see the next line:
Kernel
<_D12dummykernels5saxpyFS3ldc8dcompute__T7PointerVEQBaQz9AddrSpacei1TfZQBefQBzQCcmZv.1> was successfully vectorized (8)
I.e. the kernel is loaded but by name with suffix ".1". And if I
add this suffix to program.c:59 like:
name = name ~ ".1"
The example is working. The sample_kernel64.spv of
05_spirvkernelfromfile loads good without any suffixes to "Test"
kernel name. But if I self try compile
$ clang -c -target spir64 -emit-llvm -o sample_kernel.bc
sample_kernel.cl
$ llvm-spirv -o sample_kernel.spv sample_kernel.bc
I get the same problem and kernel "Test.1" loads. If I manually
remove two lines from assembly version which defines "OpFunction
Test" and assembly again:
$ spirv-dis sample_kernel.spv > 2.asm
$ vim 2.asm
$ spirv-as --target-env opencl2.1 -o 2.spv 2.asm
I get working spv-module.
I can't understand if it is problem of ldc2/clang/llvm-spirv and
I must go to their bugtracker or it is feature and there exists
option to compiler which will stop adding second kernel
declaration as function and then I must create pull request to
dcompute.
More information about the Digitalmars-d
mailing list