forked from intel/llvm
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL][Graph] Throw exception when creating graph for unsupported bac…
…kend (#280) * [SYCL][Graph] Throw exception when creating graph for unsupported backend - Checks backend when creating graphs and throws an exception is the backend is not supported. - Adds an e2e test to verify this exception throwing. - Updates some comments - Improves mock usage in Unitest to avoid having to force emulation mode --------- Co-authored-by: Pablo Reble <[email protected]> Co-authored-by: Julian Miller <[email protected]>
- Loading branch information
1 parent
bc01f0f
commit edeac7c
Showing
4 changed files
with
73 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// RUN: %{build} -o %t.out | ||
// RUN: %{run} %t.out | ||
|
||
// Tests the ability to finalize a empty command graph | ||
// The test checks that invalid exception is thrown | ||
// when trying to create a graph with an unsupported backend. | ||
|
||
#include "graph_common.hpp" | ||
|
||
int GetUnsupportedBackend(const sycl::device &Dev) { | ||
// Return 1 if the device backend is unsupported or 0 else. | ||
// 0 does not prevent another device to be picked as a second choice | ||
return Dev.get_info< | ||
ext::oneapi::experimental::info::device::graph_support>() == | ||
ext::oneapi::experimental::info::graph_support_level::unsupported; | ||
} | ||
|
||
int main() { | ||
sycl::device Dev{GetUnsupportedBackend}; | ||
queue Queue{Dev}; | ||
|
||
if (Dev.get_info<ext::oneapi::experimental::info::device::graph_support>() != | ||
ext::oneapi::experimental::info::graph_support_level::unsupported) | ||
return 0; | ||
|
||
std::error_code ExceptionCode = make_error_code(sycl::errc::success); | ||
try { | ||
exp_ext::command_graph Graph{Queue.get_context(), Dev}; | ||
} catch (exception &Exception) { | ||
ExceptionCode = Exception.code(); | ||
} | ||
assert(ExceptionCode == sycl::errc::invalid); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters