-
Notifications
You must be signed in to change notification settings - Fork 745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SYCL] Implement queue::ext_oneapi_empty() API to get queue status #7583
Conversation
where is this extension documented? |
Extension is documented here: As we discussed with @gmlueck, we definitely need ext_oneapi_empy. ext_oneapi_size/ext_oneapi_get_wait_list necessity is going to be discussed and most likely will be dropped. That's why this PR is implementin ext_oneapi_empty only. |
* Catch exception in the cuda plugin * Use hasOpenCommandList in the L0 plugin * Rename PI_QUEUE_INFO_STATUS -> PI_EXT_ONEAPI_QUEUE_INFO_STATUS and update int value
Immediate command lists are not associated with any L0 command queue. So we need to check status of the events on eacn immediate command lists to get the status of the queue.
Exception will be thrown if somebody attempts to call this API on OpenCL. |
* Rename PI_EXT_ONEAPI_QUEUE_INFO_STATUS->PI_EXT_ONEAPI_QUEUE_INFO_EMPTY * Document return type in pi.h * Define feature macro
sycl/include/sycl/detail/pi.h
Outdated
@@ -58,6 +58,8 @@ | |||
// piDeviceGetInfo. | |||
// 11.17 Added new PI_EXT_ONEAPI_QUEUE_PRIORITY_LOW and | |||
// PI_EXT_ONEAPI_QUEUE_PRIORITY_HIGH queue properties. | |||
// 11.18 Add new parameter name PI_EXT_ONEAPI_QUEUE_INFO_EMPTY to | |||
// _pi_queue_info. | |||
|
|||
#define _PI_H_VERSION_MAJOR 11 | |||
#define _PI_H_VERSION_MINOR 16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, thanks, fixed.
sycl/plugins/cuda/pi_cuda.hpp
Outdated
@@ -499,6 +499,30 @@ struct _pi_queue { | |||
return is_last_command && !has_been_synchronized(stream_token); | |||
} | |||
|
|||
template <typename T> bool all_of(T &&f) { | |||
{ | |||
std::lock_guard<std::mutex> compute_guard(compute_stream_mutex_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::lock_guard<std::mutex> compute_guard(compute_stream_mutex_); | |
std::lock_guard compute_guard(compute_stream_mutex_); |
sycl/plugins/cuda/pi_cuda.hpp
Outdated
} | ||
} | ||
{ | ||
std::lock_guard<std::mutex> transfer_guard(transfer_stream_mutex_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::lock_guard<std::mutex> transfer_guard(transfer_stream_mutex_); | |
std::lock_guard transfer_guard(transfer_stream_mutex_); |
sycl/plugins/cuda/pi_cuda.hpp
Outdated
unsigned int end = | ||
std::min(static_cast<unsigned int>(compute_streams_.size()), | ||
num_compute_streams_); | ||
for (unsigned int i = 0; i < end; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be an algorithm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for suggestions, fixed.
sycl/plugins/cuda/pi_cuda.hpp
Outdated
num_transfer_streams_); | ||
for (unsigned int i = 0; i < end; i++) { | ||
if (!f(transfer_streams_[i])) | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This déjà vu suggests more abstraction.
if (!f(transfer_streams_[i])) | ||
return false; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We really need some heavy refactoring across the various back-ends some day... :-(
Note that #7612 was merged. Please merge the main thread into this PR, and then move / update the spec. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes to extension spec LGTM.
@romanovvlad Friendly ping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
sycl/source/detail/queue_impl.cpp
Outdated
// If we have in-order queue where events are not discarded then just check | ||
// the status of the last event. | ||
if (isInOrder() && !MDiscardEvents) { | ||
std::lock_guard<std::mutex> Lock(MLastEventMtx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use C++17 CTAD everywhere. There are still a lot in the new code.
Reported unrelated HIP backend failures here: #7634 |
E2E tests: intel/llvm-test-suite#1427