Skip to content

[XPTI] Replace std::shared_mutex with SharedSpinLock#21502

Merged
againull merged 3 commits intointel:syclfrom
againull:xpti_spinlock
Mar 18, 2026
Merged

[XPTI] Replace std::shared_mutex with SharedSpinLock#21502
againull merged 3 commits intointel:syclfrom
againull:xpti_spinlock

Conversation

@againull
Copy link
Contributor

Replace std::shared_mutex with xpti::SharedSpinLock for short critical sections for better performance.

Replace std::shared_mutex with xpti::SharedSpinLock for short critical sections
for better performance.
@againull againull requested a review from a team as a code owner March 12, 2026 17:18
@againull againull requested a review from cperkinsintel March 12, 2026 17:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces std::shared_mutex usage in the XPTI framework with xpti::SharedSpinLock (and xpti::SharedLock for reader locking) to reduce overhead for short critical sections.

Changes:

  • Switch writer-side locking from std::unique_lock<std::shared_mutex> to std::lock_guard<xpti::SharedSpinLock> in tracepoint/payload and notification paths.
  • Switch reader-side locking from std::shared_lock<std::shared_mutex> to xpti::SharedLock where applicable.
  • Update member declarations and comments to reflect the new lock type.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
xptifw/src/xpti_trace_framework.cpp Replaces shared-mutex locking in Tracepoints/Notifications with SharedSpinLock + SharedLock.
xptifw/include/xpti_string_table.hpp Replaces StringTable shared-mutex locking with SharedSpinLock + SharedLock.
Comments suppressed due to low confidence (1)

xptifw/include/xpti_string_table.hpp:15

  • After replacing std::shared_mutex with xpti::SharedSpinLock, this header no longer uses anything from <shared_mutex>. Dropping that include will reduce unnecessary dependencies for includers of this header.
#include "parallel_hashmap/phmap.h"
#include "spin_lock.hpp"
#include "xpti/xpti_data_types.h"
#include <hash_table7.hpp>

#include <atomic>
#include <shared_mutex>
#include <unordered_map>

@againull
Copy link
Contributor Author

@cperkinsintel Could you please take a look.

@againull againull requested a review from uditagarwal97 March 17, 2026 22:05
@againull
Copy link
Contributor Author

Failures unrelated:
MemorySanitizer/local/parallel_for_work_group.cpp - #21555
Adapters/level_zero/batch_test_copy_with_compute.cpp - #21548

@againull againull merged commit 06c2553 into intel:sycl Mar 18, 2026
29 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants