Skip to content

Commit

Permalink
[SYCL] Fix post-commit failures after #14467 (#15209)
Browse files Browse the repository at this point in the history
  • Loading branch information
againull authored Aug 28, 2024
1 parent 1f5e1dc commit 921f559
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions xptifw/include/xpti_string_table.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class StringTable {
string_id_t StrID;
{
// Employ a double-check pattern here
std::unique_lock Lock(MMutex);
std::unique_lock<std::shared_mutex> Lock(MMutex);
auto Loc = MStringToID.find(str);
// String not present in the table
if (Loc == MStringToID.end()) {
Expand Down Expand Up @@ -148,7 +148,7 @@ class StringTable {
// The reverse query allows one to get the string from the string_id_t that
// may have been cached somewhere.
const char *query(xpti::string_id_t id) {
std::shared_lock lock(MMutex);
std::shared_lock<std::shared_mutex> lock(MMutex);
auto Loc = MIDToString.find(id);
if (Loc != MIDToString.end()) {
#ifdef XPTI_STATISTICS
Expand Down
1 change: 0 additions & 1 deletion xptifw/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ function(add_xpti_library LIB_NAME)
endif()

target_compile_definitions(${LIB_NAME} PRIVATE -DXPTI_API_EXPORTS)

target_include_directories(${LIB_NAME} PUBLIC
$<BUILD_INTERFACE:${XPTIFW_DIR}/include>
$<BUILD_INTERFACE:${XPTIFW_EMHASH_HEADERS}>
Expand Down
18 changes: 9 additions & 9 deletions xptifw/src/xpti_trace_framework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ class Tracepoints {

xpti::TracePointImpl *TP = reinterpret_cast<xpti::TracePointImpl *>(UId);
if (xpti::is_valid_event(&TP->MEvent))
return reinterpret_cast<xpti_trace_event_t *>(TP);
return dynamic_cast<xpti_trace_event_t *>(TP);
else
return nullptr;
}
Expand Down Expand Up @@ -880,7 +880,7 @@ class Tracepoints {

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

// Lock the mutex to ensure thread-safe access to the tracepoints map
std::unique_lock Lock(MTracepointMutex);
std::unique_lock<std::shared_mutex> Lock(MTracepointMutex);
// Access or create the tracepoint instance associated with the universal ID
auto &Tracepoint = MTracepoints[UniversalId];
// Access or create the specific instance of the tracepoint based on the
Expand Down Expand Up @@ -1101,7 +1101,7 @@ class Tracepoints {
{
xpti::uid128_t UId = TP->MUId;
// Lock the mutex to ensure thread-safe access to the tracepoints map
std::unique_lock Lock(MTracepointMutex);
std::unique_lock<std::shared_mutex> Lock(MTracepointMutex);
// Find the tracepoint for a given UID
auto &Instances = MTracepoints[UId];
// Now release the 64-bit UID associated with tracepoint instance
Expand Down Expand Up @@ -1458,7 +1458,7 @@ class Notifications {
#endif
// If reader-writer locks were emplyed, this is where the writer lock can
// be used
std::unique_lock Lock(MCBsLock);
std::unique_lock<std::shared_mutex> Lock(MCBsLock);
auto &TraceFlags = MStreamFlags[StreamID]; // Get the trace flags for the
// stream ID
TraceFlags[TraceType] = true; // Set the trace type flag to true
Expand Down Expand Up @@ -1533,7 +1533,7 @@ class Notifications {
// Since we do not remove the callback function when they are unregistered
// and only reset the flag, the writer lock is not held for very long; use
// writer lock here.
std::unique_lock Lock(MCBsLock);
std::unique_lock<std::shared_mutex> Lock(MCBsLock);
auto &TraceFlags = MStreamFlags[StreamID]; // Get the trace flags for the
// stream ID
TraceFlags[TraceType] = false; // Set the trace type flag to false
Expand Down Expand Up @@ -1587,7 +1587,7 @@ class Notifications {
// If there are no callbacks registered for the requested stream ID, we
// return not found; use reader lock here if the implementation moves to
// reader-writer locks.
std::unique_lock Lock(MCBsLock);
std::unique_lock<std::shared_mutex> Lock(MCBsLock);
if (MCallbacksByStream.count(StreamID) == 0)
return xpti::result_t::XPTI_RESULT_NOTFOUND;

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

0 comments on commit 921f559

Please sign in to comment.