Skip to content

Commit 921f559

Browse files
authored
[SYCL] Fix post-commit failures after #14467 (#15209)
1 parent 1f5e1dc commit 921f559

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

xptifw/include/xpti_string_table.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class StringTable {
9696
string_id_t StrID;
9797
{
9898
// Employ a double-check pattern here
99-
std::unique_lock Lock(MMutex);
99+
std::unique_lock<std::shared_mutex> Lock(MMutex);
100100
auto Loc = MStringToID.find(str);
101101
// String not present in the table
102102
if (Loc == MStringToID.end()) {
@@ -148,7 +148,7 @@ class StringTable {
148148
// The reverse query allows one to get the string from the string_id_t that
149149
// may have been cached somewhere.
150150
const char *query(xpti::string_id_t id) {
151-
std::shared_lock lock(MMutex);
151+
std::shared_lock<std::shared_mutex> lock(MMutex);
152152
auto Loc = MIDToString.find(id);
153153
if (Loc != MIDToString.end()) {
154154
#ifdef XPTI_STATISTICS

xptifw/src/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ function(add_xpti_library LIB_NAME)
4040
endif()
4141

4242
target_compile_definitions(${LIB_NAME} PRIVATE -DXPTI_API_EXPORTS)
43-
4443
target_include_directories(${LIB_NAME} PUBLIC
4544
$<BUILD_INTERFACE:${XPTIFW_DIR}/include>
4645
$<BUILD_INTERFACE:${XPTIFW_EMHASH_HEADERS}>

xptifw/src/xpti_trace_framework.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ class Tracepoints {
824824

825825
xpti::TracePointImpl *TP = reinterpret_cast<xpti::TracePointImpl *>(UId);
826826
if (xpti::is_valid_event(&TP->MEvent))
827-
return reinterpret_cast<xpti_trace_event_t *>(TP);
827+
return dynamic_cast<xpti_trace_event_t *>(TP);
828828
else
829829
return nullptr;
830830
}
@@ -880,7 +880,7 @@ class Tracepoints {
880880

881881
xpti::uid128_t UId = TP->MUId;
882882
{
883-
std::unique_lock Lock(MTracepointMutex);
883+
std::unique_lock<std::shared_mutex> Lock(MTracepointMutex);
884884
// Find the event list for a given UID
885885
auto &Instances = MTracepoints[UId];
886886
MUID64Check.erase(UId.uid64);
@@ -1017,7 +1017,7 @@ class Tracepoints {
10171017
// Check is Key is valid; If the payload is fully populated, then we will
10181018
// have both Key.p1 and Key.p2 set. However, if only a function name is
10191019
// provided, then we will have Key.p1 populated.
1020-
std::unique_lock Lock(MPayloadMutex);
1020+
std::unique_lock<std::shared_mutex> Lock(MPayloadMutex);
10211021
auto &PayloadEntry = MPayloads[Key];
10221022
if (PayloadEntry.first.flags == 0) {
10231023
#ifdef XPTI_STATISTICS
@@ -1066,7 +1066,7 @@ class Tracepoints {
10661066
return nullptr;
10671067

10681068
// Lock the mutex to ensure thread-safe access to the tracepoints map
1069-
std::unique_lock Lock(MTracepointMutex);
1069+
std::unique_lock<std::shared_mutex> Lock(MTracepointMutex);
10701070
// Access or create the tracepoint instance associated with the universal ID
10711071
auto &Tracepoint = MTracepoints[UniversalId];
10721072
// Access or create the specific instance of the tracepoint based on the
@@ -1101,7 +1101,7 @@ class Tracepoints {
11011101
{
11021102
xpti::uid128_t UId = TP->MUId;
11031103
// Lock the mutex to ensure thread-safe access to the tracepoints map
1104-
std::unique_lock Lock(MTracepointMutex);
1104+
std::unique_lock<std::shared_mutex> Lock(MTracepointMutex);
11051105
// Find the tracepoint for a given UID
11061106
auto &Instances = MTracepoints[UId];
11071107
// Now release the 64-bit UID associated with tracepoint instance
@@ -1458,7 +1458,7 @@ class Notifications {
14581458
#endif
14591459
// If reader-writer locks were emplyed, this is where the writer lock can
14601460
// be used
1461-
std::unique_lock Lock(MCBsLock);
1461+
std::unique_lock<std::shared_mutex> Lock(MCBsLock);
14621462
auto &TraceFlags = MStreamFlags[StreamID]; // Get the trace flags for the
14631463
// stream ID
14641464
TraceFlags[TraceType] = true; // Set the trace type flag to true
@@ -1533,7 +1533,7 @@ class Notifications {
15331533
// Since we do not remove the callback function when they are unregistered
15341534
// and only reset the flag, the writer lock is not held for very long; use
15351535
// writer lock here.
1536-
std::unique_lock Lock(MCBsLock);
1536+
std::unique_lock<std::shared_mutex> Lock(MCBsLock);
15371537
auto &TraceFlags = MStreamFlags[StreamID]; // Get the trace flags for the
15381538
// stream ID
15391539
TraceFlags[TraceType] = false; // Set the trace type flag to false
@@ -1587,7 +1587,7 @@ class Notifications {
15871587
// If there are no callbacks registered for the requested stream ID, we
15881588
// return not found; use reader lock here if the implementation moves to
15891589
// reader-writer locks.
1590-
std::unique_lock Lock(MCBsLock);
1590+
std::unique_lock<std::shared_mutex> Lock(MCBsLock);
15911591
if (MCallbacksByStream.count(StreamID) == 0)
15921592
return xpti::result_t::XPTI_RESULT_NOTFOUND;
15931593

@@ -1699,7 +1699,7 @@ class Notifications {
16991699
// the notification functions when the lock is held and then releases
17001700
// the lock before calling the notification functions. When using
17011701
// reader-writer locks, use reader lock here.
1702-
std::shared_lock Lock(MCBsLock);
1702+
std::shared_lock<std::shared_mutex> Lock(MCBsLock);
17031703
cb_t &Stream = MCallbacksByStream[StreamID]; // Thread-safe
17041704
Acc = Stream.find(TraceType);
17051705
Success = (Acc != Stream.end());

0 commit comments

Comments
 (0)