Skip to content

[SYCL][E2E] Reenable test for code location tracing with XPTI #9175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions sycl/test-e2e/Tracing/code_location_queue_copy.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// UNSUPPORTED: windows
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER sycl-trace --sycl %t.out %CPU_CHECK_PLACEHOLDER

// Test tracing of the code location data for queue.copy in case of failure
// (exception generation)
//
// CHECK: code_location_queue_copy.cpp:18 main

#include <sycl/sycl.hpp>

int main() {
sycl::queue Q;
bool ExceptionCaught = false;
unsigned char *HostAllocSrc = (unsigned char *)sycl::malloc_host(1, Q);
unsigned char *HostAllocDst = NULL;
try {
Q.copy(HostAllocDst, HostAllocSrc, 1);
} catch (sycl::exception &e) {
std::ignore = e;
ExceptionCaught = true;
}
Q.wait();
sycl::free(HostAllocSrc, Q);

return !ExceptionCaught;
}
28 changes: 28 additions & 0 deletions sycl/test-e2e/Tracing/code_location_queue_parallel_for.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// UNSUPPORTED: windows
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER sycl-trace --sycl %t.out %CPU_CHECK_PLACEHOLDER

// Test tracing of the code location data for queue.parallel_for in case of
// failure (exception generation)
//
// CHECK: code_location_queue_parallel_for.cpp:22 E2ETestKernel

#include <sycl/sycl.hpp>

int main() {
sycl::queue Queue;
sycl::buffer<int, 1> Buf(8);
sycl::device Dev = Queue.get_device();
sycl::id<1> MaxWISizes =
Dev.get_info<sycl::info::device::max_work_item_sizes<1>>();
bool ExceptionCaught = false;
try {
Queue.parallel_for<class E2ETestKernel>(
sycl::nd_range<1>{MaxWISizes.get(0), 2 * MaxWISizes.get(0)},
[](sycl::id<1> idx) {});
} catch (...) {
ExceptionCaught = true;
}
Queue.wait();
return !ExceptionCaught;
}
28 changes: 28 additions & 0 deletions sycl/test-e2e/Tracing/code_location_queue_submit.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// UNSUPPORTED: windows
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER sycl-trace --sycl %t.out %CPU_CHECK_PLACEHOLDER

// Test tracing of the code location data for queue.submit in case of failure
// (exception generation)
//
// CHECK: code_location_queue_submit.cpp:18 main

#include <sycl/sycl.hpp>

int main() {
sycl::queue Q;
bool ExceptionCaught = false;
unsigned char *HostAllocSrc = (unsigned char *)sycl::malloc_host(1, Q);
unsigned char *HostAllocDst = NULL;
try {
Q.submit(
[&](sycl::handler &cgh) { cgh.copy(HostAllocDst, HostAllocSrc, 1); });
} catch (sycl::exception &e) {
std::ignore = e;
ExceptionCaught = true;
}
Q.wait();
sycl::free(HostAllocSrc, Q);

return !ExceptionCaught;
}