Skip to content
Merged
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
15 changes: 10 additions & 5 deletions sycl/source/detail/scheduler/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1417,14 +1417,19 @@ static void adjustNDRangePerKernel(NDRDescT &NDR, RT::PiKernel Kernel,

if (WGSize[0] == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this condition valid to represent all "default work-group size" cases?

Copy link
Contributor

@romanovvlad romanovvlad Mar 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WGSize[0] == 0 means user hasn't asked for a specific local size using attribute((reqd_work_group_size(X, Y, Z)) only.

// kernel does not request specific workgroup shape - set one
// TODO maximum work group size as the local size might not be the best
// choice for CPU or FPGA devices
id<3> MaxWGSizes =
get_device_info<id<3>, cl::sycl::info::device::max_work_item_sizes>::
get(DeviceImpl.getHandleRef(), DeviceImpl.getPlugin());

size_t WGSize1D = get_kernel_work_group_info<
size_t, cl::sycl::info::kernel_work_group::work_group_size>::
get(Kernel, DeviceImpl.getHandleRef(), DeviceImpl.getPlugin());
assert(WGSize1D != 0);
// TODO implement better default for 2D/3D case:
WGSize = {WGSize1D, 1, 1};

assert(MaxWGSizes[2] != 0);

// Set default work-group size in the Z-direction to either the max
// number of work-items or the maximum work-group size in the Z-direction.
WGSize = {1, 1, min(WGSize1D, MaxWGSizes[2])};
}
NDR.set(NDR.Dims, nd_range<3>(NDR.NumWorkGroups * WGSize, WGSize));
}
Expand Down