Skip to content

[SYCL][E2E] Use sycl 2020 exceptions in KernelAndProgram e2e tests #14229

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
Jun 21, 2024
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
6 changes: 4 additions & 2 deletions sycl/test-e2e/KernelAndProgram/build-log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ void test() {
Queue.submit(
[&](sycl::handler &CGH) { CGH.single_task<class SingleTask>(Kernel); });
assert(false && "There must be compilation error");
} catch (const sycl::compile_program_error &e) {
} catch (const sycl::exception &e) {
std::string Msg(e.what());
std::cerr << Msg << std::endl;
assert(e.code() == sycl::errc::build &&
"Caught exception was not a compilation error");
assert(Msg.find("PI_ERROR_BUILD_PROGRAM_FAILURE") != std::string::npos);
} catch (...) {
assert(false && "There must be sycl::compile_program_error");
assert(false && "Caught exception was not a compilation error");
}
}

Expand Down
8 changes: 4 additions & 4 deletions sycl/test-e2e/KernelAndProgram/cache-build-result.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ void test() {
CGH.single_task<class SingleTask>(Kernel);
});
assert(false && "There must be compilation error");
} catch (const sycl::compile_program_error &e) {
} catch (const sycl::exception &e) {
fprintf(stderr, "Exception: %s, %d\n", e.what(), e.code().value());
assert(e.code() == sycl::errc::build &&
"Caught exception was not a compilation error");
if (Idx == 0) {
Msg = e.what();
Result = e.code().value();
} else {
// Exception constantly adds info on its error code in the message
assert(Msg.find_first_of(e.what()) == 0 &&
"PI_ERROR_BUILD_PROGRAM_FAILURE");
assert(Result == e.code().value() && "Exception code differs");
}
} catch (...) {
assert(false && "There must be sycl::compile_program_error");
assert(false && "Caught exception was not a compilation error");
}
}
}
Expand Down
Loading