Skip to content

Commit 8577187

Browse files
authored
Merge pull request #1401 from ph0b/patch-1
[UR][L0] Return device version based on DeviceIpVersion
2 parents 42d72b6 + 00edaab commit 8577187

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

source/adapters/level_zero/device.cpp

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//===--------- device.cpp - Level Zero Adapter ----------------------------===//
22
//
3-
// Copyright (C) 2023 Intel Corporation
3+
// Copyright (C) 2023-2024 Intel Corporation
44
//
55
// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM
66
// Exceptions. See LICENSE.TXT
@@ -337,8 +337,27 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
337337
case UR_DEVICE_INFO_DRIVER_VERSION:
338338
case UR_DEVICE_INFO_BACKEND_RUNTIME_VERSION:
339339
return ReturnValue(Device->Platform->ZeDriverVersion.c_str());
340-
case UR_DEVICE_INFO_VERSION:
341-
return ReturnValue(Device->Platform->ZeDriverApiVersion.c_str());
340+
case UR_DEVICE_INFO_VERSION: {
341+
// from compute-runtime/shared/source/helpers/hw_ip_version.h
342+
typedef struct {
343+
uint32_t revision : 6;
344+
uint32_t reserved : 8;
345+
uint32_t release : 8;
346+
uint32_t architecture : 10;
347+
} version_components_t;
348+
typedef struct {
349+
union {
350+
uint32_t value;
351+
version_components_t components;
352+
};
353+
} ipVersion_t;
354+
ipVersion_t IpVersion;
355+
IpVersion.value = Device->ZeDeviceIpVersionExt->ipVersion;
356+
std::stringstream S;
357+
S << IpVersion.components.architecture << "."
358+
<< IpVersion.components.release << "." << IpVersion.components.revision;
359+
return ReturnValue(S.str().c_str());
360+
}
342361
case UR_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES: {
343362
auto Res = Device->Platform->populateDeviceCacheIfNeeded();
344363
if (Res != UR_RESULT_SUCCESS) {

0 commit comments

Comments
 (0)