Skip to content

Commit afbc092

Browse files
author
Pavel V Chupin
committed
[SYCL] More changes to silence -Wctad-maybe-unsupported
Mutex changes could be reverted if/when this change lands: https://reviews.llvm.org/D133425
1 parent 28ba36f commit afbc092

File tree

7 files changed

+159
-134
lines changed

7 files changed

+159
-134
lines changed

sycl/plugins/level_zero/pi_level_zero.cpp

Lines changed: 147 additions & 124 deletions
Large diffs are not rendered by default.

sycl/source/detail/event_impl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ void event_impl::waitInternal() {
7272
if (MState == HES_Complete)
7373
return;
7474

75-
std::unique_lock lock(MMutex);
75+
std::unique_lock<std::mutex> lock(MMutex);
7676
cv.wait(lock, [this] { return MState == HES_Complete; });
7777
}
7878

7979
void event_impl::setComplete() {
8080
if (MHostEvent || !MEvent) {
81-
std::unique_lock lock(MMutex);
81+
std::unique_lock<std::mutex> lock(MMutex);
8282
#ifndef NDEBUG
8383
int Expected = HES_NotComplete;
8484
int Desired = HES_Complete;

sycl/source/platform.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ context platform::ext_oneapi_get_default_context() const {
7979
&PlatformToDefaultContextCache =
8080
detail::GlobalHandler::instance().getPlatformToDefaultContextCache();
8181

82-
std::lock_guard Lock{detail::GlobalHandler::instance()
83-
.getPlatformToDefaultContextCacheMutex()};
82+
std::lock_guard<std::mutex> Lock{
83+
detail::GlobalHandler::instance()
84+
.getPlatformToDefaultContextCacheMutex()};
8485

8586
auto It = PlatformToDefaultContextCache.find(impl);
8687
if (PlatformToDefaultContextCache.end() == It)

sycl/tools/sycl-prof/writer.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ class JSONWriter : public Writer {
2828
explicit JSONWriter(const std::string &OutPath) : MOutFile(OutPath) {}
2929

3030
void init() final {
31-
std::lock_guard _{MWriteMutex};
31+
std::lock_guard<std::mutex> _{MWriteMutex};
3232

3333
MOutFile << "{\n";
3434
MOutFile << " \"traceEvents\": [\n";
3535
}
3636

3737
void writeBegin(std::string_view Name, std::string_view Category, size_t PID,
3838
size_t TID, size_t TimeStamp) override {
39-
std::lock_guard _{MWriteMutex};
39+
std::lock_guard<std::mutex> _{MWriteMutex};
4040

4141
if (!MOutFile.is_open())
4242
return;
@@ -52,7 +52,7 @@ class JSONWriter : public Writer {
5252

5353
void writeEnd(std::string_view Name, std::string_view Category, size_t PID,
5454
size_t TID, size_t TimeStamp) override {
55-
std::lock_guard _{MWriteMutex};
55+
std::lock_guard<std::mutex> _{MWriteMutex};
5656

5757
if (!MOutFile.is_open())
5858
return;
@@ -67,7 +67,7 @@ class JSONWriter : public Writer {
6767
}
6868

6969
void finalize() final {
70-
std::lock_guard _{MWriteMutex};
70+
std::lock_guard<std::mutex> _{MWriteMutex};
7171

7272
if (!MOutFile.is_open())
7373
return;

sycl/tools/sycl-trace/pi_trace_collector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ XPTI_CALLBACK_API void piCallback(uint16_t TraceType,
138138
return;
139139

140140
// Lock while we print information
141-
std::lock_guard _{GlobalLock};
141+
std::lock_guard<sycl::detail::SpinLock> _{GlobalLock};
142142
const auto *Data = static_cast<const xpti::function_with_args_t *>(UserData);
143143
if (TraceType == xpti::trace_function_with_args_begin) {
144144
const auto *Plugin = static_cast<pi_plugin *>(Data->user_data);

sycl/tools/sycl-trace/ze_trace_collector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ XPTI_CALLBACK_API void zeCallback(uint16_t TraceType,
250250
xpti::trace_event_data_t * /*Parent*/,
251251
xpti::trace_event_data_t * /*Event*/,
252252
uint64_t /*Instance*/, const void *UserData) {
253-
std::lock_guard _{GlobalLock};
253+
std::lock_guard<sycl::detail::SpinLock> _{GlobalLock};
254254
const auto *Data = static_cast<const xpti::function_with_args_t *>(UserData);
255255
const auto PrintPrefix = [] {
256256
if (HasPIPrinter)

xptifw/include/spin_lock.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ template <typename Mutex> class SharedLock {
8383
Mutex *MMutex;
8484
bool MIsWriter = false;
8585
};
86+
template <typename Mutex> SharedLock(Mutex &) -> SharedLock<Mutex>;
8687

8788
/// SpinLock is a synchronization primitive, that uses atomic variable and
8889
/// causes thread trying acquire lock wait in loop while repeatedly check if

0 commit comments

Comments
 (0)