aboutsummaryrefslogtreecommitdiff
path: root/src/dynamic_fusion/sketch/gpu/components
diff options
context:
space:
mode:
authorRamy Elgammal <ramy.elgammal@arm.com>2022-11-30 16:23:10 +0000
committerRamy Elgammal <ramy.elgammal@arm.com>2022-12-09 13:57:49 +0000
commitdf6a3b05842a98702437347ca269138ccd55f852 (patch)
treed38b3cc83acfa0aa492b953b6a3c06104e0d76fc /src/dynamic_fusion/sketch/gpu/components
parent86689cdd95f634fb374f3875f62a4cb3408e1699 (diff)
downloadComputeLibrary-df6a3b05842a98702437347ca269138ccd55f852.tar.gz
Use heuristics for setting dynamic fusion direct conv2d tile sizes
Resolves: COMPMID-5735 Change-Id: I9958413b69c5052cfa205dd0e9457cc4953aaf35 Signed-off-by: Ramy Elgammal <ramy.elgammal@arm.com> Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/c/VisualCompute/ComputeLibrary/+/474818 Tested-by: bsgcomp <bsgcomp@arm.com> Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Comments-Addressed: bsgcomp <bsgcomp@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8724 Tested-by: Arm Jenkins <bsgcomp@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Benchmark: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/dynamic_fusion/sketch/gpu/components')
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.cpp18
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.h11
2 files changed, 26 insertions, 3 deletions
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.cpp
index dc05825500..1fbcb41028 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.cpp
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.cpp
@@ -57,13 +57,24 @@ bool ClComponentDirectConv2dSettings::fast_relaxed_math() const
return _fast_relaxed_math;
}
+ClComponentDirectConv2dSettings &ClComponentDirectConv2dSettings::direct_conv_descriptor(const DirectConvComputeKernelInfo &desc)
+{
+ _desc = desc;
+ return *this;
+}
+
+DirectConvComputeKernelInfo ClComponentDirectConv2dSettings::direct_conv_descriptor() const
+{
+ return _desc;
+}
+
Status ClComponentDirectConv2d::validate(
const Properties &properties,
const ArgumentPack<ITensorInfo> &tensors,
const Attributes &attributes,
const Settings &settings)
{
- ARM_COMPUTE_UNUSED(properties, settings);
+ ARM_COMPUTE_UNUSED(properties);
const auto src = tensors.get_const_tensor(TensorType::ACL_SRC_0);
const auto wei = tensors.get_const_tensor(TensorType::ACL_SRC_1);
const auto bia = tensors.get_const_tensor(TensorType::ACL_SRC_2);
@@ -125,6 +136,11 @@ Status ClComponentDirectConv2d::validate(
// Data layout
ARM_COMPUTE_RETURN_ERROR_ON_DATA_LAYOUT_NOT_IN(src, DataLayout::NHWC);
+ const auto desc = settings.direct_conv_descriptor();
+ ARM_COMPUTE_RETURN_ERROR_ON_MSG(desc.n0 != 1 && desc.n0 != 2 && desc.n0 != 3 && desc.n0 != 4 && desc.n0 != 8 && desc.n0 != 16,
+ "N0 can only be: 1, 2, 3, 4, 8, and 16");
+ ARM_COMPUTE_RETURN_ERROR_ON_MSG(desc.k0 != 1 && desc.k0 != 2 && desc.k0 != 3 && desc.k0 != 4 && desc.k0 != 8 && desc.k0 != 16,
+ "K0 can only be: 1, 2, 3, 4, 8, and 16");
return Status{};
}
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.h
index fec22b84a5..c3a70ef3ae 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.h
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.h
@@ -25,6 +25,7 @@
#define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTDIRECTCONV2D
#include "arm_compute/core/Error.h"
+#include "arm_compute/core/KernelDescriptors.h"
#include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h"
#include <memory>
@@ -56,9 +57,15 @@ public:
/** Get fast_relaxed_math flag */
bool fast_relaxed_math() const;
+ /** Set direct convolution descriptor */
+ ClComponentDirectConv2dSettings &direct_conv_descriptor(const DirectConvComputeKernelInfo &desc);
+ /** Get direct convolution descriptor */
+ DirectConvComputeKernelInfo direct_conv_descriptor() const;
+
private:
- bool _export_to_cl_image{ false };
- bool _fast_relaxed_math{ true };
+ bool _export_to_cl_image{ false };
+ bool _fast_relaxed_math{ true };
+ DirectConvComputeKernelInfo _desc{}; // Direct convolution descriptor
};
/** Forward declaration */