[PATCH] D77777: [nvptx] Add `nvvm.texsurf.handle` internalizer.

Michael Liao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 10 18:19:46 PDT 2020


hliao added a comment.

In D77777#1975440 <https://reviews.llvm.org/D77777#1975440>, @tra wrote:

> Also, if I read PTX docs correctly, it should be OK to pass texture handle address via an intermediate variable:
>  https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#texture-sampler-and-surface-types
>
> > Creating pointers to opaque variables using mov, e.g., mov.u64 reg, opaque_var;. The resulting pointer may be stored to and loaded from memory, passed as a parameter to functions, and de-referenced by texture and surface load, store, and query instructions
>
> We may not need the tokens and should be able to use regular pointer.


That handle is the output of `texsurf.handle` intrinsic instead of its input. Internally within NVTPX backend, it needs to keep track of which global variable needs to be a `texref` or `surfref` and requires the operand of `texsurf.handle` must be a global variable. Check `NVPTXReplaceImageHandles.cpp` line 167 - 175.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77777





More information about the cfe-commits mailing list