<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hi Craig and Kito,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Thanks for starting the GCC thread. I have added my thoughts there too. Looks like the GNU community is open about enabling _Float16, so I think that this is the approach that we should take.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Craig contacted me about different behaviour between GCC and Clang when FP16 isn't enabled, for example:
<a href="https://godbolt.org/z/vx6rnG" id="LPlnk">https://godbolt.org/z/vx6rnG</a>. <span style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">My colleague reminded me that this is related to </span><span style="color:rgb(0,0,0); font-family:calibri,arial,helvetica,sans-serif; font-size:12pt">FLT_EVAL_METHOD.
With</span><span style="color:rgb(0,0,0); font-family:calibri,arial,helvetica,sans-serif; font-size:12pt; background-color:rgba(0,0,0,0)"> </span><span style="color:rgb(0,0,0); font-family:calibri,arial,helvetica,sans-serif; font-size:12pt"><span style="color:rgb(0,0,0); font-family:calibri,arial,helvetica,sans-serif; font-size:12pt; background-color:rgba(0,0,0,0); display:inline!important">FLT_EVAL_METHOD=0,
smaller types and expressions are evaluated in single-precision without the need for intermediate rounding. So, GCC is right here, and Clang is wrong.
</span></span><span style="color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; background: var(--white);">With FP16 enabled, we see that GCC switches to </span><span style="color: rgb(0, 0, 0); font-size: 12pt; font-family: calibri, arial, helvetica, sans-serif;">FLT_EVAL_METHOD=16,
where as in Clang we still use 0 which is wrong: </span><a href="https://godbolt.org/z/j3KhGa" id="LPlnk302822" style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">https://godbolt.org/z/j3KhGa</a><span style="color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; background: var(--white);">. </span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I wanted to raise a ticket for this, but noticed that you already did: <a href="https://bugs.llvm.org/show_bug.cgi?id=43475" id="LPlnk452328">https://bugs.llvm.org/show_bug.cgi?id=43475</a>. I will add some information to that a bit later.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Cheers,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Sjoerd.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div id="appendonsend"></div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Craig Topper <craig.topper@gmail.com><br>
<b>Sent:</b> 11 March 2021 22:06<br>
<b>To:</b> James Y Knight <jyknight@google.com><br>
<b>Cc:</b> Sjoerd Meijer <Sjoerd.Meijer@arm.com>; Yi-Hsiu Hsu <yihsiu.hsu@sifive.com>; Zakk Chen <zakk.chen@sifive.com>; cfe-dev@lists.llvm.org <cfe-dev@lists.llvm.org>; Evandro Menezes <evandro.menezes@sifive.com>; Craig Topper <craig.topper@sifive.com><br>
<b>Subject:</b> Re: [cfe-dev] [RFC] Having different behavior for __fp16 on RISC-V</font>
<div> </div>
</div>
<div>
<div dir="ltr"><span style="color:rgb(0,0,0); font-family:Helvetica; font-size:12px">A thread has been started on the gcc mailing list. </span><a href="https://gcc.gnu.org/pipermail/gcc/2021-March/234962.html" class="x_gmail-" style="font-family:Helvetica; font-size:12px">https://gcc.gnu.org/pipermail/gcc/2021-March/234962.html</a>
<div><br clear="all">
<div>
<div dir="ltr" class="x_gmail_signature">~Craig</div>
</div>
<br>
</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Thu, Mar 11, 2021 at 10:43 AM James Y Knight via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div dir="ltr"><br>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Thu, Mar 11, 2021 at 11:20 AM Sjoerd Meijer via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<blockquote style="border-color:rgb(200,200,200); border-left-width:3px; border-left-style:solid; padding-left:1ex; margin-left:0.8ex; color:rgb(102,102,102)">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>In fact there is kind of awkward story behind this, we chose __fp16 rather than _Float16, major reason is GCC supporting, and also we saw ARM/AArch64 deprecated that for a while, but _Float16 problem still there in GCC, so we decide to using __fp16 rather
than _Float16.</span></div>
</blockquote>
<div><span style="font-family:calibri,arial,helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgba(0,0,0,0)">I am not really following this.</span><br>
</div>
<blockquote style="border-color:rgb(200,200,200); border-left-width:3px; border-left-style:solid; padding-left:1ex; margin-left:0.8ex; color:rgb(102,102,102)">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>And we also considering the compatible issue there, I mean the compatibility of ACLE's __fp16, __fp16 isn't a language extension for GCC, it's a target specific type for ARM/AArch64, so if we don't define that as a formal extension types, then we have
broken support/compiler compatibility issue on this due to GCC didn't support __fp16 as language extension.</span></div>
</blockquote>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
And am not entirely sure about this.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I don't think I have changed my mind on this topic, and I don't know what else/more I can add to what I have already mentioned.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I won't repeat my arguments, but the bottom line is that we want to deprecate __fp16, while you like to rebrand it to a native half-precision type, and I don't see how this goes together very well. I also remain unconvinced about the arguments against _Float16,
which I think is the solution.<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I don't know what your options are now. Maybe someone else can weigh in and shine a light on this, perhaps I am missing something. I don't know if you can go ahead and make these changes if you get an LGTM from someone else, but I hope the community sees the
problem of the same type behaving different on different targets.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="font-family:Arial,Helvetica,sans-serif; font-size:small; color:rgb(34,34,34)"></span></div>
</div>
</blockquote>
<div><br>
</div>
<div>I don't know why _Float16 isn't implemented by GCC in C++ mode, but I'd agree that using _Float16 for RISC-V, and adding support for _Float16 to GCC's C++ mode does seem like the better solution here, especially given that such support will also be needed
for ARM.</div>
<div><br>
</div>
</div>
</div>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote>
</div>
</div>
</body>
</html>