Skip to content

Commit

Permalink
[hip] Skip HIP kernel execution when any workgroup size is zero. (ire…
Browse files Browse the repository at this point in the history
…e-org#18835)

This fixes `hipErrorInvalidConfiguration` errors when launching kernels
with dynamic sized inputs when the dynamic size is zero.

See iree-org#18834 for more details.

Fixes iree-org#18834.

Signed-off-by: James Bartlett <[email protected]>
  • Loading branch information
JamesMBartlett authored Oct 18, 2024
1 parent df5e5aa commit f9db5c7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions runtime/src/iree/hal/drivers/hip/stream_command_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,15 @@ static iree_status_t iree_hal_hip_stream_command_buffer_dispatch(
iree_hal_hip_stream_command_buffer_cast(base_command_buffer);
IREE_TRACE_ZONE_BEGIN(z0);

// If any of the workgroup counts are zero, we can skip execution
// of the kernel. This prevents a 'hipErrorInvalidConfiguration' error when
// launching the kernel.
if (workgroup_count[0] == 0 || workgroup_count[1] == 0 ||
workgroup_count[2] == 0) {
IREE_TRACE_ZONE_END(z0);
return iree_ok_status();
}

IREE_RETURN_AND_END_ZONE_IF_ERROR(
z0, iree_hal_hip_stream_command_buffer_flush_collectives(command_buffer));

Expand Down

0 comments on commit f9db5c7

Please sign in to comment.