[Beignet] Shared Host Memory but not Share [Solved]

Gao, Sanshan gss at mail.ustc.edu.cn
Wed May 6 00:37:40 PDT 2015


Problems on making buffer object, created by CL_MEM_USE_HOST_PTR, work correctly.


1. The memory in host memory must be aligned 64 bytes.


2. libdrm-dev >= 2.4.58
 In Ubuntu 14.04.2, by "sudo apt-get install libdrm-dev", the version is 2.4.56, doesn't satisfy. And I try to compile by myself, but failed. So, in the end, I add an PPA, ppa:oibaf/graphics-drivers  from  https://launchpad.net/~oibaf/+archive/ubuntu/graphics-drivers/,
Then it's easy to install libdrm 2.4.60 just by apt-get.


Now: Ubuntu 14.04.2    Kernel 3.18.12

Thanks for all helpers!! :->

-----原始邮件-----
发件人:"Guo, Yejun" <yejun.guo at intel.com>
发送时间:2015-05-06 09:49:56 (星期三)
收件人: "Gao, Sanshan" <gss at mail.ustc.edu.cn>
抄送:
主题: RE: RE: [Beignet] Shared Host Memory but not Share



Looks like ubuntu 15.04 meets the requirement for both libdrm and linux kernel, any issue here?

 

To verify the libdrm version, you can check:

-          The output of cmake contains “Enable userptr support”

…

-- checking for module 'libdrm'

--   found libdrm, version 2.4.58

-- Looking for DRM - found at /usr/local 2.4.58

-- checking for module 'libdrm_intel>=2.4.52'

--   found libdrm_intel, version 2.4.58

-- Looking for DRM Intel - found at /usr/local 2.4.58

-- Enable userptr support

…

-          ldd your example

if it does not link against the correct version of libdrm (that you built from source code), please set LD_LIBRARY_PATH.

Thanks,

Yejun

 

From: Gao, Sanshan [mailto:gss at mail.ustc.edu.cn]
Sent: Tuesday, May 05, 2015 4:50 PM
To: Guo, Yejun
Subject: Re: RE: [Beignet] Shared Host Memory but not Share

 

Hi, Yejun,

 

After trying to compile and install libdrm 2.4.60 from source code, I think it's not installed successfully. Then I change to Ubuntu 15.04 (kernel version 3.19.6), and by "apt-get install libdrm-dev", the version is 2.4.60-2.

 

1. Recompile kernel 4.0.1 from www.kernel.org with default configuration and Beignet patch, then run command "# echo 0 > /sys/module/i915/parameters/enable_cmd_parser". However, when run utest_run,I get these information. Should I change some kernel default settings. or change and configure other things?

Before use kernel 4.0.1, but with default kernel 3.19.6, utest_run is ok, except some test units which depending on provided patch, like atomic functions.

 

gss at GPU-GIGA1:~/files/beignet/build/utests$ . setenv.sh

gss at GPU-GIGA1:~/files/beignet/build/utests$ ./utest_run

Invalid MIT-MAGIC-COOKIE-1 keyDevice open failed, aborting...

platform number 1

platform_profile "FULL_PROFILE"

platform_name "Intel Gen OCL Driver"

platform_vendor "Intel"

platform_version "OpenCL 1.2 beignet 1.1 (git-83f8739)"

platform_extensions "cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_spir cl_khr_icd"

Invalid MIT-MAGIC-COOKIE-1 keyDevice open failed, aborting...

cl_get_gt_device(): error, unknown device: ffffffff

error calling clGetDeviceIDs

Failed to initialize cl device.

 

summary:

----------

  total: 731

  run: 0

  pass: 0

  fail: 0

  pass rate: 0.000000


2. On Ubuntu 14.04.2, by "sudo apt-get install libdrm-dev", the version of libdrm is 2.4.56. I have wanted to install from source code, but it's depending on many packets and I failed.

 I find version 2.4.60 in link: https://launchpad.net/ubuntu/trusty/+package/libdrm-dev

 What should I do to make "sudo apt-get install libdrm-dev" can install the latest libdrm?

 

Thank you very much!! 



-----原始邮件-----
发件人:"Guo, Yejun" <yejun.guo at intel.com>
发送时间:2015-05-05 09:52:26 (星期二)
收件人: "Gao, Sanshan" <gss at mail.ustc.edu.cn>
抄送: "beignet at lists.freedesktop.org" <beignet at lists.freedesktop.org>
主题: RE: [Beignet] Shared Host Memory but not Share

the seg fault issue did not reproduce at my side.  Maybe you can try:

 

-          Beignet/utest also invokes clGetDeviceIDs() and successful to run, just compare it with your simple example step by step to check the difference.

-          Run your simple example within gdb, to check the crash point inside beignet (built with Debug version)

 

 

From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of Gao, Sanshan
Sent: Monday, May 04, 2015 6:05 PM
To: Guo, Yejun
Cc:beignet at lists.freedesktop.org
Subject: Re: [Beignet] Shared Host Memory but not Share

 

Thanks for your guidance!!

 

Now: 

My kernel version==4.0.0 libdrc-dev version==2.4.56

And after reading sample code, I realize that may be the reason is host memory should be aligned 64.

 

So:

I "sudo apt-get remove libdrm-dev" and install libdrm 2.4.60.2 (link:    https://launchpad.net/ubuntu/+archive/primary/+files/libdrm_2.4.60.orig.tar.gz)

It depends "sudo apt-get install libpciaccess-dev".

 

But:

After all of this, the run test in Beignet is OK, but one of my previous simple example has "Segmentation fault (core dumped)" when run, although compiling is OK. Error function is clGetDeviceIDs().

After rebuild and install the latest Beignet, problem is still.

 

I don't know why? Could you give me some guidance? (attachments are: log file and simple code)

 

 

769  summary:

770  ----------

771   total: 681

772   run: 680

773   pass: 680

774   fail: 0

775   pass rate: 1.000000

 






-----原始邮件-----
发件人:"Guo, Yejun" <yejun.guo at intel.com>
发送时间:2015-05-04 09:58:24 (星期一)
收件人: "Gao, Sanshan" <gss at mail.ustc.edu.cn>, "beignet at lists.freedesktop.org" <beignet at lists.freedesktop.org>
抄送:
主题: RE: [Beignet] Shared Host Memory but not Share

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/20150506/dd58f2bc/attachment-0001.html>


More information about the Beignet mailing list