<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 24, 2015, at 1:39 PM, Mehdi Amini <<a href="mailto:mehdi.amini@apple.com" class="">mehdi.amini@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Mar 23, 2015, at 9:31 PM, Owen Anderson <<a href="mailto:resistor@mac.com" class="">resistor@mac.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Mar 23, 2015, at 1:48 PM, Mehdi AMINI <<a href="mailto:mehdi.amini@apple.com" class="">mehdi.amini@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">In principle you're right, that might not be *always* beneficial. But in general, it should be, because even when "high precision" operations are twice more expensive than "low precision" one, the transformation does not worsen things. Right now this is only enabled for PPC, for which low and high precision operations have the same cost. Tell me if this is not acceptable.<br class=""></blockquote><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Well you can imagine having more than twice the throughput in f16 than f32 on some targets, and you can also imagine that 2 x f16 operations consume less power than one f32.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I'd rather have Owen's opinion on this.</span></div></blockquote></div><br class=""><div class="">It’s pretty standard for GPUs to have higher throughput on narrower datatypes.  For instance, if double precision is half the throughput of single precision, then the proposed optimization turns a three cycle sequence into a four cycle sequence.</div></div></div></blockquote><div class=""><br class=""></div><div class="">Not exactly, I believe the proposed optimization turns two “low" and a “high” into two “high”.</div><div class="">Note that it seems to me that this optimization can apply if the two low are f16 and the high is a double precision. In pseudo IR code:</div><div class=""><br class=""></div><div class="">%mul = fmul half %u, %v</div><div class="">%fma = fma half %x, %y, %mul</div><div class="">%fmaext = fpextend half %fma to double</div><div class="">%fadd = fadd double %fmaext, %z</div><div class=""><br class=""></div><div class="">becomes:</div><div class=""><br class=""></div><div class=""><div class="">%xext = fpextend half %x to double</div><div class=""><div class="">%yext = fpextend half %y to double</div></div><div class=""><div class="">%uext = fpextend half %u to double</div></div><div class=""><div class="">%vext = fpextend half %v to double</div></div><div class=""><br class=""></div></div><div class=""><div class="">%fma1 = fma double %uext, %vext, %zext</div><div class="">%fma = fma double %xext, %yext, %fma1</div><div class=""><br class=""></div></div><div class="">(assuming that both half and double are legal on the target)</div></div></div></div></blockquote><br class=""></div><div>In that case, this looks more reasonable.  The profitabilty would depend on the ratio of the processor in question, but 2x seems like a pretty common design point.</div><div><br class=""></div><div>—Owen</div><br class=""></body></html>