forked from intel/llvm
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL] Don't spoil MDeviceHostBaseTime during isGetDeviceAndHostTimer…
…Supported (intel#10909) `MDeviceHostBaseTime` data member of `device_impl` is supposed to be properly updated/calculated using `getCurrentDeviceTime()`. Currently it is also used to check `piGetDeviceAndHostTimer` support in `isGetDeviceAndHostTimerSupported()` which results in wrong values stored in `MDeviceHostBaseTime` and wrong calculation of submit time. That's why use temp variables to check support of `piGetDeviceAndHostTimer` to avoid spoiling `MDeviceHostBaseTime`.
- Loading branch information
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// RUN: %{build} -o %t.out | ||
// RUN: %{run} %t.out | ||
|
||
// Check that device_impl::isGetDeviceAndHostTimerSupported() is not spoiling | ||
// device_impl::MDeviceHostBaseTime values used for submit timestamp | ||
// calculation. | ||
|
||
#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 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>(); | ||
|
||
if (!(submit <= start) || !(start <= end)) | ||
return -1; | ||
|
||
return 0; | ||
} |