aboutsummaryrefslogtreecommitdiff
path: root/src/backends/cl/workloads
diff options
context:
space:
mode:
Diffstat (limited to 'src/backends/cl/workloads')
-rw-r--r--src/backends/cl/workloads/CMakeLists.txt8
-rw-r--r--src/backends/cl/workloads/ClSoftmaxBaseWorkload.cpp27
-rw-r--r--src/backends/cl/workloads/ClSoftmaxBaseWorkload.hpp19
-rw-r--r--src/backends/cl/workloads/ClSoftmaxFloatWorkload.cpp36
-rw-r--r--src/backends/cl/workloads/ClSoftmaxFloatWorkload.hpp30
-rw-r--r--src/backends/cl/workloads/ClSoftmaxUint8Workload.cpp46
-rw-r--r--src/backends/cl/workloads/ClSoftmaxUint8Workload.hpp31
-rw-r--r--src/backends/cl/workloads/ClSoftmaxWorkload.cpp48
-rw-r--r--src/backends/cl/workloads/ClSoftmaxWorkload.hpp34
-rw-r--r--src/backends/cl/workloads/ClWorkloads.hpp3
10 files changed, 85 insertions, 197 deletions
diff --git a/src/backends/cl/workloads/CMakeLists.txt b/src/backends/cl/workloads/CMakeLists.txt
index 161ad96361..e595028cbb 100644
--- a/src/backends/cl/workloads/CMakeLists.txt
+++ b/src/backends/cl/workloads/CMakeLists.txt
@@ -78,12 +78,8 @@ list(APPEND armnnClBackendWorkloads_sources
ClRsqrtWorkload.hpp
ClSliceWorkload.cpp
ClSliceWorkload.hpp
- ClSoftmaxBaseWorkload.cpp
- ClSoftmaxBaseWorkload.hpp
- ClSoftmaxFloatWorkload.cpp
- ClSoftmaxFloatWorkload.hpp
- ClSoftmaxUint8Workload.cpp
- ClSoftmaxUint8Workload.hpp
+ ClSoftmaxWorkload.cpp
+ ClSoftmaxWorkload.hpp
ClSpaceToBatchNdWorkload.hpp
ClSpaceToBatchNdWorkload.cpp
ClSpaceToDepthWorkload.cpp
diff --git a/src/backends/cl/workloads/ClSoftmaxBaseWorkload.cpp b/src/backends/cl/workloads/ClSoftmaxBaseWorkload.cpp
deleted file mode 100644
index a355ba0c2d..0000000000
--- a/src/backends/cl/workloads/ClSoftmaxBaseWorkload.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "ClSoftmaxBaseWorkload.hpp"
-
-#include <aclCommon/ArmComputeTensorUtils.hpp>
-#include <aclCommon/ArmComputeUtils.hpp>
-
-#include <arm_compute/runtime/CL/functions/CLSoftmaxLayer.h>
-
-namespace armnn
-{
-
-arm_compute::Status ClSoftmaxWorkloadValidate(const TensorInfo& input,
- const TensorInfo& output,
- const SoftmaxDescriptor& descriptor)
-{
- const arm_compute::TensorInfo aclInputInfo = armcomputetensorutils::BuildArmComputeTensorInfo(input);
- const arm_compute::TensorInfo aclOutputInfo = armcomputetensorutils::BuildArmComputeTensorInfo(output);
-
- unsigned int aclAxis = ComputeSoftmaxAclAxis(descriptor, input);
- return arm_compute::CLSoftmaxLayer::validate(&aclInputInfo, &aclOutputInfo, descriptor.m_Beta, aclAxis);
-}
-
-}
diff --git a/src/backends/cl/workloads/ClSoftmaxBaseWorkload.hpp b/src/backends/cl/workloads/ClSoftmaxBaseWorkload.hpp
deleted file mode 100644
index 8d73060162..0000000000
--- a/src/backends/cl/workloads/ClSoftmaxBaseWorkload.hpp
+++ /dev/null
@@ -1,19 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#pragma once
-
-#include <armnn/Descriptors.hpp>
-#include <armnn/Tensor.hpp>
-#include <arm_compute/core/Error.h>
-
-namespace armnn
-{
-
-arm_compute::Status ClSoftmaxWorkloadValidate(const TensorInfo& input,
- const TensorInfo& output,
- const SoftmaxDescriptor& descriptor);
-
-} // namespace armnn
diff --git a/src/backends/cl/workloads/ClSoftmaxFloatWorkload.cpp b/src/backends/cl/workloads/ClSoftmaxFloatWorkload.cpp
deleted file mode 100644
index adb4872b80..0000000000
--- a/src/backends/cl/workloads/ClSoftmaxFloatWorkload.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "ClSoftmaxFloatWorkload.hpp"
-#include "ClWorkloadUtils.hpp"
-
-#include <aclCommon/ArmComputeUtils.hpp>
-#include <cl/ClTensorHandle.hpp>
-#include <backendsCommon/CpuTensorHandle.hpp>
-
-namespace armnn
-{
-
-ClSoftmaxFloatWorkload::ClSoftmaxFloatWorkload(const SoftmaxQueueDescriptor& descriptor, const WorkloadInfo& info,
- std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager)
- : FloatWorkload<SoftmaxQueueDescriptor>(descriptor, info)
- , m_SoftmaxLayer(memoryManager)
-{
- m_Data.ValidateInputsOutputs("ClSoftmaxFloatWorkload", 1, 1);
-
- arm_compute::ICLTensor& input = static_cast<ClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
- arm_compute::ICLTensor& output = static_cast<ClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
-
- unsigned int aclAxis = ComputeSoftmaxAclAxis(m_Data.m_Parameters, info.m_InputTensorInfos[0]);
- m_SoftmaxLayer.configure(&input, &output, m_Data.m_Parameters.m_Beta, aclAxis);
-}
-
-void ClSoftmaxFloatWorkload::Execute() const
-{
- ARMNN_SCOPED_PROFILING_EVENT_CL("ClSoftmaxFloatWorkload_Execute");
- RunClFunction(m_SoftmaxLayer, CHECK_LOCATION());
-}
-
-} //namespace armnn
diff --git a/src/backends/cl/workloads/ClSoftmaxFloatWorkload.hpp b/src/backends/cl/workloads/ClSoftmaxFloatWorkload.hpp
deleted file mode 100644
index 7efdae858a..0000000000
--- a/src/backends/cl/workloads/ClSoftmaxFloatWorkload.hpp
+++ /dev/null
@@ -1,30 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#pragma once
-
-#include <backendsCommon/Workload.hpp>
-
-#include <arm_compute/runtime/CL/functions/CLSoftmaxLayer.h>
-#include <arm_compute/runtime/MemoryManagerOnDemand.h>
-
-#include <memory>
-
-namespace armnn
-{
-
-class ClSoftmaxFloatWorkload : public FloatWorkload<SoftmaxQueueDescriptor>
-{
-public:
- ClSoftmaxFloatWorkload(const SoftmaxQueueDescriptor& descriptor, const WorkloadInfo& info,
- std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager);
- void Execute() const override;
-
-private:
- mutable arm_compute::CLSoftmaxLayer m_SoftmaxLayer;
-};
-
-} //namespace armnn
-
diff --git a/src/backends/cl/workloads/ClSoftmaxUint8Workload.cpp b/src/backends/cl/workloads/ClSoftmaxUint8Workload.cpp
deleted file mode 100644
index f14ea11c82..0000000000
--- a/src/backends/cl/workloads/ClSoftmaxUint8Workload.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "ClSoftmaxUint8Workload.hpp"
-#include "ClWorkloadUtils.hpp"
-
-#include <aclCommon/ArmComputeUtils.hpp>
-#include <cl/ClTensorHandle.hpp>
-#include <backendsCommon/CpuTensorHandle.hpp>
-
-namespace armnn
-{
-
-ClSoftmaxUint8Workload::ClSoftmaxUint8Workload(const SoftmaxQueueDescriptor& descriptor, const WorkloadInfo& info,
- std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager)
- : Uint8Workload<SoftmaxQueueDescriptor>(descriptor, info)
- , m_SoftmaxLayer(memoryManager)
-{
- m_Data.ValidateInputsOutputs("ClSoftmaxUint8Workload", 1, 1);
-
- arm_compute::ICLTensor& input = static_cast<ClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
- arm_compute::ICLTensor& output = static_cast<ClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
-
- const auto outputQuantization = output.info()->quantization_info();
-
- if ((!outputQuantization.scale().empty() && outputQuantization.scale()[0] != (1.0f / 256.0f)) ||
- (!outputQuantization.offset().empty() && outputQuantization.offset()[0] != 0) ||
- outputQuantization.scale().empty() || outputQuantization.offset().empty())
- {
- throw InvalidArgumentException(
- "Invalid quantization for output. Only scale = 1.0f / 256.0f and offset = 0 supported");
- }
-
- unsigned int aclAxis = ComputeSoftmaxAclAxis(m_Data.m_Parameters, info.m_InputTensorInfos[0]);
- m_SoftmaxLayer.configure(&input, &output, descriptor.m_Parameters.m_Beta, aclAxis);
-}
-
-void ClSoftmaxUint8Workload::Execute() const
-{
- ARMNN_SCOPED_PROFILING_EVENT_CL("ClSoftmaxUint8Workload_Execute");
- RunClFunction(m_SoftmaxLayer, CHECK_LOCATION());
-}
-
-} //namespace armnn
diff --git a/src/backends/cl/workloads/ClSoftmaxUint8Workload.hpp b/src/backends/cl/workloads/ClSoftmaxUint8Workload.hpp
deleted file mode 100644
index f378b89a5d..0000000000
--- a/src/backends/cl/workloads/ClSoftmaxUint8Workload.hpp
+++ /dev/null
@@ -1,31 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#pragma once
-
-#include <backendsCommon/Workload.hpp>
-
-#include <arm_compute/runtime/CL/functions/CLSoftmaxLayer.h>
-#include <arm_compute/runtime/MemoryManagerOnDemand.h>
-
-#include <memory>
-
-namespace armnn
-{
-// Softmax
-class ClSoftmaxUint8Workload : public Uint8Workload<SoftmaxQueueDescriptor>
-{
-public:
- ClSoftmaxUint8Workload(const SoftmaxQueueDescriptor& descriptor, const WorkloadInfo& info,
- std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager);
-
- void Execute() const override;
-private:
-
- mutable arm_compute::CLSoftmaxLayer m_SoftmaxLayer;
-};
-
-} //namespace armnn
-
diff --git a/src/backends/cl/workloads/ClSoftmaxWorkload.cpp b/src/backends/cl/workloads/ClSoftmaxWorkload.cpp
new file mode 100644
index 0000000000..cbca7668ed
--- /dev/null
+++ b/src/backends/cl/workloads/ClSoftmaxWorkload.cpp
@@ -0,0 +1,48 @@
+//
+// Copyright © 2020 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#include "ClSoftmaxWorkload.hpp"
+#include "ClWorkloadUtils.hpp"
+
+#include <aclCommon/ArmComputeTensorUtils.hpp>
+#include <aclCommon/ArmComputeUtils.hpp>
+
+#include <cl/ClTensorHandle.hpp>
+
+namespace armnn
+{
+
+arm_compute::Status ClSoftmaxWorkloadValidate(const TensorInfo& input,
+ const TensorInfo& output,
+ const SoftmaxDescriptor& descriptor)
+{
+ const arm_compute::TensorInfo aclInputInfo = armcomputetensorutils::BuildArmComputeTensorInfo(input);
+ const arm_compute::TensorInfo aclOutputInfo = armcomputetensorutils::BuildArmComputeTensorInfo(output);
+
+ unsigned int aclAxis = ComputeSoftmaxAclAxis<unsigned int>(descriptor, input);
+ return arm_compute::CLSoftmaxLayer::validate(&aclInputInfo, &aclOutputInfo, descriptor.m_Beta, aclAxis);
+}
+
+ClSoftmaxWorkload::ClSoftmaxWorkload(const SoftmaxQueueDescriptor& descriptor, const WorkloadInfo& info,
+ std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager)
+ : BaseWorkload<SoftmaxQueueDescriptor>(descriptor, info)
+ , m_SoftmaxLayer(memoryManager)
+{
+ m_Data.ValidateInputsOutputs("ClSoftmaxWorkload", 1, 1);
+
+ arm_compute::ICLTensor& input = static_cast<ClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
+ arm_compute::ICLTensor& output = static_cast<ClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
+
+ unsigned int aclAxis = ComputeSoftmaxAclAxis<unsigned int>(m_Data.m_Parameters, info.m_InputTensorInfos[0]);
+ m_SoftmaxLayer.configure(&input, &output, m_Data.m_Parameters.m_Beta, aclAxis);
+}
+
+void ClSoftmaxWorkload::Execute() const
+{
+ ARMNN_SCOPED_PROFILING_EVENT_CL("ClSoftmaxWorkload_Execute");
+ RunClFunction(m_SoftmaxLayer, CHECK_LOCATION());
+}
+
+} // namespace armnn
diff --git a/src/backends/cl/workloads/ClSoftmaxWorkload.hpp b/src/backends/cl/workloads/ClSoftmaxWorkload.hpp
new file mode 100644
index 0000000000..158bf46c32
--- /dev/null
+++ b/src/backends/cl/workloads/ClSoftmaxWorkload.hpp
@@ -0,0 +1,34 @@
+//
+// Copyright © 2020 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#pragma once
+
+#include <armnn/Descriptors.hpp>
+
+#include <arm_compute/core/Error.h>
+#include <arm_compute/runtime/MemoryManagerOnDemand.h>
+#include <arm_compute/runtime/CL/functions/CLSoftmaxLayer.h>
+
+#include <backendsCommon/Workload.hpp>
+
+namespace armnn
+{
+
+arm_compute::Status ClSoftmaxWorkloadValidate(const TensorInfo& input,
+ const TensorInfo& output,
+ const SoftmaxDescriptor& descriptor);
+
+class ClSoftmaxWorkload : public BaseWorkload<SoftmaxQueueDescriptor>
+{
+public:
+ ClSoftmaxWorkload(const SoftmaxQueueDescriptor& descriptor, const WorkloadInfo& info,
+ std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager);
+ void Execute() const override;
+
+private:
+ mutable arm_compute::CLSoftmaxLayer m_SoftmaxLayer;
+};
+
+} // namespace armnn
diff --git a/src/backends/cl/workloads/ClWorkloads.hpp b/src/backends/cl/workloads/ClWorkloads.hpp
index ffe66a0716..62b73daef3 100644
--- a/src/backends/cl/workloads/ClWorkloads.hpp
+++ b/src/backends/cl/workloads/ClWorkloads.hpp
@@ -39,8 +39,7 @@
#include "ClResizeWorkload.hpp"
#include "ClRsqrtWorkload.hpp"
#include "ClSliceWorkload.hpp"
-#include "ClSoftmaxFloatWorkload.hpp"
-#include "ClSoftmaxUint8Workload.hpp"
+#include "ClSoftmaxWorkload.hpp"
#include "ClSpaceToBatchNdWorkload.hpp"
#include "ClSpaceToDepthWorkload.hpp"
#include "ClSplitterWorkload.hpp"