diff options
author | Jens Elofsson <jens.elofsson@arm.com> | 2021-04-22 20:57:15 +0200 |
---|---|---|
committer | Måns Nilsson <mans.nilsson@arm.com> | 2021-05-21 09:59:19 +0200 |
commit | 955288a1b08bbfb0ea5fc0c5994b1a3a6ff8506e (patch) | |
tree | 53f09fef19895b80012b95633106e1e823b64ad7 /applications/inference_process | |
parent | 7f3c1c92732b611a53968b14e70a2b116e43b980 (diff) | |
download | ethos-u-core-software-955288a1b08bbfb0ea5fc0c5994b1a3a6ff8506e.tar.gz |
Add EthosuProfiler to perform layer-by-layer profiling on Ethos-U.
Change-Id: Idae34fd8ab6b17b0bc21db658fff135a5ddf5461
Diffstat (limited to 'applications/inference_process')
-rw-r--r-- | applications/inference_process/CMakeLists.txt | 10 | ||||
-rw-r--r-- | applications/inference_process/src/inference_process.cpp | 13 |
2 files changed, 18 insertions, 5 deletions
diff --git a/applications/inference_process/CMakeLists.txt b/applications/inference_process/CMakeLists.txt index 67caae8..4bd75c4 100644 --- a/applications/inference_process/CMakeLists.txt +++ b/applications/inference_process/CMakeLists.txt @@ -22,5 +22,13 @@ add_library(inference_process STATIC) target_include_directories(inference_process PUBLIC include PRIVATE ${TENSORFLOW_PATH} ${TENSORFLOW_PATH}/tensorflow/lite/micro/tools/make/downloads/flatbuffers/include) + target_link_libraries(inference_process PRIVATE tflu cmsis_core cmsis_device) -target_sources(inference_process PRIVATE src/inference_process.cpp)
\ No newline at end of file +if (TARGET ethosu_profiler) + target_link_libraries(inference_process PRIVATE ethosu_profiler) +endif() +if (TARGET arm_profiler) + target_link_libraries(inference_process PRIVATE arm_profiler) +endif() + +target_sources(inference_process PRIVATE src/inference_process.cpp) diff --git a/applications/inference_process/src/inference_process.cpp b/applications/inference_process/src/inference_process.cpp index 743ed64..fa38290 100644 --- a/applications/inference_process/src/inference_process.cpp +++ b/applications/inference_process/src/inference_process.cpp @@ -24,6 +24,11 @@ #include "tensorflow/lite/schema/schema_generated.h" #include "tensorflow/lite/version.h" +#include "arm_profiler.hpp" +#ifdef ETHOSU +#include "ethosu_profiler.hpp" +#endif + #include "inference_process.hpp" #include "cmsis_compiler.h" @@ -200,15 +205,15 @@ bool InferenceProcess::runJob(InferenceJob &job) { // Create the TFL micro interpreter tflite::AllOpsResolver resolver; - tflite::MicroProfiler profiler; - -#if defined(INFERENCE_PROC_TFLU_PROFILER) && defined(ETHOSU) +#ifdef ETHOSU vector<ethosu_pmu_event_type> pmu_events(ETHOSU_PMU_NCOUNTERS, ETHOSU_PMU_NO_EVENT); for (size_t i = 0; i < job.pmuEventConfig.size(); i++) { pmu_events[i] = ethosu_pmu_event_type(job.pmuEventConfig[i]); } - profiler.MonitorEthosuPMUEvents(pmu_events[0], pmu_events[1], pmu_events[2], pmu_events[3]); + tflite::EthosUProfiler profiler(pmu_events[0], pmu_events[1], pmu_events[2], pmu_events[3]); +#else + tflite::ArmProfiler profiler; #endif tflite::MicroInterpreter interpreter(model, resolver, tensorArena, tensorArenaSize, reporter, &profiler); |