-
Notifications
You must be signed in to change notification settings - Fork 789
[SYCL] Fix computation of the submit time based on host timestamps #12104
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
Changes from all commits
762fa4c
8c362e9
195f370
cc06e88
7bb7c1f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,32 @@ | ||
// RUN: %{build} -o %t.out | ||
// RUN: %{run} %t.out | ||
// There is an issue with reported device time for the L0 backend, works only on | ||
// pvc for now. No such problems for other backends. | ||
// RUN: %if (!ext_oneapi_level_zero || gpu-intel-pvc) %{ %{run} %t.out %} | ||
|
||
// Check that device_impl::isGetDeviceAndHostTimerSupported() is not spoiling | ||
// device_impl::MDeviceHostBaseTime values used for submit timestamp | ||
// calculation. | ||
// Check that submission time is calculated properly. | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
using namespace sycl; | ||
|
||
int main(void) { | ||
sycl::queue queue( | ||
sycl::property_list{sycl::property::queue::enable_profiling()}); | ||
sycl::event event = queue.submit([&](sycl::handler &cgh) { | ||
cgh.parallel_for<class set_value>(sycl::range<1>{1024}, | ||
[=](sycl::id<1> idx) {}); | ||
}); | ||
sycl::queue q({sycl::property::queue::enable_profiling{}}); | ||
int *data = malloc_host<int>(1024, q); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This leaks. |
||
|
||
// SYCL RT internally calls device_impl::isGetDeviceAndHostTimerSupported() | ||
// to decide how to calculate "submit" timestamp - either using backend API | ||
// call or using fallback implementation. | ||
auto submit = | ||
event.get_profiling_info<sycl::info::event_profiling::command_submit>(); | ||
auto start = | ||
event.get_profiling_info<sycl::info::event_profiling::command_start>(); | ||
auto end = | ||
event.get_profiling_info<sycl::info::event_profiling::command_end>(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit; We try to discourage the use of |
||
for (int i = 0; i < 20; i++) { | ||
auto event = q.submit([&](sycl::handler &cgh) { | ||
cgh.parallel_for<class KernelTime>( | ||
sycl::range<1>(1024), [=](sycl::id<1> idx) { data[idx] = idx; }); | ||
}); | ||
|
||
if (!(submit <= start) || !(start <= end)) | ||
return -1; | ||
event.wait(); | ||
auto submit_time = | ||
event.get_profiling_info<sycl::info::event_profiling::command_submit>(); | ||
auto start_time = | ||
event.get_profiling_info<sycl::info::event_profiling::command_start>(); | ||
auto end_time = | ||
event.get_profiling_info<sycl::info::event_profiling::command_end>(); | ||
|
||
assert((submit_time <= start_time) && (start_time <= end_time)); | ||
} | ||
sycl::free(data, q); | ||
return 0; | ||
} |
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.
Should we make it a
REQUIRES
instead? Seems like it would be better to just skip it. I don't think compile-only testing benefits us in E2E.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.
I tried with REQUIRES at first, but for some reasons test is still executed if I do this. That's why changed to this approach.