ArmNN
 25.02
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
IWorkload.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2020-2024 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 /// Workload interface to enqueue a layer computation.
14 class IWorkload {
15 public:
16  virtual ~IWorkload() {}
17 
18  virtual void PostAllocationConfigure() = 0;
19 
20  virtual void Execute() const = 0;
21 
22  virtual arm::pipe::ProfilingGuid GetGuid() const = 0;
23 
24  // SupportsTensorHandleReplacement signals that a given workload is capable of
25  // replacing any of its I/O tensors via ReplaceInput/OutputTensorHandle
26  virtual bool SupportsTensorHandleReplacement() const = 0;
27 
28  // Replace input tensor handle with the given TensorHandle
29  virtual void ReplaceInputTensorHandle(ITensorHandle* /*input*/, unsigned int /*slot*/) = 0;
30 
31  // Returns the name of the workload
32  virtual const std::string& GetName() const = 0;
33 
34  // Replace output tensor handle with the given TensorHandle
35  virtual void ReplaceOutputTensorHandle(ITensorHandle* /*output*/, unsigned int /*slot*/) = 0;
36 
37  virtual void RegisterDebugCallback(const DebugCallbackFunction& /*func*/) {}
38 
40  {
41  return armnn::EmptyOptional();
42  }
43 };
44 
45 }; //namespace armnn
Workload interface to enqueue a layer computation.
Definition: IWorkload.hpp:14
virtual arm::pipe::ProfilingGuid GetGuid() const =0
virtual armnn::Optional< armnn::MemoryRequirements > GetMemoryRequirements()
Definition: IWorkload.hpp:39
virtual const std::string & GetName() const =0
virtual ~IWorkload()
Definition: IWorkload.hpp:16
virtual void Execute() const =0
virtual bool SupportsTensorHandleReplacement() const =0
virtual void ReplaceInputTensorHandle(ITensorHandle *, unsigned int)=0
virtual void RegisterDebugCallback(const DebugCallbackFunction &)
Definition: IWorkload.hpp:37
virtual void PostAllocationConfigure()=0
virtual void ReplaceOutputTensorHandle(ITensorHandle *, unsigned int)=0
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:400
EmptyOptional is used to initialize the Optional class in case we want to have default value for an O...
Definition: Optional.hpp:32