ArmNN
 24.08
RefBatchMatMulWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2022-2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
7 
8 #include "BatchMatMulImpl.hpp"
9 #include "RefWorkloadUtils.hpp"
10 #include "Profiling.hpp"
11 
12 namespace armnn
13 {
14 
16  : RefBaseWorkload(descriptor, info)
17 {}
18 
20 {
22 }
23 
25 {
26  WorkingMemDescriptor* workingMemDescriptor = static_cast<WorkingMemDescriptor*>(executionData.m_Data);
27  Execute(workingMemDescriptor->m_Inputs, workingMemDescriptor->m_Outputs);
28 }
29 
30 void RefBatchMatMulWorkload::Execute(std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const
31 {
32  ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID("RefBatchMatMulWorkload_Execute");
33 
34  const TensorInfo& inputXInfo = GetTensorInfo(inputs[0]);
35  const TensorInfo& inputYInfo = GetTensorInfo(inputs[1]);
36  const TensorInfo& outputInfo = GetTensorInfo(outputs[0]);
37 
38  std::unique_ptr<Decoder<float>> inputXDecoder = MakeDecoder<float>(GetTensorInfo(inputs[0]),
39  inputs[0]->Map());
40 
41  std::unique_ptr<Decoder<float>> inputYDecoder = MakeDecoder<float>(GetTensorInfo(inputs[1]),
42  inputs[1]->Map());
43 
44  std::unique_ptr<Encoder<float>> outputEncoder = MakeEncoder<float>(GetTensorInfo(outputs[0]),
45  outputs[0]->Map());
46 
47  auto bmm = BatchMatMul(m_Data.m_Parameters,
48  inputXInfo,
49  inputYInfo,
50  outputInfo,
51  *inputXDecoder,
52  *inputYDecoder,
53  *outputEncoder);
54 }
55 
56 } // namespace armnn
armnn::BatchMatMulQueueDescriptor
Definition: WorkloadData.hpp:753
RefBatchMatMulWorkload.hpp
BatchMatMulImpl.hpp
armnn::experimental::ExecutionData::m_Data
void * m_Data
Definition: ExecutionData.hpp:16
armnn::TensorInfo
Definition: Tensor.hpp:152
Profiling.hpp
armnn::RefBatchMatMulWorkload::Execute
void Execute() const override
Definition: RefBatchMatMulWorkload.cpp:19
ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID
#define ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
Definition: RefWorkloadUtils.hpp:22
armnn::QueueDescriptorWithParameters::m_Parameters
LayerDescriptor m_Parameters
Definition: WorkloadData.hpp:66
armnn::WorkloadInfo
Contains information about TensorInfos of a layer.
Definition: WorkloadInfo.hpp:16
armnn::RefBatchMatMulWorkload::ExecuteAsync
void ExecuteAsync(ExecutionData &executionData) override
Definition: RefBatchMatMulWorkload.cpp:24
armnn::GetTensorInfo
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
Definition: RefWorkloadUtils.hpp:33
armnn::BoostLogSeverityMapping::info
@ info
armnn::QueueDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkloadData.hpp:27
armnn::BatchMatMul
Definition: BatchMatMulImpl.hpp:16
armnn::RefBatchMatMulWorkload::RefBatchMatMulWorkload
RefBatchMatMulWorkload(const BatchMatMulQueueDescriptor &descriptor, const WorkloadInfo &info)
Definition: RefBatchMatMulWorkload.cpp:15
RefWorkloadUtils.hpp
armnn::BaseWorkload< BatchMatMulQueueDescriptor >::m_Data
BatchMatMulQueueDescriptor m_Data
Definition: Workload.hpp:89
armnn::LayerType::Map
@ Map
armnn::experimental::WorkingMemDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkingMemDescriptor.hpp:20
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::experimental::WorkingMemDescriptor
Definition: WorkingMemDescriptor.hpp:18
armnn::RefBaseWorkload
Definition: RefBaseWorkload.hpp:13
armnn::experimental::WorkingMemDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkingMemDescriptor.hpp:21
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26
armnn::experimental::ExecutionData
Definition: ExecutionData.hpp:14