Skip to content

Commit 66835de

Browse files
committed
Update interop test, check exception.
Also made exception use feature_not_supported Signed-off-by: JackAKirk <[email protected]>
1 parent 4048a82 commit 66835de

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

sycl/include/sycl/backend.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ get_native<backend::ext_oneapi_hip, context>(const context &Obj) {
244244
"Backends mismatch");
245245
}
246246
throw sycl::exception(
247-
make_error_code(sycl::errc::runtime),
247+
make_error_code(sycl::errc::feature_not_supported),
248248
"Context interop is not supported for HIP. If a native context is "
249249
"required, use hipDevicePrimaryCtxRetain with a native device");
250250
}

sycl/test-e2e/Basic/interop/interop_all_backends.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ int main() {
8282
auto Event3 = InteropQueue.memcpy(&vec[0], A, N * sizeof(int), Event2);
8383
Event3.wait();
8484

85+
if constexpr (BACKEND == backend::ext_oneapi_hip) {
86+
try {
87+
backend_traits<BACKEND>::return_type<context> NativeContext =
88+
get_native<BACKEND>(Context);
89+
} catch (sycl::exception &e) {
90+
assert(e.code() == sycl::errc::feature_not_supported);
91+
}
92+
}
93+
8594
free(A, InteropQueue);
8695

8796
for (const auto &val : vec) {

0 commit comments

Comments
 (0)