Skip to content

Commit 1dd6d32

Browse files
committed
Fix lifetime of pointer used in update
When we initialize our `ze_mutable_group_count_exp_desc_t` struct that's used in a pointer chain passed to `zexCommandListUpdateMutableCommandsExp` we set the `pGroupCount` member to `&ZeThreadGroupDimensions`. However, `ZeThreadGroupDimensions` is declared on the stack in the scope of the if statement. Resulting in this pointer becoming invalid after the scope of the if statement, when the L0 update API is called. Fixed by moving the `ZeThreadGroupDimensions` variable outside the scope of the if statement, into the scope of the function, so that the address is valid when `zexCommandListUpdateMutableCommandsExp` is called.
1 parent 963b013 commit 1dd6d32

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

source/adapters/level_zero/command_buffer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1278,8 +1278,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp(
12781278
UR_ASSERT(!(NewGlobalWorkSize && !NewLocalWorkSize) ||
12791279
(SupportedFeatures & ZE_MUTABLE_COMMAND_EXP_FLAG_GROUP_SIZE),
12801280
UR_RESULT_ERROR_UNSUPPORTED_FEATURE);
1281+
1282+
ze_group_count_t ZeThreadGroupDimensions{1, 1, 1};
12811283
if (NewGlobalWorkSize && Dim > 0) {
1282-
ze_group_count_t ZeThreadGroupDimensions{1, 1, 1};
12831284
uint32_t WG[3];
12841285
// If new global work size is provided but new local work size is not
12851286
// provided then we still need to update local work size based on size

0 commit comments

Comments
 (0)