kpyzhov added a comment.
In D115283#3179651 <https://reviews.llvm.org/D115283#3179651>, @yaxunl wrote:
> One drawback of this approach is that it does not work for LLVM modules
> generated from assembly or programmatically e.g. Tensorflow XLA.
>
> Another drawback is that if `__ockl_call_host_function` or
> `__ockl_fprintf_stderr_begin` are eliminated by optimizer, the module flag is
> still kept. This could happen if users use printf in assert.
>
> Is there a way to detect use of hostcall later in LLVM IR not by calling of
> these functions?
Two other possible solutions that come to my mind:
1. Make a separate pass that would check if there is an instance of the
ockl_hostcall_internal() function in the module and set the module flag if so.
2. Add a new "amdgpu_hostcall" function attribute. The
"ockl_hostcall_internal()" function should be declared with
__attribute__(("amdgpu_hostcall")) in the device libs. Then, in the Code Gen
pass, we just set the "hidden_hostcall" kernel arg attribute if any function
with "amdgpu_hostcall" is present. I think this is the best solution since we
don't rely on the particular function name, and it would work ideally with any
optimizations.
Please let me know what you think.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115283/new/
https://reviews.llvm.org/D115283
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits