Skip to content

Commit cb2265b

Browse files
authored
[SYCL][L0] Always set CommandList in _pi_context::getAvailableCommandList (#4359)
When adding a command list from the cache to the map, we were not returning the newly-inserted element via `CommandList` reference. Thus, the _pi_context::getAvailableCommandList function was returning `PI_SUCCESS`, but `CommandList` was left uninitialized, leading to a segfault when the command list is used later (in my case, in `enqueueMemFillHelper`). Introduced in PR #4248.
1 parent 74ef84b commit cb2265b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sycl/plugins/level_zero/pi_level_zero.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,11 @@ pi_result _pi_context::getAvailableCommandList(
876876

877877
ze_fence_handle_t ZeFence;
878878
ZE_CALL(zeFenceCreate, (ZeCommandQueue, &ZeFenceDesc, &ZeFence));
879-
Queue->CommandListMap[ZeCommandList] = {ZeFence, true, CopyQueueIndex};
879+
CommandList =
880+
Queue->CommandListMap
881+
.emplace(ZeCommandList,
882+
pi_command_list_info_t{ZeFence, true, CopyQueueIndex})
883+
.first;
880884
}
881885
ZeCommandListCache.pop_front();
882886
return PI_SUCCESS;

0 commit comments

Comments
 (0)