I wish to allocate a vector and use it's data pointer to allocate a zero copy buffer on the GPU. There is this cl_arm_import_memory extension which can be used to do this. But I am not sure wether its supported for all mali midgard OpenCL drivers or not.
I was going through this link and I am quite puzzled by the following lines : -
If the extension string cl_arm_import_memory_host is exposed then importing from normal userspace allocations (such as those created via malloc) is supported.
What exactly does these lines mean ? I am specifically working on rockchip's RK3399 boards. Kindly help.
This means you need to check the
CL_DEVICE_EXTENSIONS
property of your OpenCL device using theclGetDeviceInfo()
function. Split the returned string into extension names (they are separated by spaces) then check if"cl_arm_import_memory_host"
is one of those strings.Note that the extension in question consists of multiple different sub-features:
So if your implementation supports importing host memory it will list both
cl_arm_import_memory
andcl_arm_import_memory_host
.If the correct feature is supported, you will probably need to get a pointer to the extension's
clImportMemoryARM()
function by callingclGetExtensionFunctionAddressForPlatform
.Then, use the extension's features as documented.