且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在OpenCL 1.2中使用cl_arm_import_memory扩展进行零拷贝缓冲区-Arm Mali Midgard GPU

更新时间:2022-06-27 02:52:40

如果扩展字符串cl_arm_import_memory_host被公开

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
cl_arm_import_memory_host
cl_arm_import_memory_dma_buf
cl_arm_import_memory_protected

cl_arm_import_memory 还报告了字符串.

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

因此,如果您的实现支持导入主机内存,则它将同时列出 cl_arm_import_memory cl_arm_import_memory_host.

So if your implementation supports importing host memory it will list both cl_arm_import_memory and cl_arm_import_memory_host.

如果支持正确的功能,则可能需要获取指向扩展名 通过调用 clGetExtensionFunctionAddressForPlatform .

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.