[llvm-dev] Can I control HSA config generated by AMDGPU backend?

Changdao Dong via llvm-dev llvm-dev at lists.llvm.org
Wed Sep 5 11:17:58 PDT 2018


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?\

Thanks!

On Tue, Sep 4, 2018 at 9:23 AM 董昌道 <dongchangdao at gmail.com> wrote:

> 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. I also modified ROCm version of llvm to
> reorganize the order of the kernel args so that it’s compatible with
> clrxasm. It seems working and clrxasm seems support this dispatch kernel
> ptr thing. But it would be nice if I can turn it off. Reading the LLVM code
> it seems this intrinsic is hard coded? Hope not.
>
> Regards!
>    Changdao from cell phone
>
> On Sep 4, 2018, at 4:12 AM, Tamazov, Artem <Artem.Tamazov at amd.com> wrote:
>
> ...
>
>
>
> Hi Artem,
>
>
>
> Thanks  for replying!
>
> I am working on OpenCL program that runs with AMDGPU Pro driver.
>
> However, the compiler comes with it doesn't support inline assembly. So my
> plan is to compile my OpenCL code with inline assembly with llvm to get a
> isa file, and then generate the binary using clrxasm.
>
> It seems that the calling conventions of llvm and clrxasm are different in
> some register usages but I cannot figure out the detail from their docs. I
> wonder if llvm supports turning off "enable_sgpr_dispatch_ptr = 1" so that
> it's compatible with clrxasm.
>
>
>
> Thanks,
>
>   Changdao
>
>
>
> On Mon, Sep 3, 2018 at 5:25 AM Tamazov, Artem <Artem.Tamazov at amd.com>
> wrote:
>
> Hello,
>
>
>
> Please look into https://llvm.org/docs/AMDGPUUsage.html.
>
>
>
> > My target is amdgpu--amdhsa.
>
>
>
> This means that the kernel(s) are to be executed on HSA compatible
> runtimes such as AMD’s ROCm.
>
>
>
> > ..."enable_sgpr_dispatch_ptr = 1". Can I do something to turn that off
> in the generated assembly file?
>
> > ...user argument is placed at the first place while hidden arguments
> like "HiddenGlobalOffsetX" are placed after user arguments.
>
> > Can I change the order of the arguments so that the first argument will
> be hidden arguments before user arguments?
>
>
>
> If your wishes are met, then the compatibility with HSA will be broken.
>
>
>
> > Can I change the order of the arguments so that the first argument will
> be hidden arguments before user arguments?
>
>
>
> I think this is not normally possible while target stays at "...-amdhsa".
>
>
>
> Also I think that community would be able to help you more if you explain
> your reasons.
>
>
>
> Regards,
>
> artem
>
>
>
> *From:* llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] *On Behalf Of *Changdao
> Dong via llvm-dev
> *Sent:* 31 August 2018 г. 22:15
> *To:* llvm-dev at lists.llvm.org
> *Subject:* [llvm-dev] Can I control HSA config generated by AMDGPU
> backend?
>
>
>
> I am using llvm clang to offline compile my opencl code into assembly. My
> target is amdgpu--amdhsa. The assembly file generated by clang has config
> of "enable_sgpr_dispatch_ptr = 1". Can I do something to turn that off in
> the generated assembly file? Also, it seems that the order of kernel
> arguments is in the reverse order of AMDCL2 convention. i.e. user argument
> is placed at the first place while hidden arguments like
> "HiddenGlobalOffsetX" are placed after user arguments. Can I change the
> order of the arguments so that the first argument will be hidden arguments
> before user arguments?
>
>
>
> Thanks a lot!
>
>
> --
>
> DONG, Changdao
>
> dongchangdao at gmail.com
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180905/a7137936/attachment.html>


More information about the llvm-dev mailing list