<?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:Something went wrong when trying SYCL reduction variables with oneAPI in Intel® oneAPI DPC++/C++ Compiler</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Something-went-wrong-when-trying-SYCL-reduction-variables-with/m-p/1454387#M3039</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thank you for posting in intel communities.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Since this is a duplicate thread of &amp;lt;&lt;A href="https://community.intel.com/t5/Intel-oneAPI-Data-Parallel-C/problems-about-SYCL-reduction-variables-using-oneAPI/m-p/1454057#M2774" rel="noopener noreferrer" target="_blank"&gt;https://community.intel.com/t5/Intel-oneAPI-Data-Parallel-C/problems-about-SYCL-reduction-variables-using-oneAPI/m-p/1454057#M2774&lt;/A&gt;&amp;gt;, we will no longer monitor this thread. We will continue addressing this issue in the other thread.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks And Regards,&lt;/P&gt;&lt;P&gt;Aishwarya&lt;/P&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 08 Feb 2023 04:42:16 GMT</pubDate>
    <dc:creator>AishwaryaCV_Intel</dc:creator>
    <dc:date>2023-02-08T04:42:16Z</dc:date>
    <item>
      <title>Something went wrong when trying SYCL reduction variables with oneAPI</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Something-went-wrong-when-trying-SYCL-reduction-variables-with/m-p/1453997#M3038</link>
      <description>&lt;P&gt;Hi, I'm new to SYCL and am trying to run an example about reduction variables in the SYCL Specification. I revise the code a little and the final version is shown as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;#include &amp;lt;iostream&amp;gt;
#include &amp;lt;sycl/sycl.hpp&amp;gt;
#include &amp;lt;numeric&amp;gt;

using namespace sycl;

int main() {
	buffer&amp;lt;int&amp;gt; valuesBuf{ 1024 };
	{
		host_accessor a{ valuesBuf };
        // std::iota(a.begin(), a.end(), 0);
        std::iota(&amp;amp;(a[0]), &amp;amp;(a[1023]), 0);
	}

	int sumResult = 0;
	buffer&amp;lt;int&amp;gt; sumBuf{ &amp;amp;sumResult, 1 };
	int maxResult = 0;
	buffer&amp;lt;int&amp;gt; maxBuf{ &amp;amp;maxResult, 1 };

	queue myQueue;

	myQueue.submit([&amp;amp;](handler&amp;amp; cgh) {
		auto inputValues = valuesBuf.get_access&amp;lt;access_mode::read&amp;gt;(cgh);
	auto sumReduction = reduction(sumBuf, cgh, plus&amp;lt;&amp;gt;());
	auto maxReduction = reduction(maxBuf, cgh, maximum&amp;lt;&amp;gt;());

    /*
	 cgh.parallel_for(range&amp;lt;1&amp;gt; {2048, 1024}, sumReduction, maxReduction,
		[=](nd_item&amp;lt;1&amp;gt; it, auto&amp;amp; sum, auto&amp;amp; max) {
			sum += inputValues[it.get_local_id()];
			max.combine(inputValues[it.get_global_id()]);
		});
    */

    cgh.parallel_for(nd_range&amp;lt;1&amp;gt; {2048, 1024}, sumReduction, maxReduction,
		[=](nd_item&amp;lt;1&amp;gt; it, auto&amp;amp; sum, auto&amp;amp; max) {
			sum += inputValues[it.get_local_id()];
	        max.combine(inputValues[it.get_global_id()]);
		});
    });

	// assert(maxBuf.get_host_access()[0] == 1023 &amp;amp;&amp;amp; sumBuf.get_host_access()[0] == 523776);
    std::cout &amp;lt;&amp;lt; maxBuf.get_host_access()[0] &amp;lt;&amp;lt; std::endl;
    std::cout &amp;lt;&amp;lt; sumBuf.get_host_access()[0] &amp;lt;&amp;lt; std::endl;
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, there is still something wrong with it which I cannot figure out the reasons. The problems are:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;P&gt;The code can be successfully compiled in cmd with command&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;icpx -fsycl src.cpp -o o.exe​&lt;/LI-CODE&gt;while when compiled in Visual Studio 2022 with Intel(R) oneAPI DPC++ Compiler, it fails and pops out the error&lt;LI-CODE lang="markup"&gt;SYCL kernel cannot call a variadic function
SYCL kernel cannot call an undefined function without SYCL_EXTERNAL attribute&lt;/LI-CODE&gt;I have seen a similar problem in &lt;A href="https://community.intel.com/t5/Intel-oneAPI-Data-Parallel-C/SYCL-kernel-cannot-call-an-undefined-function-without-SYCL/m-p/1393885" target="_blank"&gt;Re: SYCL kernel cannot call an undefined function without SYCL_EXTERNAL attribute - Intel Communities &lt;/A&gt;&amp;nbsp;and &lt;A href="https://community.intel.com/t5/Intel-oneAPI-Data-Parallel-C/SYCL-kernel-cannot-call-an-undefined-function-without-SYCL/m-p/1382886#M2118" target="_blank"&gt;Re: SYCL kernel cannot call an undefined function without SYCL_EXTERNAL attribute - Intel Communities&lt;/A&gt;&amp;nbsp;and believe that Line 38 function&lt;LI-CODE lang="markup"&gt;max.combine(inputValues[it.get_global_id()]);​&lt;/LI-CODE&gt;triggers the compilation error, but cannot find a suitable solution to my code.&lt;/LI&gt;
&lt;LI&gt;&amp;nbsp;Even without the compilation problem above, the program cannot function as expected. For the program prints out nothing and exits with a meaningless value. The commands are shown below:&lt;LI-CODE lang="markup"&gt;C:\Users\a1595\Desktop\dr\c&amp;gt;icpx -fsycl c.cpp -o c.exe

C:\Users\a1595\Desktop\dr\c&amp;gt;c.exe

C:\Users\a1595\Desktop\dr\c&amp;gt;echo %ERRORLEVEL%
-1073740791​&lt;/LI-CODE&gt;A similar result also occurs in Visual Studio 2022 environment and I have no idea about it.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;I am looking forward to any help. Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 04:20:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Something-went-wrong-when-trying-SYCL-reduction-variables-with/m-p/1453997#M3038</guid>
      <dc:creator>JamesFBM</dc:creator>
      <dc:date>2023-02-07T04:20:59Z</dc:date>
    </item>
    <item>
      <title>Re:Something went wrong when trying SYCL reduction variables with oneAPI</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Something-went-wrong-when-trying-SYCL-reduction-variables-with/m-p/1454387#M3039</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thank you for posting in intel communities.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Since this is a duplicate thread of &amp;lt;&lt;A href="https://community.intel.com/t5/Intel-oneAPI-Data-Parallel-C/problems-about-SYCL-reduction-variables-using-oneAPI/m-p/1454057#M2774" rel="noopener noreferrer" target="_blank"&gt;https://community.intel.com/t5/Intel-oneAPI-Data-Parallel-C/problems-about-SYCL-reduction-variables-using-oneAPI/m-p/1454057#M2774&lt;/A&gt;&amp;gt;, we will no longer monitor this thread. We will continue addressing this issue in the other thread.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks And Regards,&lt;/P&gt;&lt;P&gt;Aishwarya&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Feb 2023 04:42:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Something-went-wrong-when-trying-SYCL-reduction-variables-with/m-p/1454387#M3039</guid>
      <dc:creator>AishwaryaCV_Intel</dc:creator>
      <dc:date>2023-02-08T04:42:16Z</dc:date>
    </item>
  </channel>
</rss>

