<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic clEnqueueReadBuffer transfers truncated data on HD4600 in OpenCL* for CPU</title>
    <link>https://community.intel.com/t5/OpenCL-for-CPU/clEnqueueReadBuffer-transfers-truncated-data-on-HD4600/m-p/1041657#M3858</link>
    <description>&lt;P&gt;In certain cases clEnqueueReadBuffer doesn't transfer all the required data when executed on HD4600. System: Win7 x64, driver version 15.36.19.64.4170, 32-bit application.&lt;/P&gt;

&lt;P&gt;It seems that in case of page-aligned destination buffer and transfer length that is not multiple of 4KB only multiple of 4KB is transfered. Sample code:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;size_t length = 76800;
char *dst = VirtualAlloc(NULL, length, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN, PAGE_READWRITE);
cl_mem buf = clCreateBuffer(context, CL_MEM_READ_WRITE, length, NULL, NULL);
clEnqueueReadBuffer(command_queue, buf, CL_TRUE, 0, length, dst, 0, NULL, NULL);&lt;/PRE&gt;

&lt;P&gt;The problem is present only on Intel GPU, the same code produce correct results when executed on AMD and Nvidia GPUs. The same incorrect behavior can be replicated on proper implementations by calling:&lt;/P&gt;

&lt;PRE class="brush:;"&gt;clEnqueueReadBuffer(command_queue, buf, CL_TRUE, 0, length &amp;amp; 0xFFFFF000, dst, 0, NULL, NULL);&lt;/PRE&gt;

&lt;P&gt;&lt;BR /&gt;
	&lt;BR /&gt;
	&lt;BR /&gt;
	&lt;BR /&gt;
	&lt;BR /&gt;
	&lt;BR /&gt;
	&lt;BR /&gt;
	&lt;BR /&gt;
	&lt;BR /&gt;
	&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 25 Apr 2015 14:32:33 GMT</pubDate>
    <dc:creator>Pavel_S_1</dc:creator>
    <dc:date>2015-04-25T14:32:33Z</dc:date>
    <item>
      <title>clEnqueueReadBuffer transfers truncated data on HD4600</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/clEnqueueReadBuffer-transfers-truncated-data-on-HD4600/m-p/1041657#M3858</link>
      <description>&lt;P&gt;In certain cases clEnqueueReadBuffer doesn't transfer all the required data when executed on HD4600. System: Win7 x64, driver version 15.36.19.64.4170, 32-bit application.&lt;/P&gt;

&lt;P&gt;It seems that in case of page-aligned destination buffer and transfer length that is not multiple of 4KB only multiple of 4KB is transfered. Sample code:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;size_t length = 76800;
char *dst = VirtualAlloc(NULL, length, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN, PAGE_READWRITE);
cl_mem buf = clCreateBuffer(context, CL_MEM_READ_WRITE, length, NULL, NULL);
clEnqueueReadBuffer(command_queue, buf, CL_TRUE, 0, length, dst, 0, NULL, NULL);&lt;/PRE&gt;

&lt;P&gt;The problem is present only on Intel GPU, the same code produce correct results when executed on AMD and Nvidia GPUs. The same incorrect behavior can be replicated on proper implementations by calling:&lt;/P&gt;

&lt;PRE class="brush:;"&gt;clEnqueueReadBuffer(command_queue, buf, CL_TRUE, 0, length &amp;amp; 0xFFFFF000, dst, 0, NULL, NULL);&lt;/PRE&gt;

&lt;P&gt;&lt;BR /&gt;
	&lt;BR /&gt;
	&lt;BR /&gt;
	&lt;BR /&gt;
	&lt;BR /&gt;
	&lt;BR /&gt;
	&lt;BR /&gt;
	&lt;BR /&gt;
	&lt;BR /&gt;
	&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Apr 2015 14:32:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/clEnqueueReadBuffer-transfers-truncated-data-on-HD4600/m-p/1041657#M3858</guid>
      <dc:creator>Pavel_S_1</dc:creator>
      <dc:date>2015-04-25T14:32:33Z</dc:date>
    </item>
    <item>
      <title>Hi Pavel,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/clEnqueueReadBuffer-transfers-truncated-data-on-HD4600/m-p/1041658#M3859</link>
      <description>&lt;P&gt;Hi Pavel,&lt;/P&gt;

&lt;P&gt;Could you please provide the full minimal reproducer with the kernel that you are running?&lt;/P&gt;

&lt;P&gt;Typically, on our systems we highly recommend to allocate memory using _aligned_malloc w/ 4K alignment and create a buffer w/ USE_HOST_POINTER flag from aligned memory allocation: this guarantees "zero copy" behavior, so instead of using clEnqueueReadBuffer, you could use clEnqueueMapBuffer and no memory is copied around.&lt;/P&gt;

&lt;P&gt;BTW, is there any reason not to use that pattern and use VirtualAlloc and clEnqueueReadBuffer instead?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;

&lt;P&gt;Robert&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2015 00:25:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/clEnqueueReadBuffer-transfers-truncated-data-on-HD4600/m-p/1041658#M3859</guid>
      <dc:creator>Robert_I_Intel</dc:creator>
      <dc:date>2015-04-28T00:25:51Z</dc:date>
    </item>
    <item>
      <title>I've attached maximally</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/clEnqueueReadBuffer-transfers-truncated-data-on-HD4600/m-p/1041659#M3860</link>
      <description>&lt;P&gt;I've attached cutted down version of my code that reproduces the bug. Compile with MSVS2013.&lt;/P&gt;

&lt;P&gt;Additional information: bug is only present if the destination address lies in second half of 32-bit address space. For that /LARGEADDRESSAWARE linker flag and MEM_TOP_DOWN allocation flag are essential. If either one is not specified the memory is allocated below 2GB and everything works fine.&lt;/P&gt;

&lt;P&gt;The code is not optimized for Intel GPUs in any way, before that I need to be sure that&amp;nbsp;my code&amp;nbsp;works there properly. My previous attempt to run the same code on some earlier driver resulted in driver hang with TDR recovery several seconds later, so I just gave up on them for the time being.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2015 10:52:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/clEnqueueReadBuffer-transfers-truncated-data-on-HD4600/m-p/1041659#M3860</guid>
      <dc:creator>Pavel_S_1</dc:creator>
      <dc:date>2015-04-28T10:52:03Z</dc:date>
    </item>
    <item>
      <title>Hi Pavel,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/clEnqueueReadBuffer-transfers-truncated-data-on-HD4600/m-p/1041660#M3861</link>
      <description>&lt;P&gt;Hi Pavel,&lt;/P&gt;

&lt;P&gt;I could reproduce the behavior you described. However, the fix is very simple: build you program using x64 configuration, and then you can use /LARGEADDRESSAWARE flag.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2015 21:18:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/clEnqueueReadBuffer-transfers-truncated-data-on-HD4600/m-p/1041660#M3861</guid>
      <dc:creator>Robert_I_Intel</dc:creator>
      <dc:date>2015-04-28T21:18:18Z</dc:date>
    </item>
    <item>
      <title>That 'fix' is not a fix at</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/clEnqueueReadBuffer-transfers-truncated-data-on-HD4600/m-p/1041661#M3862</link>
      <description>&lt;P&gt;That 'fix' is not a fix at all: the code has to interact with plenty of handwritten assembler code so 32-bit and&amp;nbsp;/LARGEADDRESSAWARE are a must. Better (and still current) solution is blacklisting Intel GPUs until they can do the processing correctly.&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2015 21:30:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/clEnqueueReadBuffer-transfers-truncated-data-on-HD4600/m-p/1041661#M3862</guid>
      <dc:creator>Pavel_S_1</dc:creator>
      <dc:date>2015-04-28T21:30:14Z</dc:date>
    </item>
    <item>
      <title>Pavel,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/clEnqueueReadBuffer-transfers-truncated-data-on-HD4600/m-p/1041662#M3863</link>
      <description>&lt;P&gt;Pavel,&lt;/P&gt;

&lt;P&gt;I contacted our driver folks to see if they can figure out what's wrong w/ 32-bit mode.&lt;/P&gt;

&lt;P&gt;Will keep you posted.&lt;/P&gt;

&lt;P&gt;Robert&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2015 21:41:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/clEnqueueReadBuffer-transfers-truncated-data-on-HD4600/m-p/1041662#M3863</guid>
      <dc:creator>Robert_I_Intel</dc:creator>
      <dc:date>2015-04-28T21:41:26Z</dc:date>
    </item>
    <item>
      <title>Thanks, I'm looking forward</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/clEnqueueReadBuffer-transfers-truncated-data-on-HD4600/m-p/1041663#M3864</link>
      <description>&lt;P&gt;Thanks, I'm looking forward to&amp;nbsp;better drivers.&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2015 21:48:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/clEnqueueReadBuffer-transfers-truncated-data-on-HD4600/m-p/1041663#M3864</guid>
      <dc:creator>Pavel_S_1</dc:creator>
      <dc:date>2015-04-28T21:48:16Z</dc:date>
    </item>
    <item>
      <title>Hi Pavel,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/clEnqueueReadBuffer-transfers-truncated-data-on-HD4600/m-p/1041664#M3865</link>
      <description>&lt;P&gt;Hi Pavel,&lt;/P&gt;

&lt;P&gt;The driver architect had informed me that this issue was fixed. It will be probably another two to six months until the driver is actually released, since the driver update was just released at the beginning of June.&lt;/P&gt;

&lt;P&gt;Sorry for the long wait! And thank you again for reporting this issue.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jun 2015 22:09:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/clEnqueueReadBuffer-transfers-truncated-data-on-HD4600/m-p/1041664#M3865</guid>
      <dc:creator>Robert_I_Intel</dc:creator>
      <dc:date>2015-06-16T22:09:47Z</dc:date>
    </item>
    <item>
      <title>I'm glad the issue is finally</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/clEnqueueReadBuffer-transfers-truncated-data-on-HD4600/m-p/1041665#M3866</link>
      <description>&lt;P&gt;I'm glad the issue is finally fixed. Too bad it would require so much time to finally see it.&lt;/P&gt;

&lt;P&gt;I think Intel should adopt regular beta drivers builds to push new versions faster and get more feedback from people who are willing to help you testing.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jun 2015 00:19:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/clEnqueueReadBuffer-transfers-truncated-data-on-HD4600/m-p/1041665#M3866</guid>
      <dc:creator>Pavel_S_1</dc:creator>
      <dc:date>2015-06-19T00:19:03Z</dc:date>
    </item>
    <item>
      <title>I can confirm that the bug is</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/clEnqueueReadBuffer-transfers-truncated-data-on-HD4600/m-p/1041666#M3867</link>
      <description>&lt;P&gt;I can confirm that the bug is fixed in driver version 15.36.24.64.4264.&lt;/P&gt;

&lt;P&gt;Too bad anything after 15.36.21.64.4222 is unusable because it can't duplicate two displays. (I haven't made bug report for that yet, will do so when gather enough information.)&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2015 18:14:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/clEnqueueReadBuffer-transfers-truncated-data-on-HD4600/m-p/1041666#M3867</guid>
      <dc:creator>Pavel_S_1</dc:creator>
      <dc:date>2015-09-10T18:14:00Z</dc:date>
    </item>
    <item>
      <title>Status update: driver version</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/clEnqueueReadBuffer-transfers-truncated-data-on-HD4600/m-p/1041667#M3868</link>
      <description>&lt;P&gt;Status update: driver version 15.36.26.4294 finally is the version we can switch to, as it has fix for the issue and no other problems for us.&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thank you (Intel) again, for actually fixing driver bugs. It's really pleasant to see that company cares for proper implementation and not just that major games/programs are working fine.&lt;/P&gt;</description>
      <pubDate>Sat, 31 Oct 2015 16:05:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/clEnqueueReadBuffer-transfers-truncated-data-on-HD4600/m-p/1041667#M3868</guid>
      <dc:creator>Pavel_S_1</dc:creator>
      <dc:date>2015-10-31T16:05:09Z</dc:date>
    </item>
  </channel>
</rss>

