[Beignet] Shared Host Memory but not Share

Guo, Yejun yejun.guo at intel.com
Sun May 3 18:58:24 PDT 2015


Please refer to the sample code in utests/runtime_use_host_ptr_buffer.cpp and  kernels/runtime_use_host_ptr_buffer.cl

To avoid internal copy, it requires libdrm version >= 2.4.58 and linux kernel version >= 3.16

From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of Gao, Sanshan
Sent: Sunday, May 03, 2015 3:56 PM
To: beignet at lists.freedesktop.org
Subject: [Beignet] Shared Host Memory but not Share

Hi, alls,

I want to use CL_MEM_USE_HOST_PTR to create a buffer object which shares host memory, so the changes to the elements in kernel can be used by host program.

But the result is that, I have changed the element in kernel, but the element in host program has not changed. I don't know why? Does this method still be a copy of host memory, so the change is not done to the host memory, but only device memory?

Hope for helps!

Device: GIGA Mini PC with core i7 and Iris Pro, integrated GPU
Kernel function:
 47 __kernel void PacketsIndexCalculation(
 48                          const unsigned int     packets_info_size,
 49                          __global packet_info_t  *packets_info,
 50                          const unsigned int     flow_table_size )
 51 {
 52     int gid = get_global_id(0);
 53     __global packet_info_t *p = packets_info + gid;
 54
 55     //calculate hash value
 56     p->index = ( ((p->flow_id).src_ip & 0xff) | (((p->flow_id).dst_ip & 0xff)<<8) |
 57                  (((p->flow_id).src_port & 0xff)<<16) | (((p->flow_id).dst_port & 0xff)<<24) )%flow_table_size;
 58
 59 }
Problem:
 In host program, the memory pointed by &(p->index) has not changed by kernel function.






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


More information about the Beignet mailing list