|
97 | 97 | { \ |
98 | 98 | bool constexpr opdiInternalBarrierIndicator = true; \ |
99 | 99 | bool constexpr opdiInternalBroadcastIndicator = true; \ |
100 | | - void* opdiInternalTapePosition1 = opdi::tool->allocPosition(); \ |
101 | | - opdi::tool->getTapePosition(opdi::tool->getThreadLocalTape(), opdiInternalTapePosition1); \ |
| 100 | + void* opdiInternalTapePosition1 = nullptr; \ |
| 101 | + if (opdi::tool != nullptr) { \ |
| 102 | + opdiInternalTapePosition1 = opdi::tool->allocPosition(); \ |
| 103 | + opdi::tool->getTapePosition(opdi::tool->getThreadLocalTape(), opdiInternalTapePosition1); \ |
| 104 | + } \ |
102 | 105 | /* broadcast-related barrier */ \ |
103 | 106 | opdi::logic->onSyncRegion(opdi::LogicInterface::SyncRegionKind::BarrierImplementation, \ |
104 | 107 | opdi::LogicInterface::ScopeEndpoint::Begin); \ |
105 | 108 | opdi::logic->onSyncRegion(opdi::LogicInterface::SyncRegionKind::BarrierImplementation, \ |
106 | 109 | opdi::LogicInterface::ScopeEndpoint::End); \ |
107 | | - void* opdiInternalTapePosition2 = opdi::tool->allocPosition(); \ |
108 | | - opdi::tool->getTapePosition(opdi::tool->getThreadLocalTape(), opdiInternalTapePosition2); \ |
| 110 | + void* opdiInternalTapePosition2 = nullptr; \ |
| 111 | + if (opdi::tool != nullptr) { \ |
| 112 | + opdiInternalTapePosition2 = opdi::tool->allocPosition(); \ |
| 113 | + opdi::tool->getTapePosition(opdi::tool->getThreadLocalTape(), opdiInternalTapePosition2); \ |
| 114 | + } \ |
109 | 115 | opdi::ImplicitBarrierTools::beginRegionWithImplicitBarrier(); \ |
110 | 116 | { \ |
111 | 117 | opdi::SingleProbe localSingleProbe; /* worksharing events */ \ |
112 | 118 | OPDI_PRAGMA(omp single __VA_ARGS__) \ |
113 | 119 | { \ |
114 | 120 | /* delay broadcast-related barrier for executor */ \ |
115 | | - opdi::tool->erase(opdi::tool->getThreadLocalTape(), opdiInternalTapePosition1, opdiInternalTapePosition2); |
| 121 | + if (opdi::tool != nullptr) \ |
| 122 | + opdi::tool->erase(opdi::tool->getThreadLocalTape(), opdiInternalTapePosition1, opdiInternalTapePosition2); |
116 | 123 |
|
117 | 124 | #define OPDI_SINGLE_COPYPRIVATE_NOWAIT(...) \ |
118 | 125 | { \ |
119 | 126 | bool constexpr opdiInternalBarrierIndicator = false; \ |
120 | 127 | bool constexpr opdiInternalBroadcastIndicator = true; \ |
121 | | - void* opdiInternalTapePosition1 = opdi::tool->allocPosition(); \ |
122 | | - opdi::tool->getTapePosition(opdi::tool->getThreadLocalTape(), opdiInternalTapePosition1); \ |
| 128 | + void* opdiInternalTapePosition1 = nullptr; \ |
| 129 | + if (opdi::tool != nullptr) { \ |
| 130 | + opdiInternalTapePosition1 = opdi::tool->allocPosition(); \ |
| 131 | + opdi::tool->getTapePosition(opdi::tool->getThreadLocalTape(), opdiInternalTapePosition1); \ |
| 132 | + } \ |
123 | 133 | /* broadcast-related barrier */ \ |
124 | 134 | opdi::logic->onSyncRegion(opdi::LogicInterface::SyncRegionKind::BarrierImplementation, \ |
125 | 135 | opdi::LogicInterface::ScopeEndpoint::Begin); \ |
126 | 136 | opdi::logic->onSyncRegion(opdi::LogicInterface::SyncRegionKind::BarrierImplementation, \ |
127 | 137 | opdi::LogicInterface::ScopeEndpoint::End); \ |
128 | | - void* opdiInternalTapePosition2 = opdi::tool->allocPosition(); \ |
129 | | - opdi::tool->getTapePosition(opdi::tool->getThreadLocalTape(), opdiInternalTapePosition2); \ |
| 138 | + void* opdiInternalTapePosition2 = nullptr; \ |
| 139 | + if (opdi::tool != nullptr) { \ |
| 140 | + opdiInternalTapePosition2 = opdi::tool->allocPosition(); \ |
| 141 | + opdi::tool->getTapePosition(opdi::tool->getThreadLocalTape(), opdiInternalTapePosition2); \ |
| 142 | + } \ |
130 | 143 | opdi::ImplicitBarrierTools::beginRegionWithImplicitBarrier(); \ |
131 | 144 | { \ |
132 | 145 | opdi::SingleProbe localSingleProbe; \ |
133 | 146 | OPDI_PRAGMA(omp single nowait __VA_ARGS__) \ |
134 | 147 | { \ |
135 | 148 | /* delay broadcast-related barrier for executor */ \ |
136 | | - opdi::tool->erase(opdi::tool->getThreadLocalTape(), opdiInternalTapePosition1, opdiInternalTapePosition2); |
| 149 | + if (opdi::tool != nullptr) \ |
| 150 | + opdi::tool->erase(opdi::tool->getThreadLocalTape(), opdiInternalTapePosition1, opdiInternalTapePosition2); |
137 | 151 |
|
138 | 152 | #define OPDI_END_SINGLE \ |
139 | 153 | /* broadcast-related barrier */ \ |
|
145 | 159 | } \ |
146 | 160 | } \ |
147 | 161 | } \ |
148 | | - if (opdiInternalBroadcastIndicator) { \ |
| 162 | + if (opdi::tool != nullptr && opdiInternalBroadcastIndicator) { \ |
149 | 163 | opdi::tool->freePosition(opdiInternalTapePosition1); \ |
150 | 164 | opdi::tool->freePosition(opdiInternalTapePosition2); \ |
151 | 165 | } \ |
|
0 commit comments