Skip to content

Commit 1a10dab

Browse files
committed
Update SuggestMaxCooperativeGroupCountExp
Signed-off-by: Michael Aziz <michael.aziz@intel.com>
1 parent fa8cc8e commit 1a10dab

File tree

11 files changed

+87
-34
lines changed

11 files changed

+87
-34
lines changed

include/ur_api.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9435,13 +9435,17 @@ urEnqueueCooperativeKernelLaunchExp(
94359435
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
94369436
/// + `NULL == hKernel`
94379437
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
9438+
/// + `NULL == pLocalWorkSize`
94389439
/// + `NULL == pGroupCountRet`
94399440
/// - ::UR_RESULT_ERROR_INVALID_KERNEL
94409441
UR_APIEXPORT ur_result_t UR_APICALL
94419442
urKernelSuggestMaxCooperativeGroupCountExp(
94429443
ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object
9443-
size_t localWorkSize, ///< [in] number of local work-items that will form a work-group when the
9444-
///< kernel is launched
9444+
uint32_t workDim, ///< [in] number of dimensions, from 1 to 3, to specify the work-group
9445+
///< work-items
9446+
const size_t *pLocalWorkSize, ///< [in] pointer to an array of workDim unsigned values that specify the
9447+
///< number of local work-items forming a work-group that will execute the
9448+
///< kernel function.
94459449
size_t dynamicSharedMemorySize, ///< [in] size of dynamic shared memory, for each work-group, in bytes,
94469450
///< that will be used when the kernel is launched
94479451
uint32_t *pGroupCountRet ///< [out] pointer to maximum number of groups
@@ -10687,7 +10691,8 @@ typedef struct ur_kernel_set_specialization_constants_params_t {
1068710691
/// allowing the callback the ability to modify the parameter's value
1068810692
typedef struct ur_kernel_suggest_max_cooperative_group_count_exp_params_t {
1068910693
ur_kernel_handle_t *phKernel;
10690-
size_t *plocalWorkSize;
10694+
uint32_t *pworkDim;
10695+
const size_t **ppLocalWorkSize;
1069110696
size_t *pdynamicSharedMemorySize;
1069210697
uint32_t **ppGroupCountRet;
1069310698
} ur_kernel_suggest_max_cooperative_group_count_exp_params_t;

include/ur_ddi.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,8 @@ typedef ur_result_t(UR_APICALL *ur_pfnGetKernelProcAddrTable_t)(
651651
/// @brief Function-pointer for urKernelSuggestMaxCooperativeGroupCountExp
652652
typedef ur_result_t(UR_APICALL *ur_pfnKernelSuggestMaxCooperativeGroupCountExp_t)(
653653
ur_kernel_handle_t,
654-
size_t,
654+
uint32_t,
655+
const size_t *,
655656
size_t,
656657
uint32_t *);
657658

include/ur_print.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12215,9 +12215,15 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct
1221512215
*(params->phKernel));
1221612216

1221712217
os << ", ";
12218-
os << ".localWorkSize = ";
12218+
os << ".workDim = ";
12219+
12220+
os << *(params->pworkDim);
12221+
12222+
os << ", ";
12223+
os << ".pLocalWorkSize = ";
1221912224

12220-
os << *(params->plocalWorkSize);
12225+
ur::details::printPtr(os,
12226+
*(params->ppLocalWorkSize));
1222112227

1222212228
os << ", ";
1222312229
os << ".dynamicSharedMemorySize = ";

scripts/core/exp-cooperative-kernels.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,13 @@ params:
7878
- type: $x_kernel_handle_t
7979
name: hKernel
8080
desc: "[in] handle of the kernel object"
81-
- type: size_t
82-
name: localWorkSize
83-
desc: "[in] number of local work-items that will form a work-group when the kernel is launched"
81+
- type: uint32_t
82+
name: workDim
83+
desc: "[in] number of dimensions, from 1 to 3, to specify the work-group work-items"
84+
- type: "const size_t*"
85+
name: pLocalWorkSize
86+
desc: |
87+
[in] pointer to an array of workDim unsigned values that specify the number of local work-items forming a work-group that will execute the kernel function.
8488
- type: size_t
8589
name: dynamicSharedMemorySize
8690
desc: "[in] size of dynamic shared memory, for each work-group, in bytes, that will be used when the kernel is launched"

source/adapters/mock/ur_mockddi.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10003,9 +10003,13 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp(
1000310003
/// @brief Intercept function for urKernelSuggestMaxCooperativeGroupCountExp
1000410004
__urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
1000510005
ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object
10006-
size_t
10007-
localWorkSize, ///< [in] number of local work-items that will form a work-group when the
10008-
///< kernel is launched
10006+
uint32_t
10007+
workDim, ///< [in] number of dimensions, from 1 to 3, to specify the work-group
10008+
///< work-items
10009+
const size_t *
10010+
pLocalWorkSize, ///< [in] pointer to an array of workDim unsigned values that specify the
10011+
///< number of local work-items forming a work-group that will execute the
10012+
///< kernel function.
1000910013
size_t
1001010014
dynamicSharedMemorySize, ///< [in] size of dynamic shared memory, for each work-group, in bytes,
1001110015
///< that will be used when the kernel is launched
@@ -10014,7 +10018,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
1001410018
ur_result_t result = UR_RESULT_SUCCESS;
1001510019

1001610020
ur_kernel_suggest_max_cooperative_group_count_exp_params_t params = {
10017-
&hKernel, &localWorkSize, &dynamicSharedMemorySize, &pGroupCountRet};
10021+
&hKernel, &workDim, &pLocalWorkSize, &dynamicSharedMemorySize,
10022+
&pGroupCountRet};
1001810023

1001910024
auto beforeCallback = reinterpret_cast<ur_mock_callback_t>(
1002010025
mock::getCallbacks().get_before_callback(

source/adapters/opencl/kernel.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelGetNativeHandle(
361361

362362
UR_APIEXPORT ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
363363
[[maybe_unused]] ur_kernel_handle_t hKernel,
364-
[[maybe_unused]] size_t localWorkSize,
364+
[[maybe_unused]] uint32_t workDim,
365+
[[maybe_unused]] const size_t *pLocalWorkSize,
365366
[[maybe_unused]] size_t dynamicSharedMemorySize,
366367
[[maybe_unused]] uint32_t *pGroupCountRet) {
367368
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;

source/loader/layers/tracing/ur_trcddi.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8585,9 +8585,13 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp(
85858585
/// @brief Intercept function for urKernelSuggestMaxCooperativeGroupCountExp
85868586
__urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
85878587
ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object
8588-
size_t
8589-
localWorkSize, ///< [in] number of local work-items that will form a work-group when the
8590-
///< kernel is launched
8588+
uint32_t
8589+
workDim, ///< [in] number of dimensions, from 1 to 3, to specify the work-group
8590+
///< work-items
8591+
const size_t *
8592+
pLocalWorkSize, ///< [in] pointer to an array of workDim unsigned values that specify the
8593+
///< number of local work-items forming a work-group that will execute the
8594+
///< kernel function.
85918595
size_t
85928596
dynamicSharedMemorySize, ///< [in] size of dynamic shared memory, for each work-group, in bytes,
85938597
///< that will be used when the kernel is launched
@@ -8602,7 +8606,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
86028606
}
86038607

86048608
ur_kernel_suggest_max_cooperative_group_count_exp_params_t params = {
8605-
&hKernel, &localWorkSize, &dynamicSharedMemorySize, &pGroupCountRet};
8609+
&hKernel, &workDim, &pLocalWorkSize, &dynamicSharedMemorySize,
8610+
&pGroupCountRet};
86068611
uint64_t instance = getContext()->notify_begin(
86078612
UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP,
86088613
"urKernelSuggestMaxCooperativeGroupCountExp", &params);
@@ -8611,7 +8616,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
86118616
logger.info(" ---> urKernelSuggestMaxCooperativeGroupCountExp\n");
86128617

86138618
ur_result_t result = pfnSuggestMaxCooperativeGroupCountExp(
8614-
hKernel, localWorkSize, dynamicSharedMemorySize, pGroupCountRet);
8619+
hKernel, workDim, pLocalWorkSize, dynamicSharedMemorySize,
8620+
pGroupCountRet);
86158621

86168622
getContext()->notify_end(
86178623
UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP,

source/loader/layers/validation/ur_valddi.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9609,9 +9609,13 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp(
96099609
/// @brief Intercept function for urKernelSuggestMaxCooperativeGroupCountExp
96109610
__urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
96119611
ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object
9612-
size_t
9613-
localWorkSize, ///< [in] number of local work-items that will form a work-group when the
9614-
///< kernel is launched
9612+
uint32_t
9613+
workDim, ///< [in] number of dimensions, from 1 to 3, to specify the work-group
9614+
///< work-items
9615+
const size_t *
9616+
pLocalWorkSize, ///< [in] pointer to an array of workDim unsigned values that specify the
9617+
///< number of local work-items forming a work-group that will execute the
9618+
///< kernel function.
96159619
size_t
96169620
dynamicSharedMemorySize, ///< [in] size of dynamic shared memory, for each work-group, in bytes,
96179621
///< that will be used when the kernel is launched
@@ -9630,6 +9634,10 @@ __urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
96309634
return UR_RESULT_ERROR_INVALID_NULL_HANDLE;
96319635
}
96329636

9637+
if (NULL == pLocalWorkSize) {
9638+
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
9639+
}
9640+
96339641
if (NULL == pGroupCountRet) {
96349642
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
96359643
}
@@ -9641,7 +9649,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
96419649
}
96429650

96439651
ur_result_t result = pfnSuggestMaxCooperativeGroupCountExp(
9644-
hKernel, localWorkSize, dynamicSharedMemorySize, pGroupCountRet);
9652+
hKernel, workDim, pLocalWorkSize, dynamicSharedMemorySize,
9653+
pGroupCountRet);
96459654

96469655
return result;
96479656
}

source/loader/ur_ldrddi.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8760,9 +8760,13 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp(
87608760
/// @brief Intercept function for urKernelSuggestMaxCooperativeGroupCountExp
87618761
__urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
87628762
ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object
8763-
size_t
8764-
localWorkSize, ///< [in] number of local work-items that will form a work-group when the
8765-
///< kernel is launched
8763+
uint32_t
8764+
workDim, ///< [in] number of dimensions, from 1 to 3, to specify the work-group
8765+
///< work-items
8766+
const size_t *
8767+
pLocalWorkSize, ///< [in] pointer to an array of workDim unsigned values that specify the
8768+
///< number of local work-items forming a work-group that will execute the
8769+
///< kernel function.
87668770
size_t
87678771
dynamicSharedMemorySize, ///< [in] size of dynamic shared memory, for each work-group, in bytes,
87688772
///< that will be used when the kernel is launched
@@ -8785,7 +8789,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
87858789

87868790
// forward to device-platform
87878791
result = pfnSuggestMaxCooperativeGroupCountExp(
8788-
hKernel, localWorkSize, dynamicSharedMemorySize, pGroupCountRet);
8792+
hKernel, workDim, pLocalWorkSize, dynamicSharedMemorySize,
8793+
pGroupCountRet);
87898794

87908795
return result;
87918796
}

source/loader/ur_libapi.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8884,13 +8884,18 @@ ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp(
88848884
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
88858885
/// + `NULL == hKernel`
88868886
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
8887+
/// + `NULL == pLocalWorkSize`
88878888
/// + `NULL == pGroupCountRet`
88888889
/// - ::UR_RESULT_ERROR_INVALID_KERNEL
88898890
ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
88908891
ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object
8891-
size_t
8892-
localWorkSize, ///< [in] number of local work-items that will form a work-group when the
8893-
///< kernel is launched
8892+
uint32_t
8893+
workDim, ///< [in] number of dimensions, from 1 to 3, to specify the work-group
8894+
///< work-items
8895+
const size_t *
8896+
pLocalWorkSize, ///< [in] pointer to an array of workDim unsigned values that specify the
8897+
///< number of local work-items forming a work-group that will execute the
8898+
///< kernel function.
88948899
size_t
88958900
dynamicSharedMemorySize, ///< [in] size of dynamic shared memory, for each work-group, in bytes,
88968901
///< that will be used when the kernel is launched
@@ -8904,7 +8909,8 @@ ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
89048909
}
89058910

89068911
return pfnSuggestMaxCooperativeGroupCountExp(
8907-
hKernel, localWorkSize, dynamicSharedMemorySize, pGroupCountRet);
8912+
hKernel, workDim, pLocalWorkSize, dynamicSharedMemorySize,
8913+
pGroupCountRet);
89088914
} catch (...) {
89098915
return exceptionToResult(std::current_exception());
89108916
}

0 commit comments

Comments
 (0)