Skip to content
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

Query out and use local size set in program IL in CL adapter. #2160

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
25 changes: 23 additions & 2 deletions source/adapters/opencl/enqueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,33 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch(
const size_t *pGlobalWorkOffset, const size_t *pGlobalWorkSize,
const size_t *pLocalWorkSize, uint32_t numEventsInWaitList,
const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) {
std::vector<size_t> compiledLocalWorksize;
if (!pLocalWorkSize) {
cl_device_id device = nullptr;
CL_RETURN_ON_FAILURE(clGetCommandQueueInfo(
cl_adapter::cast<cl_command_queue>(hQueue), CL_QUEUE_DEVICE,
sizeof(device), &device, nullptr));
// This query always returns size_t[3], if nothing was specified it returns
// all zeroes.
size_t queriedLocalWorkSize[3] = {0, 0, 0};
CL_RETURN_ON_FAILURE(clGetKernelWorkGroupInfo(
cl_adapter::cast<cl_kernel>(hKernel), device,
CL_KERNEL_COMPILE_WORK_GROUP_SIZE, sizeof(size_t[3]),
queriedLocalWorkSize, nullptr));
if (queriedLocalWorkSize[0] != 0) {
for (uint32_t i = 0; i < workDim; i++) {
compiledLocalWorksize.push_back(queriedLocalWorkSize[i]);
}
}
}

CL_RETURN_ON_FAILURE(clEnqueueNDRangeKernel(
cl_adapter::cast<cl_command_queue>(hQueue),
cl_adapter::cast<cl_kernel>(hKernel), workDim, pGlobalWorkOffset,
pGlobalWorkSize, pLocalWorkSize, numEventsInWaitList,
cl_adapter::cast<const cl_event *>(phEventWaitList),
pGlobalWorkSize,
compiledLocalWorksize.empty() ? pLocalWorkSize
: compiledLocalWorksize.data(),
numEventsInWaitList, cl_adapter::cast<const cl_event *>(phEventWaitList),
cl_adapter::cast<cl_event *>(phEvent)));

return UR_RESULT_SUCCESS;
Expand Down
1 change: 0 additions & 1 deletion test/conformance/enqueue/enqueue_adapter_opencl.match
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{NONDETERMINISTIC}}
{{OPT}}urEnqueueDeviceGetGlobalVariableReadTest.Success/Intel_R__OpenCL___{{.*}}_
urEnqueueKernelLaunchKernelWgSizeTest.Success/Intel_R__OpenCL___{{.*}}_
urEnqueueKernelLaunchKernelSubGroupTest.Success/Intel_R__OpenCL___{{.*}}_
{{OPT}}urEnqueueKernelLaunchUSMLinkedList.Success/Intel_R__OpenCL___{{.*}}_UsePoolEnabled
Loading