<div class="gmail_quote">2012/5/30 Shun Sakuraba <span dir="ltr">&lt;<a href="mailto:shun.sakuraba@gmail.com" target="_blank">shun.sakuraba@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Dear list,<br>
<br>
I would like to share my trial to port GROMACS 4.5 SSE/SSE2 nonbonded kernel<br>
to AMD&#39;s new family 15h chip, &quot;Bulldozer&quot; architecture, performed to measure<br>
the benefit of new instructions. In AMD family 15h new FMA4 instructions<br>
are added; FMA4 is the fused multiplication and addition (subtraction) operations.<br>
FMA4 reduces number of instructions and latency, giving a marginal performance boost.<br>
Also there are XOP instructions, which is useful implementing table interpolation<br>
used in GROMACS.<br>
<br></blockquote><div>Dear Shun,</div><div><br></div><div>Great work, however, besides FMA4, the Bulldozer also support three-operand AVX instructions. In fact, FMA4 is an extension to AVX. Intel Sandy Bridge only supports AVX, but no FMA4.</div>

<div><br></div><div>With AVX, you can replace two-operand SSE instructions by three-operand AVX instructions, and avoid copies. For example:</div><div><div><br></div><div>movaps %xmm6,%xmm1 </div><div>mulps %xmm6,%xmm1 ## rinv4</div>

<div>mulps %xmm6,%xmm1 ## rinv6</div><div>movaps %xmm1,%xmm2 </div><div>mulps %xmm2,%xmm2 ## xmm2=rinv12</div></div><div><br></div><div>becomes:</div><div><br></div><div>vmulps %xmm6,%xmm6,%xmm1  ##rinv4</div><div>vmulps %xmm6, %xmm1, %xmm1 ##rinv6</div>

<div>vmulps %xmm1, %xmm1, %xmm2 ## xmm2=rinv12</div><div><br></div><div>With those modifications, you may get additional performance. Often, you can free up registers that hold temporary values, and store values there that would otherwise end up on the stack.</div>

<div><br></div><div>Another direction is using 256-bit ymm registers instead of 128-bit xmm registers, but that would require a thorough rewrite of the kernels. Especially on Sandy Bridge, where each core has its own 256-bit floating point unit, you may very well increase performance by 50% or more.</div>

<div><br></div><div>At Bulldozer, two cores share a 256-bit floating point unit (FPU). With 128-bit instructions, each core uses &#39;half&#39; of the FPU, and the 128-bit instructions run at full speed. With 256-bit instructions, two cores compete for the FPU, so the performance gain would be limited, compared to Sandy Bridge. Bulldozers can still benefit from FMA4, though, which is not available on Sandy Bridge.</div>

<div><br></div><div>Maik</div></div>-- <br><span></span><div><table style="font-size:7pt;font-family:Tahoma,Arial,Helvetica;padding:0px;border:1px solid rgb(234,239,242)" height="195" width="312">
<tbody><tr valign="top"><td colspan="2">
<img alt="clustervision_logo.png" title="" src="cid:GTR293021"></td></tr>
<tr><td style="padding-left:12px" nowrap valign="bottom"><font style="font-size:9pt;font-weight:bold">Dr. Maik Nijhuis<br></font><font style="font-size:7pt">HPC Benchmark Specialist<br> <br> <br>Direct: <a value="+31204077556">+31 20 407 7556</a><br>

Skype: maiknijhuis<br><a style="text-decoration:none;color:#3988c2" href="mailto:maik.nijhuis@clustervision.com" target="_blank">maik.nijhuis@clustervision.com</a></font><br> <br></td><td nowrap valign="bottom"><span> <br>

</span><font style="font-size:8pt;font-weight:bold">ClusterVision BV<br></font><font style="font-size:7pt">Nieuw-Zeelandweg 15B<br>1045 AL Amsterdam<br>The Netherlands<br>Tel: <a value="+31204077550">+31 20 407 7550</a><br>

Fax: <a value="+31847598389">+31 84 759 8389</a><br><a style="text-decoration:none;color:#003f77" href="http://www.clustervision.com/" target="_blank">www.clustervision.com</a></font><br> </td></tr></tbody></table></div>
<br>