[OpenMP] Add thread ID function into new RTL

The new device runtime library currently lacks the
`kmpc_get_hardware_thread_id_in_block` function which is currently used
when doing the SPMDzation optimization. This call would be introduced
through the optimization and then cause a linking error because it was
not present. This patch adds support for this runtime call.

Reviewed By: tianshilei1992

Differential Revision: https://reviews.llvm.org/D110195
This commit is contained in:
Joseph Huber 2021-09-21 15:32:41 -04:00
parent e1ed02181f
commit e95731cca7
2 changed files with 8 additions and 0 deletions

View File

@ -198,6 +198,9 @@ void __kmpc_end_sharing_variables();
/// Called by the worker threads in the parallel region (function).
void __kmpc_get_shared_variables(void ***GlobalArgs);
/// External interface to get the thread ID.
uint32_t __kmpc_get_hardware_thread_id_in_block();
/// Kernel
///
///{

View File

@ -226,4 +226,9 @@ bool mapping::isSPMDMode() { return IsSPMDMode; }
bool mapping::isGenericMode() { return !isSPMDMode(); }
///}
extern "C" {
uint32_t __kmpc_get_hardware_thread_id_in_block() {
return mapping::getThreadIdInBlock();
}
}
#pragma omp end declare target