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

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 10 16:42:13 PDT 2020


tra added a subscriber: majnemer.
tra added a comment.

In D77777#1975178 <https://reviews.llvm.org/D77777#1975178>, @hliao wrote:

> the 1st argument in `llvm.nvvm.texsurf.hande.internal` or the 2nd one in `llvm.nvvm.texsurf.handle` must be kept as an immediate or constant value, i.e. that global variable. However, optimizations will find common code in the following
>
>   if (cond) {
>     %hnd = texsurf.handle.internal(@tex1);
>   } else {
>     %hnd = texsurf.handle.internal(@tex2)
>   }
>   = use(%hnd)
>
>
> and hoist or sink it into
>
>   if (cond) {
>     %ptr = @tex1;
>   } else {
>     %ptr = @tex2;
>   }
>   %hnd = texsurf.handle.intenal(%ptr);
>   = use(%hnd)
>
>
> The backend cannot handle non immediate operand in `texsurf.handle`. The similar thing happens to `read.register` as well as it also assumes its argument is always an immediate value.


I wonder if we can use `token` types to represent the handle? https://reviews.llvm.org/D11861
@majnemer -- would this use case be suitable for the `token` type?


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