Skip to content

Commit aa2ebe7

Browse files
[SYCL][E2E] Reenable test for code location tracing with XPTI (#9175)
Signed-off-by: Tikhomirova, Kseniya <[email protected]>
1 parent 41344ed commit aa2ebe7

File tree

3 files changed

+83
-0
lines changed

3 files changed

+83
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// UNSUPPORTED: windows
2+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
3+
// RUN: %CPU_RUN_PLACEHOLDER sycl-trace --sycl %t.out %CPU_CHECK_PLACEHOLDER
4+
5+
// Test tracing of the code location data for queue.copy in case of failure
6+
// (exception generation)
7+
//
8+
// CHECK: code_location_queue_copy.cpp:18 main
9+
10+
#include <sycl/sycl.hpp>
11+
12+
int main() {
13+
sycl::queue Q;
14+
bool ExceptionCaught = false;
15+
unsigned char *HostAllocSrc = (unsigned char *)sycl::malloc_host(1, Q);
16+
unsigned char *HostAllocDst = NULL;
17+
try {
18+
Q.copy(HostAllocDst, HostAllocSrc, 1);
19+
} catch (sycl::exception &e) {
20+
std::ignore = e;
21+
ExceptionCaught = true;
22+
}
23+
Q.wait();
24+
sycl::free(HostAllocSrc, Q);
25+
26+
return !ExceptionCaught;
27+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// UNSUPPORTED: windows
2+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
3+
// RUN: %CPU_RUN_PLACEHOLDER sycl-trace --sycl %t.out %CPU_CHECK_PLACEHOLDER
4+
5+
// Test tracing of the code location data for queue.parallel_for in case of
6+
// failure (exception generation)
7+
//
8+
// CHECK: code_location_queue_parallel_for.cpp:22 E2ETestKernel
9+
10+
#include <sycl/sycl.hpp>
11+
12+
int main() {
13+
sycl::queue Queue;
14+
sycl::buffer<int, 1> Buf(8);
15+
sycl::device Dev = Queue.get_device();
16+
sycl::id<1> MaxWISizes =
17+
Dev.get_info<sycl::info::device::max_work_item_sizes<1>>();
18+
bool ExceptionCaught = false;
19+
try {
20+
Queue.parallel_for<class E2ETestKernel>(
21+
sycl::nd_range<1>{MaxWISizes.get(0), 2 * MaxWISizes.get(0)},
22+
[](sycl::id<1> idx) {});
23+
} catch (...) {
24+
ExceptionCaught = true;
25+
}
26+
Queue.wait();
27+
return !ExceptionCaught;
28+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// UNSUPPORTED: windows
2+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
3+
// RUN: %CPU_RUN_PLACEHOLDER sycl-trace --sycl %t.out %CPU_CHECK_PLACEHOLDER
4+
5+
// Test tracing of the code location data for queue.submit in case of failure
6+
// (exception generation)
7+
//
8+
// CHECK: code_location_queue_submit.cpp:18 main
9+
10+
#include <sycl/sycl.hpp>
11+
12+
int main() {
13+
sycl::queue Q;
14+
bool ExceptionCaught = false;
15+
unsigned char *HostAllocSrc = (unsigned char *)sycl::malloc_host(1, Q);
16+
unsigned char *HostAllocDst = NULL;
17+
try {
18+
Q.submit(
19+
[&](sycl::handler &cgh) { cgh.copy(HostAllocDst, HostAllocSrc, 1); });
20+
} catch (sycl::exception &e) {
21+
std::ignore = e;
22+
ExceptionCaught = true;
23+
}
24+
Q.wait();
25+
sycl::free(HostAllocSrc, Q);
26+
27+
return !ExceptionCaught;
28+
}

0 commit comments

Comments
 (0)