Skip to content

Commit

Permalink
add check
Browse files Browse the repository at this point in the history
  • Loading branch information
yingcong-wu committed Mar 20, 2024
1 parent 0248d87 commit 9850c12
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions source/adapters/cuda/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelGetSuggestedLocalWorkSize(
ur_kernel_handle_t hKernel, ur_queue_handle_t hQueue, uint32_t workDim,
const size_t *pGlobalWorkOffset, const size_t *pGlobalWorkSize,
size_t *pSuggestedLocalWorkSize) {
// Preconditions
UR_ASSERT(hQueue->getContext() == hKernel->getContext(),
UR_RESULT_ERROR_INVALID_KERNEL);
UR_ASSERT(workDim > 0, UR_RESULT_ERROR_INVALID_WORK_DIMENSION);
UR_ASSERT(workDim < 4, UR_RESULT_ERROR_INVALID_WORK_DIMENSION);

std::ignore = pGlobalWorkOffset;
ur_context_handle_t Context = hQueue->getContext();
ur_device_handle_t Device = hQueue->Device;
Expand Down
5 changes: 5 additions & 0 deletions source/adapters/hip/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelGetSuggestedLocalWorkSize(
ur_kernel_handle_t hKernel, ur_queue_handle_t hQueue, uint32_t workDim,
const size_t *pGlobalWorkOffset, const size_t *pGlobalWorkSize,
size_t *pSuggestedLocalWorkSize) {
UR_ASSERT(hQueue->getContext() == hKernel->getContext(),
UR_RESULT_ERROR_INVALID_QUEUE);
UR_ASSERT(workDim > 0, UR_RESULT_ERROR_INVALID_WORK_DIMENSION);
UR_ASSERT(workDim < 4, UR_RESULT_ERROR_INVALID_WORK_DIMENSION);

std::ignore = pGlobalWorkOffset;
std::ignore = hKernel;
size_t MaxThreadsPerBlock[3];
Expand Down
3 changes: 3 additions & 0 deletions source/adapters/level_zero/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelGetSuggestedLocalWorkSize(
ur_kernel_handle_t hKernel, ur_queue_handle_t hQueue, uint32_t workDim,
const size_t *pGlobalWorkOffset, const size_t *pGlobalWorkSize,
size_t *pSuggestedLocalWorkSize) {
UR_ASSERT(workDim > 0, UR_RESULT_ERROR_INVALID_WORK_DIMENSION);
UR_ASSERT(workDim < 4, UR_RESULT_ERROR_INVALID_WORK_DIMENSION);

std::ignore = pGlobalWorkOffset;

uint32_t LocalWorkSize[3];
Expand Down

0 comments on commit 9850c12

Please sign in to comment.