<?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 OpenCL vectorisation issue in OneAPI driver in GPU Compute Software</title>
    <link>https://community.intel.com/t5/GPU-Compute-Software/OpenCL-vectorisation-issue-in-OneAPI-driver/m-p/1612674#M1498</link>
    <description>&lt;P&gt;(Cross-posting as requested from the &lt;A href="https://community.intel.com/t5/OpenCL-for-CPU/OpenCL-vectorisation-issue-in-OneAPI-driver/m-p/1315362#M6915" target="_self"&gt;toolkit forum&lt;/A&gt;.)&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;The Intel OpenCL drivers (&lt;SPAN&gt;2024.2.0.980 on Windows and&amp;nbsp;&lt;/SPAN&gt;2021.12.6.0.19_160000 on Linux) seem to have an issue with vectorization resulting in corrupted data. This simple kernel:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;__kernel void test(__global float *f, __global float *r) {&lt;BR /&gt;    int i = get_global_id(0);&lt;BR /&gt;&lt;BR /&gt;    r[i] = 0.0;&lt;BR /&gt;    if (f[i] == 1.0F) {&lt;BR /&gt;        r[i] = 1.0F+pow(1.0F, 1.0F);&lt;BR /&gt;    }&lt;BR /&gt;}&lt;/PRE&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;when run over a buffer of length 16 with f equal to:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1&lt;/PRE&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;results in the following values in r:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 3126, 0, 0, 0, 0, 3126&lt;/PRE&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Note the odd 3126 values. Turning off vectorisation using&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;CL_CONFIG_CPU_VECTORIZER_MODE=1&lt;/PRE&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Results in the correct values:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2&lt;/PRE&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;The issue seems to be caused by adding a value to the function (i.e. here&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;1.0&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class=""&gt;+pow()), for example this gives an expected result:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;__kernel void test(__global float *f, __global float *r) {&lt;BR /&gt;    int i = get_global_id(0);&lt;BR /&gt;&lt;BR /&gt;    r[i] = 0.0;&lt;BR /&gt;    if (f[i] == 1.0F) {&lt;BR /&gt;        r[i] = pow(1.0F, 1.0F);&lt;BR /&gt;    }&lt;BR /&gt;}&lt;/PRE&gt;&lt;P class=""&gt;Code for a MVE is attached.&lt;/P&gt;</description>
    <pubDate>Sat, 06 Jul 2024 12:20:48 GMT</pubDate>
    <dc:creator>OCLdev</dc:creator>
    <dc:date>2024-07-06T12:20:48Z</dc:date>
    <item>
      <title>OpenCL vectorisation issue in OneAPI driver</title>
      <link>https://community.intel.com/t5/GPU-Compute-Software/OpenCL-vectorisation-issue-in-OneAPI-driver/m-p/1612674#M1498</link>
      <description>&lt;P&gt;(Cross-posting as requested from the &lt;A href="https://community.intel.com/t5/OpenCL-for-CPU/OpenCL-vectorisation-issue-in-OneAPI-driver/m-p/1315362#M6915" target="_self"&gt;toolkit forum&lt;/A&gt;.)&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;The Intel OpenCL drivers (&lt;SPAN&gt;2024.2.0.980 on Windows and&amp;nbsp;&lt;/SPAN&gt;2021.12.6.0.19_160000 on Linux) seem to have an issue with vectorization resulting in corrupted data. This simple kernel:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;__kernel void test(__global float *f, __global float *r) {&lt;BR /&gt;    int i = get_global_id(0);&lt;BR /&gt;&lt;BR /&gt;    r[i] = 0.0;&lt;BR /&gt;    if (f[i] == 1.0F) {&lt;BR /&gt;        r[i] = 1.0F+pow(1.0F, 1.0F);&lt;BR /&gt;    }&lt;BR /&gt;}&lt;/PRE&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;when run over a buffer of length 16 with f equal to:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1&lt;/PRE&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;results in the following values in r:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 3126, 0, 0, 0, 0, 3126&lt;/PRE&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Note the odd 3126 values. Turning off vectorisation using&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;CL_CONFIG_CPU_VECTORIZER_MODE=1&lt;/PRE&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Results in the correct values:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2&lt;/PRE&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;The issue seems to be caused by adding a value to the function (i.e. here&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;1.0&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class=""&gt;+pow()), for example this gives an expected result:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;__kernel void test(__global float *f, __global float *r) {&lt;BR /&gt;    int i = get_global_id(0);&lt;BR /&gt;&lt;BR /&gt;    r[i] = 0.0;&lt;BR /&gt;    if (f[i] == 1.0F) {&lt;BR /&gt;        r[i] = pow(1.0F, 1.0F);&lt;BR /&gt;    }&lt;BR /&gt;}&lt;/PRE&gt;&lt;P class=""&gt;Code for a MVE is attached.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jul 2024 12:20:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/GPU-Compute-Software/OpenCL-vectorisation-issue-in-OneAPI-driver/m-p/1612674#M1498</guid>
      <dc:creator>OCLdev</dc:creator>
      <dc:date>2024-07-06T12:20:48Z</dc:date>
    </item>
  </channel>
</rss>

