Skip to content

Commit

Permalink
{UR][L0] Return device version based on DeviceIpVersion
Browse files Browse the repository at this point in the history
When being queried a device version:
- CUDA adapter returns the compute capability version of the device,
- HIP adapter returns the architecture name.

Both of these are what define a GPU architecture to compile binaries for and can be used with GPU compilers, this is useful information for applications and developers.

On L0/Intel side, prior to this change, it returns the L0 API version.
This information is already returned in BACKEND_RUNTIME_VERSION and DRIVER_VERSION queries.

With this change, we align the adapters behavior with CUDA and HIP, and return the Intel device architecture version that can be used with ocloc compiler.
  • Loading branch information
ph0b authored Feb 29, 2024
1 parent e8fd35a commit d248cd5
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions source/adapters/level_zero/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,26 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
case UR_DEVICE_INFO_DRIVER_VERSION:
case UR_DEVICE_INFO_BACKEND_RUNTIME_VERSION:
return ReturnValue(Device->Platform->ZeDriverVersion.c_str());
case UR_DEVICE_INFO_VERSION:
return ReturnValue(Device->Platform->ZeDriverApiVersion.c_str());
case UR_DEVICE_INFO_VERSION: {
// from compute-runtime/shared/source/helpers/hw_ip_version.h
typedef struct {
union {
uint32_t value;
struct {
uint32_t revision : 6;
uint32_t reserved : 8;
uint32_t release : 8;
uint32_t architecture : 10;
} components;
};
} ipVersion_t;
ipVersion_t IpVersion;
IpVersion.value = Device->ZeDeviceIpVersionExt->ipVersion;
std::stringstream S;
S << IpVersion.components.architecture << "."
<< IpVersion.components.release << "." << IpVersion.components.revision;
return ReturnValue(S.str().c_str());
}
case UR_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES: {
auto Res = Device->Platform->populateDeviceCacheIfNeeded();
if (Res != UR_RESULT_SUCCESS) {
Expand Down

0 comments on commit d248cd5

Please sign in to comment.