diff options
author | Jonny Svärd <jonny.svaerd@arm.com> | 2021-12-17 17:04:08 +0100 |
---|---|---|
committer | Jonny Svärd <jonny.svaerd@arm.com> | 2021-12-22 13:09:40 +0100 |
commit | 4c11a488d7f20c219ea6265480bc02f4b2cea1e3 (patch) | |
tree | 5c08668e3294112ed5fc494229c333fdc1a49fa9 /lib/layer_by_layer_profiler/include/layer_by_layer_profiler.hpp | |
parent | 05244b78be9eba0c83f6267fdbb3aa34e60eec98 (diff) | |
download | ethos-u-core-software-4c11a488d7f20c219ea6265480bc02f4b2cea1e3.tar.gz |
Use lbl-profiler to setup PMU and PMU events
Adapt layer-by-layer profiler to handle PMU event configuration,
PMU setup and retrieving PMU counter values.
Adapt the inference process application to support the lbl-profiler
PMU setup and retrieve/save PMU counter values in the InferenceJob
struct.
Change-Id: I1667a5b11c43c54e7d28232b594dd118bf3f79a8
Diffstat (limited to 'lib/layer_by_layer_profiler/include/layer_by_layer_profiler.hpp')
-rw-r--r-- | lib/layer_by_layer_profiler/include/layer_by_layer_profiler.hpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/layer_by_layer_profiler/include/layer_by_layer_profiler.hpp b/lib/layer_by_layer_profiler/include/layer_by_layer_profiler.hpp index 8e8dc0f..37bd868 100644 --- a/lib/layer_by_layer_profiler/include/layer_by_layer_profiler.hpp +++ b/lib/layer_by_layer_profiler/include/layer_by_layer_profiler.hpp @@ -23,6 +23,7 @@ #include "tensorflow/lite/kernels/internal/compatibility.h" #include <memory> #include <pmu_ethosu.h> +#include <vector> // NOTE: This profiler only works on systems with 1 NPU due to the use of // ethosu_reserve_driver(). @@ -30,22 +31,32 @@ namespace tflite { class LayerByLayerProfiler : public MicroProfiler { public: enum Backend { PRINTF, EVENT_RECORDER }; - LayerByLayerProfiler(size_t max_events = 200, - Backend backend = PRINTF, - int32_t event_id = EventID(EventLevelError, EvtStatistics_No, EventRecordNone)); + LayerByLayerProfiler(const std::vector<uint8_t> &event_config = {}, + bool pmu_cycle_counter_enable = true, + size_t max_events = 200, + Backend backend = PRINTF, + int32_t event_id = EventID(EventLevelError, EvtStatistics_No, EventRecordNone)); uint32_t BeginEvent(const char *tag); void EndEvent(uint32_t event_handle); uint64_t GetTotalTicks() const; void Log() const; + uint64_t GetPmuCycleCounterCount() const; + const std::vector<uint32_t> &GetPmuEventCount() const; + private: - size_t max_events_; std::unique_ptr<const char *[]> tags_; std::unique_ptr<uint64_t[]> start_ticks_; std::unique_ptr<uint64_t[]> end_ticks_; - Backend backend_; - int32_t event_id_; + std::vector<uint8_t> pmu_event_config; + std::vector<uint32_t> pmu_event_count; + bool pmu_cycle_counter_enable; + uint64_t pmu_cycle_counter_count; + + size_t max_events_; + Backend backend; + int32_t event_id; size_t num_events_; TF_LITE_REMOVE_VIRTUAL_DELETE; |