|
47 | 47 | opdi::logic->onParallelEnd(opdiInternalParallelData); \ |
48 | 48 | } |
49 | 49 |
|
| 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 | + |
50 | 56 | #define OPDI_FOR(...) \ |
51 | 57 | opdi::ImplicitBarrierTools::beginRegionWithImplicitBarrier(); \ |
| 58 | + OPDI_WORK(opdi::LogicInterface::WorksharingKind::Loop, opdi::LogicInterface::ScopeEndpoint::Begin); \ |
52 | 59 | OPDI_PRAGMA(omp for __VA_ARGS__ private(opdi::internalLoopProbe)) |
53 | 60 |
|
54 | 61 | #define OPDI_END_FOR \ |
| 62 | + OPDI_WORK(opdi::LogicInterface::WorksharingKind::Loop, opdi::LogicInterface::ScopeEndpoint::End); \ |
55 | 63 | opdi::ImplicitBarrierTools::endRegionWithImplicitBarrier(); |
56 | 64 |
|
57 | 65 | #define OPDI_SECTIONS(...) \ |
58 | 66 | opdi::ImplicitBarrierTools::beginRegionWithImplicitBarrier(); \ |
| 67 | + OPDI_WORK(opdi::LogicInterface::WorksharingKind::Sections, opdi::LogicInterface::ScopeEndpoint::Begin); \ |
59 | 68 | OPDI_PRAGMA(omp sections private(opdi::internalSectionsProbe) __VA_ARGS__) |
60 | 69 |
|
61 | 70 | #define OPDI_END_SECTIONS \ |
| 71 | + OPDI_WORK(opdi::LogicInterface::WorksharingKind::Sections, opdi::LogicInterface::ScopeEndpoint::End); \ |
62 | 72 | opdi::ImplicitBarrierTools::endRegionWithImplicitBarrier(); |
63 | 73 |
|
64 | 74 | #define OPDI_SINGLE(...) \ |
65 | 75 | { \ |
| 76 | + OPDI_WORK(opdi::LogicInterface::WorksharingKind::Single, opdi::LogicInterface::ScopeEndpoint::Begin); \ |
66 | 77 | bool constexpr opdiInternalBarrierIndicator = true; \ |
67 | 78 | void* opdiInternalTapePosition1 = opdi::tool->allocPosition(); \ |
68 | 79 | opdi::tool->getTapePosition(opdi::tool->getThreadLocalTape(), opdiInternalTapePosition1); \ |
|
79 | 90 |
|
80 | 91 | #define OPDI_SINGLE_NOWAIT(...) \ |
81 | 92 | { \ |
| 93 | + OPDI_WORK(opdi::LogicInterface::WorksharingKind::Single, opdi::LogicInterface::ScopeEndpoint::Begin); \ |
82 | 94 | bool constexpr opdiInternalBarrierIndicator = false; \ |
83 | 95 | void* opdiInternalTapePosition1 = opdi::tool->allocPosition(); \ |
84 | 96 | void* opdiInternalTapePosition2 = opdi::tool->allocPosition(); /* for consistency with the end macro */ \ |
|
101 | 113 | } \ |
102 | 114 | opdi::tool->freePosition(opdiInternalTapePosition1); \ |
103 | 115 | opdi::tool->freePosition(opdiInternalTapePosition2); \ |
| 116 | + OPDI_WORK(opdi::LogicInterface::WorksharingKind::Single, opdi::LogicInterface::ScopeEndpoint::End); \ |
104 | 117 | opdi::ImplicitBarrierTools::implicitBarrierStack.top() = opdiInternalBarrierIndicator; \ |
105 | 118 | opdi::ImplicitBarrierTools::endRegionWithImplicitBarrier(); \ |
106 | 119 | } |
|
0 commit comments