aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSadik Armagan <sadik.armagan@arm.com>2020-09-29 15:12:36 +0100
committerSadik Armagan <sadik.armagan@arm.com>2020-10-02 12:04:08 +0000
commit890bf652dd82c2f951e511630f0907994ffc1cee (patch)
tree7f33cf5fb2290eee1048f8cd2eb9353e27f3b8ea /src
parent01e8b07452eb691469c0a302fff64ecd5dadd3e3 (diff)
downloadarmnn-890bf652dd82c2f951e511630f0907994ffc1cee.tar.gz
IVGCVSW-4997 'Superfluous memcopy workloads'
* If Output Layer is already connected to MemCopy Layer do not insert CopyMemGenericWorkload. Signed-off-by: Sadik Armagan <sadik.armagan@arm.com> Change-Id: I9f813be5a3de2bc62d16864edb3eeaf371ef48e0
Diffstat (limited to 'src')
-rw-r--r--src/armnn/LoadedNetwork.cpp35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/armnn/LoadedNetwork.cpp b/src/armnn/LoadedNetwork.cpp
index 7b64a88470..33625744c5 100644
--- a/src/armnn/LoadedNetwork.cpp
+++ b/src/armnn/LoadedNetwork.cpp
@@ -685,24 +685,29 @@ void LoadedNetwork::EnqueueOutput(const BindableLayer& layer, ITensorHandle* ten
}
else
{
- // If we got here then we didn't export the memory, so add an output workload which performs a memcopy.
- outputQueueDescriptor.m_Inputs.push_back(inputTensorHandle);
- info.m_InputTensorInfos.push_back(inputTensorInfo);
+ const Layer& connectedLayer = layer.GetInputSlots()[0].GetConnectedOutputSlot()->GetOwningLayer();
+ // Do not add MemCopy Layer if OutputLayer is already connected the MemCopy Layer
+ if (connectedLayer.GetType() != LayerType::MemCopy)
+ {
+ // If we got here then we didn't export the memory, so add an output workload which performs a memcopy.
+ outputQueueDescriptor.m_Inputs.push_back(inputTensorHandle);
+ info.m_InputTensorInfos.push_back(inputTensorInfo);
- std::unique_ptr<IWorkload> outputWorkload =
- std::make_unique<CopyMemGenericWorkload>(outputQueueDescriptor, info);
- ARMNN_ASSERT_MSG(outputWorkload, "No output workload created");
+ std::unique_ptr<IWorkload> outputWorkload =
+ std::make_unique<CopyMemGenericWorkload>(outputQueueDescriptor, info);
+ ARMNN_ASSERT_MSG(outputWorkload, "No output workload created");
- std::unique_ptr<TimelineUtilityMethods> timelineUtils =
- TimelineUtilityMethods::GetTimelineUtils(m_ProfilingService);
- if (timelineUtils)
- {
- // Add Output Workload to the post-optimisation network structure
- AddWorkloadStructure(timelineUtils, outputWorkload, layer);
- timelineUtils->Commit();
- }
+ std::unique_ptr<TimelineUtilityMethods> timelineUtils =
+ TimelineUtilityMethods::GetTimelineUtils(m_ProfilingService);
+ if (timelineUtils)
+ {
+ // Add Output Workload to the post-optimisation network structure
+ AddWorkloadStructure(timelineUtils, outputWorkload, layer);
+ timelineUtils->Commit();
+ }
- m_OutputQueue.push_back(move(outputWorkload));
+ m_OutputQueue.push_back(move(outputWorkload));
+ }
}
}