Skip to content

Commit b4195c2

Browse files
committed
[L0] remove leftover, duplicated getSuggestedLocalWorkSize implementation
getSuggestedLocalWorkSize is implemented in kernel_helpers.cpp
1 parent 2dcccff commit b4195c2

File tree

2 files changed

+2
-84
lines changed

2 files changed

+2
-84
lines changed

source/adapters/level_zero/kernel.cpp

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelGetSuggestedLocalWorkSize(
3131
ze_kernel_handle_t ZeKernel{};
3232
UR_CALL(getZeKernel(Legacy(hQueue)->Device->ZeDevice, hKernel, &ZeKernel));
3333

34-
UR_CALL(getSuggestedLocalWorkSize(Legacy(hQueue), ZeKernel, GlobalWorkSize3D,
35-
LocalWorkSize));
34+
UR_CALL(getSuggestedLocalWorkSize(Legacy(hQueue)->Device, ZeKernel,
35+
GlobalWorkSize3D, LocalWorkSize));
3636

3737
std::copy(LocalWorkSize, LocalWorkSize + workDim, pSuggestedLocalWorkSize);
3838
return UR_RESULT_SUCCESS;
@@ -54,52 +54,6 @@ ur_result_t getZeKernel(ze_device_handle_t hDevice, ur_kernel_handle_t hKernel,
5454
return UR_RESULT_SUCCESS;
5555
}
5656

57-
ur_result_t getSuggestedLocalWorkSize(ur_queue_handle_legacy_t hQueue,
58-
ze_kernel_handle_t hZeKernel,
59-
size_t GlobalWorkSize3D[3],
60-
uint32_t SuggestedLocalWorkSize3D[3]) {
61-
uint32_t *WG = SuggestedLocalWorkSize3D;
62-
63-
// We can't call to zeKernelSuggestGroupSize if 64-bit GlobalWorkSize
64-
// values do not fit to 32-bit that the API only supports currently.
65-
bool SuggestGroupSize = true;
66-
for (int I : {0, 1, 2}) {
67-
if (GlobalWorkSize3D[I] > UINT32_MAX) {
68-
SuggestGroupSize = false;
69-
}
70-
}
71-
if (SuggestGroupSize) {
72-
ZE2UR_CALL(zeKernelSuggestGroupSize,
73-
(hZeKernel, GlobalWorkSize3D[0], GlobalWorkSize3D[1],
74-
GlobalWorkSize3D[2], &WG[0], &WG[1], &WG[2]));
75-
} else {
76-
for (int I : {0, 1, 2}) {
77-
// Try to find a I-dimension WG size that the GlobalWorkSize[I] is
78-
// fully divisable with. Start with the max possible size in
79-
// each dimension.
80-
uint32_t GroupSize[] = {
81-
hQueue->Device->ZeDeviceComputeProperties->maxGroupSizeX,
82-
hQueue->Device->ZeDeviceComputeProperties->maxGroupSizeY,
83-
hQueue->Device->ZeDeviceComputeProperties->maxGroupSizeZ};
84-
GroupSize[I] = (std::min)(size_t(GroupSize[I]), GlobalWorkSize3D[I]);
85-
while (GlobalWorkSize3D[I] % GroupSize[I]) {
86-
--GroupSize[I];
87-
}
88-
if (GlobalWorkSize3D[I] / GroupSize[I] > UINT32_MAX) {
89-
logger::error("getSuggestedLocalWorkSize: can't find a WG size "
90-
"suitable for global work size > UINT32_MAX");
91-
return UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE;
92-
}
93-
WG[I] = GroupSize[I];
94-
}
95-
logger::debug(
96-
"getSuggestedLocalWorkSize: using computed WG size = {{{}, {}, {}}}",
97-
WG[0], WG[1], WG[2]);
98-
}
99-
100-
return UR_RESULT_SUCCESS;
101-
}
102-
10357
ur_result_t ur_queue_handle_legacy_t_::enqueueKernelLaunch(
10458
ur_kernel_handle_t Kernel, ///< [in] handle of the kernel object
10559
uint32_t WorkDim, ///< [in] number of dimensions, from 1 to 3, to specify

source/adapters/level_zero/kernel.hpp

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -108,41 +108,5 @@ struct ur_kernel_handle_t_ : _ur_object {
108108
ZeCache<std::string> ZeKernelName;
109109
};
110110

111-
ur_result_t getSuggestedLocalWorkSize(ur_queue_handle_legacy_t hQueue,
112-
ze_kernel_handle_t hZeKernel,
113-
size_t GlobalWorkSize3D[3],
114-
uint32_t SuggestedLocalWorkSize3D[3]);
115111
ur_result_t getZeKernel(ze_device_handle_t hDevice, ur_kernel_handle_t hKernel,
116112
ze_kernel_handle_t *phZeKernel);
117-
118-
/**
119-
* Calculates a work group size for the kernel based on the GlobalWorkSize or
120-
* the LocalWorkSize if provided.
121-
* @param[in][optional] Kernel The Kernel. Used when LocalWorkSize is not
122-
* provided.
123-
* @param[in][optional] Device The device associated with the kernel. Used when
124-
* LocalWorkSize is not provided.
125-
* @param[out] ZeThreadGroupDimensions Number of work groups in each dimension.
126-
* @param[out] WG The work group size for each dimension.
127-
* @param[in] WorkDim The number of dimensions in the kernel.
128-
* @param[in] GlobalWorkSize The global work size.
129-
* @param[in][optional] LocalWorkSize The local work size.
130-
* @return UR_RESULT_SUCCESS or an error code on failure.
131-
*/
132-
ur_result_t calculateKernelWorkDimensions(
133-
ur_kernel_handle_t Kernel, ur_device_handle_t Device,
134-
ze_group_count_t &ZeThreadGroupDimensions, uint32_t (&WG)[3],
135-
uint32_t WorkDim, const size_t *GlobalWorkSize,
136-
const size_t *LocalWorkSize);
137-
138-
/**
139-
* Sets the global offset for a kernel command that will be appended to the
140-
* command buffer.
141-
* @param[in] Context Context associated with the queue.
142-
* @param[in] Kernel The handle to the kernel that will be appended.
143-
* @param[in] GlobalWorkOffset The global offset value.
144-
* @return UR_RESULT_SUCCESS or an error code on failure
145-
*/
146-
ur_result_t setKernelGlobalOffset(ur_context_handle_t Context,
147-
ur_kernel_handle_t Kernel,
148-
const size_t *GlobalWorkOffset);

0 commit comments

Comments
 (0)