[PATCH] D115283: [AMDGPU] Set "amdgpu_hostcall" module flag if an AMDGPU function has calls to device lib functions that use hostcalls.

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 9 07:34:36 PST 2021


yaxunl added a comment.

In D115283#3181109 <https://reviews.llvm.org/D115283#3181109>, @kpyzhov wrote:

> In D115283#3180836 <https://reviews.llvm.org/D115283#3180836>, @yaxunl wrote:
>
>> If we only need to check whether `__ockl_hostcall_internal` exists in the final module in LLVM codegen to determine whether we need the hostcall metadata, probably we don't even need a function attribute or even module flag.
>
> Right, we used to do exactly that (just check at the CodeGen phase if 'ockl_hostcall_internal()' is present in the module), but then it turned out that it does not work with -fgpu-rdc since IPO may rename the 'ockl_hostcall_internal()'.

Sorry I forgot that.

Then I agree that a function attribute seems a better way to represent hostcall requirement in IR. It is needed in both source and IR. This avoids checking hostcall requirements by function names. It works for all frontends as long as they use device libs or mark their own hostcall function with the attribute. It also can result in more efficient code object if useless hostcall functions are removed by optimizers. Overall it will result in a cleaner IR representation.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115283/new/

https://reviews.llvm.org/D115283



More information about the cfe-commits mailing list