From 992d6dc57d8463729910b688f0fb5825d0d3ccf2 Mon Sep 17 00:00:00 2001 From: Matteo Martincigh Date: Thu, 10 Jan 2019 17:34:20 +0000 Subject: IVGCVSW-2454 Refactor ArmNN to support pluggable backends from a separate code base * Made the virtual functions in ILayerSupport.hpp pure * Created a LayerSupportBase class with the default implementation of the interface * Made the backend layer support classes inherit from the base class, instead of directly from the interface * Refactored the profiler and the profiling event classes to use the BackendId instead of the Compute * Implemented a proper MemCopy support method * Changed Compute to BackendId in the profiling API and objects * Removed static references to pluggable backends !android-nn-driver:492 Change-Id: Id6332b5f48c980819e0a09adc818d1effd057296 --- src/armnn/test/ProfilingEventTest.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/armnn/test') diff --git a/src/armnn/test/ProfilingEventTest.cpp b/src/armnn/test/ProfilingEventTest.cpp index 9e31ccb323..0add8365e9 100644 --- a/src/armnn/test/ProfilingEventTest.cpp +++ b/src/armnn/test/ProfilingEventTest.cpp @@ -2,10 +2,12 @@ // Copyright © 2017 Arm Ltd. All rights reserved. // SPDX-License-Identifier: MIT // + #include #include "ProfilingEvent.hpp" #include "Profiling.hpp" + #include using namespace armnn; @@ -24,7 +26,7 @@ BOOST_AUTO_TEST_CASE(ProfilingEventTest) Event testEvent(eventName, nullptr, nullptr, - armnn::Compute::Undefined, + BackendId(), std::move(insts1)); BOOST_CHECK_EQUAL(testEvent.GetName(), "EventName"); @@ -41,17 +43,18 @@ BOOST_AUTO_TEST_CASE(ProfilingEventTest) BOOST_CHECK_GE(testEvent.GetMeasurements().front().m_Value, 10.0); // create a sub event with CpuAcc + BackendId cpuAccBackendId(Compute::CpuAcc); Event::Instruments insts2; insts2.emplace_back(std::make_unique()); Event testEvent2(eventName, profileManager.GetProfiler(), &testEvent, - Compute::CpuAcc, + cpuAccBackendId, std::move(insts2)); BOOST_CHECK_EQUAL(&testEvent, testEvent2.GetParentEvent()); BOOST_CHECK_EQUAL(profileManager.GetProfiler(), testEvent2.GetProfiler()); - BOOST_CHECK_EQUAL(Compute::CpuAcc, testEvent2.GetComputeDevice()); + BOOST_CHECK(cpuAccBackendId == testEvent2.GetBackendId()); } BOOST_AUTO_TEST_CASE(ProfilingEventTestOnGpuAcc) @@ -66,7 +69,7 @@ BOOST_AUTO_TEST_CASE(ProfilingEventTestOnGpuAcc) Event testEvent(eventName, nullptr, nullptr, - armnn::Compute::Undefined, + BackendId(), std::move(insts1)); BOOST_CHECK_EQUAL(testEvent.GetName(), "GPUEvent"); @@ -83,13 +86,18 @@ BOOST_AUTO_TEST_CASE(ProfilingEventTestOnGpuAcc) BOOST_CHECK_GE(testEvent.GetMeasurements().front().m_Value, 10.0); // create a sub event + BackendId gpuAccBackendId(Compute::GpuAcc); Event::Instruments insts2; insts2.emplace_back(std::make_unique()); - Event testEvent2(eventName, profileManager.GetProfiler(), &testEvent, Compute::GpuAcc, std::move(insts2)); + Event testEvent2(eventName, + profileManager.GetProfiler(), + &testEvent, + gpuAccBackendId, + std::move(insts2)); BOOST_CHECK_EQUAL(&testEvent, testEvent2.GetParentEvent()); BOOST_CHECK_EQUAL(profileManager.GetProfiler(), testEvent2.GetProfiler()); - BOOST_CHECK_EQUAL(Compute::GpuAcc, testEvent2.GetComputeDevice()); + BOOST_CHECK(gpuAccBackendId == testEvent2.GetBackendId()); } BOOST_AUTO_TEST_SUITE_END() -- cgit v1.2.1