[clang] [Clang] Implement resource directory headers for common GPU intrinsics (PR #110179)
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 27 10:24:54 PDT 2024
jhuber6 wrote:
> Probably want a longer prefix. _gpu or_llvm or similar.
Yeah, just wasn't sure. Also, do resource headers need to be in a reserved namespace? Probably nothing wrong with `gpu_get_thread_id` vs `_gpu_get_thread_id`.
> If the shared header gets the declarations then people can include the intrin.h and look at it to see what functions they have available, without going and looking through all the implementations. That seems like a good thing. Can put descriptive comments in the main header then.
Yeah I was actually wondering if I should go for something like this:
```c
#ifdef __NVPTX__
uint32_t nvptx_get_thread_id_x() { return __nvvm_ptx_read_sreg_tid_x(); }
#define IMPL nvptx
#endif
uint32_t gpu_get_thread_id_x() { return ##IMPL##_get_thread_id_x(); }
#undef IMPL
```
https://github.com/llvm/llvm-project/pull/110179
More information about the cfe-commits
mailing list