From c081e5954cd92165b139488e76bdfef1402acee6 Mon Sep 17 00:00:00 2001 From: Mikael Olsson Date: Mon, 30 Oct 2023 11:10:56 +0100 Subject: Change create network UAPI to take a user buffer To not allow the buffer for a network instance to be changed after creation, the create network UAPI will now take the network model data as a user buffer. The content of the user buffer is copied into an internally allocated DMA buffer that cannot be accessed by the user. This breaks the current API so the Linux kernel NPU driver version and the driver library version have been given major version bumps. All the tests, documentation and other applications affected by the changes have been updated accordingly. Change-Id: I25c785d75a24794c3db632e4abe5cfbb1c7ac190 Signed-off-by: Mikael Olsson --- driver_library/include/ethosu.hpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'driver_library/include/ethosu.hpp') diff --git a/driver_library/include/ethosu.hpp b/driver_library/include/ethosu.hpp index 47c1868..eaa1ce7 100644 --- a/driver_library/include/ethosu.hpp +++ b/driver_library/include/ethosu.hpp @@ -39,12 +39,12 @@ namespace EthosU { -constexpr uint32_t DRIVER_LIBRARY_VERSION_MAJOR = 2; +constexpr uint32_t DRIVER_LIBRARY_VERSION_MAJOR = 3; 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 = 2; -constexpr uint32_t MIN_SUPPORTED_KERNEL_DRIVER_MAJOR_VERSION = 2; +constexpr uint32_t MAX_SUPPORTED_KERNEL_DRIVER_MAJOR_VERSION = 3; +constexpr uint32_t MIN_SUPPORTED_KERNEL_DRIVER_MAJOR_VERSION = 3; class Exception : public std::exception { public: @@ -168,12 +168,11 @@ private: class Network { public: - Network(const Device &device, std::shared_ptr &buffer); + Network(const Device &device, const unsigned char *networkData, size_t networkSize); Network(const Device &device, const unsigned index); virtual ~Network() noexcept(false); int ioctl(unsigned long cmd, void *data = nullptr); - std::shared_ptr getBuffer(); const std::vector &getIfmDims() const; size_t getIfmSize() const; const std::vector &getOfmDims() const; @@ -183,7 +182,6 @@ private: void collectNetworkInfo(); int fd; - std::shared_ptr buffer; std::vector ifmDims; std::vector ofmDims; }; -- cgit v1.2.1