在OpenCL 1.2中使用cl_arm_import_memory扩展进行零拷贝缓冲区-Arm Mali Midgard GPU [英] Zero Copy Buffers using cl_arm_import_memory extension in OpenCL 1.2 - arm mali midgard GPUs

查看:775
本文介绍了在OpenCL 1.2中使用cl_arm_import_memory扩展进行零拷贝缓冲区-Arm Mali Midgard GPU的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望分配一个向量,并使用它的数据指针在GPU上分配一个零拷贝缓冲区.有此cl_arm_import_memory扩展名可用于执行此操作.但是我不确定是否所有马里Midgard OpenCL驱动程序都支持它.

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 : -

如果公开了扩展字符串cl_arm_import_memory_host,则从普通用户空间分配(例如通过malloc创建的分配)中导入 支持.

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.

这些行到底是什么意思?我专门在Rockchip的RK3399板上工作.请帮助.

What exactly does these lines mean ? I am specifically working on rockchip's RK3399 boards. Kindly help.

推荐答案

如果扩展字符串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.

这篇关于在OpenCL 1.2中使用cl_arm_import_memory扩展进行零拷贝缓冲区-Arm Mali Midgard GPU的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆