Zero Copy Buffers using cl_arm_import_memory extension in OpenCL 1.2 - arm mali midgard GPUs

◇◆丶佛笑我妖孽 提交于 2020-01-25 02:48:47

问题


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.


回答1:


If the extension string cl_arm_import_memory_host is exposed

This means you need to check the CL_DEVICE_EXTENSIONS property of your OpenCL device using the clGetDeviceInfo() 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:

cl_arm_import_memory
cl_arm_import_memory_host
cl_arm_import_memory_dma_buf
cl_arm_import_memory_protected

cl_arm_import_memory will be reported if at least one of the other extension strings is also reported.

So if your implementation supports importing host memory it will list both cl_arm_import_memory and cl_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 calling clGetExtensionFunctionAddressForPlatform.

Then, use the extension's features as documented.



来源:https://stackoverflow.com/questions/58475633/zero-copy-buffers-using-cl-arm-import-memory-extension-in-opencl-1-2-arm-mali

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!