Skip to content

Commit 430886b

Browse files
igchorKornevNikita
authored andcommitted
[SYCL][UR][L0 v2] fix urQueueCreateWithNativeHandle (#17784)
getSignalEvent in ur_command_list_manager returned nullptr when queue was not set. This was the case when initializing the command list manager in queue ctor called from urQueueCreateWithNativeHandle. Fix this by passing queue to the command list manager and removing the default nullptr value from the ctor (to avoid this issue in future). Also, even if queue is nullptr, return the event instead of nullptr from getSignalEvent. This event is mostly functional, it just cannot be used for profiling.
1 parent f0bce89 commit 430886b

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ ur_exp_command_buffer_handle_t_::ur_exp_command_buffer_handle_t_(
3535
const ur_exp_command_buffer_desc_t *desc)
3636
: commandListManager(
3737
context, device,
38-
std::forward<v2::raii::command_list_unique_handle>(commandList)),
38+
std::forward<v2::raii::command_list_unique_handle>(commandList),
39+
v2::EVENT_FLAGS_COUNTER, nullptr),
3940
isUpdatable(desc ? desc->isUpdatable : false) {}
4041

4142
ur_result_t ur_exp_command_buffer_handle_t_::finalizeCommandBuffer() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ ur_command_list_manager::getWaitListView(const ur_event_handle_t *phWaitEvents,
172172
ze_event_handle_t
173173
ur_command_list_manager::getSignalEvent(ur_event_handle_t *hUserEvent,
174174
ur_command_t commandType) {
175-
if (hUserEvent && queue) {
175+
if (hUserEvent) {
176176
*hUserEvent = eventPool->allocate();
177177
(*hUserEvent)->resetQueueAndCommand(queue, commandType);
178178
return (*hUserEvent)->getZeEvent();

unified-runtime/source/adapters/level_zero/v2/command_list_manager.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ struct ur_command_list_manager {
3636
ur_command_list_manager(ur_context_handle_t context,
3737
ur_device_handle_t device,
3838
v2::raii::command_list_unique_handle &&commandList,
39-
v2::event_flags_t flags = v2::EVENT_FLAGS_COUNTER,
40-
ur_queue_t_ *queue = nullptr);
39+
v2::event_flags_t flags, ur_queue_t_ *queue);
4140
ur_command_list_manager(ur_command_list_manager &&src) = default;
4241
~ur_command_list_manager();
4342

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ ur_queue_immediate_in_order_t::ur_queue_immediate_in_order_t(
9090
}
9191
}
9292
}),
93-
eventFlagsFromQueueFlags(flags)) {}
93+
eventFlagsFromQueueFlags(flags), this) {}
9494

9595
ze_event_handle_t ur_queue_immediate_in_order_t::getSignalEvent(
9696
locked<ur_command_list_manager> &commandList, ur_event_handle_t *hUserEvent,

0 commit comments

Comments
 (0)