Skip to content

Commit c29f263

Browse files
committed
Add getOrderedIdentifier to backend layer.
Address of parallel data as wait identifier for ordered construct (macro backend).
1 parent 9a52ed6 commit c29f263

4 files changed

Lines changed: 19 additions & 9 deletions

File tree

include/opdi/backend/backendInterface.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ namespace opdi {
4242
virtual std::size_t getNestLockIdentifier(omp_nest_lock_t* lock) = 0;
4343
virtual std::size_t getCriticalIdentifier(std::string const& name) = 0;
4444
virtual std::size_t getReductionIdentifier() = 0;
45+
virtual std::size_t getOrderedIdentifier() = 0;
4546

4647
virtual void* getParallelData() = 0;
4748
virtual void* getTaskData() = 0;

include/opdi/backend/macro/macros.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,10 @@
181181
#define OPDI_ORDERED(...) \
182182
OPDI_PRAGMA(omp ordered __VA_ARGS__) \
183183
{ \
184-
opdi::logic->onMutexAcquired(opdi::LogicInterface::MutexKind::Ordered, 0);
184+
opdi::logic->onMutexAcquired(opdi::LogicInterface::MutexKind::Ordered, opdi::backend->getOrderedIdentifier());
185185

186186
#define OPDI_END_ORDERED \
187-
opdi::logic->onMutexReleased(opdi::LogicInterface::MutexKind::Ordered, 0); \
187+
opdi::logic->onMutexReleased(opdi::LogicInterface::MutexKind::Ordered, opdi::backend->getOrderedIdentifier()); \
188188
}
189189

190190
#define OPDI_SECTION(...) \

include/opdi/backend/macro/mutexIdentifiers.hpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ namespace opdi {
4949
omp_destroy_lock(&this->criticalLock);
5050
}
5151

52+
std::size_t getLockIdentifier(omp_lock_t* lock) {
53+
return reinterpret_cast<std::size_t>(lock);
54+
}
55+
56+
std::size_t getNestLockIdentifier(omp_nest_lock_t* lock) {
57+
return reinterpret_cast<std::size_t>(lock);
58+
}
59+
5260
std::size_t getCriticalIdentifier(std::string const& name) {
5361
// unnamed critical region has index 0
5462
if (name.empty()) {
@@ -69,12 +77,8 @@ namespace opdi {
6977
return reinterpret_cast<std::size_t>(opdi::backend->getParallelData());
7078
}
7179

72-
std::size_t getLockIdentifier(omp_lock_t* lock) {
73-
return reinterpret_cast<std::size_t>(lock);
74-
}
75-
76-
std::size_t getNestLockIdentifier(omp_nest_lock_t* lock) {
77-
return reinterpret_cast<std::size_t>(lock);
80+
std::size_t getOrderedIdentifier() {
81+
return reinterpret_cast<std::size_t>(opdi::backend->getParallelData());
7882
}
7983
};
8084

include/opdi/backend/ompt/omptBackend.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,19 @@ namespace opdi {
164164

165165
std::size_t getCriticalIdentifier(std::string const& name) {
166166
OPDI_UNUSED(name);
167-
OPDI_ERROR("OMPT backend does not support explicit queries of mutex identifiers of critical regions.");
167+
OPDI_ERROR("OMPT backend does not support explicit queries of mutex identifiers of critical constructs.");
168168
return 0;
169169
}
170170

171171
std::size_t getReductionIdentifier() {
172172
return reinterpret_cast<std::size_t>(getParallelData());
173173
}
174174

175+
std::size_t getOrderedIdentifier() {
176+
OPDI_ERROR("OMPT backend does not support explicit queries of mutex identifiers of ordered constructs.");
177+
return 0;
178+
}
179+
175180
void* getParallelData() {
176181
ompt_data_t* parallelData;
177182
int teamSize;

0 commit comments

Comments
 (0)