[libc-commits] [PATCH] D148810: [libc] Add more utility functions for the GPU
Artem Belevich via Phabricator via libc-commits
libc-commits at lists.llvm.org
Mon Apr 24 10:49:35 PDT 2023
tra added inline comments.
================
Comment at: libc/src/__support/GPU/nvptx/utils.h:77
+/// Returns the absolute id of the thread in the current CUDA block.
+LIBC_INLINE uint32_t get_thread_id() {
+ return get_thread_id_x() + get_num_threads_x() * get_thread_id_y() +
----------------
jhuber6 wrote:
> tra wrote:
> > 32 bits are not sufficient to represent all threads, as block dimensions alone can take up to 63 bits. (31 bits for x, 16 for y,z).
> So, the individual thread_id_x() functions can be kept 32-bit but this one global one should be 64-bit?
Yup. https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#features-and-technical-specifications-technical-specifications-per-compute-capability
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148810/new/
https://reviews.llvm.org/D148810
More information about the libc-commits
mailing list