Skip to content

Commit 204e992

Browse files
committed
Fixes for work events in the macro backend.
Fix duplicate event generation. Move checks to make event generation optional.
1 parent 1da798f commit 204e992

2 files changed

Lines changed: 8 additions & 17 deletions

File tree

include/opdi/backend/macro/macros.hpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,33 +47,22 @@
4747
opdi::logic->onParallelEnd(opdiInternalParallelData); \
4848
}
4949

50-
#if OPDI_BACKEND_GENERATE_WORK_EVENTS
51-
#define OPDI_WORK(type, endpoint) opdi::logic->onWork(kind, endpoint)
52-
#else
53-
#define OPDI_WORK(type, endpoint) /* empty */
54-
#endif
55-
5650
#define OPDI_FOR(...) \
5751
opdi::ImplicitBarrierTools::beginRegionWithImplicitBarrier(); \
58-
OPDI_WORK(opdi::LogicInterface::WorksharingKind::Loop, opdi::LogicInterface::ScopeEndpoint::Begin); \
5952
OPDI_PRAGMA(omp for __VA_ARGS__ private(opdi::internalLoopProbe))
6053

6154
#define OPDI_END_FOR \
62-
OPDI_WORK(opdi::LogicInterface::WorksharingKind::Loop, opdi::LogicInterface::ScopeEndpoint::End); \
6355
opdi::ImplicitBarrierTools::endRegionWithImplicitBarrier();
6456

6557
#define OPDI_SECTIONS(...) \
6658
opdi::ImplicitBarrierTools::beginRegionWithImplicitBarrier(); \
67-
OPDI_WORK(opdi::LogicInterface::WorksharingKind::Sections, opdi::LogicInterface::ScopeEndpoint::Begin); \
6859
OPDI_PRAGMA(omp sections private(opdi::internalSectionsProbe) __VA_ARGS__)
6960

7061
#define OPDI_END_SECTIONS \
71-
OPDI_WORK(opdi::LogicInterface::WorksharingKind::Sections, opdi::LogicInterface::ScopeEndpoint::End); \
7262
opdi::ImplicitBarrierTools::endRegionWithImplicitBarrier();
7363

7464
#define OPDI_SINGLE(...) \
7565
{ \
76-
OPDI_WORK(opdi::LogicInterface::WorksharingKind::Single, opdi::LogicInterface::ScopeEndpoint::Begin); \
7766
bool constexpr opdiInternalBarrierIndicator = true; \
7867
void* opdiInternalTapePosition1 = opdi::tool->allocPosition(); \
7968
opdi::tool->getTapePosition(opdi::tool->getThreadLocalTape(), opdiInternalTapePosition1); \
@@ -90,7 +79,6 @@
9079

9180
#define OPDI_SINGLE_NOWAIT(...) \
9281
{ \
93-
OPDI_WORK(opdi::LogicInterface::WorksharingKind::Single, opdi::LogicInterface::ScopeEndpoint::Begin); \
9482
bool constexpr opdiInternalBarrierIndicator = false; \
9583
void* opdiInternalTapePosition1 = opdi::tool->allocPosition(); \
9684
void* opdiInternalTapePosition2 = opdi::tool->allocPosition(); /* for consistency with the end macro */ \
@@ -113,7 +101,6 @@
113101
} \
114102
opdi::tool->freePosition(opdiInternalTapePosition1); \
115103
opdi::tool->freePosition(opdiInternalTapePosition2); \
116-
OPDI_WORK(opdi::LogicInterface::WorksharingKind::Single, opdi::LogicInterface::ScopeEndpoint::End); \
117104
opdi::ImplicitBarrierTools::implicitBarrierStack.top() = opdiInternalBarrierIndicator; \
118105
opdi::ImplicitBarrierTools::endRegionWithImplicitBarrier(); \
119106
}

include/opdi/backend/macro/probes.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,17 @@ namespace opdi {
109109
WorkProbe(int) : needsAction(false) {}
110110

111111
WorkProbe() : needsAction(true) {
112-
logic->onWork(kind, LogicInterface::ScopeEndpoint::Begin);
112+
#if OPDI_BACKEND_GENERATE_WORK_EVENTS
113+
logic->onWork(kind, LogicInterface::ScopeEndpoint::Begin);
114+
#endif
113115
}
114116

115117
~WorkProbe() {
116-
if (needsAction) {
117-
logic->onWork(kind, LogicInterface::ScopeEndpoint::End);
118-
}
118+
#if OPDI_BACKEND_GENERATE_WORK_EVENTS
119+
if (needsAction) {
120+
logic->onWork(kind, LogicInterface::ScopeEndpoint::End);
121+
}
122+
#endif
119123
}
120124
};
121125

0 commit comments

Comments
 (0)