Closed maleadt closed 2 years ago
An OpFunctionParameter for an OpFunction that is identified with OpEntryPoint defines a kernel argument. Allowed types for kernel arguments are:
OpTypeInt
OpTypeFloat
OpTypeStruct
OpTypeVector
OpTypePointer
OpTypeSampler
OpTypeImage `
The reason why the non-ByVal version worked is that array got treated as pointer "%_ptr_CrossWorkgroup__arr_ulong_ulong_1 = OpTypePointer CrossWorkgroup %_arr_ulong_ulong_1".
Can you try wrapping the array with a struct or using vector types?
The reason why the non-ByVal version worked is that array got treated as pointer "%_ptr_CrossWorkgroup__arr_ulong_ulong_1 = OpTypePointer CrossWorkgroup %_arr_ulong_ulong_1".
It's the inverse: the case that works is a OpTypePointer
with the ByVal
attribute. It's the non-ByVal version where I don't use a pointer but actually pass a value that doesn't (because that's not supported, apparently).
Anyway, if passing a OpTypeArray
isn't supported, but doing so as a OpTypePointer
with the ByVal
attribute set is (which should boil down to exactly the same code, so I don't really get the difference), that works for me. I'd rather not start wrapping stuff in structs or vector types.
What remains of this issue then is just the reporting by zeModuleCreate
.
I'm transferring this issue to IGC project: https://github.com/intel/intel-graphics-compiler
Thanks, @maleadt for spotting the issue. The commit https://github.com/intel/intel-graphics-compiler/commit/c389eb9c7b518fde6ceba9b4e47b39599782b529 add the error message if we get unsupported type as Kernel argument.
Given the following IR, then compiled with Khronos' LLVM to SPIRV translator:
I can successfully load this module (
zeModuleCreate
) and iterate the kernels (zeModuleGetKernelNames
) to getkernel
.If I change the function argument to take an array by value, instead of a pointer with the ByVal attribute:
Now
zeModuleGetKernelNames
returns an empty set.