aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Olsson <mikael.olsson@arm.com>2023-06-12 15:58:10 +0200
committerMikael Olsson <mikael.olsson@arm.com>2023-08-09 15:11:11 +0200
commite9c3f076d1e99c11729627723d008b6686946995 (patch)
tree846b8a9f9e5a92d8322e93784ee71bca2bc0ebd4
parent308e7f1352bfdab8cc90be78a82b7ce4195301bc (diff)
downloadethos-u-linux-driver-stack-e9c3f076d1e99c11729627723d008b6686946995.tar.gz
Add version to driver library23.08-rc1
A version has been added to the driver library so users can check if they are compatible with the driver library in use. The Python wrapper has been updated accordingly to make the version information available. Change-Id: I8affbf7068c057f7103adf14c9e4a331d547fbcc Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
-rw-r--r--driver_library/include/ethosu.hpp6
-rw-r--r--driver_library/python/src/ethosu_driver/__init__.py5
-rw-r--r--driver_library/python/src/ethosu_driver/swig/driver.i13
-rw-r--r--driver_library/python/test/test_driver.py7
-rw-r--r--driver_library/src/ethosu.cpp5
-rw-r--r--utils/inference_runner/inference_runner.cpp4
6 files changed, 38 insertions, 2 deletions
diff --git a/driver_library/include/ethosu.hpp b/driver_library/include/ethosu.hpp
index 4dba469..491dc28 100644
--- a/driver_library/include/ethosu.hpp
+++ b/driver_library/include/ethosu.hpp
@@ -40,6 +40,10 @@
namespace EthosU {
+constexpr uint32_t DRIVER_LIBRARY_VERSION_MAJOR = 1;
+constexpr uint32_t DRIVER_LIBRARY_VERSION_MINOR = 0;
+constexpr uint32_t DRIVER_LIBRARY_VERSION_PATCH = 0;
+
constexpr uint32_t MAX_SUPPORTED_KERNEL_DRIVER_MAJOR_VERSION = 1;
constexpr uint32_t MIN_SUPPORTED_KERNEL_DRIVER_MAJOR_VERSION = 1;
@@ -75,6 +79,8 @@ public:
std::ostream &operator<<(std::ostream &out, const SemanticVersion &v);
+const SemanticVersion getLibraryVersion();
+
/*
* Hardware Identifier
* @versionStatus: Version status
diff --git a/driver_library/python/src/ethosu_driver/__init__.py b/driver_library/python/src/ethosu_driver/__init__.py
index a804c13..20c5f52 100644
--- a/driver_library/python/src/ethosu_driver/__init__.py
+++ b/driver_library/python/src/ethosu_driver/__init__.py
@@ -2,6 +2,9 @@
# SPDX-License-Identifier: Apache-2.0
from ._generated.driver import Device, Inference, Network, Buffer, \
- MAX_SUPPORTED_KERNEL_DRIVER_MAJOR_VERSION, MIN_SUPPORTED_KERNEL_DRIVER_MAJOR_VERSION
+ MAX_SUPPORTED_KERNEL_DRIVER_MAJOR_VERSION, MIN_SUPPORTED_KERNEL_DRIVER_MAJOR_VERSION, \
+ DRIVER_LIBRARY_VERSION_MAJOR, DRIVER_LIBRARY_VERSION_MINOR, DRIVER_LIBRARY_VERSION_PATCH, \
+ getLibraryVersion
+
from ._utilities import open_device, load_model, populate_buffers, \
allocate_buffers, get_results, InferenceRunner
diff --git a/driver_library/python/src/ethosu_driver/swig/driver.i b/driver_library/python/src/ethosu_driver/swig/driver.i
index 558c22e..1ff8ded 100644
--- a/driver_library/python/src/ethosu_driver/swig/driver.i
+++ b/driver_library/python/src/ethosu_driver/swig/driver.i
@@ -38,6 +38,10 @@ namespace std {
namespace EthosU
{
+constexpr uint32_t DRIVER_LIBRARY_VERSION_MAJOR;
+constexpr uint32_t DRIVER_LIBRARY_VERSION_MINOR;
+constexpr uint32_t DRIVER_LIBRARY_VERSION_PATCH;
+
constexpr uint32_t MAX_SUPPORTED_KERNEL_DRIVER_MAJOR_VERSION;
constexpr uint32_t MIN_SUPPORTED_KERNEL_DRIVER_MAJOR_VERSION;
@@ -65,6 +69,15 @@ public:
%feature("docstring",
"
+ Return driver library version information.
+
+ Returns:
+ SemanticVersion: driver library version.
+") getLibraryVersion;
+const SemanticVersion getLibraryVersion();
+
+%feature("docstring",
+"
Hardware Identifier which consists of version status, version revision, product revision and architecture revision.
") HardwareId;
class HardwareId {
diff --git a/driver_library/python/test/test_driver.py b/driver_library/python/test/test_driver.py
index e4e276a..28d0a29 100644
--- a/driver_library/python/test/test_driver.py
+++ b/driver_library/python/test/test_driver.py
@@ -188,3 +188,10 @@ def test_kernel_driver_version(device):
assert driver.MAX_SUPPORTED_KERNEL_DRIVER_MAJOR_VERSION
assert driver.MIN_SUPPORTED_KERNEL_DRIVER_MAJOR_VERSION
+def test_driver_library_version():
+ version = driver.getLibraryVersion()
+ expected_version = [driver.DRIVER_LIBRARY_VERSION_MAJOR,
+ driver.DRIVER_LIBRARY_VERSION_MINOR,
+ driver.DRIVER_LIBRARY_VERSION_PATCH]
+ # Validate that the expected version was returned
+ assert expected_version == [version.major, version.minor, version.patch]
diff --git a/driver_library/src/ethosu.cpp b/driver_library/src/ethosu.cpp
index 1758b07..64aee4d 100644
--- a/driver_library/src/ethosu.cpp
+++ b/driver_library/src/ethosu.cpp
@@ -96,6 +96,11 @@ const Severity Log::level = Log::getLogLevel();
} // namespace
namespace EthosU {
+
+const SemanticVersion getLibraryVersion() {
+ return {DRIVER_LIBRARY_VERSION_MAJOR, DRIVER_LIBRARY_VERSION_MINOR, DRIVER_LIBRARY_VERSION_PATCH};
+}
+
__attribute__((weak)) int eioctl(int fd, unsigned long cmd, void *data = nullptr) {
int ret = ::ioctl(fd, cmd, data);
if (ret < 0) {
diff --git a/utils/inference_runner/inference_runner.cpp b/utils/inference_runner/inference_runner.cpp
index d53ab8c..569fda6 100644
--- a/utils/inference_runner/inference_runner.cpp
+++ b/utils/inference_runner/inference_runner.cpp
@@ -210,8 +210,10 @@ int main(int argc, char *argv[]) {
}
try {
+ cout << "Driver library version:" << getLibraryVersion() << endl;
+
Device device;
- cout << "Driver version:" << device.getDriverVersion() << endl;
+ cout << "Kernel driver version:" << device.getDriverVersion() << endl;
cout << "Send Ping" << endl;
device.ioctl(ETHOSU_IOCTL_PING);