Skip to content

Commit 193ed13

Browse files
committed
[SYCL][UR] Update Unified Runtime tag to support UR_DEVICE_INFO_IP_VERSION
This should have been an obvious update of Unified Runtime sources to support UR_DEVICE_INFO_IP_VERSION, required in #9843, but this update brought many API breaks mostly caused by this patch: oneapi-src/unified-runtime#536
1 parent a055665 commit 193ed13

File tree

3 files changed

+44
-32
lines changed

3 files changed

+44
-32
lines changed

sycl/plugins/unified_runtime/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ if (NOT DEFINED UNIFIED_RUNTIME_LIBRARY OR NOT DEFINED UNIFIED_RUNTIME_INCLUDE_D
44
include(FetchContent)
55

66
set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
7-
set(UNIFIED_RUNTIME_TAG 4a9e53b0d7b15d9b0239864d13999f32e6c73bac)
7+
set(UNIFIED_RUNTIME_TAG 9a9c05762ac672ecaf2c1bca815c54444a6ae457)
88

99
message(STATUS "Will fetch Unified Runtime from ${UNIFIED_RUNTIME_REPO}")
1010
FetchContent_Declare(unified-runtime

sycl/plugins/unified_runtime/pi2ur.hpp

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -285,35 +285,37 @@ inline pi_result ur2piDeviceInfoValue(ur_device_info_t ParamName,
285285
return Value.convertBitSet<ur_device_affinity_domain_flag_t,
286286
pi_device_affinity_domain>(ConvertFunc);
287287
} else if (ParamName == UR_DEVICE_INFO_PARTITION_TYPE) {
288-
auto ConvertFunc = [](ur_device_partition_property_t UrValue) {
288+
auto ConvertFunc = [](ur_device_partition_t UrValue) {
289289
switch (UrValue) {
290290
case UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN:
291291
return PI_DEVICE_PARTITION_BY_AFFINITY_DOMAIN;
292292
case UR_DEVICE_PARTITION_BY_CSLICE:
293293
return PI_EXT_INTEL_DEVICE_PARTITION_BY_CSLICE;
294-
case (ur_device_partition_property_t)
294+
case (ur_device_partition_t)
295295
UR_DEVICE_AFFINITY_DOMAIN_FLAG_NEXT_PARTITIONABLE:
296296
return (pi_device_partition_property)
297297
PI_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE;
298298
default:
299299
die("UR_DEVICE_INFO_PARTITION_TYPE: unhandled value");
300300
}
301301
};
302-
return Value.convertArray<ur_device_partition_property_t,
303-
pi_device_partition_property>(ConvertFunc);
304-
} else if (ParamName == UR_DEVICE_INFO_PARTITION_PROPERTIES) {
305-
auto ConvertFunc = [](ur_device_partition_property_t UrValue) {
302+
return Value
303+
.convertArray<ur_device_partition_t, pi_device_partition_property>(
304+
ConvertFunc);
305+
} else if (ParamName == UR_DEVICE_INFO_SUPPORTED_PARTITIONS) {
306+
auto ConvertFunc = [](ur_device_partition_t UrValue) {
306307
switch (UrValue) {
307308
case UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN:
308309
return PI_DEVICE_PARTITION_BY_AFFINITY_DOMAIN;
309310
case UR_DEVICE_PARTITION_BY_CSLICE:
310311
return PI_EXT_INTEL_DEVICE_PARTITION_BY_CSLICE;
311312
default:
312-
die("UR_DEVICE_INFO_PARTITION_PROPERTIES: unhandled value");
313+
die("UR_DEVICE_INFO_SUPPORTED_PARTITIONS: unhandled value");
313314
}
314315
};
315-
return Value.convertArray<ur_device_partition_property_t,
316-
pi_device_partition_property>(ConvertFunc);
316+
return Value
317+
.convertArray<ur_device_partition_t, pi_device_partition_property>(
318+
ConvertFunc);
317319
} else if (ParamName == UR_DEVICE_INFO_LOCAL_MEM_TYPE) {
318320
auto ConvertFunc = [](ur_device_local_mem_type_t UrValue) {
319321
switch (UrValue) {
@@ -777,7 +779,7 @@ inline pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName,
777779
InfoType = UR_DEVICE_INFO_REFERENCE_COUNT;
778780
break;
779781
case PI_DEVICE_INFO_PARTITION_PROPERTIES:
780-
InfoType = UR_DEVICE_INFO_PARTITION_PROPERTIES;
782+
InfoType = UR_DEVICE_INFO_SUPPORTED_PARTITIONS;
781783
break;
782784
case PI_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN:
783785
InfoType = UR_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN;
@@ -1080,7 +1082,7 @@ inline pi_result piDevicePartition(
10801082
if (!Properties || !Properties[0])
10811083
return PI_ERROR_INVALID_VALUE;
10821084

1083-
ur_device_partition_property_t Property;
1085+
ur_device_partition_t Property;
10841086
switch (Properties[0]) {
10851087
case PI_DEVICE_PARTITION_EQUALLY:
10861088
Property = UR_DEVICE_PARTITION_EQUALLY;
@@ -1120,12 +1122,20 @@ inline pi_result piDevicePartition(
11201122
// TODO: correctly terminate the UR properties, see:
11211123
// https://github.com/oneapi-src/unified-runtime/issues/183
11221124
//
1123-
ur_device_partition_property_t UrProperties[] = {
1124-
ur_device_partition_property_t(Property), Value, 0};
1125+
ur_device_partition_property_t UrProperty;
1126+
UrProperty.type = Property;
1127+
UrProperty.value.equally = Value;
1128+
1129+
ur_device_partition_properties_t UrProperties{
1130+
UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES,
1131+
nullptr,
1132+
&UrProperty,
1133+
1,
1134+
};
11251135

11261136
auto UrDevice = reinterpret_cast<ur_device_handle_t>(Device);
11271137
auto UrSubDevices = reinterpret_cast<ur_device_handle_t *>(SubDevices);
1128-
HANDLE_ERRORS(urDevicePartition(UrDevice, UrProperties, NumEntries,
1138+
HANDLE_ERRORS(urDevicePartition(UrDevice, &UrProperties, NumEntries,
11291139
UrSubDevices, NumSubDevices));
11301140
return PI_SUCCESS;
11311141
}

sycl/plugins/unified_runtime/ur/adapters/level_zero/ur_level_zero_device.cpp

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
281281
}
282282
case UR_DEVICE_INFO_REFERENCE_COUNT:
283283
return ReturnValue(uint32_t{Device->RefCount.load()});
284-
case UR_DEVICE_INFO_PARTITION_PROPERTIES: {
284+
case UR_DEVICE_INFO_SUPPORTED_PARTITIONS: {
285285
// SYCL spec says: if this SYCL device cannot be partitioned into at least
286286
// two sub devices then the returned vector must be empty.
287287
auto Res = Device->Platform->populateDeviceCacheIfNeeded();
@@ -291,15 +291,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
291291

292292
uint32_t ZeSubDeviceCount = Device->SubDevices.size();
293293
if (ZeSubDeviceCount < 2) {
294-
return ReturnValue((ur_device_partition_property_t)0);
294+
return ReturnValue((ur_device_partition_t)0);
295295
}
296296
bool PartitionedByCSlice = Device->SubDevices[0]->isCCS();
297297

298298
auto ReturnHelper = [&](auto... Partitions) {
299299
struct {
300300
ur_device_partition_property_t Arr[sizeof...(Partitions) + 1];
301301
} PartitionProperties = {
302-
{Partitions..., ur_device_partition_property_t(0)}};
302+
{Partitions..., ur_device_partition_t(0)}};
303303
return ReturnValue(PartitionProperties);
304304
};
305305

@@ -324,23 +324,23 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
324324
case UR_DEVICE_INFO_PARTITION_TYPE: {
325325
// For root-device there is no partitioning to report.
326326
if (!Device->isSubDevice())
327-
return ReturnValue(ur_device_partition_property_t(0));
327+
return ReturnValue(ur_device_partition_t(0));
328328

329329
if (Device->isCCS()) {
330330
struct {
331331
ur_device_partition_property_t Arr[2];
332332
} PartitionProperties = {
333-
{UR_DEVICE_PARTITION_BY_CSLICE, ur_device_partition_property_t(0)}};
333+
{UR_DEVICE_PARTITION_BY_CSLICE, ur_device_partition_t(0)}};
334334
return ReturnValue(PartitionProperties);
335335
}
336336

337337
struct {
338338
ur_device_partition_property_t Arr[3];
339339
} PartitionProperties = {
340340
{UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN,
341-
(ur_device_partition_property_t)
341+
(ur_device_partition_t)
342342
UR_DEVICE_AFFINITY_DOMAIN_FLAG_NEXT_PARTITIONABLE,
343-
ur_device_partition_property_t(0)}};
343+
ur_device_partition_t(0)}};
344344
return ReturnValue(PartitionProperties);
345345
}
346346

@@ -1088,9 +1088,8 @@ void ZeUSMImportExtension::doZeUSMRelease(ze_driver_handle_t DriverHandle,
10881088

10891089
UR_APIEXPORT ur_result_t UR_APICALL urDevicePartition(
10901090
ur_device_handle_t Device, ///< [in] handle of the device to partition.
1091-
const ur_device_partition_property_t
1092-
*Properties, ///< [in] null-terminated array of <$_device_partition_t
1093-
///< enum, value> pairs.
1091+
const ur_device_partition_properties_t
1092+
*Properties, ///< [in] Device partition properties.
10941093
uint32_t NumDevices, ///< [in] the number of sub-devices.
10951094
ur_device_handle_t
10961095
*OutDevices, ///< [out][optional][range(0, NumDevices)] array of handle
@@ -1102,13 +1101,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urDevicePartition(
11021101
///< according to the partitioning property.
11031102
) {
11041103
// Other partitioning ways are not supported by Level Zero
1105-
if (Properties[0] == UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN) {
1106-
if ((Properties[1] != UR_DEVICE_AFFINITY_DOMAIN_FLAG_NEXT_PARTITIONABLE &&
1107-
Properties[1] != UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA)) {
1104+
if (Properties->pProperties->type == UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN) {
1105+
if ((Properties->pProperties->value.affinity_domain !=
1106+
UR_DEVICE_AFFINITY_DOMAIN_FLAG_NEXT_PARTITIONABLE &&
1107+
Properties->pProperties->value.affinity_domain !=
1108+
UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA)) {
11081109
return UR_RESULT_ERROR_INVALID_VALUE;
11091110
}
1110-
} else if (Properties[0] == UR_DEVICE_PARTITION_BY_CSLICE) {
1111-
if (Properties[1] != 0) {
1111+
} else if (Properties->pProperties->type == UR_DEVICE_PARTITION_BY_CSLICE) {
1112+
if (Properties->pProperties->value.affinity_domain != 0) {
11121113
return UR_RESULT_ERROR_INVALID_VALUE;
11131114
}
11141115
} else {
@@ -1132,13 +1133,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urDevicePartition(
11321133
// UR_L0_EXPOSE_CSLICE_IN_AFFINITY_PARTITIONING overrides that
11331134
// still expose CSlices in partitioning by affinity domain for compatibility
11341135
// reasons.
1135-
if (Properties[0] == UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN &&
1136+
if (Properties->pProperties->type ==
1137+
UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN &&
11361138
!ExposeCSliceInAffinityPartitioning) {
11371139
if (Device->isSubDevice()) {
11381140
return 0;
11391141
}
11401142
}
1141-
if (Properties[0] == UR_DEVICE_PARTITION_BY_CSLICE) {
1143+
if (Properties->pProperties->type == UR_DEVICE_PARTITION_BY_CSLICE) {
11421144
// Not a CSlice-based partitioning.
11431145
if (!Device->SubDevices[0]->isCCS()) {
11441146
return 0;

0 commit comments

Comments
 (0)