<div dir="ltr"><div dir="ltr"><div dir="ltr">This page <a href="https://gpuopen.com/opencl-rocm1-6/">https://gpuopen.com/opencl-rocm1-6/</a> also suggests that inline asm is supported by the rocm toolchain, and there are example exercises / solutions here: <br></div><div dir="ltr"><br></div><div dir="ltr"><a href="https://github.com/HandsOnOpenCL/Exercises-Solutions/tree/master/Solutions">https://github.com/HandsOnOpenCL/Exercises-Solutions/tree/master/Solutions</a></div><div dir="ltr"><br></div><div>The AMD PRO driver says it has supported rocm 1.6 since last year, but it sounds like that doesn't work with it, so ??? <br></div><div dir="ltr"><br clear="all"><div><div><div class="gmail_signature">-G <br></div></div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Sep 6, 2018 at 10:11 PM UE US <<a href="mailto:uexplorer666@gmail.com">uexplorer666@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Wed, Sep 5, 2018 at 1:17 PM Changdao Dong via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div>Finally I kind of modified llvm to generate assembly that can run on AMDGPU pro drivers. One problem is the performance of the code generated by llvm is about 10% slower than amdgpu's online compiler. Anything I can tune the performance up the performance of llvm?\</div><div><br></div><div>Thanks!<br></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Sep 4, 2018 at 9:23 AM 董昌道 <<a href="mailto:dongchangdao@gmail.com" target="_blank">dongchangdao@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">I am writing a miner of crypto currency, for which most users run it with amdgpu driver. I have written a script the translate the meta data of LLVM isa format into clrxasm format. </div></blockquote></div></div></blockquote><div><br></div><div>clrxasm's docs say it only supports GCN devices to begin with, so it seems like you wouldn't actually want to use the --amdhsa "os" flag (or the amdgpu target, you'd want amdgcn);  that's for things that will be directly loaded with the HSA API as far as I know.  If you felt like it you could load and execute them with that API instead of the opencl one and not mess around with it further than that.  I've never worked with that, so Artem can probably tell you more if that doesn't explain things.  It looks relatively straightforward.    <a href="https://gpuopen.com/rocm-with-harmony-combining-opencl-hcc-hsa-in-a-single-program/" target="_blank">https://gpuopen.com/rocm-with-harmony-combining-opencl-hcc-hsa-in-a-single-program/</a><br></div><div><br></div>This page 
<a href="https://openwall.info/wiki/john/development/AMD-IL" target="_blank">https://openwall.info/wiki/john/development/AMD-IL</a>

 (linked from another AMD list posting last year about something similar)   says that the following work:<br><br>

<strong>(i)</strong>Setting the environment variable:<br>

AMD_OCL_BUILD_OPTIONS_APPEND=-save-temps  ./Name_of_executable <br>

<strong>(ii)</strong>Using the build options:<br>

In clBuildProram() specify ”-save-temps” in the build option field to generate IL and ISA.


</div><div class="gmail_quote"><br></div><div class="gmail_quote">...and the driver will retain the .isa and .il files, but then you'd still be left with patching in your changes somehow.   If that works it would at least give you an example of what LLVM is currently generating vs. the driver so you can compare those and also modify / test assembly changes to determine if they're worthwhile for whatever issue you're trying to solve.  <br></div><br></div><div>If this is an optimization thing, I'd strongly suggest going through the files as-is and trying to perform some of the ocl-level optimizations AMD's guides suggest.  You'd be surprised what removing a couple of conditionals in often-called loops can do for performance of many things.    Looking at the code, vectorizing / using native opencl data types would probably show some gains as well.  Many of them seem to be straight C source conversions of stuff that was optimized for x86 at some point before SSE2 existed and promptly  forgotten.  <br></div><div><br></div><div>Cheers,</div><div>-G<br></div></div></div></div></div>
</blockquote></div>