aboutsummaryrefslogtreecommitdiff
path: root/src/backends/cl/workloads
diff options
context:
space:
mode:
authorTeresa Charlin <teresa.charlinreyes@arm.com>2023-03-30 13:56:34 +0100
committerTeresa Charlin <teresa.charlinreyes@arm.com>2023-05-08 18:18:39 +0100
commitee1497c400db10134ab540005e105f64bd0f486a (patch)
tree807a47a2854fe6f472f9af2c9ec4b65643912b80 /src/backends/cl/workloads
parenta3dc95ec2b0ac9e7f87dd32d03679a4b2a9b5d2a (diff)
downloadarmnn-ee1497c400db10134ab540005e105f64bd0f486a.tar.gz
IVGCVSW-7454 Enable NonConstWeights in GpuAcc
* Set flag for constant weights and bias in ACL tensorInfo in ACl workloads * Set flag for constant weights and bias in Unit Tests * Add to dot file for FullyConnected layer the constantWeights flag Signed-off-by: Teresa Charlin <teresa.charlinreyes@arm.com> Change-Id: I87e1fef516ce4a8a59245dfdf7d92c153418e1d6
Diffstat (limited to 'src/backends/cl/workloads')
-rw-r--r--src/backends/cl/workloads/ClConvolution2dWorkload.cpp8
-rw-r--r--src/backends/cl/workloads/ClDepthwiseConvolutionWorkload.cpp41
-rw-r--r--src/backends/cl/workloads/ClFullyConnectedWorkload.cpp50
3 files changed, 58 insertions, 41 deletions
diff --git a/src/backends/cl/workloads/ClConvolution2dWorkload.cpp b/src/backends/cl/workloads/ClConvolution2dWorkload.cpp
index 1920f2d20b..d6a72e6488 100644
--- a/src/backends/cl/workloads/ClConvolution2dWorkload.cpp
+++ b/src/backends/cl/workloads/ClConvolution2dWorkload.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
+// Copyright © 2017, 2023 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -88,9 +88,15 @@ ClConvolution2dWorkload::ClConvolution2dWorkload(const Convolution2dQueueDescrip
arm_compute::ICLTensor& input = static_cast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
arm_compute::ICLTensor& weights = static_cast<IClTensorHandle*>(m_Data.m_Inputs[1])->GetTensor();
+ weights.info()->set_are_values_constant(info.m_InputTensorInfos[1].IsConstant());
+
if (m_Data.m_Parameters.m_BiasEnabled)
{
arm_compute::ICLTensor& bias = static_cast<IClTensorHandle*>(m_Data.m_Inputs[2])->GetTensor();
+ bias.info()->set_are_values_constant(info.m_InputTensorInfos[2].IsConstant());
+ // We do not support dynamic bias
+ ARMNN_ASSERT(info.m_InputTensorInfos[2].IsConstant() == true);
+
m_BiasProxy = std::make_unique<ICLTensorProxy>(&bias);
}
diff --git a/src/backends/cl/workloads/ClDepthwiseConvolutionWorkload.cpp b/src/backends/cl/workloads/ClDepthwiseConvolutionWorkload.cpp
index 041cb8b0fc..e6c9cb5c20 100644
--- a/src/backends/cl/workloads/ClDepthwiseConvolutionWorkload.cpp
+++ b/src/backends/cl/workloads/ClDepthwiseConvolutionWorkload.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2017,2022 Arm Ltd and Contributors. All rights reserved.
+// Copyright © 2017,2022-2023 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -91,28 +91,12 @@ ClDepthwiseConvolutionWorkload::ClDepthwiseConvolutionWorkload(
const arm_compute::CLCompileContext& clCompileContext)
: ClBaseWorkload<DepthwiseConvolution2dQueueDescriptor>(descriptor, info)
{
- // Add details for profiling output
- WorkloadInfo detailsInfo;
-
- detailsInfo.m_InputTensorInfos = info.m_InputTensorInfos;
- detailsInfo.m_OutputTensorInfos = info.m_OutputTensorInfos;
- detailsInfo.m_WeightsTensorInfo = armnn::Optional<armnn::TensorInfo>(info.m_InputTensorInfos[1]);
- if (descriptor.m_Parameters.m_BiasEnabled)
- {
- detailsInfo.m_BiasTensorInfo = armnn::Optional<armnn::TensorInfo>(info.m_InputTensorInfos[2]);
- }
-
- // Report Profiling Details
- ARMNN_REPORT_PROFILING_WORKLOAD_DESC("ClDepthwiseConvolutionWorkload_Construct",
- descriptor.m_Parameters,
- detailsInfo,
- GetGuid());
-
m_Data.ValidateInputsOutputs("ClDepthwiseConv2dWorkload", descriptor.m_Parameters.GetNumInputs(), 1);
arm_compute::ICLTensor& input = PolymorphicDowncast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
arm_compute::ICLTensor& output = PolymorphicDowncast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
arm_compute::ICLTensor& weights = PolymorphicDowncast<IClTensorHandle*>(m_Data.m_Inputs[1])->GetTensor();
+ weights.info()->set_are_values_constant(info.m_InputTensorInfos[1].IsConstant());
arm_compute::ITensorInfo* weightsInfo = weights.info();
arm_compute::ITensorInfo* inputInfo = input.info();
auto weightsShape = weightsInfo->tensor_shape();
@@ -127,6 +111,9 @@ ClDepthwiseConvolutionWorkload::ClDepthwiseConvolutionWorkload(
if (m_Data.m_Parameters.m_BiasEnabled)
{
bias = &PolymorphicDowncast<IClTensorHandle*>(m_Data.m_Inputs[2])->GetTensor();
+ bias->info()->set_are_values_constant(info.m_InputTensorInfos[2].IsConstant());
+ // We do not support dynamic bias
+ ARMNN_ASSERT(info.m_InputTensorInfos[2].IsConstant() == true);
}
const arm_compute::Size2D aclDilationInfo = BuildArmComputeSize2D(
@@ -158,6 +145,24 @@ ClDepthwiseConvolutionWorkload::ClDepthwiseConvolutionWorkload(
aclDilationInfo);
}
ARMNN_ASSERT(m_DepthwiseConvolutionLayer);
+
+ // Add details for profiling output
+ WorkloadInfo detailsInfo;
+
+ detailsInfo.m_InputTensorInfos = info.m_InputTensorInfos;
+ detailsInfo.m_OutputTensorInfos = info.m_OutputTensorInfos;
+ detailsInfo.m_WeightsTensorInfo = armnn::Optional<armnn::TensorInfo>(info.m_InputTensorInfos[1]);
+
+ if (descriptor.m_Parameters.m_BiasEnabled)
+ {
+ detailsInfo.m_BiasTensorInfo = armnn::Optional<armnn::TensorInfo>(info.m_InputTensorInfos[2]);
+ }
+
+ // Report Profiling Details
+ ARMNN_REPORT_PROFILING_WORKLOAD_DESC("ClDepthwiseConvolutionWorkload_Construct",
+ descriptor.m_Parameters,
+ detailsInfo,
+ GetGuid());
}
void ClDepthwiseConvolutionWorkload::Execute() const
diff --git a/src/backends/cl/workloads/ClFullyConnectedWorkload.cpp b/src/backends/cl/workloads/ClFullyConnectedWorkload.cpp
index 22df04fc76..1f26b09964 100644
--- a/src/backends/cl/workloads/ClFullyConnectedWorkload.cpp
+++ b/src/backends/cl/workloads/ClFullyConnectedWorkload.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2017,2022 Arm Ltd and Contributors. All rights reserved.
+// Copyright © 2017,2022-2023 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -46,6 +46,7 @@ arm_compute::Status ClFullyConnectedWorkloadValidate(const TensorInfo& input,
const arm_compute::FullyConnectedLayerInfo fullyConnectedLayerInfo =
ConvertFullyConnectedDescriptorToAclFullyConnectedLayerInfo(descriptor, activationDescriptor);
+
return arm_compute::CLFullyConnectedLayer::validate(&aclInput,
&aclWeights,
optionalAclBiases,
@@ -60,34 +61,22 @@ ClFullyConnectedWorkload::ClFullyConnectedWorkload(
const arm_compute::CLCompileContext& clCompileContext)
: ClBaseWorkload<FullyConnectedQueueDescriptor>(descriptor, info), m_FullyConnectedLayer(memoryManager)
{
- // Add details for profiling output
- WorkloadInfo detailsInfo;
+ m_Data.ValidateInputsOutputs("ClFullyConnectedWorkload", descriptor.m_Parameters.GetNumInputs(), 1);
- detailsInfo.m_InputTensorInfos = info.m_InputTensorInfos;
- detailsInfo.m_OutputTensorInfos = info.m_OutputTensorInfos;
- detailsInfo.m_WeightsTensorInfo = armnn::Optional<armnn::TensorInfo>(info.m_InputTensorInfos[1]);
- if (descriptor.m_Parameters.m_BiasEnabled)
- {
- detailsInfo.m_BiasTensorInfo = armnn::Optional<armnn::TensorInfo>(info.m_InputTensorInfos[2]);
- }
-
- // Report Profiling Details
- ARMNN_REPORT_PROFILING_WORKLOAD_DESC("ClFullyConnectedWorkload_Construct",
- descriptor.m_Parameters,
- detailsInfo,
- this->GetGuid());
-
- m_Data.ValidateInputsOutputs("ClFullyConnectedWorkload", descriptor.m_Parameters.GetNumInputs(),
- 1);
-
- arm_compute::ICLTensor& input = static_cast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
- arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
+ arm_compute::ICLTensor& input = PolymorphicDowncast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
+ arm_compute::ICLTensor& output = PolymorphicDowncast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
arm_compute::ICLTensor& weights = PolymorphicDowncast<IClTensorHandle*>(m_Data.m_Inputs[1])->GetTensor();
+ weights.info()->set_are_values_constant(info.m_InputTensorInfos[1].IsConstant());
+
arm_compute::ICLTensor* bias = nullptr;
if (m_Data.m_Parameters.m_BiasEnabled)
{
bias = &PolymorphicDowncast<IClTensorHandle*>(m_Data.m_Inputs[2])->GetTensor();
+ bias->info()->set_are_values_constant(info.m_InputTensorInfos[2].IsConstant());
+
+ // We do not support dynamic bias
+ ARMNN_ASSERT(info.m_InputTensorInfos[2].IsConstant() == true);
}
const arm_compute::ActivationLayerInfo activationInfo = ConvertAdditionalInfoToAclActivationLayerInfo(descriptor);
@@ -105,6 +94,23 @@ ClFullyConnectedWorkload::ClFullyConnectedWorkload(
&output,
fc_info);
}
+
+ // Add details for profiling output
+ WorkloadInfo detailsInfo;
+
+ detailsInfo.m_InputTensorInfos = info.m_InputTensorInfos;
+ detailsInfo.m_OutputTensorInfos = info.m_OutputTensorInfos;
+ detailsInfo.m_WeightsTensorInfo = armnn::Optional<armnn::TensorInfo>(info.m_InputTensorInfos[1]);
+ if (descriptor.m_Parameters.m_BiasEnabled)
+ {
+ detailsInfo.m_BiasTensorInfo = armnn::Optional<armnn::TensorInfo>(info.m_InputTensorInfos[2]);
+ }
+
+ // Report Profiling Details
+ ARMNN_REPORT_PROFILING_WORKLOAD_DESC("ClFullyConnectedWorkload_Construct",
+ descriptor.m_Parameters,
+ detailsInfo,
+ this->GetGuid());
}
void ClFullyConnectedWorkload::Execute() const