<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=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<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;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@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">Adding Adam and Gerolf.<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">>This would also create a decent IR representation of a matrix or other 2D vector: matMxN would be <N x <M x float>><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"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">It may be time to consolidate the discussion with Matrix support RFC (http://lists.llvm.org/pipermail/llvm-dev/2018-December/128322.html), and talk about possible
 phasing-in of “features”<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"><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>
<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"> Jacob Lifshay [mailto:programmerjake@gmail.com]
<br>
<b>Sent:</b> Thursday, February 07, 2019 4:06 PM<br>
<b>To:</b> Simon Moll <moll@cs.uni-saarland.de><br>
<b>Cc:</b> David Greene <dag@cray.com>; Robin Kruppe <robin.kruppe@gmail.com>; llvm-dev <llvm-dev@lists.llvm.org>; Maslov, Sergey V <sergey.v.maslov@intel.com>; Luke Kenneth Casson Leighton <lkcl@lkcl.net>; Saito, Hideki <hideki.saito@intel.com>; Topper, Craig
 <craig.topper@intel.com><br>
<b>Subject:</b> Re: [llvm-dev] [RFC] Vector Predication<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<div>
<p class="MsoNormal">On Thu, Feb 7, 2019, 09:21 Simon Moll <<a href="mailto:moll@cs.uni-saarland.de">moll@cs.uni-saarland.de</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal"><br>
On 2/7/19 6:08 PM, David Greene wrote:<br>
> Jacob Lifshay <<a href="mailto:programmerjake@gmail.com" target="_blank">programmerjake@gmail.com</a>> writes:<br>
><br>
>> So it would be handy for the vector length on evl intrinsics to be in<br>
>> units of the mask length so we don't have to pattern match a division<br>
>> in the backend. We could have 2 variants of the vector length<br>
>> argument, one in terms of the data vector and one in terms of the mask<br>
>> vector. we could legalize the mask vector variant for those<br>
>> architectures that need it by pulling the multiplication out and<br>
>> switching to the data vector variants.<br>
> Would it make sense to have two different intrinsics?<br>
><br>
> # "Normal" form, L is in terms of flat vector length.<br>
> <scalable 2 x float> evl.fsub(<scalable 2 x float> %x,<br>
>                                <scalable 2 x float> %y,<br>
>                                <scalable 2 x i1> %M, i32 %L)<br>
><br>
> # "Sub-vector" form, L is in terms of sub-vectors elements.<br>
> <scalable 1 x <2 x float>> evl.fsub(<scalable 1 x <2 x float>> %x,<br>
>                                      <scalable 1 x <2 x float>> %y,<br>
>                                      <scalable 1 x <2 x i1>> %M, i32 %L<br>
><br>
> Overloading types to mean two very different things is confusing to me.<br>
><br>
>                             -David<br>
<br>
Allowing vector types as vector elements would solve the vlen <br>
interpretation issue in an elegant way.<o:p></o:p></p>
</blockquote>
</div>
</div>
<div>
<p class="MsoNormal">This seems like the best solution, though maybe out of scope of the current evl proposal. This would also create a decent IR representation of a matrix or other 2D vector: matMxN would be <N x <M x float>>.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">While we're adding this, it may be a good idea to go all in and just lift the restriction on vectors containing other non-scalable vectors, so you could do something like: <scalable 1 x <4 x <4 x float>>> to be a scalable vector of 4x4
 matrices.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">all the standard arithmetic operations (fadd, fmul, etc.) would still be the standard operations (so fmul would be element-wise, not matrix multiplication), we would, as a separate proposal, add matrix multiplication as a separate intrinsic.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Most operations would treat a <scalable I x <J x <K x <L x ... type ...>>>> as a <scalable I x <(J * K * L * ...) x type>> for everything but result type.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">We could have methods on Type that return the next level down vector type, the scalar type under the vector type nest (probably getScalarType), and the number of total scalar elements (getVectorNumElementsRecursive) assuming VL is the first
 valid non-zero integer: so <span style="font-family:"Arial",sans-serif"><scalable I x <J x <K x <L x ... type ...>>>> returns I * J * K * L * ...</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif">We will probably want to cache the innermost scalar type and the number of total scalar elements. Since we want to avoid adding another field to Type, we could have vector types store the getVectorNumElementsRecursive  instead
 of the getVectorNumElements value, for getVectorNumElements we would divide the stored value by the stored value of the next level down.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">There would be a pass to convert vector kinds for different targets.<o:p></o:p></p>
</div>
<div>
<div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
- Simon<br>
<br>
-- <br>
<br>
Simon Moll<br>
Researcher / PhD Student<br>
<br>
Compiler Design Lab (Prof. Hack)<br>
Saarland University, Computer Science<br>
Building E1.3, Room 4.31<br>
<br>
Tel. +49 (0)681 302-57521 : <a href="mailto:moll@cs.uni-saarland.de" target="_blank">
moll@cs.uni-saarland.de</a><br>
Fax. +49 (0)681 302-3065  : <a href="http://compilers.cs.uni-saarland.de/people/moll" target="_blank">
http://compilers.cs.uni-saarland.de/people/moll</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</div>
</div>
</body>
</html>