Skip to content

Commit

Permalink
[L0 v2] implement urKernelSuggestMaxCooperativeGroupCountExp
Browse files Browse the repository at this point in the history
  • Loading branch information
igchor committed Jan 9, 2025
1 parent 188e8a3 commit bfae55d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
8 changes: 0 additions & 8 deletions source/adapters/level_zero/v2/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,14 +474,6 @@ ur_result_t urCommandBufferCommandGetInfoExp(
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
}

ur_result_t urKernelSuggestMaxCooperativeGroupCountExp(
ur_kernel_handle_t hKernel, ur_device_handle_t hDevice, uint32_t workDim,
const size_t *pLocalWorkSize, size_t dynamicSharedMemorySize,
uint32_t *pGroupCountRet) {
logger::error("{} function not implemented!", __FUNCTION__);
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
}

ur_result_t urUSMImportExp(ur_context_handle_t hContext, void *pMem,
size_t size) {
logger::error("{} function not implemented!", __FUNCTION__);
Expand Down
20 changes: 20 additions & 0 deletions source/adapters/level_zero/v2/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -649,4 +649,24 @@ ur_result_t urKernelGetSuggestedLocalWorkSize(
std::copy(localWorkSize, localWorkSize + workDim, pSuggestedLocalWorkSize);
return UR_RESULT_SUCCESS;
}

ur_result_t urKernelSuggestMaxCooperativeGroupCountExp(
ur_kernel_handle_t hKernel, ur_device_handle_t hDevice, uint32_t workDim,
const size_t *pLocalWorkSize, size_t dynamicSharedMemorySize,
uint32_t *pGroupCountRet) {
(void)dynamicSharedMemorySize;

uint32_t wg[3];
wg[0] = ur_cast<uint32_t>(pLocalWorkSize[0]);
wg[1] = workDim >= 2 ? ur_cast<uint32_t>(pLocalWorkSize[1]) : 1;
wg[2] = workDim == 3 ? ur_cast<uint32_t>(pLocalWorkSize[2]) : 1;
ZE2UR_CALL(zeKernelSetGroupSize,
(hKernel->getZeHandle(hDevice), wg[0], wg[1], wg[2]));

uint32_t totalGroupCount = 0;
ZE2UR_CALL(zeKernelSuggestMaxCooperativeGroupCount,
(hKernel->getZeHandle(hDevice), &totalGroupCount));
*pGroupCountRet = totalGroupCount;
return UR_RESULT_SUCCESS;
}
} // namespace ur::level_zero

0 comments on commit bfae55d

Please sign in to comment.