mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 12:23:05 +08:00
feature: Define L0 Driver API for Driver Version String
Related-To: NEO-11752 - Adds zeIntelGetDriverVersionString to report the driver version string to the user in the format: Major.Minor.Patch+Optional Signed-off-by: Neil R. Spruit <neil.r.spruit@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
cf71353d84
commit
0daa0335cf
@@ -5,9 +5,16 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/string.h"
|
||||
|
||||
#include "level_zero/api/driver_experimental/public/zex_api.h"
|
||||
#include "level_zero/core/source/driver/driver.h"
|
||||
#include "level_zero/core/source/driver/driver_handle.h"
|
||||
#include "level_zero/include/ze_intel_gpu.h"
|
||||
|
||||
#include "driver_version.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace L0 {
|
||||
|
||||
@@ -36,6 +43,25 @@ zexDriverGetHostPointerBaseAddress(
|
||||
|
||||
} // namespace L0
|
||||
|
||||
ze_result_t ZE_APICALL
|
||||
zeIntelGetDriverVersionString(
|
||||
ze_driver_handle_t hDriver,
|
||||
char *pDriverVersion,
|
||||
size_t *pVersionSize) {
|
||||
ze_api_version_t apiVersion;
|
||||
L0::DriverHandle::fromHandle(hDriver)->getApiVersion(&apiVersion);
|
||||
std::string driverVersionString = std::to_string(ZE_MAJOR_VERSION(apiVersion)) + "." + std::to_string(ZE_MINOR_VERSION(apiVersion)) + "." + std::to_string(NEO_VERSION_BUILD);
|
||||
if (NEO_VERSION_HOTFIX > 0) {
|
||||
driverVersionString += "+" + std::to_string(NEO_VERSION_HOTFIX);
|
||||
}
|
||||
if (*pVersionSize == 0) {
|
||||
*pVersionSize = strlen(driverVersionString.c_str());
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
driverVersionString.copy(pDriverVersion, *pVersionSize, 0);
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL
|
||||
|
||||
Reference in New Issue
Block a user