<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:"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:"Helvetica Neue";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"\.PingFang TC";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
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.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
p.gmail-p1, li.gmail-p1, div.gmail-p1
        {mso-style-name:gmail-p1;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
p.gmail-p2, li.gmail-p2, div.gmail-p2
        {mso-style-name:gmail-p2;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
p.gmail-p3, li.gmail-p3, div.gmail-p3
        {mso-style-name:gmail-p3;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.gmail-s1
        {mso-style-name:gmail-s1;}
span.gmail-apple-converted-space
        {mso-style-name:gmail-apple-converted-space;}
span.EmailStyle23
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle24
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle26
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.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="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">    Looking at the language reference, vscale is an integer. This might pose a problem for fractional vscale. Furthermore, I believe that vscale is constant throughout the life of the program; so if RISC-V vscale can vary from instruction
 to instruction that may also be problematic unless you can just commit to one specific value of vscale.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">   Also, I had a question about your table. Based on your description of how LMUL works, I’d expect that LMUL == vscale, and that each column in your table would be the same:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="gmail-p2" style="margin:0in;margin-bottom:.0001pt"><span style="font-size:9.0pt;font-family:"Helvetica Neue",serif;color:#454545"><o:p> </o:p></span></p>
<p class="gmail-p3" style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:9.0pt;font-family:"Courier New";color:#454545">int64_t | vscale x 1 x i64<o:p></o:p></span></p>
<p class="gmail-p3" style="margin:0in;margin-bottom:.0001pt"><span style="font-size:9.0pt;font-family:"Courier New";color:#454545">int32_t | vscale x 2 x i32<o:p></o:p></span></p>
<p class="gmail-p3" style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:9.0pt;font-family:"Courier New";color:#454545">int16_t | vscale x 4 x i16<o:p></o:p></span></p>
<p class="MsoNormal" style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:9.0pt;font-family:"Courier New";color:#454545"> </span></span><span style="font-size:9.0pt;font-family:"Courier New";color:#454545">int8_t | vscale x 8 x i8<span class="gmail-apple-converted-space"> </span></span><span class="gmail-apple-converted-space"><o:p></o:p></span></p>
<p class="MsoNormal"><span class="gmail-apple-converted-space"><span style="font-size:9.0pt;font-family:"Courier New";color:#454545"><o:p> </o:p></span></span></p>
<p class="MsoNormal">… which is basically equivalent to:<o:p></o:p></p>
<p class="MsoNormal"><span class="gmail-apple-converted-space"><span style="font-size:9.0pt;font-family:"Courier New";color:#454545"><o:p> </o:p></span></span></p>
<p class="gmail-p3" style="margin:0in;margin-bottom:.0001pt"><span style="font-size:9.0pt;font-family:"Courier New";color:#454545">int64_t | LMUL x 1 x i64</span><o:p></o:p></p>
<p class="gmail-p3" style="margin:0in;margin-bottom:.0001pt"><span style="font-size:9.0pt;font-family:"Courier New";color:#454545">int32_t | LMUL x 2 x i32<o:p></o:p></span></p>
<p class="gmail-p3" style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:9.0pt;font-family:"Courier New";color:#454545">int16_t | LMUL x 4 x i16<o:p></o:p></span></p>
<p class="MsoNormal" style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:9.0pt;font-family:"Courier New";color:#454545"> </span></span><span style="font-size:9.0pt;font-family:"Courier New";color:#454545">int8_t | LMUL x 8 x i8<span class="gmail-apple-converted-space"> </span></span><span class="gmail-apple-converted-space"><o:p></o:p></span></p>
<p class="MsoNormal"><span class="gmail-apple-converted-space"><span style="font-size:9.0pt;font-family:"Courier New";color:#454545"><o:p> </o:p></span></span></p>
<p class="MsoNormal"><span class="gmail-apple-converted-space"><span style="font-size:9.0pt;font-family:"Courier New";color:#454545"><o:p> </o:p></span></span></p>
<p class="MsoNormal">… is this not the case?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal">   Chris Tetreault<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>From:</b> llvm-dev <<a href="mailto:llvm-dev-bounces@lists.llvm.org">llvm-dev-bounces@lists.llvm.org</a>>
<b>On Behalf Of </b>Kai Wang via llvm-dev<br>
<b>Sent:</b> Tuesday, April 7, 2020 1:31 AM<br>
<b>To:</b> <a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<b>Cc:</b> Roger Ferrer Ibanez <<a href="mailto:roger.ferrer@bsc.es">roger.ferrer@bsc.es</a>>;
<a href="mailto:rengolin@gmail.co">rengolin@gmail.co</a>; <a href="mailto:robin.kruppe@gmail.com">
robin.kruppe@gmail.com</a><br>
<b>Subject:</b> [EXT] [llvm-dev] Questions about vscale<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="gmail-p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size:9.0pt;font-family:"Helvetica Neue",serif;color:#454545">Hi,<o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:9.0pt;font-family:"Helvetica Neue",serif;color:#454545"><o:p> </o:p></span></p>
<p class="gmail-p1" style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:9.0pt;font-family:"Helvetica Neue",serif;color:#454545">In RISC-V v-extension</span><span class="gmail-s1"><span style="font-size:9.0pt;font-family:".PingFang TC",serif;color:#454545">,</span></span><span style="font-size:9.0pt;font-family:"Helvetica Neue",serif;color:#454545">
 operations could operate on a group of vector registers</span><span class="gmail-s1"><span style="font-size:9.0pt;font-family:".PingFang TC",serif;color:#454545">;</span></span><span style="font-size:9.0pt;font-family:"Helvetica Neue",serif;color:#454545">
 we called it LMUL. If LMUL equals 2</span><span class="gmail-s1"><span style="font-size:9.0pt;font-family:".PingFang TC",serif;color:#454545">,</span></span><span style="font-size:9.0pt;font-family:"Helvetica Neue",serif;color:#454545"> it means we could operate
 on 2 vector registers at the same time. So</span><span class="gmail-s1"><span style="font-size:9.0pt;font-family:".PingFang TC",serif;color:#454545">,</span></span><span style="font-size:9.0pt;font-family:"Helvetica Neue",serif;color:#454545"> we have the
 following combinations of types.<o:p></o:p></span></p>
<p class="gmail-p2" style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;min-height:14px">
<span style="font-size:9.0pt;font-family:"Helvetica Neue",serif;color:#454545"><o:p> </o:p></span></p>
<p class="gmail-p3" style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:9.0pt;font-family:"Courier New";color:#454545">         
</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:#454545">LMUL = 1
<span class="gmail-apple-converted-space">          </span>LMUL = 2<span class="gmail-apple-converted-space">           
</span>LMUL = 4<span class="gmail-apple-converted-space">            </span>LMUL = 8<o:p></o:p></span></p>
<p class="gmail-p3" style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:9.0pt;font-family:"Courier New";color:#454545">int64_t | vscale x 1 x i64 | vscale x<span class="gmail-apple-converted-space"> 
</span>2 x i64 | vscale x<span class="gmail-apple-converted-space">  </span>4 x i64 | vscale x<span class="gmail-apple-converted-space"> 
</span>8 x i64<o:p></o:p></span></p>
<p class="gmail-p3" style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:9.0pt;font-family:"Courier New";color:#454545">int32_t | vscale x 2 x i32 | vscale x<span class="gmail-apple-converted-space"> 
</span>4 x i32 | vscale x<span class="gmail-apple-converted-space">  </span>8 x i32 | vscale x 16 x i32<o:p></o:p></span></p>
<p class="gmail-p3" style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:9.0pt;font-family:"Courier New";color:#454545">int16_t | vscale x 4 x i16 | vscale x<span class="gmail-apple-converted-space"> 
</span>8 x i16 | vscale x 16 x i16 | vscale x 32 x i16<o:p></o:p></span></p>
<p class="gmail-p3" style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span class="gmail-apple-converted-space"><span style="font-size:9.0pt;font-family:"Courier New";color:#454545"> </span></span><span style="font-size:9.0pt;font-family:"Courier New";color:#454545">int8_t | vscale x 8 x i8<span class="gmail-apple-converted-space"> 
</span>| vscale x 16 x i8<span class="gmail-apple-converted-space">  </span>| vscale x 32 x i8<span class="gmail-apple-converted-space"> 
</span>| vscale x 64 x i8<o:p></o:p></span></p>
<p class="gmail-p2" style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;min-height:14px">
<span style="font-size:9.0pt;font-family:"Helvetica Neue",serif;color:#454545"><o:p> </o:p></span></p>
<p class="gmail-p1" style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:9.0pt;font-family:"Helvetica Neue",serif;color:#454545">We have another architecture parameter</span><span class="gmail-s1"><span style="font-size:9.0pt;font-family:".PingFang TC",serif;color:#454545">,</span></span><span style="font-size:9.0pt;font-family:"Helvetica Neue",serif;color:#454545">
 ELEN</span><span class="gmail-s1"><span style="font-size:9.0pt;font-family:".PingFang TC",serif;color:#454545">,</span></span><span style="font-size:9.0pt;font-family:"Helvetica Neue",serif;color:#454545"> which means the maximum size of a single vector element
 in bits.<o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:9.0pt;font-family:"Helvetica Neue",serif;color:#454545">We hope the type system could be consistent under ELEN = 32 and ELEN = 64. However</span><span class="gmail-s1"><span style="font-size:9.0pt;font-family:".PingFang TC",serif;color:#454545">,</span></span><span style="font-size:9.0pt;font-family:"Helvetica Neue",serif;color:#454545">
 vscale may be a fractional value under ELEN = 32 in the above type system. When ELEN = 32</span><span class="gmail-s1"><span style="font-size:9.0pt;font-family:".PingFang TC",serif;color:#454545">,</span></span><span style="font-size:9.0pt;font-family:"Helvetica Neue",serif;color:#454545">
 i64 is an invalid type (we could ignore the first row for ELEN = 32) and vscale may become 1/2 on run time to fit the architecture
</span><span class="gmail-s1"><span style="font-size:9.0pt;font-family:".PingFang TC",serif;color:#454545">(</span></span><span style="font-size:9.0pt;font-family:"Helvetica Neue",serif;color:#454545">if the vector register only has 32 bits</span><span class="gmail-s1"><span style="font-size:9.0pt;font-family:".PingFang TC",serif;color:#454545">)</span></span><span style="font-size:9.0pt;font-family:"Helvetica Neue",serif;color:#454545">.
 Is there any problem to assume vscale to be fractional under some circumstances? vscale should be an unknown value when compiling. So</span><span class="gmail-s1"><span style="font-size:9.0pt;font-family:".PingFang TC",serif;color:#454545">,</span></span><span style="font-size:9.0pt;font-family:"Helvetica Neue",serif;color:#454545">
 it should have no impact on code generation and optimization. The relationship between types is correct regardless vscale</span><span class="gmail-s1"><span style="font-size:9.0pt;font-family:".PingFang TC",serif;color:#454545">’</span></span><span style="font-size:9.0pt;font-family:"Helvetica Neue",serif;color:#454545">s
 value. Is there anything I missed</span><span style="font-size:9.0pt;font-family:".PingFang TC",serif;color:#454545">?</span><span style="font-size:9.0pt;color:#454545"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:9.0pt;color:#454545"><o:p> </o:p></span></p>
<p class="gmail-p1" style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:9.0pt;font-family:".PingFang TC",serif;color:#454545">Thanks!</span><span style="font-size:9.0pt;color:#454545"><o:p></o:p></span></p>
<p class="gmail-p1" style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:9.0pt;font-family:".PingFang TC",serif;color:#454545">Hsiangkai</span><span style="font-size:9.0pt;color:#454545"><o:p></o:p></span></p>
</div>
</div>
</body>
</html>