2
2
// RUN: %{build} -o %t.out
3
3
// RUN: %{run} %t.out
4
4
// RUN: %if ext_oneapi_level_zero %{env ZE_DEBUG=4 %{run} %t.out 2>&1 | FileCheck %s %}
5
-
6
- // https://github.com/intel/llvm/issues/11277:
7
- // UNSUPPORTED: windows
8
5
//
9
6
// CHECK-NOT: LEAK
10
7
14
11
15
12
#include " graph_common.hpp"
16
13
14
+ inline bool
15
+ isSubmittedOrRunningCommand (sycl::info::event_command_status Status) {
16
+ return ((Status == sycl::info::event_command_status::submitted) ||
17
+ (Status == sycl::info::event_command_status::running));
18
+ }
19
+
17
20
int main () {
18
21
queue Queue{{sycl::ext::intel::property::queue::no_immediate_command_list{}}};
19
22
20
23
using T = int ;
21
24
22
25
size_t LargeSize =
23
- 1000000 ; // we use large Size to increase the kernel execution time
26
+ 10000 ; // we use large Size to increase the kernel execution time
24
27
size_t NumIterations = 10 ;
25
28
size_t SuccessfulSubmissions = 0 ;
26
29
@@ -56,26 +59,46 @@ int main() {
56
59
}
57
60
58
61
// Concurrent Submissions
59
- sycl::event Event;
60
- sycl::info::event_command_status PreEventInfo =
62
+ sycl::event PreEvent, Event;
63
+ sycl::info::event_command_status PreEventInfoStateBefore =
64
+ sycl::info::event_command_status::ext_oneapi_unknown;
65
+ sycl::info::event_command_status PreEventInfoStateAfter =
61
66
sycl::info::event_command_status::ext_oneapi_unknown;
62
- std::error_code ErrorCode = make_error_code (sycl::errc::success);
63
67
for (unsigned i = 0 ; i < NumIterations; ++i) {
68
+ std::error_code ErrorCode = make_error_code (sycl::errc::success);
69
+ PreEventInfoStateBefore =
70
+ PreEvent.get_info <sycl::info::event::command_execution_status>();
71
+
72
+ // Submit the kernel
64
73
try {
65
74
Event =
66
75
Queue.submit ([&](handler &CGH) { CGH.ext_oneapi_graph (GraphExec); });
67
76
} catch (const sycl::exception &e) {
68
77
ErrorCode = e.code ();
69
78
}
70
- if ((PreEventInfo == sycl::info::event_command_status::submitted) ||
71
- (PreEventInfo == sycl::info::event_command_status::running)) {
79
+ PreEventInfoStateAfter =
80
+ PreEvent.get_info <sycl::info::event::command_execution_status>();
81
+
82
+ // Check submission status
83
+ if (isSubmittedOrRunningCommand (PreEventInfoStateBefore) &&
84
+ isSubmittedOrRunningCommand (PreEventInfoStateAfter)) {
72
85
assert (ErrorCode == sycl::errc::invalid);
73
- } else {
86
+ } else if (PreEventInfoStateBefore ==
87
+ sycl::info::event_command_status::complete) {
74
88
// Submission has succeeded
75
89
SuccessfulSubmissions++;
90
+ PreEvent = Event;
91
+ } else {
92
+ // We cannot be sure of the state of the previous task when the current
93
+ // submission occurred because `PreEventInfoStateBefore` and
94
+ // `PreEventInfoStateAfter` indicate different status We therefore only
95
+ // read the submission status and increment the number of successful
96
+ // submissions if the submission was successful
97
+ if (ErrorCode == sycl::errc::success) {
98
+ SuccessfulSubmissions++;
99
+ PreEvent = Event;
100
+ }
76
101
}
77
- PreEventInfo =
78
- Event.get_info <sycl::info::event::command_execution_status>();
79
102
}
80
103
Queue.wait_and_throw ();
81
104
@@ -91,6 +114,7 @@ int main() {
91
114
// Compute the reference based on the total number of successful executions
92
115
calculate_reference_data (NumIterations + SuccessfulSubmissions, LargeSize,
93
116
ReferenceA, ReferenceB, ReferenceC);
117
+
94
118
assert (ReferenceA == DataA);
95
119
assert (ReferenceB == DataB);
96
120
assert (ReferenceC == DataC);
0 commit comments