clspv icon indicating copy to clipboard operation
clspv copied to clipboard

About "error: structures may not contain pointers"

Open fynv opened this issue 5 years ago • 1 comments

The code that generated the error: ` struct Params { __global const float* arr_in; __global float* arr_out; };

__kernel void foo(__constant struct Params* p) { int idx = (int)get_global_id(0); p->arr_out[idx] = 1025.0 - p->arr_in[idx]; } ` I know that in OpenCL 1.2, structures that are used as kernel paramters cannot contain pointer. However, I also notice that clspv has started to support C++ so I assume clspv doesn't stick to the OpenCL 1.2 restrictions?

Here if we consider the extensions "GL_EXT_buffer_reference" and "GL_EXT_buffer_reference2", IMO it makes sense for clspv to remove the restriction in question, because it is possible to interpret the pointer members of a parameter struct as buffer references, and user is expected to attach VkDeviceAddress values to these fields.

However, I don't know much about compilers. I guess the actual implementation might be tricky.

fynv avatar May 15 '20 12:05 fynv

There are no near term plans to implement support for SPV_KHR_physical_storage_buffer.

alan-baker avatar May 19 '20 14:05 alan-baker