ArmNN
 24.08
IWorkload.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2020-2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
7 #include <armnn/Types.hpp>
9 
10 namespace armnn
11 {
12 
13 namespace experimental
14 {
15 
16 struct ExecutionData;
17 
18 } // end experimental namespace
19 
20 using namespace armnn::experimental;
21 
22 /// Workload interface to enqueue a layer computation.
23 class IWorkload {
24 public:
25  virtual ~IWorkload() {}
26 
27  // Note: do not call for async networks via ExecuteAsync or otherwise,
28  // as async networks memory is allocated outside the workload.
29  virtual void PostAllocationConfigure() = 0;
30 
31  virtual void Execute() const = 0;
32 
33  virtual void ExecuteAsync(ExecutionData& executionData) = 0;
34 
35  virtual arm::pipe::ProfilingGuid GetGuid() const = 0;
36 
37  // SupportsTensorHandleReplacement signals that a given workload is capable of
38  // replacing any of its I/O tensors via ReplaceInput/OutputTensorHandle
39  virtual bool SupportsTensorHandleReplacement() const = 0;
40 
41  // Replace input tensor handle with the given TensorHandle
42  virtual void ReplaceInputTensorHandle(ITensorHandle* /*input*/, unsigned int /*slot*/) = 0;
43 
44  // Returns the name of the workload
45  virtual const std::string& GetName() const = 0;
46 
47  // Replace output tensor handle with the given TensorHandle
48  virtual void ReplaceOutputTensorHandle(ITensorHandle* /*output*/, unsigned int /*slot*/) = 0;
49 
50  virtual void RegisterDebugCallback(const DebugCallbackFunction& /*func*/) {}
51 
53  {
54  return armnn::EmptyOptional();
55  }
56 };
57 
58 } //namespace armnn
armnn::Optional
Definition: Optional.hpp:270
armnn::IWorkload
Workload interface to enqueue a layer computation.
Definition: IWorkload.hpp:23
armnn::ITensorHandle
Definition: ITensorHandle.hpp:16
armnn::IWorkload::GetMemoryRequirements
virtual armnn::Optional< armnn::MemoryRequirements > GetMemoryRequirements()
Definition: IWorkload.hpp:52
armnn::EmptyOptional
EmptyOptional is used to initialize the Optional class in case we want to have default value for an O...
Definition: Optional.hpp:32
armnn::experimental
Definition: IWorkload.hpp:13
armnn::IWorkload::~IWorkload
virtual ~IWorkload()
Definition: IWorkload.hpp:25
armnn::DebugCallbackFunction
std::function< void(LayerGuid guid, unsigned int slotIndex, ITensorHandle *tensorHandle)> DebugCallbackFunction
Define the type of callback for the Debug layer to call.
Definition: Types.hpp:398
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
Types.hpp
armnn::IWorkload::RegisterDebugCallback
virtual void RegisterDebugCallback(const DebugCallbackFunction &)
Definition: IWorkload.hpp:50
WorkloadInfo.hpp
armnn::experimental::ExecutionData
Definition: ExecutionData.hpp:14