[PATCH] D76365: [cuda][hip] Add CUDA builtin surface/texture reference support.

Michael Liao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 19 17:00:16 PDT 2020


hliao added a comment.

In D76365#1932392 <https://reviews.llvm.org/D76365#1932392>, @tra wrote:

> > Note that, clang-based one needs defining texture fetch functions as they could not be reused from CUDA SDK. That part is enclosed with #if defined(__clang__).
>
> What prevents clang to compile the texture functions in the CUDA headers? It looks like we'll need to implement the `__nv_tex_surf_handler()` builtin, but other than that it should work.


That's a magic. I could not figure out how it works. From its use, e.g. `tex2D` on `texture<T, cudaTextureType2D, cudaReadModeElementType>`,

  __nv_tex_surf_handler("__tex2D_v2", (typename __nv_tex_rmet_cast<T>::type) &temp, t, x, y);

`__tex2D_v2` is a string literal. However, it's more likely a underly function name for the real implementation. Hardly imagine that that string literal is checked directly instead used for constructing the real function name. If that's the case, we also need to find that where that underlying functions are defined as the device bitcode library has no such definition.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76365





More information about the cfe-commits mailing list