I am trying to allocate a zero copy buffer on Mali Midgard GPUs . The OpenCL 1.2 guide mentions that the only sure shot way to do this is to use the flag
CL_MEM_ALLOC_HOST_PTR
SO, First we need to allocate the Gpu memory using the flag and then perform map and unmap operations. The issue is I wish to do it the other way around i.e. first allocate CPU memory ( c arrays etc.) and then just point its pointer to the clBuffer flag. In Intel Integrated Graphics, the way I do this is by first allocating a memory in proper aligned form - alignment = 4096 and size = multiple of 64 bytes. Then, I use the flag USE_MEM_HOST_PTR and map unmap operations to do zero copy operations. How to do the same for arm mali gpus and cpus for hybrid operations. Kindly help. And What's the alignment requirement for Arm GPUs?
Yes, importing a std::vector's data pointer is supported. You can even reuse the same custom allocator (or relax the alignment constraints if you want).
Regards,
Kévin
Hi, while going through the txt file, I came across this line .I don't understand the meaning of this. If I have the opencl library and use c headers from khronos, won't it work? or Am I missing something? Kindly help.
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.