<?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 Re: How to use OpenCL 2.0 atomics in OpenCL* for CPU</title>
    <link>https://community.intel.com/t5/OpenCL-for-CPU/How-to-use-OpenCL-2-0-atomics/m-p/1277130#M6893</link>
    <description>&lt;P&gt;Hello, and apologies for the slow reply.&lt;/P&gt;
&lt;P&gt;Both the CPU and GPU OpenCL devices support OpenCL 2.0 atomics.&lt;/P&gt;
&lt;P&gt;A few things to try:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Can you check your program build log to see if it provides any additional information?&lt;/LI&gt;
&lt;LI&gt;Can you try compiling for the CPU and GPU devices separately?&amp;nbsp; Are both devices failing, or just one?&lt;/LI&gt;
&lt;LI&gt;Can you try a simpler kernel?&amp;nbsp; Here is a simple example that successfully compiles through Clang:&amp;nbsp;&lt;A href="https://godbolt.org/z/dnbTco5ca" target="_blank"&gt;https://godbolt.org/z/dnbTco5ca&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Tue, 27 Apr 2021 21:23:31 GMT</pubDate>
    <dc:creator>Ben_A_Intel</dc:creator>
    <dc:date>2021-04-27T21:23:31Z</dc:date>
    <item>
      <title>How to use OpenCL 2.0 atomics</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/How-to-use-OpenCL-2-0-atomics/m-p/1269950#M6887</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I am compiling OpenCL programs on Intel CPU and the integrated GPU. The processor is i9-9700K.&amp;nbsp; The driver is 26.20.xx.xx and&amp;nbsp;system_studio_2020 is installed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; OpenCL 2.0 atomics such as&amp;nbsp;atomic_compare_exchange_strong_explicit are used and the "-cl-std=CL2.0" flag is provided in&amp;nbsp;clBuildProgram.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; However, the function&amp;nbsp;clBuildProgram returns -11 (&lt;SPAN class="errorname"&gt;CL_BUILD_PROGRAM_FAILURE&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;) and the information is "implicit declaration of function 'atomic_compare_exchange_strong_explicit' is invalid in OpenCL".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; How to use 2.0 atomics? Or they are not supported by Intel?&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 11:53:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/How-to-use-OpenCL-2-0-atomics/m-p/1269950#M6887</guid>
      <dc:creator>cllh80</dc:creator>
      <dc:date>2021-04-01T11:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to use OpenCL 2.0 atomics</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/How-to-use-OpenCL-2-0-atomics/m-p/1277130#M6893</link>
      <description>&lt;P&gt;Hello, and apologies for the slow reply.&lt;/P&gt;
&lt;P&gt;Both the CPU and GPU OpenCL devices support OpenCL 2.0 atomics.&lt;/P&gt;
&lt;P&gt;A few things to try:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Can you check your program build log to see if it provides any additional information?&lt;/LI&gt;
&lt;LI&gt;Can you try compiling for the CPU and GPU devices separately?&amp;nbsp; Are both devices failing, or just one?&lt;/LI&gt;
&lt;LI&gt;Can you try a simpler kernel?&amp;nbsp; Here is a simple example that successfully compiles through Clang:&amp;nbsp;&lt;A href="https://godbolt.org/z/dnbTco5ca" target="_blank"&gt;https://godbolt.org/z/dnbTco5ca&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 21:23:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/How-to-use-OpenCL-2-0-atomics/m-p/1277130#M6893</guid>
      <dc:creator>Ben_A_Intel</dc:creator>
      <dc:date>2021-04-27T21:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to use OpenCL 2.0 atomics</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/How-to-use-OpenCL-2-0-atomics/m-p/1277276#M6894</link>
      <description>&lt;P&gt;Thank you for your reply.&lt;/P&gt;
&lt;P&gt;Now we can use OpenCL 2.0 atomics on both the CPU and the GPU. However a new problem has occured.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is like this:&lt;/P&gt;
&lt;P&gt;We run a kernel on the GPU and the kernel operates on an Integer array (where each value is zero initially) using OpenCL 2.0 atomics (atomic_compare_exchange_strong_explicit) to set element values. Finanlly, in the kernel we calculate the number of keys whose values are not zero and could get the right result. But if the program comes back to the host, the number of keys is calculated again and the correct number could not be acquired.&amp;nbsp; The data structures are allocated by&amp;nbsp;clSVMAlloc and "CL_MEM_READ_WRITE | CL_MEM_SVM_FINE_GRAIN_BUFFER | CL_MEM_SVM_ATOMICS" are used.&lt;/P&gt;
&lt;P&gt;So if an array is set by the GPU, could its values be seen correctly by the CPU?&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Apr 2021 07:48:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/How-to-use-OpenCL-2-0-atomics/m-p/1277276#M6894</guid>
      <dc:creator>cllh80</dc:creator>
      <dc:date>2021-04-28T07:48:01Z</dc:date>
    </item>
  </channel>
</rss>

