[PATCH] D111665: [CUDA] Provide address space conversion builtins.

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 12 17:01:02 PDT 2021


tra added a comment.

In D111665#3059989 <https://reviews.llvm.org/D111665#3059989>, @jdoerfert wrote:

> Except when it doesn't get instcombined away: https://godbolt.org/z/YE4EfEPde

Well, it does get translated into sensible PTX, so, while not ideal, it's not too big of a deal.
Using an integer is a sensible approach to prevent accidental load/store using a wrong address space.

An alternative would be to make conversion functions return a pointer with specific AS attribute, but that's clang-specific and it would not work for something that needs to plug in into CUDA headers that were written for NVCC.

So, yeah. It could be better, but it's tolerable. At least we didn't have to resort to using inline asm. :-)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111665



More information about the cfe-commits mailing list