diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu b/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu --- a/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu +++ b/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu @@ -114,10 +114,10 @@ DEVICE void __kmpc_impl_threadfence_system() { __threadfence_system(); } // Calls to the NVPTX layer (assuming 1D layout) -DEVICE int GetThreadIdInBlock() { return threadIdx.x; } -DEVICE int GetBlockIdInKernel() { return blockIdx.x; } -DEVICE int GetNumberOfBlocksInKernel() { return gridDim.x; } -DEVICE int GetNumberOfThreadsInBlock() { return blockDim.x; } +DEVICE int GetThreadIdInBlock() { return __nvvm_read_ptx_sreg_tid_x(); } +DEVICE int GetBlockIdInKernel() { return __nvvm_read_ptx_sreg_ctaid_x(); } +DEVICE int GetNumberOfBlocksInKernel() { return __nvvm_read_ptx_sreg_nctaid_x(); } +DEVICE int GetNumberOfThreadsInBlock() { return __nvvm_read_ptx_sreg_ntid_x(); } DEVICE unsigned GetWarpId() { return GetThreadIdInBlock() / WARPSIZE; } DEVICE unsigned GetLaneId() { return GetThreadIdInBlock() & (WARPSIZE - 1); }