[clang] [llvm] [openmp] [OpenMP] Depobj optimisation (PR #91145)
PEREIRA Romain via cfe-commits
cfe-commits at lists.llvm.org
Sun May 5 14:06:15 PDT 2024
https://github.com/rpereira-dev created https://github.com/llvm/llvm-project/pull/91145
# Description
As per before, an `omp_depend_t` remains a `kmp_depend_info_t *` allocated on the heap.
This patch extends the `kmp_depend_info_t *` data structure caching its associated `kmp_dephash_entry_t` after instanciating a depobj `obj` with `# pragma omp depobj(obj) depend(...)`, hence removing a call to `__kmp_dephash_find` on task constructs using `obj`.
This hashing operation can represent
# Notes
Regarding tests, we should probably maintain a header file with all runtime data structure interfaces of interest to avoid code dupplication as currently.
# Evaluation
On 16x cores Intel(R) Xeon(R) Gold 5218 CPU @ 2.30GHz
10 runs on the same code, with/without the patch gives respectively `0.946 +/- 0.004 s.` and `1.046 +/- 0.007 s.`
`clang -fopenmp -Wall -Werror -Wextra -O0 main.c`
```C
# include <assert.h>
# include <omp.h>
# include <stdio.h>
static omp_depend_t obj;
# define N 16
static int x[N];
# define I (4096 * 64)
int
main(void)
{
double t0 = omp_get_wtime();
# pragma omp parallel
{
# pragma omp single nowait
{
# pragma omp depobj(obj) depend(iterator(i=0:N), out: x[i])
for (int i = 0 ; i < I ; ++i)
{
# pragma omp depobj(obj) update(out)
# pragma omp task depend(depobj: obj) shared(x) firstprivate(i)
{}
# pragma omp depobj(obj) update(in)
# pragma omp task depend(depobj: obj) shared(x) firstprivate(i)
{}
}
# pragma omp depobj(obj) destroy
# pragma omp taskwait
}
}
double tf = omp_get_wtime();
printf("Took %lf s.\n", tf - t0);
return 0;
}
```
>From e72c62ae0c79d6970af21465285aa96f841353a2 Mon Sep 17 00:00:00 2001
From: Romain PEREIRA <romain.pereira at inria.fr>
Date: Thu, 2 May 2024 14:27:02 +0200
Subject: [PATCH 1/4] [WIP] Optimized OpenMP depobj implementation to avoid
rehashing
---
clang/lib/CodeGen/CGOpenMPRuntime.cpp | 38 ++++++++++++++++---
clang/lib/CodeGen/CGOpenMPRuntime.h | 17 ++++++++-
.../llvm/Frontend/OpenMP/OMPConstants.h | 2 +-
.../include/llvm/Frontend/OpenMP/OMPKinds.def | 1 +
openmp/runtime/src/dllexports | 1 +
openmp/runtime/src/kmp.h | 21 ++++++++++
openmp/runtime/src/kmp_taskdeps.cpp | 19 ++++++++--
7 files changed, 87 insertions(+), 12 deletions(-)
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index e39c7c58d2780e..459585b1639301 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -4030,6 +4030,7 @@ static void getDependTypes(ASTContext &C, QualType &KmpDependInfoTy,
addFieldToRecordDecl(C, KmpDependInfoRD, C.getIntPtrType());
addFieldToRecordDecl(C, KmpDependInfoRD, C.getSizeType());
addFieldToRecordDecl(C, KmpDependInfoRD, FlagsTy);
+ addFieldToRecordDecl(C, KmpDependInfoRD, C.VoidPtrTy);
KmpDependInfoRD->completeDefinition();
KmpDependInfoTy = C.getRecordType(KmpDependInfoRD);
}
@@ -4062,10 +4063,12 @@ CGOpenMPRuntime::getDepobjElements(CodeGenFunction &CGF, LValue DepobjLVal,
return std::make_pair(NumDeps, Base);
}
-static void emitDependData(CodeGenFunction &CGF, QualType &KmpDependInfoTy,
+void CGOpenMPRuntime::emitDependData(CodeGenFunction &CGF, QualType &KmpDependInfoTy,
llvm::PointerUnion<unsigned *, LValue *> Pos,
const OMPTaskDataTy::DependData &Data,
- Address DependenciesArray) {
+ Address DependenciesArray,
+ bool depobj,
+ SourceLocation Loc) {
CodeGenModule &CGM = CGF.CGM;
ASTContext &C = CGM.getContext();
QualType FlagsTy;
@@ -4121,6 +4124,30 @@ static void emitDependData(CodeGenFunction &CGF, QualType &KmpDependInfoTy,
CGF.EmitStoreOfScalar(
llvm::ConstantInt::get(LLVMFlagsTy, static_cast<unsigned int>(DepKind)),
FlagsLVal);
+ // deps[i].dephash = NULL || findhash if depobj
+ LValue DephashLVal = CGF.EmitLValueForField(
+ Base, *std::next(KmpDependInfoRD->field_begin(),
+ static_cast<unsigned int>(RTLDependInfoFields::Dephash)));
+ llvm::Value * Dephash;
+ if (depobj)
+ {
+ // Build kmp_dephash_entry * __kmpc_dephash_find(ident_t * loc, kmp_int32 gtid, kmp_intptr_t addr)
+ llvm::OpenMPIRBuilder &OMPBuilder = CGM.getOpenMPRuntime().getOMPBuilder();
+ llvm::Value *UpLoc = emitUpdateLocation(CGF, Loc);
+ llvm::Value *ThreadID = getThreadID(CGF, Loc);
+ llvm::Value * DephashArgs[3] = { UpLoc, ThreadID, Addr } ;
+ Dephash = CGF.EmitRuntimeCall(
+ OMPBuilder.getOrCreateRuntimeFunction(
+ CGM.getModule(), OMPRTL___kmpc_dephash_find),
+ DephashArgs);
+ }
+ else
+ {
+ Dephash = llvm::Constant::getNullValue(CGF.VoidPtrTy);
+ }
+ CGF.EmitStoreOfScalar(Dephash, DephashLVal);
+
+ // what is this ?
if (unsigned *P = Pos.dyn_cast<unsigned *>()) {
++(*P);
} else {
@@ -4306,7 +4333,7 @@ std::pair<llvm::Value *, Address> CGOpenMPRuntime::emitDependClause(
Dependencies[I].IteratorExpr)
continue;
emitDependData(CGF, KmpDependInfoTy, &Pos, Dependencies[I],
- DependenciesArray);
+ DependenciesArray, false, Loc);
}
// Copy regular dependencies with iterators.
LValue PosLVal = CGF.MakeAddrLValue(
@@ -4317,7 +4344,7 @@ std::pair<llvm::Value *, Address> CGOpenMPRuntime::emitDependClause(
!Dependencies[I].IteratorExpr)
continue;
emitDependData(CGF, KmpDependInfoTy, &PosLVal, Dependencies[I],
- DependenciesArray);
+ DependenciesArray, false, Loc);
}
// Copy final depobj arrays without iterators.
if (HasDepobjDeps) {
@@ -4413,10 +4440,11 @@ Address CGOpenMPRuntime::emitDepobjDependClause(
} else {
Pos = &Idx;
}
- emitDependData(CGF, KmpDependInfoTy, Pos, Dependencies, DependenciesArray);
+ emitDependData(CGF, KmpDependInfoTy, Pos, Dependencies, DependenciesArray, true, Loc);
DependenciesArray = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
CGF.Builder.CreateConstGEP(DependenciesArray, 1), CGF.VoidPtrTy,
CGF.Int8Ty);
+
return DependenciesArray;
}
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.h b/clang/lib/CodeGen/CGOpenMPRuntime.h
index 522ae3d35d22d7..83197c8678addf 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.h
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.h
@@ -457,13 +457,19 @@ class CGOpenMPRuntime {
QualType SavedKmpTaskTQTy;
/// Saved kmp_task_t for taskloop-based directive.
QualType SavedKmpTaskloopTQTy;
+
/// Type typedef struct kmp_depend_info {
/// kmp_intptr_t base_addr;
/// size_t len;
/// struct {
- /// bool in:1;
- /// bool out:1;
+ /// unsigned in : 1;
+ /// unsigned out : 1;
+ /// unsigned mtx : 1;
+ /// unsigned set : 1;
+ /// unsigned unused : 3;
+ /// unsigned all : 1;
/// } flags;
+ /// kmp_dephash_entry_t * hashentry;
/// } kmp_depend_info_t;
QualType KmpDependInfoTy;
/// Type typedef struct kmp_task_affinity_info {
@@ -623,6 +629,13 @@ class CGOpenMPRuntime {
LValue PosLVal, const OMPTaskDataTy::DependData &Data,
Address DependenciesArray);
+ void emitDependData(CodeGenFunction &CGF, QualType &KmpDependInfoTy,
+ llvm::PointerUnion<unsigned *, LValue *> Pos,
+ const OMPTaskDataTy::DependData &Data,
+ Address DependenciesArray,
+ bool depobj,
+ SourceLocation Loc);
+
public:
explicit CGOpenMPRuntime(CodeGenModule &CGM);
virtual ~CGOpenMPRuntime() {}
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPConstants.h b/llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
index 338b56226f2041..8e7b14c7435736 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
@@ -267,7 +267,7 @@ enum class OMPInteropType { Unknown, Target, TargetSync };
enum class OMPAtomicCompareOp : unsigned { EQ, MIN, MAX };
/// Fields ids in kmp_depend_info record.
-enum class RTLDependInfoFields { BaseAddr, Len, Flags };
+enum class RTLDependInfoFields { BaseAddr, Len, Flags, Dephash };
/// Dependence kind for RTL.
enum class RTLDependenceKindTy {
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
index fe09bb8177c28e..e47bb7f33c528e 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
@@ -378,6 +378,7 @@ __OMP_RTL(__kmpc_task_reduction_init, false, VoidPtr, Int32, Int32, VoidPtr)
__OMP_RTL(__kmpc_task_reduction_modifier_init, false, VoidPtr, VoidPtr, Int32,
Int32, Int32, VoidPtr)
__OMP_RTL(__kmpc_proxy_task_completed_ooo, false, Void, VoidPtr)
+__OMP_RTL(__kmpc_dephash_find, false, VoidPtr, IdentPtr, Int32, VoidPtr)
__OMP_RTL(__kmpc_omp_wait_deps, false, Void, IdentPtr, Int32, Int32,
/* kmp_depend_info_t */ VoidPtr, Int32, VoidPtr)
diff --git a/openmp/runtime/src/dllexports b/openmp/runtime/src/dllexports
index 0d49643709e0a0..ceb2d2147232b8 100644
--- a/openmp/runtime/src/dllexports
+++ b/openmp/runtime/src/dllexports
@@ -404,6 +404,7 @@ kmpc_set_disp_num_buffers 267
__kmpc_process_loop_nest_rectang 293
__kmpc_calc_original_ivs_rectang 295
__kmpc_for_collapsed_init 296
+ __kmpc_dephash_find 297
%endif
# User API entry points that have both lower- and upper- case versions for Fortran.
diff --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h
index 18ccf10fe17d0f..83b25a7a687d45 100644
--- a/openmp/runtime/src/kmp.h
+++ b/openmp/runtime/src/kmp.h
@@ -2525,6 +2525,7 @@ typedef struct kmp_depend_info {
#endif
} flags;
};
+ void * hashentry; /* kmp_dephash_entry_t * */
} kmp_depend_info_t;
// Internal structures to work with task dependencies:
@@ -2533,6 +2534,25 @@ struct kmp_depnode_list {
kmp_depnode_list_t *next;
};
+# if 0
+typedef struct kmp_dependences_s
+{
+ // using more than 65,536 dependences isnt a good idea anyway
+ // TODO : decrease to 'uint8_t' ? >256 deps/task also sounds a bit suspicious
+ uint16_t ndeps;
+ uint16_t nout;
+ uint16_t nin;
+ uint16_t nmtxinoutset;
+ uint16_t ninoutset;
+ uint16_t ndepobj;
+
+ // followed in order by 'ndeps' x 'uintptr_t' with
+ // 'nout' of type 'out'
+ // 'nin' of type 'in'
+ // [...]
+} kmp_dependences_t;
+# endif
+
// Max number of mutexinoutset dependencies per node
#define MAX_MTX_DEPS 4
@@ -4267,6 +4287,7 @@ KMP_EXPORT kmp_int32 __kmpc_omp_task_with_deps(
kmp_depend_info_t *noalias_dep_list);
KMP_EXPORT kmp_base_depnode_t *__kmpc_task_get_depnode(kmp_task_t *task);
+KMP_EXPORT kmp_dephash_entry * __kmpc_dephash_find(ident_t * loc_ref, kmp_int32 gtid, kmp_intptr_t addr);
KMP_EXPORT kmp_depnode_list_t *__kmpc_task_get_successors(kmp_task_t *task);
diff --git a/openmp/runtime/src/kmp_taskdeps.cpp b/openmp/runtime/src/kmp_taskdeps.cpp
index e575ad8b08a55f..07e2f12dd9ee32 100644
--- a/openmp/runtime/src/kmp_taskdeps.cpp
+++ b/openmp/runtime/src/kmp_taskdeps.cpp
@@ -154,10 +154,11 @@ static kmp_dephash_t *__kmp_dephash_create(kmp_info_t *thread,
return h;
}
-static kmp_dephash_entry *__kmp_dephash_find(kmp_info_t *thread,
+static inline kmp_dephash_entry *__kmp_dephash_find(kmp_info_t *thread,
kmp_dephash_t **hash,
kmp_intptr_t addr) {
- kmp_dephash_t *h = *hash;
+ kmp_dephash_t * h = *hash;
+
if (h->nelements != 0 && h->nconflicts / h->size >= 1) {
*hash = __kmp_dephash_extend(thread, h);
h = *hash;
@@ -196,6 +197,17 @@ static kmp_dephash_entry *__kmp_dephash_find(kmp_info_t *thread,
return entry;
}
+/** return the hashmap entry for the given adress on the currently executing dependency context */
+kmp_dephash_entry * __kmpc_dephash_find(ident_t * loc_ref, kmp_int32 gtid, kmp_intptr_t addr)
+{
+ (void) loc_ref;
+ kmp_info_t * thread = __kmp_threads[gtid];
+ kmp_dephash_t ** hash = &thread->th.th_current_task->td_dephash;
+ if (*hash == NULL)
+ *hash = __kmp_dephash_create(thread, thread->th.th_current_task);
+ return __kmp_dephash_find(thread, hash, addr);
+}
+
static kmp_depnode_list_t *__kmp_add_node(kmp_info_t *thread,
kmp_depnode_list_t *list,
kmp_depnode_t *node) {
@@ -464,8 +476,7 @@ __kmp_process_deps(kmp_int32 gtid, kmp_depnode_t *node, kmp_dephash_t **hash,
if (filter && dep->base_addr == 0)
continue; // skip filtered entries
- kmp_dephash_entry_t *info =
- __kmp_dephash_find(thread, hash, dep->base_addr);
+ kmp_dephash_entry_t *info = dep->hashentry ? (kmp_dephash_entry_t *) dep->hashentry : __kmp_dephash_find(thread, hash, dep->base_addr);
kmp_depnode_t *last_out = info->last_out;
kmp_depnode_list_t *last_set = info->last_set;
kmp_depnode_list_t *prev_set = info->prev_set;
>From 5585a84d54e1106b79ea70924f31620da04eb623 Mon Sep 17 00:00:00 2001
From: Romain PEREIRA <romain.pereira at inria.fr>
Date: Thu, 2 May 2024 15:11:43 +0200
Subject: [PATCH 2/4] [WIP] linter + fix most test, 3 tests still fails
---
clang/lib/CodeGen/CGOpenMPRuntime.cpp | 50 +++++++++----------
clang/lib/CodeGen/CGOpenMPRuntime.h | 9 ++--
openmp/runtime/src/kmp.h | 24 ++-------
openmp/runtime/src/kmp_taskdeps.cpp | 29 ++++++-----
.../test/ompt/tasks/kmp_task_depend_all.c | 8 +++
.../test/ompt/tasks/omp_task_depend_all.c | 3 ++
.../test/tasking/hidden_helper_task/common.h | 1 +
.../tasking/hidden_helper_task/depend.cpp | 4 ++
.../test/tasking/hidden_helper_task/gtid.cpp | 3 ++
.../test/tasking/kmp_detach_tasks_t3.c | 2 +
.../test/tasking/kmp_task_depend_all.c | 8 +++
openmp/runtime/test/tasking/kmp_task_deps.h | 1 +
.../tasking/kmp_task_deps_multiple_edges.c | 4 ++
.../kmp_task_deps_multiple_edges_inoutset.c | 2 +
.../test/tasking/kmp_taskwait_depend_all.c | 8 +++
.../test/tasking/kmp_taskwait_depend_in.c | 3 ++
.../test/tasking/kmp_taskwait_nowait.c | 3 ++
.../test/tasking/omp50_task_depend_mtx.c | 3 ++
.../test/tasking/omp50_task_depend_mtx2.c | 3 ++
.../test/tasking/omp51_task_dep_inoutset.c | 3 ++
20 files changed, 107 insertions(+), 64 deletions(-)
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 459585b1639301..cf1fbe94c195df 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -4063,12 +4063,11 @@ CGOpenMPRuntime::getDepobjElements(CodeGenFunction &CGF, LValue DepobjLVal,
return std::make_pair(NumDeps, Base);
}
-void CGOpenMPRuntime::emitDependData(CodeGenFunction &CGF, QualType &KmpDependInfoTy,
- llvm::PointerUnion<unsigned *, LValue *> Pos,
- const OMPTaskDataTy::DependData &Data,
- Address DependenciesArray,
- bool depobj,
- SourceLocation Loc) {
+void CGOpenMPRuntime::emitDependData(
+ CodeGenFunction &CGF, QualType &KmpDependInfoTy,
+ llvm::PointerUnion<unsigned *, LValue *> Pos,
+ const OMPTaskDataTy::DependData &Data, Address DependenciesArray,
+ bool depobj, SourceLocation Loc) {
CodeGenModule &CGM = CGF.CGM;
ASTContext &C = CGM.getContext();
QualType FlagsTy;
@@ -4126,24 +4125,24 @@ void CGOpenMPRuntime::emitDependData(CodeGenFunction &CGF, QualType &KmpDependIn
FlagsLVal);
// deps[i].dephash = NULL || findhash if depobj
LValue DephashLVal = CGF.EmitLValueForField(
- Base, *std::next(KmpDependInfoRD->field_begin(),
- static_cast<unsigned int>(RTLDependInfoFields::Dephash)));
- llvm::Value * Dephash;
- if (depobj)
- {
- // Build kmp_dephash_entry * __kmpc_dephash_find(ident_t * loc, kmp_int32 gtid, kmp_intptr_t addr)
- llvm::OpenMPIRBuilder &OMPBuilder = CGM.getOpenMPRuntime().getOMPBuilder();
- llvm::Value *UpLoc = emitUpdateLocation(CGF, Loc);
- llvm::Value *ThreadID = getThreadID(CGF, Loc);
- llvm::Value * DephashArgs[3] = { UpLoc, ThreadID, Addr } ;
- Dephash = CGF.EmitRuntimeCall(
- OMPBuilder.getOrCreateRuntimeFunction(
- CGM.getModule(), OMPRTL___kmpc_dephash_find),
- DephashArgs);
- }
- else
- {
- Dephash = llvm::Constant::getNullValue(CGF.VoidPtrTy);
+ Base,
+ *std::next(KmpDependInfoRD->field_begin(),
+ static_cast<unsigned int>(RTLDependInfoFields::Dephash)));
+ llvm::Value *Dephash;
+ if (depobj) {
+ // Build kmp_dephash_entry * __kmpc_dephash_find(ident_t * loc, kmp_int32
+ // gtid, kmp_intptr_t addr)
+ llvm::OpenMPIRBuilder &OMPBuilder =
+ CGM.getOpenMPRuntime().getOMPBuilder();
+ llvm::Value *UpLoc = emitUpdateLocation(CGF, Loc);
+ llvm::Value *ThreadID = getThreadID(CGF, Loc);
+ llvm::Value *DephashArgs[3] = {UpLoc, ThreadID, Addr};
+ Dephash =
+ CGF.EmitRuntimeCall(OMPBuilder.getOrCreateRuntimeFunction(
+ CGM.getModule(), OMPRTL___kmpc_dephash_find),
+ DephashArgs);
+ } else {
+ Dephash = llvm::Constant::getNullValue(CGF.VoidPtrTy);
}
CGF.EmitStoreOfScalar(Dephash, DephashLVal);
@@ -4440,7 +4439,8 @@ Address CGOpenMPRuntime::emitDepobjDependClause(
} else {
Pos = &Idx;
}
- emitDependData(CGF, KmpDependInfoTy, Pos, Dependencies, DependenciesArray, true, Loc);
+ emitDependData(CGF, KmpDependInfoTy, Pos, Dependencies, DependenciesArray,
+ true, Loc);
DependenciesArray = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
CGF.Builder.CreateConstGEP(DependenciesArray, 1), CGF.VoidPtrTy,
CGF.Int8Ty);
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.h b/clang/lib/CodeGen/CGOpenMPRuntime.h
index 83197c8678addf..855544dac2b7e4 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.h
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.h
@@ -630,11 +630,10 @@ class CGOpenMPRuntime {
Address DependenciesArray);
void emitDependData(CodeGenFunction &CGF, QualType &KmpDependInfoTy,
- llvm::PointerUnion<unsigned *, LValue *> Pos,
- const OMPTaskDataTy::DependData &Data,
- Address DependenciesArray,
- bool depobj,
- SourceLocation Loc);
+ llvm::PointerUnion<unsigned *, LValue *> Pos,
+ const OMPTaskDataTy::DependData &Data,
+ Address DependenciesArray, bool depobj,
+ SourceLocation Loc);
public:
explicit CGOpenMPRuntime(CodeGenModule &CGM);
diff --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h
index 83b25a7a687d45..f70c7faeae3b00 100644
--- a/openmp/runtime/src/kmp.h
+++ b/openmp/runtime/src/kmp.h
@@ -2525,7 +2525,7 @@ typedef struct kmp_depend_info {
#endif
} flags;
};
- void * hashentry; /* kmp_dephash_entry_t * */
+ void *hashentry; /* kmp_dephash_entry_t * */
} kmp_depend_info_t;
// Internal structures to work with task dependencies:
@@ -2534,25 +2534,6 @@ struct kmp_depnode_list {
kmp_depnode_list_t *next;
};
-# if 0
-typedef struct kmp_dependences_s
-{
- // using more than 65,536 dependences isnt a good idea anyway
- // TODO : decrease to 'uint8_t' ? >256 deps/task also sounds a bit suspicious
- uint16_t ndeps;
- uint16_t nout;
- uint16_t nin;
- uint16_t nmtxinoutset;
- uint16_t ninoutset;
- uint16_t ndepobj;
-
- // followed in order by 'ndeps' x 'uintptr_t' with
- // 'nout' of type 'out'
- // 'nin' of type 'in'
- // [...]
-} kmp_dependences_t;
-# endif
-
// Max number of mutexinoutset dependencies per node
#define MAX_MTX_DEPS 4
@@ -4287,7 +4268,8 @@ KMP_EXPORT kmp_int32 __kmpc_omp_task_with_deps(
kmp_depend_info_t *noalias_dep_list);
KMP_EXPORT kmp_base_depnode_t *__kmpc_task_get_depnode(kmp_task_t *task);
-KMP_EXPORT kmp_dephash_entry * __kmpc_dephash_find(ident_t * loc_ref, kmp_int32 gtid, kmp_intptr_t addr);
+KMP_EXPORT kmp_dephash_entry *
+__kmpc_dephash_find(ident_t *loc_ref, kmp_int32 gtid, kmp_intptr_t addr);
KMP_EXPORT kmp_depnode_list_t *__kmpc_task_get_successors(kmp_task_t *task);
diff --git a/openmp/runtime/src/kmp_taskdeps.cpp b/openmp/runtime/src/kmp_taskdeps.cpp
index 07e2f12dd9ee32..fa1dc82d14e5ac 100644
--- a/openmp/runtime/src/kmp_taskdeps.cpp
+++ b/openmp/runtime/src/kmp_taskdeps.cpp
@@ -155,9 +155,9 @@ static kmp_dephash_t *__kmp_dephash_create(kmp_info_t *thread,
}
static inline kmp_dephash_entry *__kmp_dephash_find(kmp_info_t *thread,
- kmp_dephash_t **hash,
- kmp_intptr_t addr) {
- kmp_dephash_t * h = *hash;
+ kmp_dephash_t **hash,
+ kmp_intptr_t addr) {
+ kmp_dephash_t *h = *hash;
if (h->nelements != 0 && h->nconflicts / h->size >= 1) {
*hash = __kmp_dephash_extend(thread, h);
@@ -197,15 +197,16 @@ static inline kmp_dephash_entry *__kmp_dephash_find(kmp_info_t *thread,
return entry;
}
-/** return the hashmap entry for the given adress on the currently executing dependency context */
-kmp_dephash_entry * __kmpc_dephash_find(ident_t * loc_ref, kmp_int32 gtid, kmp_intptr_t addr)
-{
- (void) loc_ref;
- kmp_info_t * thread = __kmp_threads[gtid];
- kmp_dephash_t ** hash = &thread->th.th_current_task->td_dephash;
- if (*hash == NULL)
- *hash = __kmp_dephash_create(thread, thread->th.th_current_task);
- return __kmp_dephash_find(thread, hash, addr);
+/** return the hashmap entry for the given adress on the currently executing
+ * dependency context */
+kmp_dephash_entry *__kmpc_dephash_find(ident_t *loc_ref, kmp_int32 gtid,
+ kmp_intptr_t addr) {
+ (void)loc_ref;
+ kmp_info_t *thread = __kmp_threads[gtid];
+ kmp_dephash_t **hash = &thread->th.th_current_task->td_dephash;
+ if (*hash == NULL)
+ *hash = __kmp_dephash_create(thread, thread->th.th_current_task);
+ return __kmp_dephash_find(thread, hash, addr);
}
static kmp_depnode_list_t *__kmp_add_node(kmp_info_t *thread,
@@ -476,7 +477,9 @@ __kmp_process_deps(kmp_int32 gtid, kmp_depnode_t *node, kmp_dephash_t **hash,
if (filter && dep->base_addr == 0)
continue; // skip filtered entries
- kmp_dephash_entry_t *info = dep->hashentry ? (kmp_dephash_entry_t *) dep->hashentry : __kmp_dephash_find(thread, hash, dep->base_addr);
+ kmp_dephash_entry_t *info =
+ dep->hashentry ? (kmp_dephash_entry_t *)dep->hashentry
+ : __kmp_dephash_find(thread, hash, dep->base_addr);
kmp_depnode_t *last_out = info->last_out;
kmp_depnode_list_t *last_set = info->last_set;
kmp_depnode_list_t *prev_set = info->prev_set;
diff --git a/openmp/runtime/test/ompt/tasks/kmp_task_depend_all.c b/openmp/runtime/test/ompt/tasks/kmp_task_depend_all.c
index a18fe5a726e777..1d6073c3055dbd 100644
--- a/openmp/runtime/test/ompt/tasks/kmp_task_depend_all.c
+++ b/openmp/runtime/test/ompt/tasks/kmp_task_depend_all.c
@@ -92,6 +92,7 @@ typedef struct DEP {
size_t addr;
size_t len;
unsigned char flags;
+ void * dephash;
} dep;
#define DEP_ALL_MEM 0x80
typedef struct task {
@@ -233,9 +234,11 @@ int main() {
sdep[0].addr = (size_t)&i1;
sdep[0].len = 0; // not used
sdep[0].flags = 1; // IN
+ sdep[0].dephash = NULL;
sdep[1].addr = (size_t)&i2;
sdep[1].len = 0; // not used
sdep[1].flags = 8; // INOUTSET
+ sdep[1].dephash = NULL;
ptr->f_priv = t + 10; // init single first-private variable
__kmpc_omp_task_with_deps(&loc, gtid, ptr, 2, sdep, 0, 0);
@@ -244,9 +247,11 @@ int main() {
sdep[0].addr = (size_t)&i1; // to be ignored
sdep[0].len = 0; // not used
sdep[0].flags = 1; // IN
+ sdep[0].dephash = NULL;
sdep[1].addr = 0;
sdep[1].len = 0; // not used
sdep[1].flags = DEP_ALL_MEM; // omp_all_memory
+ sdep[1].dephash = NULL;
ptr->f_priv = t + 20; // init single first-private variable
__kmpc_omp_task_with_deps(&loc, gtid, ptr, 2, sdep, 0, 0);
// compiler codegen end
@@ -298,6 +303,7 @@ int main() {
sdep[0].addr = (size_t)(-1); // omp_all_memory
sdep[0].len = 0; // not used
sdep[0].flags = 2; // OUT
+ sdep[0].dephash = NULL;
ptr->f_priv = t + 30; // init single first-private variable
__kmpc_omp_task_with_deps(&loc, gtid, ptr, 1, sdep, 0, 0);
@@ -306,9 +312,11 @@ int main() {
sdep[0].addr = 0;
sdep[0].len = 0; // not used
sdep[0].flags = DEP_ALL_MEM; // omp_all_memory
+ sdep[0].dephash = NULL;
sdep[1].addr = (size_t)&i3; // to be ignored
sdep[1].len = 0; // not used
sdep[1].flags = 4; // MUTEXINOUTSET
+ sdep[1].dephash = NULL;
ptr->f_priv = t + 40; // init single first-private variable
__kmpc_omp_task_with_deps(&loc, gtid, ptr, 2, sdep, 0, 0);
// compiler codegen end
diff --git a/openmp/runtime/test/ompt/tasks/omp_task_depend_all.c b/openmp/runtime/test/ompt/tasks/omp_task_depend_all.c
index eff6ea5444b511..b9dcb67daf7412 100644
--- a/openmp/runtime/test/ompt/tasks/omp_task_depend_all.c
+++ b/openmp/runtime/test/ompt/tasks/omp_task_depend_all.c
@@ -91,6 +91,7 @@ typedef struct DEP {
size_t addr;
size_t len;
unsigned char flags;
+ void * dephash;
} dep;
#define DEP_ALL_MEM 0x80
typedef struct task {
@@ -233,9 +234,11 @@ int main() {
sdep[0].addr = (size_t)&i1;
sdep[0].len = 0; // not used
sdep[0].flags = 1; // IN
+ sdep[0].dephash = NULL;
sdep[1].addr = (size_t)&i2;
sdep[1].len = 0; // not used
sdep[1].flags = 8; // INOUTSET
+ sdep[1].dephash = NULL;
ptr->f_priv = t + 10; // init single first-private variable
__kmpc_omp_task_with_deps(&loc, gtid, ptr, 2, sdep, 0, 0);
diff --git a/openmp/runtime/test/tasking/hidden_helper_task/common.h b/openmp/runtime/test/tasking/hidden_helper_task/common.h
index 68e2b584c87739..7f2b9c227172ab 100644
--- a/openmp/runtime/test/tasking/hidden_helper_task/common.h
+++ b/openmp/runtime/test/tasking/hidden_helper_task/common.h
@@ -33,6 +33,7 @@ typedef struct kmp_depend_info {
unsigned all : 1;
#endif
} flags;
+ void *hashentry; /* kmp_dephash_entry_t * */
};
} kmp_depend_info_t;
diff --git a/openmp/runtime/test/tasking/hidden_helper_task/depend.cpp b/openmp/runtime/test/tasking/hidden_helper_task/depend.cpp
index 430c2006a451e6..4f0d566b059c00 100644
--- a/openmp/runtime/test/tasking/hidden_helper_task/depend.cpp
+++ b/openmp/runtime/test/tasking/hidden_helper_task/depend.cpp
@@ -68,6 +68,7 @@ int main(int argc, char *argv[]) {
depinfo1.base_addr = reinterpret_cast<intptr_t>(&data);
depinfo1.flag = 2; // OUT
depinfo1.len = 4;
+ depinfo1.hashentry = NULL;
__kmpc_omp_task_with_deps(nullptr, gtid, task1, 1, &depinfo1, 0, nullptr);
@@ -83,6 +84,7 @@ int main(int argc, char *argv[]) {
depinfo2.base_addr = reinterpret_cast<intptr_t>(&data);
depinfo2.flag = 3; // INOUT
depinfo2.len = 4;
+ depinfo2.hashentry = NULL;
__kmpc_omp_task_with_deps(nullptr, gtid, task2, 1, &depinfo2, 0, nullptr);
@@ -98,6 +100,7 @@ int main(int argc, char *argv[]) {
depinfo3.base_addr = reinterpret_cast<intptr_t>(&data);
depinfo3.flag = 3; // INOUT
depinfo3.len = 4;
+ depinfo3.hashentry = NULL;
__kmpc_omp_task_with_deps(nullptr, gtid, task3, 1, &depinfo3, 0, nullptr);
@@ -113,6 +116,7 @@ int main(int argc, char *argv[]) {
depinfo4.base_addr = reinterpret_cast<intptr_t>(&data);
depinfo4.flag = 3; // INOUT
depinfo4.len = 4;
+ depinfo4.hashentry = NULL;
__kmpc_omp_task_with_deps(nullptr, gtid, task4, 1, &depinfo4, 0, nullptr);
diff --git a/openmp/runtime/test/tasking/hidden_helper_task/gtid.cpp b/openmp/runtime/test/tasking/hidden_helper_task/gtid.cpp
index bc02caccb69ed9..8838fa73699c82 100644
--- a/openmp/runtime/test/tasking/hidden_helper_task/gtid.cpp
+++ b/openmp/runtime/test/tasking/hidden_helper_task/gtid.cpp
@@ -85,6 +85,7 @@ int main(int argc, char *argv[]) {
depinfo1.base_addr = reinterpret_cast<intptr_t>(&depvar);
depinfo1.flag = 3; // INOUT
depinfo1.len = 4;
+ depinfo1.hashentry = NULL;
__kmpc_omp_task_with_deps(nullptr, gtid, task1, 1, &depinfo1, 0, nullptr);
@@ -99,6 +100,7 @@ int main(int argc, char *argv[]) {
depinfo2.base_addr = reinterpret_cast<intptr_t>(&depvar);
depinfo2.flag = 3; // INOUT
depinfo2.len = 4;
+ depinfo2.hashentry = NULL;
__kmpc_omp_task_with_deps(nullptr, gtid, task2, 1, &depinfo2, 0, nullptr);
@@ -113,6 +115,7 @@ int main(int argc, char *argv[]) {
depinfo3.base_addr = reinterpret_cast<intptr_t>(&depvar);
depinfo3.flag = 3; // INOUT
depinfo3.len = 4;
+ depinfo3.hashentry = NULL;
__kmpc_omp_task_with_deps(nullptr, gtid, task3, 1, &depinfo3, 0, nullptr);
diff --git a/openmp/runtime/test/tasking/kmp_detach_tasks_t3.c b/openmp/runtime/test/tasking/kmp_detach_tasks_t3.c
index bf41d94fcbbd82..911245050b7c90 100644
--- a/openmp/runtime/test/tasking/kmp_detach_tasks_t3.c
+++ b/openmp/runtime/test/tasking/kmp_detach_tasks_t3.c
@@ -57,6 +57,7 @@ typedef struct DEP {
size_t addr;
size_t len;
unsigned char flags;
+ void * dephash;
} dep;
typedef int(* task_entry_t)( int, ptask );
@@ -115,6 +116,7 @@ int main() {
sdep.addr = (size_t)&nt;
sdep.len = 0L;
sdep.flags = 3;
+ sdep.dephash = NULL;
__kmpc_omp_task_with_deps(NULL,gtid,task,1,&sdep,0,0);
//__kmpc_omp_task(NULL, gtid, task);
diff --git a/openmp/runtime/test/tasking/kmp_task_depend_all.c b/openmp/runtime/test/tasking/kmp_task_depend_all.c
index 9a2999657abdc2..83ecbc07df3994 100644
--- a/openmp/runtime/test/tasking/kmp_task_depend_all.c
+++ b/openmp/runtime/test/tasking/kmp_task_depend_all.c
@@ -44,6 +44,7 @@ typedef struct DEP {
size_t addr;
size_t len;
unsigned char flags;
+ void * dephash;
} dep;
#define DEP_ALL_MEM 0x80
typedef struct task {
@@ -186,9 +187,11 @@ int main()
sdep[0].addr = (size_t)&i1;
sdep[0].len = 0; // not used
sdep[0].flags = 1; // IN
+ sdep[0].dephash = NULL;
sdep[1].addr = (size_t)&i2;
sdep[1].len = 0; // not used
sdep[1].flags = 8; // INOUTSET
+ sdep[1].dephash = NULL;
ptr->f_priv = t + 10; // init single first-private variable
__kmpc_omp_task_with_deps(&loc, gtid, ptr, 2, sdep, 0, 0);
@@ -197,9 +200,11 @@ int main()
sdep[0].addr = (size_t)&i1; // to be ignored
sdep[0].len = 0; // not used
sdep[0].flags = 1; // IN
+ sdep[0].dephash = NULL;
sdep[1].addr = 0;
sdep[1].len = 0; // not used
sdep[1].flags = DEP_ALL_MEM; // omp_all_memory
+ sdep[1].dephash = NULL;
ptr->f_priv = t + 20; // init single first-private variable
__kmpc_omp_task_with_deps(&loc, gtid, ptr, 2, sdep, 0, 0);
// compiler codegen end
@@ -251,6 +256,7 @@ int main()
sdep[0].addr = (size_t)(-1); // omp_all_memory
sdep[0].len = 0; // not used
sdep[0].flags = 2; // OUT
+ sdep[0].dephash = NULL;
ptr->f_priv = t + 30; // init single first-private variable
__kmpc_omp_task_with_deps(&loc, gtid, ptr, 1, sdep, 0, 0);
@@ -259,9 +265,11 @@ int main()
sdep[0].addr = 0;
sdep[0].len = 0; // not used
sdep[0].flags = DEP_ALL_MEM; // omp_all_memory
+ sdep[0].dephash = NULL;
sdep[1].addr = (size_t)&i3; // to be ignored
sdep[1].len = 0; // not used
sdep[1].flags = 4; // MUTEXINOUTSET
+ sdep[1].dephash = NULL;
ptr->f_priv = t + 40; // init single first-private variable
__kmpc_omp_task_with_deps(&loc, gtid, ptr, 2, sdep, 0, 0);
// compiler codegen end
diff --git a/openmp/runtime/test/tasking/kmp_task_deps.h b/openmp/runtime/test/tasking/kmp_task_deps.h
index 5a1f2b0806a8a5..b72926be6663ea 100644
--- a/openmp/runtime/test/tasking/kmp_task_deps.h
+++ b/openmp/runtime/test/tasking/kmp_task_deps.h
@@ -9,6 +9,7 @@ typedef struct DEP {
size_t addr;
size_t len;
unsigned char flags;
+ void * hashentry;
} dep;
typedef struct task {
diff --git a/openmp/runtime/test/tasking/kmp_task_deps_multiple_edges.c b/openmp/runtime/test/tasking/kmp_task_deps_multiple_edges.c
index e04ebf0f394000..36e5862cf39c6a 100644
--- a/openmp/runtime/test/tasking/kmp_task_deps_multiple_edges.c
+++ b/openmp/runtime/test/tasking/kmp_task_deps_multiple_edges.c
@@ -31,10 +31,12 @@ int main(void) {
deps[0].addr = (size_t)&x;
deps[0].len = 0;
deps[0].flags = 2; // OUT
+ deps[0].hashentry = NULL;
deps[1].addr = (size_t)&y;
deps[1].len = 0;
deps[1].flags = 2; // OUT
+ deps[1].hashentry = NULL;
__kmpc_omp_task_with_deps(&loc, gtid, A, 2, deps, 0, 0);
@@ -43,10 +45,12 @@ int main(void) {
deps[0].addr = (size_t)&x;
deps[0].len = 0;
deps[0].flags = 1; // IN
+ deps[0].hashentry = NULL;
deps[1].addr = (size_t)&y;
deps[1].len = 0;
deps[1].flags = 1; // IN
+ deps[1].hashentry = NULL;
__kmpc_omp_task_with_deps(&loc, gtid, B, 2, deps, 0, 0);
diff --git a/openmp/runtime/test/tasking/kmp_task_deps_multiple_edges_inoutset.c b/openmp/runtime/test/tasking/kmp_task_deps_multiple_edges_inoutset.c
index 65f1ed8920baef..984265f95e4786 100644
--- a/openmp/runtime/test/tasking/kmp_task_deps_multiple_edges_inoutset.c
+++ b/openmp/runtime/test/tasking/kmp_task_deps_multiple_edges_inoutset.c
@@ -37,10 +37,12 @@ int main(void) {
deps[0].addr = (size_t)&x;
deps[0].len = 0;
deps[0].flags = 8; // INOUTSET
+ deps[0].hashentry = NULL;
deps[1].addr = (size_t)&y;
deps[1].len = 0;
deps[1].flags = 8; // INOUTSET
+ deps[1].hashentry = NULL;
// A inoutset(x)
A = __kmpc_omp_task_alloc(&loc, gtid, TIED, sizeof(kmp_task_t), 0, NULL);
diff --git a/openmp/runtime/test/tasking/kmp_taskwait_depend_all.c b/openmp/runtime/test/tasking/kmp_taskwait_depend_all.c
index 98ce1f8347f374..fa9ccf128e07d4 100644
--- a/openmp/runtime/test/tasking/kmp_taskwait_depend_all.c
+++ b/openmp/runtime/test/tasking/kmp_taskwait_depend_all.c
@@ -50,6 +50,7 @@ typedef struct DEP {
size_t addr;
size_t len;
unsigned char flags;
+ void * hashentry;
} dep;
#define DEP_ALL_MEM 0x80
typedef struct task {
@@ -213,9 +214,11 @@ int main()
sdep[0].addr = (size_t)&i1;
sdep[0].len = 0; // not used
sdep[0].flags = 1; // IN
+ sdep[0].hashentry = NULL;
sdep[1].addr = (size_t)&i2;
sdep[1].len = 0; // not used
sdep[1].flags = 8; // INOUTSET
+ sdep[1].hashentry = NULL;
ptr->f_priv = t + 10; // init single first-private variable
__kmpc_omp_task_with_deps(&loc, gtid, ptr, 2, sdep, 0, 0);
@@ -224,9 +227,11 @@ int main()
sdep[0].addr = (size_t)&i1; // to be ignored
sdep[0].len = 0; // not used
sdep[0].flags = 1; // IN
+ sdep[0].hashentry = NULL;
sdep[1].addr = 0;
sdep[1].len = 0; // not used
sdep[1].flags = DEP_ALL_MEM; // omp_all_memory
+ sdep[1].hashentry = NULL;
ptr->f_priv = t + 20; // init single first-private variable
__kmpc_omp_task_with_deps(&loc, gtid, ptr, 2, sdep, 0, 0);
// compiler codegen end
@@ -278,6 +283,7 @@ int main()
sdep[0].addr = (size_t)(-1); // omp_all_memory
sdep[0].len = 0; // not used
sdep[0].flags = 2; // OUT
+ sdep[0].hashentry = NULL;
ptr->f_priv = t + 30; // init single first-private variable
__kmpc_omp_task_with_deps(&loc, gtid, ptr, 1, sdep, 0, 0);
@@ -286,9 +292,11 @@ int main()
sdep[0].addr = 0;
sdep[0].len = 0; // not used
sdep[0].flags = DEP_ALL_MEM; // omp_all_memory
+ sdep[0].hashentry = NULL;
sdep[1].addr = (size_t)&i3; // to be ignored
sdep[1].len = 0; // not used
sdep[1].flags = 4; // MUTEXINOUTSET
+ sdep[1].hashentry = NULL;
ptr->f_priv = t + 40; // init single first-private variable
__kmpc_omp_task_with_deps(&loc, gtid, ptr, 2, sdep, 0, 0);
// compiler codegen end
diff --git a/openmp/runtime/test/tasking/kmp_taskwait_depend_in.c b/openmp/runtime/test/tasking/kmp_taskwait_depend_in.c
index fef29ea60b4876..2eefc757af778e 100644
--- a/openmp/runtime/test/tasking/kmp_taskwait_depend_in.c
+++ b/openmp/runtime/test/tasking/kmp_taskwait_depend_in.c
@@ -10,6 +10,7 @@ typedef struct DEP {
size_t addr;
size_t len;
unsigned char flags;
+ void * hashentry;
} _dep;
typedef struct ID {
int reserved_1;
@@ -56,8 +57,10 @@ int main()
int gtid = __kmpc_global_thread_num(&loc);
sdep[0].addr = (size_t)&i2;
sdep[0].flags = 1; // 1-in, 2-out, 3-inout, 4-mtx, 8-inoutset
+ sdep[0].hashentry = NULL;
sdep[1].addr = (size_t)&i1;
sdep[1].flags = 1; // in
+ sdep[1].hashentry = NULL;
__kmpc_omp_wait_deps(&loc, gtid, 2, sdep, 0, NULL);
}
printf("single done\n");
diff --git a/openmp/runtime/test/tasking/kmp_taskwait_nowait.c b/openmp/runtime/test/tasking/kmp_taskwait_nowait.c
index 0353d62e322418..714d85ec932477 100644
--- a/openmp/runtime/test/tasking/kmp_taskwait_nowait.c
+++ b/openmp/runtime/test/tasking/kmp_taskwait_nowait.c
@@ -12,6 +12,7 @@ typedef struct DEP {
size_t addr;
size_t len;
unsigned char flags;
+ void * hashentry;
} _dep;
typedef struct ID {
int reserved_1;
@@ -74,8 +75,10 @@ int main()
sizeof(task_t), 0, NULL);
sdep[0].addr = (size_t)&i2;
sdep[0].flags = 1; // 1-in, 2-out, 3-inout, 4-mtx, 8-inoutset
+ sdep[0].hashentry = NULL;
sdep[1].addr = (size_t)&i1;
sdep[1].flags = 1; // in
+ sdep[1].hashentry = NULL;
__kmpc_omp_task_with_deps(&loc, gtid, ptr, 2, sdep, 0, NULL);
}
printf("single done\n");
diff --git a/openmp/runtime/test/tasking/omp50_task_depend_mtx.c b/openmp/runtime/test/tasking/omp50_task_depend_mtx.c
index e6cd7ff1d9d207..1f53e6e766a6e8 100644
--- a/openmp/runtime/test/tasking/omp50_task_depend_mtx.c
+++ b/openmp/runtime/test/tasking/omp50_task_depend_mtx.c
@@ -38,6 +38,7 @@ typedef struct DEP {
size_t addr;
size_t len;
unsigned char flags;
+ void * hashentry;
} dep;
typedef struct ID {
int reserved_1;
@@ -125,9 +126,11 @@ int main()
sdep[0].addr = (size_t)&i1;
sdep[0].len = 0; // not used
sdep[0].flags = 4; // mx
+ sdep[0].hashentry = NULL;
sdep[1].addr = (size_t)&i4;
sdep[1].len = 0; // not used
sdep[1].flags = 4; // mx
+ sdep[1].hashentry = NULL;
**ptr = t + 10; // init single shared variable
__kmpc_omp_task_with_deps(&loc, gtid, ptr, 2, sdep, 0, 0);
diff --git a/openmp/runtime/test/tasking/omp50_task_depend_mtx2.c b/openmp/runtime/test/tasking/omp50_task_depend_mtx2.c
index cc0a3a19038242..29b4f7338053ea 100644
--- a/openmp/runtime/test/tasking/omp50_task_depend_mtx2.c
+++ b/openmp/runtime/test/tasking/omp50_task_depend_mtx2.c
@@ -38,6 +38,7 @@ typedef struct DEP {
size_t addr;
size_t len;
unsigned char flags;
+ void * hashentry;
} dep;
typedef struct ID {
int reserved_1;
@@ -125,9 +126,11 @@ int main()
sdep[0].addr = (size_t)&i1;
sdep[0].len = 0; // not used
sdep[0].flags = 4; // mx
+ sdep[0].hashentry = NULL;
sdep[1].addr = (size_t)&i4;
sdep[1].len = 0; // not used
sdep[1].flags = 4; // mx
+ sdep[1].hashentry = NULL;
**ptr = t + 10; // init single shared variable
__kmpc_omp_task_with_deps(&loc, gtid, ptr, 2, sdep, 0, 0);
diff --git a/openmp/runtime/test/tasking/omp51_task_dep_inoutset.c b/openmp/runtime/test/tasking/omp51_task_dep_inoutset.c
index a7787ff3da53ac..b59f22f2ff0a3f 100644
--- a/openmp/runtime/test/tasking/omp51_task_dep_inoutset.c
+++ b/openmp/runtime/test/tasking/omp51_task_dep_inoutset.c
@@ -41,6 +41,7 @@ typedef struct DEP {
size_t addr;
size_t len;
unsigned char flags;
+ void * hashentry;
} dep;
typedef struct task {
void** shareds;
@@ -168,9 +169,11 @@ int main()
sdep[0].addr = (size_t)&i1;
sdep[0].len = 0; // not used
sdep[0].flags = 1; // IN
+ sdep[0].hashentry = NULL;
sdep[1].addr = (size_t)&i2;
sdep[1].len = 0; // not used
sdep[1].flags = 8; // INOUTSET
+ sdep[1].hashentry = NULL;
ptr->f_priv = t + 10; // init single first-private variable
__kmpc_omp_task_with_deps(&loc, gtid, ptr, 2, sdep, 0, 0);
>From 7c54adbbdf7ac01b62992144db3ec6002bffc852 Mon Sep 17 00:00:00 2001
From: Romain PEREIRA <romain.pereira at inria.fr>
Date: Sun, 5 May 2024 19:35:15 +0200
Subject: [PATCH 3/4] fixed test/tasking/hidden_helper_task/common.h
---
openmp/runtime/test/tasking/hidden_helper_task/common.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/openmp/runtime/test/tasking/hidden_helper_task/common.h b/openmp/runtime/test/tasking/hidden_helper_task/common.h
index 7f2b9c227172ab..0207774789a658 100644
--- a/openmp/runtime/test/tasking/hidden_helper_task/common.h
+++ b/openmp/runtime/test/tasking/hidden_helper_task/common.h
@@ -33,8 +33,8 @@ typedef struct kmp_depend_info {
unsigned all : 1;
#endif
} flags;
- void *hashentry; /* kmp_dephash_entry_t * */
};
+ void *hashentry; /* kmp_dephash_entry_t * */
} kmp_depend_info_t;
typedef union kmp_cmplrdata {
>From 28db4a35d7fa04a38cda29081953e3f009ee939f Mon Sep 17 00:00:00 2001
From: Romain PEREIRA <romain.pereira at inria.fr>
Date: Sun, 5 May 2024 20:40:53 +0200
Subject: [PATCH 4/4] clang format
---
openmp/runtime/test/ompt/tasks/kmp_task_depend_all.c | 2 +-
openmp/runtime/test/ompt/tasks/omp_task_depend_all.c | 2 +-
openmp/runtime/test/tasking/kmp_detach_tasks_t3.c | 2 +-
openmp/runtime/test/tasking/kmp_task_depend_all.c | 2 +-
openmp/runtime/test/tasking/kmp_task_deps.h | 2 +-
openmp/runtime/test/tasking/kmp_taskwait_depend_all.c | 2 +-
openmp/runtime/test/tasking/kmp_taskwait_depend_in.c | 2 +-
openmp/runtime/test/tasking/kmp_taskwait_nowait.c | 2 +-
openmp/runtime/test/tasking/omp50_task_depend_mtx.c | 2 +-
openmp/runtime/test/tasking/omp50_task_depend_mtx2.c | 2 +-
openmp/runtime/test/tasking/omp51_task_dep_inoutset.c | 2 +-
11 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/openmp/runtime/test/ompt/tasks/kmp_task_depend_all.c b/openmp/runtime/test/ompt/tasks/kmp_task_depend_all.c
index 1d6073c3055dbd..a2487a10a1a49e 100644
--- a/openmp/runtime/test/ompt/tasks/kmp_task_depend_all.c
+++ b/openmp/runtime/test/ompt/tasks/kmp_task_depend_all.c
@@ -92,7 +92,7 @@ typedef struct DEP {
size_t addr;
size_t len;
unsigned char flags;
- void * dephash;
+ void *dephash;
} dep;
#define DEP_ALL_MEM 0x80
typedef struct task {
diff --git a/openmp/runtime/test/ompt/tasks/omp_task_depend_all.c b/openmp/runtime/test/ompt/tasks/omp_task_depend_all.c
index b9dcb67daf7412..76cea216049372 100644
--- a/openmp/runtime/test/ompt/tasks/omp_task_depend_all.c
+++ b/openmp/runtime/test/ompt/tasks/omp_task_depend_all.c
@@ -91,7 +91,7 @@ typedef struct DEP {
size_t addr;
size_t len;
unsigned char flags;
- void * dephash;
+ void *dephash;
} dep;
#define DEP_ALL_MEM 0x80
typedef struct task {
diff --git a/openmp/runtime/test/tasking/kmp_detach_tasks_t3.c b/openmp/runtime/test/tasking/kmp_detach_tasks_t3.c
index 911245050b7c90..49828ddfeab895 100644
--- a/openmp/runtime/test/tasking/kmp_detach_tasks_t3.c
+++ b/openmp/runtime/test/tasking/kmp_detach_tasks_t3.c
@@ -57,7 +57,7 @@ typedef struct DEP {
size_t addr;
size_t len;
unsigned char flags;
- void * dephash;
+ void *dephash;
} dep;
typedef int(* task_entry_t)( int, ptask );
diff --git a/openmp/runtime/test/tasking/kmp_task_depend_all.c b/openmp/runtime/test/tasking/kmp_task_depend_all.c
index 83ecbc07df3994..c8a49dd47efd78 100644
--- a/openmp/runtime/test/tasking/kmp_task_depend_all.c
+++ b/openmp/runtime/test/tasking/kmp_task_depend_all.c
@@ -44,7 +44,7 @@ typedef struct DEP {
size_t addr;
size_t len;
unsigned char flags;
- void * dephash;
+ void *dephash;
} dep;
#define DEP_ALL_MEM 0x80
typedef struct task {
diff --git a/openmp/runtime/test/tasking/kmp_task_deps.h b/openmp/runtime/test/tasking/kmp_task_deps.h
index b72926be6663ea..67c56edac0beab 100644
--- a/openmp/runtime/test/tasking/kmp_task_deps.h
+++ b/openmp/runtime/test/tasking/kmp_task_deps.h
@@ -9,7 +9,7 @@ typedef struct DEP {
size_t addr;
size_t len;
unsigned char flags;
- void * hashentry;
+ void *hashentry;
} dep;
typedef struct task {
diff --git a/openmp/runtime/test/tasking/kmp_taskwait_depend_all.c b/openmp/runtime/test/tasking/kmp_taskwait_depend_all.c
index fa9ccf128e07d4..fa09f698223549 100644
--- a/openmp/runtime/test/tasking/kmp_taskwait_depend_all.c
+++ b/openmp/runtime/test/tasking/kmp_taskwait_depend_all.c
@@ -50,7 +50,7 @@ typedef struct DEP {
size_t addr;
size_t len;
unsigned char flags;
- void * hashentry;
+ void *hashentry;
} dep;
#define DEP_ALL_MEM 0x80
typedef struct task {
diff --git a/openmp/runtime/test/tasking/kmp_taskwait_depend_in.c b/openmp/runtime/test/tasking/kmp_taskwait_depend_in.c
index 2eefc757af778e..ecef14bad6b4bd 100644
--- a/openmp/runtime/test/tasking/kmp_taskwait_depend_in.c
+++ b/openmp/runtime/test/tasking/kmp_taskwait_depend_in.c
@@ -10,7 +10,7 @@ typedef struct DEP {
size_t addr;
size_t len;
unsigned char flags;
- void * hashentry;
+ void *hashentry;
} _dep;
typedef struct ID {
int reserved_1;
diff --git a/openmp/runtime/test/tasking/kmp_taskwait_nowait.c b/openmp/runtime/test/tasking/kmp_taskwait_nowait.c
index 714d85ec932477..fc03c3aaa882bc 100644
--- a/openmp/runtime/test/tasking/kmp_taskwait_nowait.c
+++ b/openmp/runtime/test/tasking/kmp_taskwait_nowait.c
@@ -12,7 +12,7 @@ typedef struct DEP {
size_t addr;
size_t len;
unsigned char flags;
- void * hashentry;
+ void *hashentry;
} _dep;
typedef struct ID {
int reserved_1;
diff --git a/openmp/runtime/test/tasking/omp50_task_depend_mtx.c b/openmp/runtime/test/tasking/omp50_task_depend_mtx.c
index 1f53e6e766a6e8..a20c27c7efd950 100644
--- a/openmp/runtime/test/tasking/omp50_task_depend_mtx.c
+++ b/openmp/runtime/test/tasking/omp50_task_depend_mtx.c
@@ -38,7 +38,7 @@ typedef struct DEP {
size_t addr;
size_t len;
unsigned char flags;
- void * hashentry;
+ void *hashentry;
} dep;
typedef struct ID {
int reserved_1;
diff --git a/openmp/runtime/test/tasking/omp50_task_depend_mtx2.c b/openmp/runtime/test/tasking/omp50_task_depend_mtx2.c
index 29b4f7338053ea..135b7931379f1d 100644
--- a/openmp/runtime/test/tasking/omp50_task_depend_mtx2.c
+++ b/openmp/runtime/test/tasking/omp50_task_depend_mtx2.c
@@ -38,7 +38,7 @@ typedef struct DEP {
size_t addr;
size_t len;
unsigned char flags;
- void * hashentry;
+ void *hashentry;
} dep;
typedef struct ID {
int reserved_1;
diff --git a/openmp/runtime/test/tasking/omp51_task_dep_inoutset.c b/openmp/runtime/test/tasking/omp51_task_dep_inoutset.c
index b59f22f2ff0a3f..74fffbf80108ba 100644
--- a/openmp/runtime/test/tasking/omp51_task_dep_inoutset.c
+++ b/openmp/runtime/test/tasking/omp51_task_dep_inoutset.c
@@ -41,7 +41,7 @@ typedef struct DEP {
size_t addr;
size_t len;
unsigned char flags;
- void * hashentry;
+ void *hashentry;
} dep;
typedef struct task {
void** shareds;
More information about the cfe-commits
mailing list