Skip to content

Commit 155a86c

Browse files
authored
[UR][Offload] Handle MAX_WORK_GROUP_SIZE changes (#19695)
Offload changed the semantics of `OL_DEVICE_INFO_MAX_WORK_GROUP_SIZE`, so update UR to follow.
1 parent 542a00b commit 155a86c

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

unified-runtime/source/adapters/offload/device.cpp

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,21 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
8585
case UR_DEVICE_INFO_SUB_GROUP_SIZES_INTEL:
8686
// TODO: Implement subgroups in Offload
8787
return ReturnValue(1);
88+
case UR_DEVICE_INFO_MAX_WORK_GROUP_SIZE:
89+
if (pPropSizeRet) {
90+
*pPropSizeRet = sizeof(size_t);
91+
}
92+
93+
if (pPropValue) {
94+
uint32_t as32;
95+
OL_RETURN_ON_ERR(olGetDeviceInfo(hDevice->OffloadDevice,
96+
OL_DEVICE_INFO_MAX_WORK_GROUP_SIZE,
97+
sizeof(as32), &as32));
98+
99+
*reinterpret_cast<size_t *>(pPropValue) = as32;
100+
}
101+
102+
return UR_RESULT_SUCCESS;
88103
case UR_DEVICE_INFO_MAX_WORK_ITEM_SIZES: {
89104
// OL dimensions are uint32_t while UR is size_t, so they need to be mapped
90105
if (pPropSizeRet) {
@@ -94,9 +109,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
94109
if (pPropValue) {
95110
ol_dimensions_t olVec;
96111
size_t *urVec = reinterpret_cast<size_t *>(pPropValue);
97-
OL_RETURN_ON_ERR(olGetDeviceInfo(hDevice->OffloadDevice,
98-
OL_DEVICE_INFO_MAX_WORK_GROUP_SIZE,
99-
sizeof(olVec), &olVec));
112+
OL_RETURN_ON_ERR(
113+
olGetDeviceInfo(hDevice->OffloadDevice,
114+
OL_DEVICE_INFO_MAX_WORK_GROUP_SIZE_PER_DIMENSION,
115+
sizeof(olVec), &olVec));
100116

101117
urVec[0] = olVec.x;
102118
urVec[1] = olVec.y;

0 commit comments

Comments
 (0)