oneapi-src / level-zero

oneAPI Level Zero Specification Headers and Loader
https://spec.oneapi.com/versions/latest/elements/l0/source/index.html
MIT License
208 stars 90 forks source link

LevelZero Driver-API Versions #70

Open jjfumero opened 2 years ago

jjfumero commented 2 years ago

When running this code (as provided in the zello_world.cpp example:

ze_api_version_t version = {};
zeDriverGetApiVersion(pDriver, &version);
std::cout << "API version: " << to_string(version) << "\n";

it prints the following API version:

API version: 1.1

I am using the latest commit from Level-Zero d84a5a2 and the compute-runtime 21.38.21026. I wonder if the version of the API used should match the one described in the documentation, which should be 1.3.0.

Does the API version number match the API Level-Zero version? In that case, shouldn't it be 1.3.0 instead? If this is the case, there is no link to version 1.1 here.

jandres742 commented 2 years ago

@jjfumero the api version returned is the one supported by the driver. The driver currently supports 1.2. We were returning still 1.1 but we fixed it here, https://github.com/intel/compute-runtime/commit/c58e8eeddd1c1ee1d6cc7b593e9f0e9b7b14c9c7, and now we are correctly returning 1.2, since that's what the L0 GPU driver currently returns. Once we release support for 1.3, we will bump up the version.

jjfumero commented 2 years ago

Thank you @jandres742 for the clarification. So it should be the API 1.1 version in the spec documentation, is this correct?

There isn't 1.1 here: https://spec.oneapi.io/level-zero/latest/versions.html

Previous Releases
1.2.43 Level Zero Spec (Oct 2021)
1.2.13 Level Zero Spec (Apr 2021)
1.2.2 Level Zero Spec (Feb 2021)
1.0.4 Level Zero Spec (Oct 2020)
0.95 Level Zero Spec (Jun 2020)
0.91 Level Zero Spec (Mar 2020)

Also, does it make sense to add a minor revision in the LevelZero zeDriverGetApiVersion? to make it aligned with the definition from the spec?

jandres742 commented 2 years ago

@jjfumero it is there, but the name is misspelled, if you click on 1.2.2 Level Zero Spec (Feb 2021) you see that it takes you to: https://spec.oneapi.io/level-zero/1.1.2/index.html we will fix that

jjfumero commented 2 years ago

Got it, thank you!

bmyates commented 2 years ago

Hey @jjfumero Is there still an open question about spec versioning here, or can this be closed?

jjfumero commented 2 years ago

From my side, this is clear now. However, in the spec I still see 1.2.2 link opens the SPEC version 1.1.2.

abagusetty commented 11 months ago

I was trying to use the following snippet to get the API versioning and it seems to be wrong, though I was using L0 v1.13.1 based on L0-spec v1.7.0

Driver version: 1.3.26918
value of string_version: 1.3
      ze_driver_properties_t properties;
      status = zeDriverGetProperties(drivers[j], &properties);
      uint32_t DriverVersion = properties.driverVersion;
      auto VersionMajor = std::to_string((DriverVersion & 0xFF000000) >> 24);
      auto VersionMinor = std::to_string((DriverVersion & 0x00FF0000) >> 16);
      auto VersionBuild = std::to_string(DriverVersion & 0x0000FFFF);
      auto ZeDriverVersion = VersionMajor + "." + VersionMinor + "." + VersionBuild;
      std::cout << "Driver version: " << ZeDriverVersion << std::endl;

      ze_api_version_t ze_drv_api_version = {};
      status = zeDriverGetApiVersion(drivers[j], &ze_drv_api_version); 
      const std::string string_version =
        std::to_string(ZE_MAJOR_VERSION(ze_drv_api_version)) + "." +
        std::to_string(ZE_MINOR_VERSION(ze_drv_api_version));
      std::cout << "value of string_version: " << string_version << std::endl;

Installed compute-runtime: 23.30.26918.9 & the level-zero loader: 1.13.1