[AMDGPU] Use "hostcall" module flag instead of searching for ockl_hostcall_internal...
authorkpyzhov <konstantin.pyzhov@amd.com>
Tue, 5 Oct 2021 13:56:04 +0000 (09:56 -0400)
committerkpyzhov <konstantin.pyzhov@amd.com>
Tue, 5 Oct 2021 13:56:04 +0000 (09:56 -0400)
commit095c48fdf3d27a4f346f8680d1d7e89449bb557b
tree062b5f2f5b92d0d9a040c9b5a3959713a1d1b50a
parent80a645630660b1096aa16e18ed4747b24995f6cb
[AMDGPU] Use "hostcall" module flag instead of searching for ockl_hostcall_internal() declaration.
The current way to detect hostcalls by looking for "ockl_hostcall_internal()" function in the module seems to be not reliable enough. The LTO may rename the "ockl_hostcall_internal()" function when an application is compiled with "-fgpu-rdc", and MetadataStreamer pass to fail to detect hostcalls, therefore it does not set the "hidden_hostcall_buffer" kernel argument.
This change adds a new module flag: hostcall that can be used to detect whether GPU functions use host calls for printf.

Differential revision: https://reviews.llvm.org/D110337
llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp
llvm/test/CodeGen/AMDGPU/hsa-metadata-hostcall-present-v3.ll