<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 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><br class=""></div><div>Not exactly, I believe the proposed optimization turns two “low" and a “high” into two “high”.</div><div>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><br class=""></div><div>%mul = fmul half %u, %v</div><div>%fma = fma half %x, %y, %mul</div><div>%fmaext = fpextend half %fma to double</div><div>%fadd = fadd double %fmaext, %z</div><div><br class=""></div><div>becomes:</div><div><br class=""></div><div><div>%xext = fpextend half %x to double</div><div class=""><div>%yext = fpextend half %y to double</div></div><div class=""><div>%uext = fpextend half %u to double</div></div><div class=""><div>%vext = fpextend half %v to double</div></div><div class=""><br class=""></div></div><div><div>%fma1 = fma double %uext, %vext, %zext</div><div>%fma = fma double %xext, %yext, %fma1</div><div><br class=""></div></div><div>(assuming that both half and double are legal on the target)</div><div><br class=""></div><div>— </div><div>Mehdi</div><div><br class=""></div></div></body></html>