<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:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Courier New";
        color:windowtext;}
.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="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-family:"Courier New"">Hi Michaël,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">Thanks for you feedback.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">> it's currently possible to know for a given type which VectorSpecies is preferred<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">> on the current platform.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">I think the preferred species is usually the largest available species.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">> an application developer would want to know which Operator will be preferred (i.e.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">> backed by an appropriate SIMD instruction) on a targeted platform. Similarly, a<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">> library developer would want to be able to pick at runtime between different<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">> implementations of an algorithm.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">Usually, the larger species would have better performance since more data could be<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">handled in just one time. That’s true that it’s architecture dependent. Even though<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">some instructions have low throughput in a larger size, a well implemented backend<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">should choose the optimal instructions and should not trouble the Java developers.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">Have you ever found a case that has better performance but with a smaller species on<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">any platform? If there is, perhaps some micro-architecture optimizations should be done.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">- Eric<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> panama-dev <panama-dev-retn@openjdk.org> <b>On Behalf Of
</b>Michaël Figuière<br>
<b>Sent:</b> Saturday, October 15, 2022 1:56 AM<br>
<b>To:</b> panama-dev@openjdk.org<br>
<b>Subject:</b> [Vector API] Missing a way to know which operators are preferred<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hello,<br>
<br>
A suggestion based on my small experience with the Vector API: it's currently possible to know for<o:p></o:p></p>
<div>
<p class="MsoNormal">a given type which VectorSpecies is preferred on the current platform, but it's not the case for<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Operator. As the Vector API is all about improved performance, an application developer would<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">want to know which Operator will be preferred (i.e. backed by an appropriate SIMD instruction) on<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">a targeted platform. Similarly, a library developer would want to be able to pick at runtime between<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">different implementations of an algorithm.<o:p></o:p></p>
<div>
<p class="MsoNormal"><br>
That could look like:<br>
<br>
boolean VectorOperators.Operator#isPreferredWith(VectorSpecies)<br>
<br>
I haven't looked at the implementation details but I assume that it would be doable as the Operator<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">actual implementation is already picked based on CPU instructions availability.<br>
<br>
Thanks,<br>
Michaël<o:p></o:p></p>
</div>
</div>
</div>
</div>
</body>
</html>