<?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 Cilk array notation prevents gcc auto-vectorization? in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Cilk-array-notation-prevents-gcc-auto-vectorization/m-p/930657#M14705</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I am having a problem getting Cilk array notation to play well with Gcc auto-vectorization (i.e., -ftree-vectorize). &amp;nbsp;For example,&lt;/P&gt;
&lt;P&gt;(Let's refer to the code snippet at&amp;nbsp;&lt;A href="http://www.cilkplus.org/tutorial-add-arrays"&gt;http://www.cilkplus.org/tutorial-add-arrays&lt;/A&gt;&amp;nbsp;as copy.c).&lt;/P&gt;
&lt;P&gt;If I run&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;nbsp;gcc -fcilkplus -lcilkrts -Wall -O3 copy.c&lt;/P&gt;
&lt;P&gt;using "gcc version 4.8.1 20130520 (prerelease) (GCC)" downloaded from &lt;A href="https://www.cilkplus.org/download"&gt;https://www.cilkplus.org/download&lt;/A&gt;, I get a functionally correct code, but only the reference loop (i.e.,&lt;/P&gt;
&lt;P&gt;for (int i = 0; i &amp;lt; array_size; i++) c&lt;I&gt; = a&lt;I&gt; + b&lt;I&gt;;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;)&lt;/P&gt;
&lt;P&gt;will vectorize (according to both&amp;nbsp;-ftree-vectorizer-verbose=1 and manual assembly inspection). &amp;nbsp;I am having similar luck when explicitely using -ftree-vectorize without -O3. &amp;nbsp;I have verified that -O3 is not pruning the loops and the problem is still the same with other vector operators.&lt;/P&gt;
&lt;P&gt;The simplest problem is of course a missing flag, but I don't see documentation for such a flag (beyond -fcilkplus which is needed for array notation to compile). &amp;nbsp;Further, it seems that the simplest loops described in array notation do vectorize; e.g., 'c[:] = 5;'&lt;/P&gt;
&lt;P&gt;Thanks for any tips!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Chris Fletcher&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 17 Sep 2013 00:57:22 GMT</pubDate>
    <dc:creator>Christopher_F_</dc:creator>
    <dc:date>2013-09-17T00:57:22Z</dc:date>
    <item>
      <title>Cilk array notation prevents gcc auto-vectorization?</title>
      <link>https://community.intel.com/t5/Software-Archive/Cilk-array-notation-prevents-gcc-auto-vectorization/m-p/930657#M14705</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I am having a problem getting Cilk array notation to play well with Gcc auto-vectorization (i.e., -ftree-vectorize). &amp;nbsp;For example,&lt;/P&gt;
&lt;P&gt;(Let's refer to the code snippet at&amp;nbsp;&lt;A href="http://www.cilkplus.org/tutorial-add-arrays"&gt;http://www.cilkplus.org/tutorial-add-arrays&lt;/A&gt;&amp;nbsp;as copy.c).&lt;/P&gt;
&lt;P&gt;If I run&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;nbsp;gcc -fcilkplus -lcilkrts -Wall -O3 copy.c&lt;/P&gt;
&lt;P&gt;using "gcc version 4.8.1 20130520 (prerelease) (GCC)" downloaded from &lt;A href="https://www.cilkplus.org/download"&gt;https://www.cilkplus.org/download&lt;/A&gt;, I get a functionally correct code, but only the reference loop (i.e.,&lt;/P&gt;
&lt;P&gt;for (int i = 0; i &amp;lt; array_size; i++) c&lt;I&gt; = a&lt;I&gt; + b&lt;I&gt;;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;)&lt;/P&gt;
&lt;P&gt;will vectorize (according to both&amp;nbsp;-ftree-vectorizer-verbose=1 and manual assembly inspection). &amp;nbsp;I am having similar luck when explicitely using -ftree-vectorize without -O3. &amp;nbsp;I have verified that -O3 is not pruning the loops and the problem is still the same with other vector operators.&lt;/P&gt;
&lt;P&gt;The simplest problem is of course a missing flag, but I don't see documentation for such a flag (beyond -fcilkplus which is needed for array notation to compile). &amp;nbsp;Further, it seems that the simplest loops described in array notation do vectorize; e.g., 'c[:] = 5;'&lt;/P&gt;
&lt;P&gt;Thanks for any tips!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Chris Fletcher&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2013 00:57:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Cilk-array-notation-prevents-gcc-auto-vectorization/m-p/930657#M14705</guid>
      <dc:creator>Christopher_F_</dc:creator>
      <dc:date>2013-09-17T00:57:22Z</dc:date>
    </item>
  </channel>
</rss>

