mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[OpenMP] Lower taskyield using OpenMP IR Builder
This is similar to D69828. Special codegen for enclosing untied tasks is still done in clang. Differential Revision: https://reviews.llvm.org/D70799
This commit is contained in:
parent
a01f774bf4
commit
707a18256a
@ -171,6 +171,7 @@ public:
|
|||||||
Value *IfCondition, Value *NumThreads,
|
Value *IfCondition, Value *NumThreads,
|
||||||
omp::ProcBindKind ProcBind, bool IsCancellable);
|
omp::ProcBindKind ProcBind, bool IsCancellable);
|
||||||
|
|
||||||
|
|
||||||
/// Generator for '#omp flush'
|
/// Generator for '#omp flush'
|
||||||
///
|
///
|
||||||
/// \param Loc The location where the flush directive was encountered
|
/// \param Loc The location where the flush directive was encountered
|
||||||
@ -181,6 +182,11 @@ public:
|
|||||||
/// \param Loc The location where the taskwait directive was encountered.
|
/// \param Loc The location where the taskwait directive was encountered.
|
||||||
void CreateTaskwait(const LocationDescription& Loc);
|
void CreateTaskwait(const LocationDescription& Loc);
|
||||||
|
|
||||||
|
/// Generator for '#omp taskyield'
|
||||||
|
///
|
||||||
|
/// \param Loc The location where the taskyield directive was encountered.
|
||||||
|
void CreateTaskyield(const LocationDescription& Loc);
|
||||||
|
|
||||||
///}
|
///}
|
||||||
|
|
||||||
|
|
||||||
@ -251,6 +257,11 @@ private:
|
|||||||
/// \param Loc The location at which the request originated and is fulfilled.
|
/// \param Loc The location at which the request originated and is fulfilled.
|
||||||
void emitTaskwaitImpl(const LocationDescription &Loc);
|
void emitTaskwaitImpl(const LocationDescription &Loc);
|
||||||
|
|
||||||
|
/// Generate a taskyield runtime call.
|
||||||
|
///
|
||||||
|
/// \param Loc The location at which the request originated and is fulfilled.
|
||||||
|
void emitTaskyieldImpl(const LocationDescription &Loc);
|
||||||
|
|
||||||
/// Return the current thread ID.
|
/// Return the current thread ID.
|
||||||
///
|
///
|
||||||
/// \param Ident The ident (ident_t*) describing the query origin.
|
/// \param Ident The ident (ident_t*) describing the query origin.
|
||||||
|
@ -170,6 +170,7 @@ __OMP_RTL(__kmpc_flush, false, Void, IdentPtr)
|
|||||||
__OMP_RTL(__kmpc_global_thread_num, false, Int32, IdentPtr)
|
__OMP_RTL(__kmpc_global_thread_num, false, Int32, IdentPtr)
|
||||||
__OMP_RTL(__kmpc_fork_call, true, Void, IdentPtr, Int32, ParallelTaskPtr)
|
__OMP_RTL(__kmpc_fork_call, true, Void, IdentPtr, Int32, ParallelTaskPtr)
|
||||||
__OMP_RTL(__kmpc_omp_taskwait, false, Int32, IdentPtr, Int32)
|
__OMP_RTL(__kmpc_omp_taskwait, false, Int32, IdentPtr, Int32)
|
||||||
|
__OMP_RTL(__kmpc_omp_taskyield, false, Int32, IdentPtr, Int32, Int32)
|
||||||
__OMP_RTL(__kmpc_push_num_threads, false, Void, IdentPtr, Int32,
|
__OMP_RTL(__kmpc_push_num_threads, false, Void, IdentPtr, Int32,
|
||||||
/* Int */ Int32)
|
/* Int */ Int32)
|
||||||
__OMP_RTL(__kmpc_push_proc_bind, false, Void, IdentPtr, Int32, /* Int */ Int32)
|
__OMP_RTL(__kmpc_push_proc_bind, false, Void, IdentPtr, Int32, /* Int */ Int32)
|
||||||
|
@ -709,3 +709,20 @@ void OpenMPIRBuilder::CreateTaskwait(const LocationDescription &Loc) {
|
|||||||
return;
|
return;
|
||||||
emitTaskwaitImpl(Loc);
|
emitTaskwaitImpl(Loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OpenMPIRBuilder::emitTaskyieldImpl(const LocationDescription &Loc) {
|
||||||
|
// Build call __kmpc_omp_taskyield(loc, thread_id, 0);
|
||||||
|
Constant *SrcLocStr = getOrCreateSrcLocStr(Loc);
|
||||||
|
Value *Ident = getOrCreateIdent(SrcLocStr);
|
||||||
|
Constant *I32Null = ConstantInt::getNullValue(Int32);
|
||||||
|
Value *Args[] = {Ident, getOrCreateThreadID(Ident), I32Null};
|
||||||
|
|
||||||
|
Builder.CreateCall(getOrCreateRuntimeFunction(OMPRTL___kmpc_omp_taskyield),
|
||||||
|
Args);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenMPIRBuilder::CreateTaskyield(const LocationDescription &Loc) {
|
||||||
|
if (!updateToLocation(Loc))
|
||||||
|
return;
|
||||||
|
emitTaskyieldImpl(Loc);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user