Skip to content

[UR][Offload] Bump kernel launching after launchargs change #18957

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: sycl
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions unified-runtime/source/adapters/offload/enqueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,24 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch(
}

if (GroupSize[0] > GlobalSize[0] || GroupSize[1] > GlobalSize[1] ||
GroupSize[2] > GlobalSize[2]) {
GroupSize[2] > GlobalSize[2] ||
GroupSize[0] > std::numeric_limits<uint32_t>::max() ||
GroupSize[1] > std::numeric_limits<uint32_t>::max() ||
GroupSize[2] > std::numeric_limits<uint32_t>::max() ||
GlobalSize[0] / GroupSize[0] > std::numeric_limits<uint32_t>::max() ||
GlobalSize[1] / GroupSize[1] > std::numeric_limits<uint32_t>::max() ||
GlobalSize[2] / GroupSize[2] > std::numeric_limits<uint32_t>::max()) {
return UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE;
}

ol_kernel_launch_size_args_t LaunchArgs;
LaunchArgs.Dimensions = workDim;
LaunchArgs.NumGroupsX = GlobalSize[0] / GroupSize[0];
LaunchArgs.NumGroupsY = GlobalSize[1] / GroupSize[1];
LaunchArgs.NumGroupsZ = GlobalSize[2] / GroupSize[2];
LaunchArgs.GroupSizeX = GroupSize[0];
LaunchArgs.GroupSizeY = GroupSize[1];
LaunchArgs.GroupSizeZ = GroupSize[2];
LaunchArgs.NumGroups.x = GlobalSize[0] / GroupSize[0];
LaunchArgs.NumGroups.y = GlobalSize[1] / GroupSize[1];
LaunchArgs.NumGroups.z = GlobalSize[2] / GroupSize[2];
LaunchArgs.GroupSize.x = GroupSize[0];
LaunchArgs.GroupSize.y = GroupSize[1];
LaunchArgs.GroupSize.z = GroupSize[2];
LaunchArgs.DynSharedMemory = 0;

ol_event_handle_t EventOut;
Expand Down