<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Book Antiqua";
        panose-1:2 4 6 2 5 3 5 3 3 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"Book Antiqua \,serif";}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;
        mso-fareast-language:EN-US;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Book Antiqua",serif;
        color:windowtext;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Book Antiqua",serif;
        color:windowtext;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Book Antiqua",serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor="white" lang="EN-IE" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext">Hi again.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext">Sorry for the noise.  I have just realised that this has been resolved more or less as I suggested in the v6.0 sources – the diagnostic is now only generated
 if the source language is OpenCL.  My apologies for distracting people on something that has already been resolved – I should have checked v6 or head first, and thanks again Eli for your careful response.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext">            MartinO<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="color:windowtext;mso-fareast-language:EN-IE">From:</span></b><span lang="EN-US" style="color:windowtext;mso-fareast-language:EN-IE"> cfe-dev [mailto:cfe-dev-bounces@lists.llvm.org]
<b>On Behalf Of </b>ORiordan, Martin via cfe-dev<br>
<b>Sent:</b> Saturday, February 17, 2018 11:28 AM<br>
<b>To:</b> Friedman, Eli <efriedma@codeaurora.org>; Clang Dev <cfe-dev@lists.llvm.org><br>
<b>Subject:</b> Re: [cfe-dev] Sub-vector selection and CLang v5.0<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext">Thanks for the explanation Eli.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext">In this case the source language is C using the vector extensions – I chose ‘</span><span style="font-size:12.0pt;font-family:"Courier New";color:windowtext">char16</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext">’
 because it is familiar, but it could have been the ARM Neon form:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New";color:windowtext">typedef char int8x16_t __attribute__((ext_vector_type(16)));<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New";color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New";color:windowtext">int8x16_t
</span><span style="font-size:12.0pt;font-family:"Courier New"">v0, v1;</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New"">...</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New"">v1.s0123456 = v0.s0123456; // Replace the 1<sup>st</sup> 7-elements of ‘v1’ with the 1<sup>st</sup> 7-elements of ‘v0’</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext">However, though OpenCL has a hard semantic requirement for swizzle vector lengths, there is no corresponding restriction on extensions for other languages
 that do not formally specify such a semantic constraint.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext">In the machine vision [MV] space we use a lot of vectors that are 3, 5, 7, 11 and 13 elements in length (NxN matrices heavily used in convolutions).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext">LLVM itself has no difficulty handling swizzles with arbitrary sub-vector lengths, so I would like to suggest that this test is only enabled if the source
 language is OpenCL.  Our Myriad:SHAVE target implementation also has very carefully optimised code generation for these odd-element length swizzles because algorithms using them are so common in the MV space.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext">Replace:<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New";color:windowtext">if (IsValidOpenCLComponentSwizzleLength(SwizzleLength) == false) {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext">with:<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New";color:windowtext">if (S.getLangOpts().OpenCL && IsValidOpenCLComponentSwizzleLength(SwizzleLength) == false) {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext">The rest of the ‘Sema’ checking and the LLVR-IR produced are valid for arbitrary sub-vector lengths.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext">            MartinO<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif;color:windowtext"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="color:windowtext;mso-fareast-language:EN-IE">From:</span></b><span lang="EN-US" style="color:windowtext;mso-fareast-language:EN-IE"> Friedman, Eli [<a href="mailto:efriedma@codeaurora.org">mailto:efriedma@codeaurora.org</a>]
<br>
<b>Sent:</b> Friday, February 16, 2018 9:36 PM<br>
<b>To:</b> ORiordan, Martin <<a href="mailto:martin.oriordan@intel.com">martin.oriordan@intel.com</a>>; Clang Dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>><br>
<b>Subject:</b> Re: [cfe-dev] Sub-vector selection and CLang v5.0<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On 2/16/2018 1:11 AM, ORiordan, Martin via cfe-dev wrote:<span style="font-size:12.0pt;mso-fareast-language:EN-IE"><o:p></o:p></span></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua \,serif"">Hi CFE-Devs,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua \,serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua \,serif"">I received a bug report for a breaking change between CLang v4.0 and v5.0 regarding sub-vectors that has been caused by:</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua \,serif""> </span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New""><a href="http://llvm.org/viewvc/llvm-project?view=revision&revision=298369">http://llvm.org/viewvc/llvm-project?view=revision&revision=298369</a></span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua \,serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua \,serif"">The example is as follows:</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua \,serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Courier New"">  char16 v0, v1;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Courier New"">  ...</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Courier New"">  v1.s0123456 = v0.s0123456; // Replace the 1<sup>st</sup> 7-elements of ‘v1’ with the 1<sup>st</sup> 7-elements of ‘v0’</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua \,serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua \,serif"">which used to generate valid code, but which is now diagnosed with the following error:</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua \,serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Courier New"">  error: vector component access has invalid length 7. Supported: 1,2,3,4,8,16.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua \,serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua \,serif"">However, I don’t see why it should not be possible to replace any range of elements of a vector with a corresponding set of elements.</span><o:p></o:p></p>
</blockquote>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;mso-fareast-language:EN-IE"><br>
Vector swizzles are defined in the OpenCL standard, and <a href="https://www.khronos.org/registry/OpenCL/specs/opencl-2.2-cplusplus.html#builtin-vector-data-types">
https://www.khronos.org/registry/OpenCL/specs/opencl-2.2-cplusplus.html#builtin-vector-data-types</a> says "vector-swizzle-selector shall have swizzle size of 1, 2, 3, 4, 8 or 16."<br>
<br>
-Eli<br>
<br>
<o:p></o:p></span></p>
<pre>-- <o:p></o:p></pre>
<pre>Employee of Qualcomm Innovation Center, Inc.<o:p></o:p></pre>
<pre>Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project<o:p></o:p></pre>
<p>--------------------------------------------------------------<br>
Intel Research and Development Ireland Limited<br>
Registered in Ireland<br>
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare<br>
Registered Number: 308263<o:p></o:p></p>
<p>This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all
 copies.<o:p></o:p></p>
</div>
<p>--------------------------------------------------------------<br>
Intel Research and Development Ireland Limited<br>
Registered in Ireland<br>
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare<br>
Registered Number: 308263</p>


<p>This e-mail and any attachments may contain confidential material for the
sole use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.</p>

<p></p>
</body>
</html>