diff options
Diffstat (limited to 'driver_library')
-rw-r--r-- | driver_library/include/ethosu.hpp | 2 | ||||
-rw-r--r-- | driver_library/python/src/ethosu_driver/swig/driver.i | 10 | ||||
-rwxr-xr-x | driver_library/python/swig_generate.py | 3 | ||||
-rw-r--r-- | driver_library/src/ethosu.cpp | 4 |
4 files changed, 14 insertions, 5 deletions
diff --git a/driver_library/include/ethosu.hpp b/driver_library/include/ethosu.hpp index eaa1ce7..27f6828 100644 --- a/driver_library/include/ethosu.hpp +++ b/driver_library/include/ethosu.hpp @@ -235,7 +235,7 @@ public: virtual ~Inference() noexcept(false); bool wait(int64_t timeoutNanos = -1) const; - const std::vector<uint32_t> getPmuCounters() const; + const std::vector<uint64_t> getPmuCounters() const; uint64_t getCycleCounter() const; bool cancel() const; InferenceStatus status() const; diff --git a/driver_library/python/src/ethosu_driver/swig/driver.i b/driver_library/python/src/ethosu_driver/swig/driver.i index 6e0ad25..a8db7c1 100644 --- a/driver_library/python/src/ethosu_driver/swig/driver.i +++ b/driver_library/python/src/ethosu_driver/swig/driver.i @@ -29,6 +29,14 @@ %shared_ptr(EthosU::Buffer); %shared_ptr(EthosU::Network); +%typemap(out) (std::vector<uint64_t>) { + PyObject *list = PyList_New($1.size()); + for (size_t i=0; i < $1.size(); ++i) { + PyList_SET_ITEM(list, i, PyLong_FromUnsignedLong($1.at(i))); + } + $result = list; +} + namespace std { %template(UintVector) vector<unsigned int>; %template(SizeTVector) vector<size_t>; @@ -508,7 +516,7 @@ public: Returns: list: PMU event data ") getPmuCounters; - const std::vector<uint32_t> getPmuCounters(); + const std::vector<uint64_t> getPmuCounters(); %feature("docstring", " diff --git a/driver_library/python/swig_generate.py b/driver_library/python/swig_generate.py index bdd43a3..8394d96 100755 --- a/driver_library/python/swig_generate.py +++ b/driver_library/python/swig_generate.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright 2021-2022 Arm Limited and/or its affiliates <open-source-office@arm.com> +# SPDX-FileCopyrightText: Copyright 2021-2023 Arm Limited and/or its affiliates <open-source-office@arm.com> # SPDX-License-Identifier: Apache-2.0 """ This script executes SWIG commands to generate C++ library wrappers. @@ -13,6 +13,7 @@ def generate_wrap(name, extr_includes): print('Generating wrappers for {}'.format(name)) subprocess.check_output("swig -v -c++ -python" + " -Wall" + + " -DSWIGWORDSIZE64 " + # Force 64-bit word size for uint64_t vector to work " -o {}/src/ethosu_driver/_generated/{}_wrap.cpp ".format(__current_dir, name) + "-outdir {}/src/ethosu_driver/_generated ".format(__current_dir) + "{} ".format(extr_includes) + diff --git a/driver_library/src/ethosu.cpp b/driver_library/src/ethosu.cpp index 7aec696..a4feef1 100644 --- a/driver_library/src/ethosu.cpp +++ b/driver_library/src/ethosu.cpp @@ -539,9 +539,9 @@ InferenceStatus Inference::status() const { throw Exception("Unknown inference status"); } -const std::vector<uint32_t> Inference::getPmuCounters() const { +const std::vector<uint64_t> Inference::getPmuCounters() const { ethosu_uapi_result_status uapi; - std::vector<uint32_t> counterValues = std::vector<uint32_t>(ETHOSU_PMU_EVENT_MAX, 0); + std::vector<uint64_t> counterValues = std::vector<uint64_t>(ETHOSU_PMU_EVENT_MAX, 0); eioctl(fd, ETHOSU_IOCTL_INFERENCE_STATUS, static_cast<void *>(&uapi)); |