Skip to content

Commit 9e79d31

Browse files
authored
[SYCL] Throw error when mismatched plugins on queue (#1659)
Signed-off-by: Ruyman Reyes <[email protected]>
1 parent c22e34b commit 9e79d31

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

sycl/source/detail/queue_impl.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ class queue_impl {
6969
: MDevice(Device), MContext(Context), MAsyncHandler(AsyncHandler),
7070
MPropList(PropList), MHostQueue(MDevice->is_host()),
7171
MOpenCLInterop(!MHostQueue) {
72-
if (!MHostQueue) {
73-
MCommandQueue = createQueue(Order);
74-
}
7572
if (!Context->hasDevice(Device))
7673
throw cl::sycl::invalid_parameter_error(
7774
"Queue cannot be constructed with the given context and device "
7875
"as the context does not contain the given device.",
7976
PI_INVALID_DEVICE);
77+
if (!MHostQueue) {
78+
MCommandQueue = createQueue(Order);
79+
}
8080
}
8181

8282
/// Constructs a SYCL queue from plugin interoperability handle.
@@ -240,6 +240,8 @@ class queue_impl {
240240
RT::PiContext Context = MContext->getHandleRef();
241241
RT::PiDevice Device = MDevice->getHandleRef();
242242
const detail::plugin &Plugin = getPlugin();
243+
244+
assert(Plugin.getBackend() == MDevice->getPlugin().getBackend());
243245
RT::PiResult Error = Plugin.call_nocheck<PiApiKind::piQueueCreate>(
244246
Context, Device, CreationFlags, &Queue);
245247

0 commit comments

Comments
 (0)