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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to