Skip to content

Commit f1fa455

Browse files
committed
Move solution for reduction-related barriers to the backend layer.
Merge branch 'feature/implementationSpecificBarrier' into develop
2 parents 01b52a4 + 1c85bca commit f1fa455

3 files changed

Lines changed: 19 additions & 3 deletions

File tree

include/opdi/backend/macro/reductionTools.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ namespace opdi {
5757
}
5858
ReductionTools::reductionBarrierStack.pop();
5959
if (ProbeScopeStatus::insideImplicitTaskProbeScope()) {
60+
logic->onSyncRegion(LogicInterface::SyncRegionKind::BarrierImplementation,
61+
LogicInterface::ScopeEndpoint::Begin);
6062
#pragma omp barrier
6163
logic->onSyncRegion(LogicInterface::SyncRegionKind::BarrierImplementation,
6264
LogicInterface::ScopeEndpoint::End);
@@ -72,6 +74,8 @@ namespace opdi {
7274
#else
7375
logic->onSyncRegion(LogicInterface::SyncRegionKind::BarrierImplementation,
7476
LogicInterface::ScopeEndpoint::Begin);
77+
logic->onSyncRegion(LogicInterface::SyncRegionKind::BarrierImplementation,
78+
LogicInterface::ScopeEndpoint::End);
7579
#endif
7680
}
7781
ReductionTools::reductionBarrierStack.top() = true;

include/opdi/backend/ompt/syncRegionCallbacks.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,12 @@ namespace opdi {
8080
logic->onSyncRegion(LogicInterface::SyncRegionKind::BarrierExplicit, endpoint);
8181
break;
8282
case ompt_sync_region_barrier_implementation:
83+
#if OPDI_OMPT_BACKEND_BARRIER_IMPLEMENTATION_BEHAVIOUR == OPDI_PAIR_OF_AD_EVENTS_PER_ENDPOINT
84+
logic->onSyncRegion(LogicInterface::SyncRegionKind::BarrierImplementation, LogicInterface::ScopeEndpoint::Begin);
85+
logic->onSyncRegion(LogicInterface::SyncRegionKind::BarrierImplementation, LogicInterface::ScopeEndpoint::End);
86+
#else
8387
logic->onSyncRegion(LogicInterface::SyncRegionKind::BarrierImplementation, endpoint);
88+
#endif
8489
break;
8590
#if _OPENMP >= 202011
8691
case ompt_sync_region_barrier_implicit_parallel:

include/opdi/config.hpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727

2828
/* ------------------ constants ------------------ */
2929

30-
/* backends */
31-
3230
#define OPDI_MACRO_BACKEND 1
3331
#define OPDI_OMPT_BACKEND 2
3432

@@ -42,6 +40,9 @@
4240
#define OPDI_OMPT_IMPLICIT_TASK_END 1
4341
#define OPDI_OMPT_SYNC_REGION_END 2
4442

43+
#define OPDI_PAIR_OF_AD_EVENTS_PER_ENDPOINT 1
44+
#define OPDI_SINGLE_AD_EVENT_PER_ENDPOINT 2
45+
4546
/* ------------------ configuration ------------------ */
4647

4748
/* ----- backend configuration ----- */
@@ -61,6 +62,12 @@
6162
static_assert(0 < OPDI_OMPT_BACKEND_IMPLICIT_TASK_END_SOURCE);
6263
static_assert(OPDI_OMPT_BACKEND_IMPLICIT_TASK_END_SOURCE <= 2);
6364

65+
#ifndef OPDI_OMPT_BACKEND_BARRIER_IMPLEMENTATION_BEHAVIOUR
66+
#define OPDI_OMPT_BACKEND_BARRIER_IMPLEMENTATION_BEHAVIOUR OPDI_PAIR_OF_AD_EVENTS_PER_ENDPOINT
67+
#endif
68+
69+
static_assert(0 < OPDI_OMPT_BACKEND_BARRIER_IMPLEMENTATION_BEHAVIOUR);
70+
static_assert(OPDI_OMPT_BACKEND_BARRIER_IMPLEMENTATION_BEHAVIOUR <= 2);
6471

6572
/* ----- logic configuration ----- */
6673

@@ -105,7 +112,7 @@ static_assert(0 < OPDI_SYNC_REGION_BARRIER_EXPLICIT_BEHAVIOUR);
105112
static_assert(OPDI_SYNC_REGION_BARRIER_EXPLICIT_BEHAVIOUR <= 3);
106113

107114
#ifndef OPDI_SYNC_REGION_BARRIER_IMPLEMENTATION_BEHAVIOUR
108-
#define OPDI_SYNC_REGION_BARRIER_IMPLEMENTATION_BEHAVIOUR OPDI_SCOPE_ENDPOINT_BOTH
115+
#define OPDI_SYNC_REGION_BARRIER_IMPLEMENTATION_BEHAVIOUR OPDI_SCOPE_ENDPOINT_BEGIN
109116
#endif
110117

111118
static_assert(0 < OPDI_SYNC_REGION_BARRIER_IMPLEMENTATION_BEHAVIOUR);

0 commit comments

Comments
 (0)