[PATCH] D110556: [openmp] Add addrspacecast to getOrCreateIdent

Jon Chesterfield via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 27 08:27:28 PDT 2021


JonChesterfield added a comment.

In D110556#3024709 <https://reviews.llvm.org/D110556#3024709>, @jdoerfert wrote:

> What AS are the "ident globals" generated in if we target amdgcn? If it is not 0 we should generate them in the right AS rather than introducing a cast. If it is 0, this patch looks reasonable.

They're in AS1 which seems right. Standard GPU memory. The choice is either we qualify all the deviceRTL functions with an addrspace(1) qualifier, or we create the variable in the GPU memory address space and addrspacecast the pointer to unspecified address space. It works out the same after inlining. This approach follows the pattern we use for stack variables, where they're alloca'ed in AS5 and then immediately addrspacecast to unspecified.

We could remove the AS1 qualification by putting the variable in unspecified address space, but that should lead to either infer address spaces putting it back to AS1 or a minor degradation in codegen (using flat instructions instead of the more specific global one).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110556



More information about the llvm-commits mailing list