Skip to content

Commit 58f4da6

Browse files
authored
[SYCL][UR][L0 v2] Update pDesc in urQueueGetNativeHandle (#19439)
SYCL expects urQueueGetNativeHandle to set pNativeData to 1 or 0 depending on whether the queue is using immediate command list. V2 adapter was not setting this at all, which resulted in SYCL reading uninitialized data.
1 parent 61888af commit 58f4da6

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,13 @@ ur_queue_immediate_in_order_t::queueGetInfo(ur_queue_info_t propName,
9090
}
9191

9292
ur_result_t ur_queue_immediate_in_order_t::queueGetNativeHandle(
93-
ur_queue_native_desc_t * /*pDesc*/, ur_native_handle_t *phNativeQueue) {
93+
ur_queue_native_desc_t *pDesc, ur_native_handle_t *phNativeQueue) {
9494
*phNativeQueue = reinterpret_cast<ur_native_handle_t>(
9595
commandListManager.get_no_lock()->getZeCommandList());
96+
if (pDesc && pDesc->pNativeData) {
97+
// pNativeData == isImmediateQueue
98+
*(reinterpret_cast<int32_t *>(pDesc->pNativeData)) = 1;
99+
}
96100
return UR_RESULT_SUCCESS;
97101
}
98102

unified-runtime/source/adapters/level_zero/v2/queue_immediate_out_of_order.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,14 @@ ur_result_t ur_queue_immediate_out_of_order_t::queueGetInfo(
9494
}
9595

9696
ur_result_t ur_queue_immediate_out_of_order_t::queueGetNativeHandle(
97-
ur_queue_native_desc_t * /*pDesc*/, ur_native_handle_t *phNativeQueue) {
97+
ur_queue_native_desc_t *pDesc, ur_native_handle_t *phNativeQueue) {
9898
*phNativeQueue = reinterpret_cast<ur_native_handle_t>(
9999
(*commandListManagers.get_no_lock())[getNextCommandListId()]
100100
.getZeCommandList());
101+
if (pDesc && pDesc->pNativeData) {
102+
// pNativeData == isImmediateQueue
103+
*(reinterpret_cast<int32_t *>(pDesc->pNativeData)) = 1;
104+
}
101105
return UR_RESULT_SUCCESS;
102106
}
103107

0 commit comments

Comments
 (0)