Skip to content

Commit 3203c84

Browse files
committed
[SYCL][NFC] Fix LIT test
Make sure that commands in the queue complete before check data in host array
1 parent 0474429 commit 3203c84

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

sycl/test/basic_tests/event_profiling_info.cpp

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// XFAIL: cuda, opencl, level_zero
21
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
32
//
43
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
@@ -29,10 +28,10 @@ bool verifyProfiling(event Event) {
2928
assert(Submit <= Start);
3029
assert(Start <= End);
3130

32-
bool Fail = sycl::info::event_command_status::complete !=
31+
bool Pass = sycl::info::event_command_status::complete ==
3332
Event.get_info<sycl::info::event::command_execution_status>();
3433

35-
return Fail;
34+
return Pass;
3635
}
3736

3837
// The test checks that get_profiling_info waits for command asccociated with
@@ -45,28 +44,32 @@ int main() {
4544
}
4645
int Values[Size] = {0};
4746

48-
buffer<int, 1> BufferFrom(Data, range<1>(Size));
49-
buffer<int, 1> BufferTo(Values, range<1>(Size));
47+
{
48+
buffer<int, 1> BufferFrom(Data, range<1>(Size));
49+
buffer<int, 1> BufferTo(Values, range<1>(Size));
5050

51-
// buffer copy
52-
queue copyQueue{sycl::property::queue::enable_profiling()};
53-
event copyEvent = copyQueue.submit([&](sycl::handler &Cgh) {
54-
accessor<int, 1, access::mode::read, access::target::global_buffer>
55-
AccessorFrom(BufferFrom, Cgh, range<1>(Size));
56-
accessor<int, 1, access::mode::write, access::target::global_buffer>
57-
AccessorTo(BufferTo, Cgh, range<1>(Size));
58-
Cgh.copy(AccessorFrom, AccessorTo);
59-
});
51+
// buffer copy
52+
queue copyQueue{sycl::property::queue::enable_profiling()};
53+
event copyEvent = copyQueue.submit([&](sycl::handler &Cgh) {
54+
accessor<int, 1, access::mode::read, access::target::global_buffer>
55+
AccessorFrom(BufferFrom, Cgh, range<1>(Size));
56+
accessor<int, 1, access::mode::write, access::target::global_buffer>
57+
AccessorTo(BufferTo, Cgh, range<1>(Size));
58+
Cgh.copy(AccessorFrom, AccessorTo);
59+
});
60+
61+
// kernel launch
62+
queue kernelQueue{sycl::property::queue::enable_profiling()};
63+
event kernelEvent = kernelQueue.submit([&](sycl::handler &CGH) {
64+
CGH.single_task<class EmptyKernel>([=]() {});
65+
});
66+
67+
assert(verifyProfiling(copyEvent) && verifyProfiling(kernelEvent));
68+
}
6069

6170
for (size_t I = 0; I < Size; ++I) {
6271
assert(Data[I] == Values[I]);
6372
}
6473

65-
// kernel launch
66-
queue kernelQueue{sycl::property::queue::enable_profiling()};
67-
event kernelEvent = kernelQueue.submit([&](sycl::handler &CGH) {
68-
CGH.single_task<class EmptyKernel>([=]() {});
69-
});
70-
71-
return verifyProfiling(copyEvent) || verifyProfiling(kernelEvent);
74+
return 0;
7275
}

0 commit comments

Comments
 (0)