mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[OpenMPOpt][Fix] Only initialize ICV initial values once.
Reviewers: jdoerfert, ggeorgakoudis Differential Revision: https://reviews.llvm.org/D88441
This commit is contained in:
parent
5159bb7b3f
commit
e47fd785ee
@ -41,12 +41,12 @@ enum class InternalControlVar {
|
|||||||
#include "llvm/Frontend/OpenMP/OMPKinds.def"
|
#include "llvm/Frontend/OpenMP/OMPKinds.def"
|
||||||
|
|
||||||
enum class ICVInitValue {
|
enum class ICVInitValue {
|
||||||
#define ICV_DATA_ENV(Enum, Name, EnvVar, Init) Init,
|
#define ICV_INIT_VALUE(Enum, Name) Enum,
|
||||||
#include "llvm/Frontend/OpenMP/OMPKinds.def"
|
#include "llvm/Frontend/OpenMP/OMPKinds.def"
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ICV_DATA_ENV(Enum, Name, EnvVar, Init) \
|
#define ICV_INIT_VALUE(Enum, Name) \
|
||||||
constexpr auto Init = omp::ICVInitValue::Init;
|
constexpr auto Enum = omp::ICVInitValue::Enum;
|
||||||
#include "llvm/Frontend/OpenMP/OMPKinds.def"
|
#include "llvm/Frontend/OpenMP/OMPKinds.def"
|
||||||
|
|
||||||
/// IDs for all omp runtime library (RTL) functions.
|
/// IDs for all omp runtime library (RTL) functions.
|
||||||
|
@ -230,6 +230,20 @@ __OMP_FUNCTION_TYPE(TaskRoutineEntry, false, Int32, Int32,
|
|||||||
///
|
///
|
||||||
///{
|
///{
|
||||||
|
|
||||||
|
#ifndef ICV_INIT_VALUE
|
||||||
|
#define ICV_INIT_VALUE(Enum, Name)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define __ICV_INIT_VALUE(Name) ICV_INIT_VALUE(ICV_##Name, #Name)
|
||||||
|
|
||||||
|
__ICV_INIT_VALUE(ZERO)
|
||||||
|
__ICV_INIT_VALUE(FALSE)
|
||||||
|
__ICV_INIT_VALUE(IMPLEMENTATION_DEFINED)
|
||||||
|
__ICV_INIT_VALUE(LAST)
|
||||||
|
|
||||||
|
#undef __ICV_INIT_VALUE
|
||||||
|
#undef ICV_INIT_VALUE
|
||||||
|
|
||||||
#ifndef ICV_DATA_ENV
|
#ifndef ICV_DATA_ENV
|
||||||
#define ICV_DATA_ENV(Enum, Name, EnvVarName, Init)
|
#define ICV_DATA_ENV(Enum, Name, EnvVarName, Init)
|
||||||
#endif
|
#endif
|
||||||
@ -240,6 +254,7 @@ __OMP_FUNCTION_TYPE(TaskRoutineEntry, false, Int32, Int32,
|
|||||||
__ICV_DATA_ENV(nthreads, OMP_NUM_THREADS, ICV_IMPLEMENTATION_DEFINED)
|
__ICV_DATA_ENV(nthreads, OMP_NUM_THREADS, ICV_IMPLEMENTATION_DEFINED)
|
||||||
__ICV_DATA_ENV(active_levels, NONE, ICV_ZERO)
|
__ICV_DATA_ENV(active_levels, NONE, ICV_ZERO)
|
||||||
__ICV_DATA_ENV(cancel, OMP_CANCELLATION, ICV_FALSE)
|
__ICV_DATA_ENV(cancel, OMP_CANCELLATION, ICV_FALSE)
|
||||||
|
__ICV_DATA_ENV(proc_bind, OMP_PROC_BIND, ICV_IMPLEMENTATION_DEFINED)
|
||||||
__ICV_DATA_ENV(__last, last, ICV_LAST)
|
__ICV_DATA_ENV(__last, last, ICV_LAST)
|
||||||
|
|
||||||
#undef __ICV_DATA_ENV
|
#undef __ICV_DATA_ENV
|
||||||
@ -265,6 +280,7 @@ __ICV_RT_SET(nthreads, omp_set_num_threads)
|
|||||||
__ICV_RT_GET(nthreads, omp_get_max_threads)
|
__ICV_RT_GET(nthreads, omp_get_max_threads)
|
||||||
__ICV_RT_GET(active_levels, omp_get_active_level)
|
__ICV_RT_GET(active_levels, omp_get_active_level)
|
||||||
__ICV_RT_GET(cancel, omp_get_cancellation)
|
__ICV_RT_GET(cancel, omp_get_cancellation)
|
||||||
|
__ICV_RT_GET(proc_bind, omp_get_proc_bind)
|
||||||
|
|
||||||
#undef __ICV_RT_GET
|
#undef __ICV_RT_GET
|
||||||
#undef ICV_RT_GET
|
#undef ICV_RT_GET
|
||||||
|
@ -518,7 +518,8 @@ struct OpenMPOpt {
|
|||||||
/// Print initial ICV values for testing.
|
/// Print initial ICV values for testing.
|
||||||
/// FIXME: This should be done from the Attributor once it is added.
|
/// FIXME: This should be done from the Attributor once it is added.
|
||||||
void printICVs() const {
|
void printICVs() const {
|
||||||
InternalControlVar ICVs[] = {ICV_nthreads, ICV_active_levels, ICV_cancel};
|
InternalControlVar ICVs[] = {ICV_nthreads, ICV_active_levels, ICV_cancel,
|
||||||
|
ICV_proc_bind};
|
||||||
|
|
||||||
for (Function *F : OMPInfoCache.ModuleSlice) {
|
for (Function *F : OMPInfoCache.ModuleSlice) {
|
||||||
for (auto ICV : ICVs) {
|
for (auto ICV : ICVs) {
|
||||||
|
Loading…
Reference in New Issue
Block a user