[Beignet] CL_MEM_USE_HOST_PTR involve extra copy?

Guo, Yejun yejun.guo at intel.com
Tue Dec 2 18:14:10 PST 2014


Just need to invoke clMapxx function before you access the host ptr from CPU side, and invoke clUnmapxx function after the CPU access. There is no extra copy inside clMap/Unmapxx if all the conditions are satisfied. You can refer to the code in runtime_use_host_ptr_buffer.cpp under beignet/utests.


From: spring_wind [mailto:spring_wind at yeah.net]
Sent: Wednesday, December 03, 2014 10:02 AM
To: Guo, Yejun
Cc: beignet at lists.freedesktop.org
Subject: Re:RE: [Beignet] CL_MEM_USE_HOST_PTR involve extra copy?

You mean if I use CL_MEM_USE_HOST_PTR and host ptr is page aligned, I change the data pointed by host ptr from CPU side, I don't have to do any flush opertaion or I should still call clMapxx function?




在 2014-12-03 08:37:15,"Guo, Yejun" <yejun.guo at intel.com<mailto:yejun.guo at intel.com>> 写道:

Hi,

please check the latest code of beignet, there is no copy needed between CPU and GPU if the host_ptr provided by application is page aligned, and the page align limitation is expected to be removed some days later. You can also try CL_MEM_ALLOC_HOST_PTR to avoid the extra copy without align limitation.

Btw, this zero-copy is supported starting from linux kernel 3.16 and libdrm 2.4.58.


From: Beignet [mailto:beignet-bounces at lists.freedesktop.org<mailto:beignet-bounces at lists.freedesktop.org>] On Behalf Of spring_wind
Sent: Tuesday, December 02, 2014 8:38 PM
To: beignet at lists.freedesktop.org<mailto:beignet at lists.freedesktop.org>
Subject: [Beignet] CL_MEM_USE_HOST_PTR involve extra copy?

Hi:
Intel opencl optimization guide said using CL_MEM_USE_HOST_PTR can avoid extra copy between CPU and GPU, but I noticed that in beignet's implementation source it was not like that:
/* Copy the data if required */
  if (flags & CL_MEM_COPY_HOST_PTR || flags & CL_MEM_USE_HOST_PTR)
    cl_buffer_subdata(mem->bo, 0, sz, data);

Could someone give me an answer?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/beignet/attachments/20141203/8b584e0f/attachment.html>


More information about the Beignet mailing list