Skip to content

Commit d64b35d

Browse files
authored
[SYCL][CUDA] Pass device from context in create queue. (intel#10491)
Recently in the switch to UR `urQueueCreateFromNativeHandle` changed the previous behaviour whereby a queue was created with a device taken as the default device from the context. It changed it so that the queue was created with the device argument instead. Since the sycl runtime always passes a nullptr for the device when programmers call `make_queue(nativeStream, context)`, this broke `make_queue`. This patch reverts to the previous behaviour before the switch from pi cuda to ur cuda. Note that this should also fix `make_queue` for l0 which I also guess was broken due to the asserts meaning that this line was never reached: https://github.com/intel/llvm/blob/sycl/sycl/plugins/unified_runtime/ur/adapters/level_zero/queue.cpp#L574. But I have not tested this. --------- Signed-off-by: JackAKirk <[email protected]>
1 parent b4c5397 commit d64b35d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

queue.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueCreateWithNativeHandle(
243243
ur_device_handle_t hDevice, const ur_queue_native_properties_t *pProperties,
244244
ur_queue_handle_t *phQueue) {
245245
(void)pProperties;
246+
(void)hDevice;
246247

247248
unsigned int CuFlags;
248249
CUstream CuStream = reinterpret_cast<CUstream>(hNativeQueue);
249-
UR_ASSERT(hContext->getDevice() == hDevice, UR_RESULT_ERROR_INVALID_DEVICE);
250250

251251
auto Return = UR_CHECK_ERROR(cuStreamGetFlags(CuStream, &CuFlags));
252252

@@ -266,7 +266,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueCreateWithNativeHandle(
266266
*phQueue = new ur_queue_handle_t_{std::move(ComputeCuStreams),
267267
std::move(TransferCuStreams),
268268
hContext,
269-
hDevice,
269+
hContext->getDevice(),
270270
CuFlags,
271271
Flags,
272272
/*backend_owns*/ false};

0 commit comments

Comments
 (0)