ArmNN
 22.08
IWorkload.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2022 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  // Replace output tensor handle with the given TensorHandle
45  virtual void ReplaceOutputTensorHandle(ITensorHandle* /*output*/, unsigned int /*slot*/) = 0;
46 
47  virtual void RegisterDebugCallback(const DebugCallbackFunction& /*func*/) {}
48 
50  {
51  return armnn::EmptyOptional();
52  }
53 };
54 
55 } //namespace armnn
virtual void RegisterDebugCallback(const DebugCallbackFunction &)
Definition: IWorkload.hpp:47
Copyright (c) 2021 ARM Limited and Contributors.
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:379
virtual ~IWorkload()
Definition: IWorkload.hpp:25
Workload interface to enqueue a layer computation.
Definition: IWorkload.hpp:23
EmptyOptional is used to initialize the Optional class in case we want to have default value for an O...
Definition: Optional.hpp:32
virtual armnn::Optional< armnn::MemoryRequirements > GetMemoryRequirements()
Definition: IWorkload.hpp:49