Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

[SYCL] Add test for default async_handler #1351

Merged
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
24 changes: 24 additions & 0 deletions SYCL/AsyncHandler/default_async_handler.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out &> %t.txt || true
// RUN: %CPU_RUN_PLACEHOLDER FileCheck %s --input-file %t.txt
// RUN: %GPU_RUN_PLACEHOLDER %t.out &> %t.txt || true
// RUN: %GPU_RUN_PLACEHOLDER FileCheck %s --input-file %t.txt
// RUN: %ACC_RUN_PLACEHOLDER %t.out &> %t.txt || true
// RUN: %ACC_RUN_PLACEHOLDER FileCheck %s --input-file %t.txt

#include <sycl/sycl.hpp>

using namespace sycl;

int main() {
queue Q;
Q.submit([&](handler &CGH) {
CGH.host_task([=]() {
throw std::runtime_error("Exception thrown from host_task.");
});
}).wait_and_throw();
return 0;
}

// CHECK: Default async_handler caught exceptions:
// CHECK-NEXT: Exception thrown from host_task.