-
Notifications
You must be signed in to change notification settings - Fork 730
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL] Support profiling info for event returned by NOP barrier (#12949)
Currently if ext_oneapi_barrier without waitlist is submitted to the in-order queue that doesn't have the last command (empty queue) then we return default constructed event which doesn't have profiling info because it is not associated with any queue. Associate such event with the queue and record submission time which is equal to the start time and the end time for such event because it basically corresponds to NOP.
- Loading branch information
Showing
7 changed files
with
113 additions
and
34 deletions.
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
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
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
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,36 @@ | ||
// RUN: %{build} -o %t.out | ||
// RUN: %{run} %t.out | ||
|
||
// Test to check that it is possible to get profiling info from the event | ||
// returned by barrier which turns into NOP. | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
int main() { | ||
sycl::event start; | ||
sycl::event stop; | ||
sycl::queue q{sycl::property_list(sycl::property::queue::in_order(), | ||
sycl::property::queue::enable_profiling())}; | ||
float elapsed = 0; | ||
|
||
start = q.ext_oneapi_submit_barrier(); | ||
std::cout << "before parallel_for" << std::endl; | ||
q.parallel_for( | ||
sycl::nd_range<3>(sycl::range<3>(1, 1, 16) * sycl::range<3>(1, 1, 16), | ||
sycl::range<3>(1, 1, 16)), | ||
[=](sycl::nd_item<3> item_ct1) { | ||
double d = 123; | ||
for (int i = 0; i < 10000; i++) { | ||
d = d * i; | ||
} | ||
}); | ||
std::cout << "after parallel_for" << std::endl; | ||
stop = q.ext_oneapi_submit_barrier(); | ||
stop.wait_and_throw(); | ||
elapsed = | ||
(stop.get_profiling_info<sycl::info::event_profiling::command_end>() - | ||
start.get_profiling_info<sycl::info::event_profiling::command_start>()) / | ||
1000000.0f; | ||
std::cout << "elapsed:" << elapsed << std::endl; | ||
return 0; | ||
} |