|
64 | 64 | #define OPDI_SINGLE(...) \ |
65 | 65 | { \ |
66 | 66 | bool constexpr opdiInternalBarrierIndicator = true; \ |
| 67 | + bool constexpr opdiInternalBroadcastIndicator = false; \ |
| 68 | + void* opdiInternalTapePosition1; /* for consistency with the end macro */ \ |
| 69 | + void* opdiInternalTapePosition2; \ |
| 70 | + OPDI_UNUSED(opdiInternalTapePosition1); \ |
| 71 | + OPDI_UNUSED(opdiInternalTapePosition2); \ |
| 72 | + opdi::ImplicitBarrierTools::beginRegionWithImplicitBarrier(); \ |
| 73 | + { \ |
| 74 | + opdi::SingleProbe localSingleProbe; /* worksharing events */ \ |
| 75 | + OPDI_PRAGMA(omp single __VA_ARGS__) \ |
| 76 | + { |
| 77 | + |
| 78 | +#define OPDI_SINGLE_NOWAIT(...) \ |
| 79 | + { \ |
| 80 | + bool constexpr opdiInternalBarrierIndicator = false; \ |
| 81 | + bool constexpr opdiInternalBroadcastIndicator = false; \ |
| 82 | + void* opdiInternalTapePosition1; /* for consistency with the end macro */ \ |
| 83 | + void* opdiInternalTapePosition2; \ |
| 84 | + OPDI_UNUSED(opdiInternalTapePosition1); \ |
| 85 | + OPDI_UNUSED(opdiInternalTapePosition2); \ |
| 86 | + opdi::ImplicitBarrierTools::beginRegionWithImplicitBarrier(); \ |
| 87 | + { \ |
| 88 | + opdi::SingleProbe localSingleProbe; /* worksharing events */ \ |
| 89 | + OPDI_PRAGMA(omp single nowait __VA_ARGS__) \ |
| 90 | + { |
| 91 | + |
| 92 | +#define OPDI_SINGLE_COPYPRIVATE(...) \ |
| 93 | + { \ |
| 94 | + bool constexpr opdiInternalBarrierIndicator = true; \ |
| 95 | + bool constexpr opdiInternalBroadcastIndicator = true; \ |
67 | 96 | void* opdiInternalTapePosition1 = opdi::tool->allocPosition(); \ |
68 | 97 | opdi::tool->getTapePosition(opdi::tool->getThreadLocalTape(), opdiInternalTapePosition1); \ |
69 | 98 | /* broadcast-related barrier */ \ |
|
81 | 110 | /* delay broadcast-related barrier for executor */ \ |
82 | 111 | opdi::tool->erase(opdi::tool->getThreadLocalTape(), opdiInternalTapePosition1, opdiInternalTapePosition2); |
83 | 112 |
|
84 | | -#define OPDI_SINGLE_NOWAIT(...) \ |
| 113 | +#define OPDI_SINGLE_COPYPRIVATE_NOWAIT(...) \ |
85 | 114 | { \ |
86 | 115 | bool constexpr opdiInternalBarrierIndicator = false; \ |
| 116 | + bool constexpr opdiInternalBroadcastIndicator = true; \ |
87 | 117 | void* opdiInternalTapePosition1 = opdi::tool->allocPosition(); \ |
88 | 118 | opdi::tool->getTapePosition(opdi::tool->getThreadLocalTape(), opdiInternalTapePosition1); \ |
89 | 119 | /* broadcast-related barrier */ \ |
|
103 | 133 |
|
104 | 134 | #define OPDI_END_SINGLE \ |
105 | 135 | /* broadcast-related barrier */ \ |
106 | | - opdi::logic->onSyncRegion(opdi::LogicInterface::SyncRegionKind::BarrierImplementation, \ |
107 | | - opdi::LogicInterface::ScopeEndpoint::Begin); \ |
108 | | - opdi::logic->onSyncRegion(opdi::LogicInterface::SyncRegionKind::BarrierImplementation, \ |
109 | | - opdi::LogicInterface::ScopeEndpoint::End); \ |
| 136 | + if (opdiInternalBroadcastIndicator) { \ |
| 137 | + opdi::logic->onSyncRegion(opdi::LogicInterface::SyncRegionKind::BarrierImplementation, \ |
| 138 | + opdi::LogicInterface::ScopeEndpoint::Begin); \ |
| 139 | + opdi::logic->onSyncRegion(opdi::LogicInterface::SyncRegionKind::BarrierImplementation, \ |
| 140 | + opdi::LogicInterface::ScopeEndpoint::End); \ |
| 141 | + } \ |
110 | 142 | } \ |
111 | 143 | } \ |
112 | | - opdi::tool->freePosition(opdiInternalTapePosition1); \ |
113 | | - opdi::tool->freePosition(opdiInternalTapePosition2); \ |
| 144 | + if (opdiInternalBroadcastIndicator) { \ |
| 145 | + opdi::tool->freePosition(opdiInternalTapePosition1); \ |
| 146 | + opdi::tool->freePosition(opdiInternalTapePosition2); \ |
| 147 | + } \ |
114 | 148 | /* implicit barrier */ \ |
115 | 149 | opdi::ImplicitBarrierTools::implicitBarrierStack.top() = opdiInternalBarrierIndicator; \ |
116 | 150 | opdi::ImplicitBarrierTools::endRegionWithImplicitBarrier(); \ |
|
0 commit comments