[PATCH] D110337: [AMDGPU] Use "amdgpu-hostcalls" attribute to detect if a kernel function hostcall for GPU printf.

Jon Chesterfield via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 23 08:54:23 PDT 2021


JonChesterfield added a comment.

Aomp uses the presence of a symbol to determine if the hostcall machinery needs to be initialised. Using the function symbol messes up inlining so it defines a weak (strictly, common to work around an assembler bug) object within the hostcall entry point.

  // The global variable needs hostcall_buffer is used to detect that
  // host services are required. If this function is not inlined, the symbol
  // will not be present and the runtime can avoid initialising said support.
  __asm__("; hostcall_invoke: record need for hostcall support\n\t"
          ".type needs_hostcall_buffer, at object\n\t"
          ".global needs_hostcall_buffer\n\t"
          ".comm needs_hostcall_buffer,4":::);

I'd suggest hip do the same thing, with a different symbol name to that. It can be detected by looking for that symbol in the code object, same as you do today.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110337



More information about the llvm-commits mailing list