[PATCH] D70038: [AMDGPU] add support for hostcall buffer pointer as hidden kernel argument

Sameer Sahasrabuddhe via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 17 22:10:07 PST 2019


sameerds marked an inline comment as done.
sameerds added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp:859-860
       emitKernelArg(DL, Int8PtrTy, "hidden_printf_buffer", Offset, Args);
+    else if (Func.getParent()->getFunction("__ockl_hostcall_internal"))
+      emitKernelArg(DL, Int8PtrTy, "hidden_hostcall_buffer", Offset, Args);
     else
----------------
arsenm wrote:
> Is this metadata really necessary if the runtime can just check if the symbol is used?
The metadata itself is necessary because the runtime is not aware of the sequence of hidden arguments. It depends on the metadata to identify each of them.
I tried moving the check for the function name "__ockl_hostcall_internal" to the runtime. This would have nicely avoided having to hard-code a library function name into the backend. But such a check needs us to modify the internalize pass so that this name remains visible to the runtime. For that pass to recognize this function, we have to either hardcode it there (which defeats the purpose) or introduce a new variable similar to llvm.used, which is a non-trivial separate task. So the conclusion was to keep the current check exactly as we see it here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70038





More information about the llvm-commits mailing list