<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)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
@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:"\@MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.emailquote, li.emailquote, div.emailquote
        {mso-style-name:emailquote;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:1.0pt;
        border:none;
        padding:0in;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
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 lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">For example, Type 2 case, scalar-foo used call by value while vector-foo used call by ref. The question Johannes is asking is whether we can decipher that after
 the fact, only by looking at the two function signatures, or need some more info (what kind, what’s minimal)? I think we need to list up cases of interest, and for each vector ABI of interest, we need to work on the requirements and determine whether deciphering
 after the fact is feasible.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">I think we can make further progress on trivial cases (where FE doesn’t “change” type) while we continue working out the details on non-trivial cases.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Hideki<o:p></o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></a></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><a name="_____replyseparator"></a><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Doerfert, Johannes [mailto:jdoerfert@anl.gov]
<br>
<b>Sent:</b> Monday, June 24, 2019 9:21 AM<br>
<b>To:</b> Francesco Petrogalli <Francesco.Petrogalli@arm.com>; Tian, Xinmin <xinmin.tian@intel.com><br>
<b>Cc:</b> Saito, Hideki <hideki.saito@intel.com>; Simon Moll <moll@cs.uni-saarland.de>; LLVM Development List <llvm-dev@lists.llvm.org>; Clang Dev <cfe-dev@lists.llvm.org>; Renato Golin <rengolin@gmail.com>; Finkel, Hal J. <hfinkel@anl.gov>; Andrea Bocci <andrea.bocci@cern.ch>;
 Elovikov, Andrei <andrei.elovikov@intel.com>; Alexey Bataev <a.bataev@hotmail.com>; nd <nd@arm.com>; Roman Lebedev <lebedev.ri@gmail.com>; Philip Reames <listmail@philipreames.com>; Shawn Landden <slandden@gmail.com><br>
<b>Subject:</b> Re: RFC: Interface user provided vector functions with the vectorizer.<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black">I mean, the FE will create only one of the 3 vector versions matching the one we want for a given vector length, wouldn't it? The question
 now is: can we with the scalar and one vector version correctly vectorize the call. If the answer is no, what is the minimal amount of information, in addition to the two version, we would need?<o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black">Get
<a href="https://aka.ms/ghei36">Outlook for Android</a><o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="x_divRplyFwdMsg">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> Francesco Petrogalli <<a href="mailto:Francesco.Petrogalli@arm.com">Francesco.Petrogalli@arm.com</a>><br>
<b>Sent:</b> Monday, June 24, 2019 6:06:12 PM<br>
<b>To:</b> Tian, Xinmin<br>
<b>Cc:</b> Doerfert, Johannes; Saito, Hideki; Simon Moll; LLVM Development List; Clang Dev; Renato Golin; Finkel, Hal J.; Andrea Bocci; Elovikov, Andrei; Alexey Bataev; nd; Roman Lebedev; Philip Reames; Shawn Landden<br>
<b>Subject:</b> Re: RFC: Interface user provided vector functions with the vectorizer.</span>
<o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"><br>
<br>
> On Jun 24, 2019, at 10:53 AM, Tian, Xinmin <<a href="mailto:xinmin.tian@intel.com">xinmin.tian@intel.com</a>> wrote:<br>
> <br>
> To me, it is also an issue related to SIMD signature matching when the vectorizer kicks in. Losing info from FE to BE is not good in general.<br>
>  <br>
<br>
Yes, we cannot loose such information. In particular, the three examples I reported are all generating i64 in the scalar function signature:<br>
<br>
// Type 1<br>
typedef _Complex int S;<br>
<br>
// Type 2 <br>
typedef struct x{<br>
int a;<br>
int b;<br>
} S;<br>
<br>
// Type 3<br>
typedef uint64_t S;<br>
<br>
S foo(S a, S b) {<br>
return ...;<br>
}<br>
<br>
<br>
On AArch64, the correspondent vector function signature in the three cases would be (for 2-lane unmasked vectorization):<br>
<br>
// Type 1:<br>
<br>
<4 x int> vectorized_foo(<4 x int>, <4 x int>)<br>
<br>
// Type 2:<br>
<br>
%a = type struct {I 32, i32}<br>
<br>
<2 x %a* > vectorized_foo(<2 x %a*> , <2 x %a*>)<br>
<br>
// Type 3:<br>
<br>
<2 x i64> vectorized_foo(<2 x i64>, <2 x i64)<br>
<br>
To make sure that the vectorizer knows how to map the scalar function parameters to the vector ones, we have to make sure that the original signature  information is stored somewhere.<br>
<br>
I will work on this, and provide examples.<br>
<br>
Suggestions are welcome.<br>
<br>
Thank you<br>
<br>
Francesco<o:p></o:p></span></p>
</div>
</div>
</body>
</html>