[libc-commits] [PATCH] D148810: [libc] Add more utility functions for the GPU

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Apr 24 10:45:30 PDT 2023


jhuber6 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() +
----------------
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?


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