aboutsummaryrefslogtreecommitdiff
path: root/src/dynamic_fusion/sketch/gpu/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/dynamic_fusion/sketch/gpu/components')
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/GpuKernelComponentFactory.h7
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h15
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.cpp12
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.h18
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.cpp30
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.h10
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDepthwiseConv2d.cpp57
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDepthwiseConv2d.h34
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.cpp64
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.h26
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.cpp65
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.h12
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DMaxShiftExpSum.cpp14
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DMaxShiftExpSum.h7
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DNorm.cpp14
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DNorm.h7
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentPool2d.cpp49
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentPool2d.h21
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentReshape.cpp12
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentReshape.h5
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentResize.cpp14
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentResize.h13
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.cpp20
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.h5
-rw-r--r--src/dynamic_fusion/sketch/gpu/components/utils/type_printer/ElementwiseBinary.h22
25 files changed, 258 insertions, 295 deletions
diff --git a/src/dynamic_fusion/sketch/gpu/components/GpuKernelComponentFactory.h b/src/dynamic_fusion/sketch/gpu/components/GpuKernelComponentFactory.h
index f7f0029618..ee109a7e2b 100644
--- a/src/dynamic_fusion/sketch/gpu/components/GpuKernelComponentFactory.h
+++ b/src/dynamic_fusion/sketch/gpu/components/GpuKernelComponentFactory.h
@@ -24,8 +24,9 @@
#ifndef SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_GPUKERNELCOMPONENTFACTORY
#define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_GPUKERNELCOMPONENTFACTORY
-#include "Types.h"
#include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h"
+
+#include "Types.h"
#include <memory>
namespace arm_compute
@@ -49,13 +50,13 @@ public:
* @return std::unique_ptr<IGpuKernelComponent>
*/
template <typename T, typename... Args>
- std::unique_ptr<IGpuKernelComponent> create(Args &&... args)
+ std::unique_ptr<IGpuKernelComponent> create(Args &&...args)
{
return std::make_unique<T>(_count++, std::forward<Args>(args)...);
}
private:
- ComponentId _count{ 0 };
+ ComponentId _count{0};
};
} // namespace dynamic_fusion
diff --git a/src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h b/src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h
index af766a7ece..4b8eea2f57 100644
--- a/src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h
+++ b/src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h
@@ -24,11 +24,11 @@
#ifndef ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_IGPUKERNELCOMPONENT
#define ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_IGPUKERNELCOMPONENT
-#include "Types.h"
-
#include "src/dynamic_fusion/sketch/ArgumentPack.h"
#include "src/dynamic_fusion/sketch/gpu/GpuWorkloadSourceCode.h"
+#include "Types.h"
+
namespace arm_compute
{
namespace experimental
@@ -76,13 +76,8 @@ public:
* @param[in] properties Kernel component properties
* @param[in] tensors Tensor arguments to the components
*/
- IGpuKernelComponent(
- ComponentId id,
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors)
- : _id{ id },
- _properties{ properties },
- _tensors{ tensors }
+ IGpuKernelComponent(ComponentId id, const Properties &properties, const ArgumentPack<ITensorInfo> &tensors)
+ : _id{id}, _properties{properties}, _tensors{tensors}
{
}
/** Destructor */
@@ -117,7 +112,7 @@ public:
virtual GpuComponentType type() const = 0;
private:
- ComponentId _id{ -1 };
+ ComponentId _id{-1};
Properties _properties{};
ArgumentPack<ITensorInfo> _tensors{};
};
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.cpp
index c41257d18c..fdf528a65d 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.cpp
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.cpp
@@ -68,17 +68,11 @@ ClComponentActivation::ClComponentActivation(ComponentId
const IGpuKernelComponent::Properties &properties,
const ArgumentPack<ITensorInfo> &tensors,
const Attributes &attributes)
- : IGpuKernelComponent{ id, properties, tensors },
+ : IGpuKernelComponent{id, properties, tensors},
#ifndef ACL_INTERNAL_TEST_CKW_IN_DF
- _component_writer
-{
- std::make_unique<ClTemplateActivation>(id, tensors, attributes)
-}
+ _component_writer{std::make_unique<ClTemplateActivation>(id, tensors, attributes)}
#else //ACL_INTERNAL_TEST_CKW_IN_DF
- _component_writer
-{
- std::make_unique<GpuCkwActivation>(id, tensors, attributes)
-}
+ _component_writer{std::make_unique<GpuCkwActivation>(id, tensors, attributes)}
#endif //ACL_INTERNAL_TEST_CKW_IN_DF
{
}
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.h
index 9b090af988..02c854356a 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.h
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.h
@@ -25,9 +25,8 @@
#define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTACTIVATION
#include "arm_compute/function_info/ActivationLayerInfo.h"
-#include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h"
-#include "arm_compute/function_info/ActivationLayerInfo.h"
+#include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h"
namespace arm_compute
{
@@ -79,20 +78,17 @@ public:
* |F16 |F16 |
* |F32 |F32 |
*/
- static Status validate(
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors,
- const Attributes &attributes);
+ static Status
+ validate(const Properties &properties, const ArgumentPack<ITensorInfo> &tensors, const Attributes &attributes);
/** Constructor
*
* Similar to @ref ClComponentActivation::validate()
*/
- ClComponentActivation(
- ComponentId id,
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors,
- const Attributes &attributes);
+ ClComponentActivation(ComponentId id,
+ const Properties &properties,
+ const ArgumentPack<ITensorInfo> &tensors,
+ const Attributes &attributes);
/** Destructor */
~ClComponentActivation() override;
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.cpp
index 635869f817..b1636795a3 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.cpp
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.cpp
@@ -24,6 +24,7 @@
#include "ClComponentCast.h"
#include "arm_compute/core/Error.h"
+
#include "src/core/CL/CLValidate.h"
#include "src/dynamic_fusion/sketch/ArgumentPack.h"
#ifndef ACL_INTERNAL_TEST_CKW_IN_DF
@@ -38,11 +39,10 @@ namespace experimental
{
namespace dynamic_fusion
{
-Status ClComponentCast::validate(
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors,
- const Attributes &attributes,
- const Settings &settings)
+Status ClComponentCast::validate(const Properties &properties,
+ const ArgumentPack<ITensorInfo> &tensors,
+ const Attributes &attributes,
+ const Settings &settings)
{
ARM_COMPUTE_UNUSED(properties, attributes, settings);
@@ -53,13 +53,15 @@ Status ClComponentCast::validate(
ARM_COMPUTE_RETURN_ERROR_ON_F16_UNSUPPORTED(dst);
ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(src, dst);
ARM_COMPUTE_RETURN_ERROR_ON(src == dst);
- ARM_COMPUTE_RETURN_ERROR_ON_MSG(src->data_type() == attributes.data_type(), "input and target data types should be different");
+ ARM_COMPUTE_RETURN_ERROR_ON_MSG(src->data_type() == attributes.data_type(),
+ "input and target data types should be different");
// Validate in case of configured dst
- if(dst->total_size() > 0)
+ if (dst->total_size() > 0)
{
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(src, dst);
- ARM_COMPUTE_RETURN_ERROR_ON_MSG(dst->data_type() != attributes.data_type(), "dst and target data types should be same");
+ ARM_COMPUTE_RETURN_ERROR_ON_MSG(dst->data_type() != attributes.data_type(),
+ "dst and target data types should be same");
}
return Status{};
@@ -69,17 +71,11 @@ ClComponentCast::ClComponentCast(ComponentId id,
const ArgumentPack<ITensorInfo> &tensors,
const Attributes &attributes,
const Settings &settings)
- : IGpuKernelComponent{ id, properties, tensors },
+ : IGpuKernelComponent{id, properties, tensors},
#ifndef ACL_INTERNAL_TEST_CKW_IN_DF
- _component_writer
-{
- std::make_unique<ClTemplateCast>(id, tensors, attributes)
-}
+ _component_writer{std::make_unique<ClTemplateCast>(id, tensors, attributes)}
#else //ACL_INTERNAL_TEST_CKW_IN_DF
- _component_writer
-{
- std::make_unique<GpuCkwCast>(id, tensors, attributes)
-}
+ _component_writer{std::make_unique<GpuCkwCast>(id, tensors, attributes)}
#endif //ACL_INTERNAL_TEST_CKW_IN_DF
{
ARM_COMPUTE_UNUSED(attributes, settings);
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.h
index 37b8cbb6c9..ed77b1203b 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.h
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.h
@@ -25,6 +25,7 @@
#define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTCAST
#include "arm_compute/dynamic_fusion/sketch/attributes/CastAttributes.h"
+
#include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h"
namespace arm_compute
@@ -93,11 +94,10 @@ public:
* |F16 | U8, S8, U16, S16, U32, S32, F32 |
* |F32 | U8, S8, U16, S16, U32, S32, F16 |
*/
- static Status validate(
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors,
- const Attributes &attributes,
- const Settings &settings);
+ static Status validate(const Properties &properties,
+ const ArgumentPack<ITensorInfo> &tensors,
+ const Attributes &attributes,
+ const Settings &settings);
/** Constructor
*
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDepthwiseConv2d.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDepthwiseConv2d.cpp
index 5626093079..d95e0be1f2 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDepthwiseConv2d.cpp
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDepthwiseConv2d.cpp
@@ -26,6 +26,7 @@
#include "arm_compute/core/CL/CLHelpers.h"
#include "arm_compute/core/utils/misc/ShapeCalculator.h"
#include "arm_compute/dynamic_fusion/sketch/attributes/DepthwiseConv2dAttributes.h"
+
#include "src/core/CL/CLValidate.h"
#include "src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateDepthwiseConv2d.h"
@@ -103,11 +104,10 @@ unsigned int Settings::m0() const
return _m0;
}
-Status ClComponentDepthwiseConv2d::validate(
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors,
- const Attributes &attributes,
- const Settings &settings)
+Status ClComponentDepthwiseConv2d::validate(const Properties &properties,
+ const ArgumentPack<ITensorInfo> &tensors,
+ const Attributes &attributes,
+ const Settings &settings)
{
ARM_COMPUTE_UNUSED(properties, settings);
const auto src = tensors.get_const_tensor(TensorType::ACL_SRC_0);
@@ -121,7 +121,7 @@ Status ClComponentDepthwiseConv2d::validate(
// Matching data type
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(src, wei);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(src, dst);
- if(bia != nullptr)
+ if (bia != nullptr)
{
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(src, bia);
}
@@ -129,7 +129,7 @@ Status ClComponentDepthwiseConv2d::validate(
// Matching data layout
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(src, wei);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(src, dst);
- if(bia != nullptr)
+ if (bia != nullptr)
{
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(src, bia);
}
@@ -138,7 +138,7 @@ Status ClComponentDepthwiseConv2d::validate(
ARM_COMPUTE_RETURN_ERROR_ON(src->tensor_shape().total_size() == 0);
ARM_COMPUTE_RETURN_ERROR_ON(wei->tensor_shape().total_size() == 0);
ARM_COMPUTE_RETURN_ERROR_ON(dst->tensor_shape().total_size() == 0);
- if(bia != nullptr)
+ if (bia != nullptr)
{
ARM_COMPUTE_RETURN_ERROR_ON(bia->tensor_shape().total_size() == 0);
}
@@ -148,16 +148,17 @@ Status ClComponentDepthwiseConv2d::validate(
const DataLayout data_layout = src->data_layout();
const size_t channel_idx = get_data_layout_dimension_index(data_layout, DataLayoutDimension::CHANNEL);
- ARM_COMPUTE_RETURN_ERROR_ON(wei->dimension(channel_idx) != (src->dimension(channel_idx) * attributes.depth_multiplier()));
+ ARM_COMPUTE_RETURN_ERROR_ON(wei->dimension(channel_idx) !=
+ (src->dimension(channel_idx) * attributes.depth_multiplier()));
ARM_COMPUTE_RETURN_ERROR_ON_MSG(wei->num_dimensions() > 3, "Weights can be at most 3 dimensional");
// dst shape is correct
- const PadStrideInfo pad_stride_info = PadStrideInfo(attributes.stride().x(), attributes.stride().y(),
- attributes.pad().left, attributes.pad().right,
- attributes.pad().top, attributes.pad().bottom,
- attributes.dimension_rounding_type());
- const ConvolutionInfo conv_info{ pad_stride_info, attributes.depth_multiplier(), ActivationLayerInfo(), attributes.dilation() };
- const TensorShape output_shape = misc::shape_calculator::compute_depthwise_convolution_shape(*src, *wei, conv_info);
+ const PadStrideInfo pad_stride_info =
+ PadStrideInfo(attributes.stride().x(), attributes.stride().y(), attributes.pad().left, attributes.pad().right,
+ attributes.pad().top, attributes.pad().bottom, attributes.dimension_rounding_type());
+ const ConvolutionInfo conv_info{pad_stride_info, attributes.depth_multiplier(), ActivationLayerInfo(),
+ attributes.dilation()};
+ const TensorShape output_shape = misc::shape_calculator::compute_depthwise_convolution_shape(*src, *wei, conv_info);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DIMENSIONS(dst->tensor_shape(), output_shape);
@@ -168,19 +169,22 @@ Status ClComponentDepthwiseConv2d::validate(
ARM_COMPUTE_RETURN_ERROR_ON(conv_info.pad_stride_info.stride().first > 1 && settings.m0() != 1);
ARM_COMPUTE_RETURN_ERROR_ON(conv_info.dilation.x() > 1 && settings.m0() != 1);
- if(conv_info.depth_multiplier > 1 && settings.n0() > 1)
+ if (conv_info.depth_multiplier > 1 && settings.n0() > 1)
{
ARM_COMPUTE_RETURN_ERROR_ON((conv_info.depth_multiplier % settings.n0()) != 0);
}
// Check export weights to cl image
- ARM_COMPUTE_RETURN_ERROR_ON_MSG((settings.export_weights_to_cl_image() == true) && (export_to_cl_image(wei) == false), "Weights cannot be exported to cl_image!");
+ ARM_COMPUTE_RETURN_ERROR_ON_MSG((settings.export_weights_to_cl_image() == true) &&
+ (export_to_cl_image(wei) == false),
+ "Weights cannot be exported to cl_image!");
ARM_COMPUTE_RETURN_ERROR_ON((settings.export_weights_to_cl_image() == true) && ((settings.n0() % 4) != 0));
- ARM_COMPUTE_RETURN_ERROR_ON(wei->dimension(channel_idx) != (src->dimension(channel_idx) * conv_info.depth_multiplier));
+ ARM_COMPUTE_RETURN_ERROR_ON(wei->dimension(channel_idx) !=
+ (src->dimension(channel_idx) * conv_info.depth_multiplier));
// bia shape is correct
- if(bia != nullptr)
+ if (bia != nullptr)
{
ARM_COMPUTE_RETURN_ERROR_ON_MSG(bia->dimension(0) != output_shape[channel_idx],
"Biases size and number of dst feature maps should match");
@@ -198,14 +202,13 @@ Status ClComponentDepthwiseConv2d::validate(
return Status{};
}
-ClComponentDepthwiseConv2d::ClComponentDepthwiseConv2d(
- ComponentId id,
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors,
- const Attributes &attributes,
- const Settings &settings)
- : IGpuKernelComponent{ id, properties, tensors },
- _component_writer{ std::make_unique<ClTemplateDepthwiseConv2d>(id, tensors, attributes, settings) }
+ClComponentDepthwiseConv2d::ClComponentDepthwiseConv2d(ComponentId id,
+ const Properties &properties,
+ const ArgumentPack<ITensorInfo> &tensors,
+ const Attributes &attributes,
+ const Settings &settings)
+ : IGpuKernelComponent{id, properties, tensors},
+ _component_writer{std::make_unique<ClTemplateDepthwiseConv2d>(id, tensors, attributes, settings)}
{
}
ClComponentDepthwiseConv2d::~ClComponentDepthwiseConv2d()
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDepthwiseConv2d.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDepthwiseConv2d.h
index 0e2b5f14cb..b3e1bd222d 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDepthwiseConv2d.h
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDepthwiseConv2d.h
@@ -25,7 +25,9 @@
#define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTDEPTHWISECONV2D
#include "arm_compute/core/Error.h"
+
#include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h"
+
#include <memory>
namespace arm_compute
@@ -77,12 +79,12 @@ public:
unsigned int m0() const;
private:
- bool _export_input_to_cl_image{ false }; /**< Export input to cl_image */
- bool _export_weights_to_cl_image{ false }; /**< Export the weights to cl_image */
- bool _fast_relaxed_math{ true }; /**< Enable/disable -cl-fast-relaxed-math flag */
- bool _is_fma_available{ false }; /**< Is fma instruction available */
- unsigned int _n0{ 0 }; /**< Number of columns processed by each thread */
- unsigned int _m0{ 0 }; /**< Number of rows processed by each thread */
+ bool _export_input_to_cl_image{false}; /**< Export input to cl_image */
+ bool _export_weights_to_cl_image{false}; /**< Export the weights to cl_image */
+ bool _fast_relaxed_math{true}; /**< Enable/disable -cl-fast-relaxed-math flag */
+ bool _is_fma_available{false}; /**< Is fma instruction available */
+ unsigned int _n0{0}; /**< Number of columns processed by each thread */
+ unsigned int _m0{0}; /**< Number of rows processed by each thread */
};
/** Forward declaration */
@@ -127,22 +129,20 @@ public:
* |F16 |F16 |F16 |F16 |
* |F32 |F32 |F32 |F32 |
*/
- static Status validate(
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors,
- const Attributes &attributes,
- const Settings &settings);
+ static Status validate(const Properties &properties,
+ const ArgumentPack<ITensorInfo> &tensors,
+ const Attributes &attributes,
+ const Settings &settings);
/** Constructor
*
* Similar to @ref ClComponentDepthwiseConv2d::validate()
*/
- ClComponentDepthwiseConv2d(
- ComponentId id,
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors,
- const Attributes &attributes,
- const Settings &settings);
+ ClComponentDepthwiseConv2d(ComponentId id,
+ const Properties &properties,
+ const ArgumentPack<ITensorInfo> &tensors,
+ const Attributes &attributes,
+ const Settings &settings);
/** Destructor */
~ClComponentDepthwiseConv2d() override;
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.cpp
index a713c82003..98f3d6a882 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.cpp
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.cpp
@@ -23,8 +23,8 @@
*/
#include "ClComponentDirectConv2d.h"
-#include "arm_compute/core/Validate.h"
#include "arm_compute/core/utils/misc/ShapeCalculator.h"
+#include "arm_compute/core/Validate.h"
#include "arm_compute/dynamic_fusion/sketch/attributes/Conv2dAttributes.h"
#include "src/core/CL/CLValidate.h"
@@ -57,7 +57,8 @@ bool ClComponentDirectConv2dSettings::fast_relaxed_math() const
return _fast_relaxed_math;
}
-ClComponentDirectConv2dSettings &ClComponentDirectConv2dSettings::direct_conv_descriptor(const DirectConvComputeKernelInfo &desc)
+ClComponentDirectConv2dSettings &
+ClComponentDirectConv2dSettings::direct_conv_descriptor(const DirectConvComputeKernelInfo &desc)
{
_desc = desc;
return *this;
@@ -68,11 +69,10 @@ DirectConvComputeKernelInfo ClComponentDirectConv2dSettings::direct_conv_descrip
return _desc;
}
-Status ClComponentDirectConv2d::validate(
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors,
- const Attributes &attributes,
- const Settings &settings)
+Status ClComponentDirectConv2d::validate(const Properties &properties,
+ const ArgumentPack<ITensorInfo> &tensors,
+ const Attributes &attributes,
+ const Settings &settings)
{
ARM_COMPUTE_UNUSED(properties);
const auto src = tensors.get_const_tensor(TensorType::ACL_SRC_0);
@@ -86,7 +86,7 @@ Status ClComponentDirectConv2d::validate(
// Matching data type
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(src, wei);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(src, dst);
- if(bia != nullptr)
+ if (bia != nullptr)
{
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(src, bia);
}
@@ -94,7 +94,7 @@ Status ClComponentDirectConv2d::validate(
// Matching data layout
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(src, wei);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(src, dst);
- if(bia != nullptr)
+ if (bia != nullptr)
{
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(src, bia);
}
@@ -103,7 +103,7 @@ Status ClComponentDirectConv2d::validate(
ARM_COMPUTE_RETURN_ERROR_ON(src->tensor_shape().total_size() == 0);
ARM_COMPUTE_RETURN_ERROR_ON(wei->tensor_shape().total_size() == 0);
ARM_COMPUTE_RETURN_ERROR_ON(dst->tensor_shape().total_size() == 0);
- if(bia != nullptr)
+ if (bia != nullptr)
{
ARM_COMPUTE_RETURN_ERROR_ON(bia->tensor_shape().total_size() == 0);
}
@@ -112,22 +112,23 @@ Status ClComponentDirectConv2d::validate(
// wei shape is correct
const DataLayout data_layout = src->data_layout();
const int channel_idx = get_data_layout_dimension_index(data_layout, DataLayoutDimension::CHANNEL);
- ARM_COMPUTE_RETURN_ERROR_ON_MSG(wei->dimension(channel_idx) != src->dimension(channel_idx), "Weights feature map dimension should match the respective src's one");
+ ARM_COMPUTE_RETURN_ERROR_ON_MSG(wei->dimension(channel_idx) != src->dimension(channel_idx),
+ "Weights feature map dimension should match the respective src's one");
ARM_COMPUTE_RETURN_ERROR_ON_MSG(wei->num_dimensions() > 4, "Weights can be at most 4 dimensional");
// dst shape is correct
- PadStrideInfo legacy_pad_stride(attributes.stride().x(), attributes.stride().y(), attributes.pad().left, attributes.pad().right, attributes.pad().top,
- attributes.pad().bottom, DimensionRoundingType{});
- ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DIMENSIONS(dst->tensor_shape(),
- misc::shape_calculator::compute_deep_convolution_shape(*src, *wei, legacy_pad_stride));
+ PadStrideInfo legacy_pad_stride(attributes.stride().x(), attributes.stride().y(), attributes.pad().left,
+ attributes.pad().right, attributes.pad().top, attributes.pad().bottom,
+ DimensionRoundingType{});
+ ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DIMENSIONS(
+ dst->tensor_shape(), misc::shape_calculator::compute_deep_convolution_shape(*src, *wei, legacy_pad_stride));
// bia shape is correct
- if(bia != nullptr)
+ if (bia != nullptr)
{
ARM_COMPUTE_RETURN_ERROR_ON_MSG(bia->dimension(0) != wei->dimension(3),
"Biases size and number of dst feature maps should match");
- ARM_COMPUTE_RETURN_ERROR_ON_MSG(bia->num_dimensions() > 1,
- "Biases should be one dimensional");
+ ARM_COMPUTE_RETURN_ERROR_ON_MSG(bia->num_dimensions() > 1, "Biases should be one dimensional");
}
// 2. Check support level
@@ -137,24 +138,25 @@ Status ClComponentDirectConv2d::validate(
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,
+ 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,
+ 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{};
}
-ClComponentDirectConv2d::ClComponentDirectConv2d(
- ComponentId id,
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors,
- const Attributes &attributes,
- const Settings &settings)
- : IGpuKernelComponent{ id, properties, tensors },
+ClComponentDirectConv2d::ClComponentDirectConv2d(ComponentId id,
+ const Properties &properties,
+ const ArgumentPack<ITensorInfo> &tensors,
+ const Attributes &attributes,
+ const Settings &settings)
+ : IGpuKernelComponent{id, properties, tensors},
#ifndef ACL_INTERNAL_TEST_CKW_IN_DF
- _component_writer{ std::make_unique<ClTemplateDirectConv2d>(id, tensors, attributes, settings) }
-#else // ACL_INTERNAL_TEST_CKW_IN_DF
- _component_writer{ std::make_unique<GpuCkwDirectConv2d>(id, tensors, attributes, settings) }
+ _component_writer{std::make_unique<ClTemplateDirectConv2d>(id, tensors, attributes, settings)}
+#else // ACL_INTERNAL_TEST_CKW_IN_DF
+ _component_writer{std::make_unique<GpuCkwDirectConv2d>(id, tensors, attributes, settings)}
#endif // ACL_INTERNAL_TEST_CKW_IN_DF
{
}
@@ -165,7 +167,7 @@ ClComponentDirectConv2d::~ClComponentDirectConv2d()
#ifndef ACL_INTERNAL_TEST_CKW_IN_DF
const IGpuTemplateComponentWriter *ClComponentDirectConv2d::template_writer() const
-#else // ACL_INTERNAL_TEST_CKW_IN_DF
+#else // ACL_INTERNAL_TEST_CKW_IN_DF
const IGpuCkwComponentDriver *ClComponentDirectConv2d::ckw_component_driver() const
#endif // ACL_INTERNAL_TEST_CKW_IN_DF
{
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.h
index 24acb1b2c1..d6d9705d3c 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.h
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.h
@@ -26,7 +26,9 @@
#include "arm_compute/core/Error.h"
#include "arm_compute/core/KernelDescriptors.h"
+
#include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h"
+
#include <memory>
namespace arm_compute
@@ -61,7 +63,7 @@ public:
DirectConvComputeKernelInfo direct_conv_descriptor() const;
private:
- bool _fast_relaxed_math{ true };
+ bool _fast_relaxed_math{true};
DirectConvComputeKernelInfo _desc{}; // Direct convolution descriptor
};
@@ -111,22 +113,20 @@ public:
* |F16 |F16 |F16 |F16 |
* |F32 |F32 |F32 |F32 |
*/
- static Status validate(
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors,
- const Attributes &attributes,
- const Settings &settings);
+ static Status validate(const Properties &properties,
+ const ArgumentPack<ITensorInfo> &tensors,
+ const Attributes &attributes,
+ const Settings &settings);
/** Constructor
*
* Similar to @ref ClComponentDirectConv2d::validate()
*/
- ClComponentDirectConv2d(
- ComponentId id,
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors,
- const Attributes &attributes,
- const Settings &settings);
+ ClComponentDirectConv2d(ComponentId id,
+ const Properties &properties,
+ const ArgumentPack<ITensorInfo> &tensors,
+ const Attributes &attributes,
+ const Settings &settings);
/** Destructor */
~ClComponentDirectConv2d() override;
@@ -142,7 +142,7 @@ public:
#ifndef ACL_INTERNAL_TEST_CKW_IN_DF
const IGpuTemplateComponentWriter *template_writer() const override;
#else // ACL_INTERNAL_TEST_CKW_IN_DF
- const IGpuCkwComponentDriver *ckw_component_driver() const override;
+ const IGpuCkwComponentDriver *ckw_component_driver() const override;
#endif // ACL_INTERNAL_TEST_CKW_IN_DF
/** Get component type */
GpuComponentType type() const override
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.cpp
index 88d729170c..5b136427e4 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.cpp
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.cpp
@@ -24,6 +24,7 @@
#include "ClComponentElementwiseBinary.h"
#include "arm_compute/core/Validate.h"
+
#include "src/core/CL/CLValidate.h"
#ifndef ACL_INTERNAL_TEST_CKW_IN_DF
#include "src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateElementwiseBinary.h"
@@ -39,56 +40,55 @@ namespace dynamic_fusion
{
namespace
{
-std::set<ElementwiseBinaryCommonAttributes::ElementwiseOp> supported_ops
-{
- ElementwiseBinaryCommonAttributes::ElementwiseOp::Add,
- ElementwiseBinaryCommonAttributes::ElementwiseOp::Sub,
- ElementwiseBinaryCommonAttributes::ElementwiseOp::Mul
-};
+std::set<ElementwiseBinaryCommonAttributes::ElementwiseOp> supported_ops{
+ ElementwiseBinaryCommonAttributes::ElementwiseOp::Add, ElementwiseBinaryCommonAttributes::ElementwiseOp::Sub,
+ ElementwiseBinaryCommonAttributes::ElementwiseOp::Mul};
}
-Status ClComponentElementwiseBinary::validate(const ArgumentPack<ITensorInfo> &tensors, const ElementwiseBinaryCommonAttributes &attributes)
+Status ClComponentElementwiseBinary::validate(const ArgumentPack<ITensorInfo> &tensors,
+ const ElementwiseBinaryCommonAttributes &attributes)
{
const auto lhs = tensors.get_const_tensor(TensorType::ACL_SRC_0);
const auto rhs = tensors.get_const_tensor(TensorType::ACL_SRC_1);
const auto dst = tensors.get_const_tensor(TensorType::ACL_DST_0);
// Check operator type
- ARM_COMPUTE_RETURN_ERROR_ON_MSG(supported_ops.find(attributes.operation()) == supported_ops.end(), "Provided Elementwise operation not supported.");
+ ARM_COMPUTE_RETURN_ERROR_ON_MSG(supported_ops.find(attributes.operation()) == supported_ops.end(),
+ "Provided Elementwise operation not supported.");
// Check validity
ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(lhs, rhs, dst);
//Check data type for different elementwise operators
- ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(lhs, 1, DataType::F32, DataType::F16, DataType::S32, DataType::S16, DataType::U8);
+ ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(lhs, 1, DataType::F32, DataType::F16, DataType::S32,
+ DataType::S16, DataType::U8);
// dst shape is correct
const TensorShape out_shape = TensorShape::broadcast_shape(lhs->tensor_shape(), rhs->tensor_shape());
ARM_COMPUTE_RETURN_ERROR_ON_MSG(out_shape.total_size() == 0, "Inputs are not broadcast compatible");
- ARM_COMPUTE_RETURN_ERROR_ON_MSG(detail::have_different_dimensions(out_shape, dst->tensor_shape(), 0), "Wrong shape for dst.");
+ ARM_COMPUTE_RETURN_ERROR_ON_MSG(detail::have_different_dimensions(out_shape, dst->tensor_shape(), 0),
+ "Wrong shape for dst.");
const auto &lhs_shape = lhs->tensor_shape();
const auto &rhs_shape = rhs->tensor_shape();
const auto &dst_shape = dst->tensor_shape();
- ARM_COMPUTE_RETURN_ERROR_ON_MSG(
- detail::have_different_dimensions(lhs_shape, dst_shape, 0) && detail::have_different_dimensions(rhs_shape, dst_shape, 0),
- "Only LHS or RHS can be broadcasting, not both.");
+ ARM_COMPUTE_RETURN_ERROR_ON_MSG(detail::have_different_dimensions(lhs_shape, dst_shape, 0) &&
+ detail::have_different_dimensions(rhs_shape, dst_shape, 0),
+ "Only LHS or RHS can be broadcasting, not both.");
// Dimension Y and Z are collapsed together in the current kernel implementation,
// hence they cannot be independently broadcast or non-broadcast.
// See: ClTemplateElementwiseBinary::get_window
- ARM_COMPUTE_RETURN_ERROR_ON_MSG(
- (lhs_shape[1] != dst_shape[1] || rhs_shape[1] != dst_shape[1]) != (lhs_shape[2] != dst_shape[2] || rhs_shape[2] != dst_shape[2]),
- "Dimension Y and Z must both be either broadcast or non-broadcast.");
+ ARM_COMPUTE_RETURN_ERROR_ON_MSG((lhs_shape[1] != dst_shape[1] || rhs_shape[1] != dst_shape[1]) !=
+ (lhs_shape[2] != dst_shape[2] || rhs_shape[2] != dst_shape[2]),
+ "Dimension Y and Z must both be either broadcast or non-broadcast.");
- ARM_COMPUTE_RETURN_ERROR_ON_MSG(
- detail::have_different_dimensions(lhs_shape, dst_shape, 3),
- "LHS broadcast in dimension 3 or higher is not supported.");
+ ARM_COMPUTE_RETURN_ERROR_ON_MSG(detail::have_different_dimensions(lhs_shape, dst_shape, 3),
+ "LHS broadcast in dimension 3 or higher is not supported.");
- ARM_COMPUTE_RETURN_ERROR_ON_MSG(
- detail::have_different_dimensions(rhs_shape, dst_shape, 3),
- "RHS broadcast in dimension 3 or higher is not supported.");
+ ARM_COMPUTE_RETURN_ERROR_ON_MSG(detail::have_different_dimensions(rhs_shape, dst_shape, 3),
+ "RHS broadcast in dimension 3 or higher is not supported.");
// Matching data type
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(lhs, rhs);
@@ -112,22 +112,15 @@ Status ClComponentElementwiseBinary::validate(const ArgumentPack<ITensorInfo> &t
ClComponentElementwiseBinary::~ClComponentElementwiseBinary()
{
}
-ClComponentElementwiseBinary::ClComponentElementwiseBinary(
- ComponentId id,
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors,
- const Attributes &attributes)
- : IGpuKernelComponent{ id, properties, tensors },
+ClComponentElementwiseBinary::ClComponentElementwiseBinary(ComponentId id,
+ const Properties &properties,
+ const ArgumentPack<ITensorInfo> &tensors,
+ const Attributes &attributes)
+ : IGpuKernelComponent{id, properties, tensors},
#ifndef ACL_INTERNAL_TEST_CKW_IN_DF
- _component_writer
-{
- std::make_unique<ClTemplateElementwiseBinary>(id, tensors, attributes)
-}
+ _component_writer{std::make_unique<ClTemplateElementwiseBinary>(id, tensors, attributes)}
#else //ACL_INTERNAL_TEST_CKW_IN_DF
- _component_writer
-{
- std::make_unique<GpuCkwElementwiseBinary>(id, tensors, attributes)
-}
+ _component_writer{std::make_unique<GpuCkwElementwiseBinary>(id, tensors, attributes)}
#endif //ACL_INTERNAL_TEST_CKW_IN_DF
{
}
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.h
index f7175903d0..7589b9732c 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.h
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.h
@@ -82,17 +82,17 @@ public:
* |S16 |S16 |S16 |
* |U8 |U8 |U8 |
*/
- static Status validate(const ArgumentPack<ITensorInfo> &tensors, const ElementwiseBinaryCommonAttributes &attributes);
+ static Status validate(const ArgumentPack<ITensorInfo> &tensors,
+ const ElementwiseBinaryCommonAttributes &attributes);
/** Constructor
*
* Similar to @ref ClComponentElementwiseBinary::validate()
*/
- ClComponentElementwiseBinary(
- ComponentId id,
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors,
- const Attributes &attributes);
+ ClComponentElementwiseBinary(ComponentId id,
+ const Properties &properties,
+ const ArgumentPack<ITensorInfo> &tensors,
+ const Attributes &attributes);
/** Destructor */
~ClComponentElementwiseBinary() override;
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DMaxShiftExpSum.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DMaxShiftExpSum.cpp
index 279c77e227..27c13bd654 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DMaxShiftExpSum.cpp
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DMaxShiftExpSum.cpp
@@ -25,9 +25,10 @@
#include "src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DMaxShiftExpSum.h"
#include "arm_compute/core/CL/CLHelpers.h"
-#include "arm_compute/core/Validate.h"
#include "arm_compute/core/utils/misc/ShapeCalculator.h"
+#include "arm_compute/core/Validate.h"
#include "arm_compute/dynamic_fusion/sketch/attributes/SoftmaxAttributes.h"
+
#include "src/core/CL/CLValidate.h"
#include "src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateLogits1DMaxShiftExpSum.h"
@@ -37,10 +38,9 @@ namespace experimental
{
namespace dynamic_fusion
{
-Status ClComponentLogits1DMaxShiftExpSum::validate(
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors,
- const Attributes &attributes)
+Status ClComponentLogits1DMaxShiftExpSum::validate(const Properties &properties,
+ const ArgumentPack<ITensorInfo> &tensors,
+ const Attributes &attributes)
{
ARM_COMPUTE_UNUSED(properties, attributes);
@@ -75,8 +75,8 @@ ClComponentLogits1DMaxShiftExpSum::ClComponentLogits1DMaxShiftExpSum(ComponentId
const Properties &properties,
const ArgumentPack<ITensorInfo> &tensors,
const Attributes &attributes)
- : IGpuKernelComponent{ id, properties, tensors },
- _component_writer{ std::make_unique<ClTemplateLogits1DMaxShiftExpSum>(id, tensors, attributes) }
+ : IGpuKernelComponent{id, properties, tensors},
+ _component_writer{std::make_unique<ClTemplateLogits1DMaxShiftExpSum>(id, tensors, attributes)}
{
}
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DMaxShiftExpSum.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DMaxShiftExpSum.h
index b5db458248..91ab5de3b5 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DMaxShiftExpSum.h
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DMaxShiftExpSum.h
@@ -25,6 +25,7 @@
#define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTLOGITS1DMAXSHIFTEXPSUM
#include "arm_compute/dynamic_fusion/sketch/attributes/SoftmaxAttributes.h"
+
#include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h"
namespace arm_compute
@@ -89,10 +90,8 @@ public:
* |F16 | F16 | F16 |
* |F32 | F32 | F32 |
*/
- static Status validate(
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors,
- const Attributes &attributes);
+ static Status
+ validate(const Properties &properties, const ArgumentPack<ITensorInfo> &tensors, const Attributes &attributes);
/** Constructor
*
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DNorm.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DNorm.cpp
index 7864d56d29..fb2544385c 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DNorm.cpp
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DNorm.cpp
@@ -25,9 +25,10 @@
#include "src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DNorm.h"
#include "arm_compute/core/CL/CLHelpers.h"
-#include "arm_compute/core/Validate.h"
#include "arm_compute/core/utils/misc/ShapeCalculator.h"
+#include "arm_compute/core/Validate.h"
#include "arm_compute/dynamic_fusion/sketch/attributes/SoftmaxAttributes.h"
+
#include "src/core/CL/CLValidate.h"
#include "src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateLogits1DNorm.h"
@@ -37,10 +38,9 @@ namespace experimental
{
namespace dynamic_fusion
{
-Status ClComponentLogits1DNorm::validate(
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors,
- const Attributes &attributes)
+Status ClComponentLogits1DNorm::validate(const Properties &properties,
+ const ArgumentPack<ITensorInfo> &tensors,
+ const Attributes &attributes)
{
ARM_COMPUTE_UNUSED(properties, attributes);
@@ -77,8 +77,8 @@ ClComponentLogits1DNorm::ClComponentLogits1DNorm(ComponentId
const Properties &properties,
const ArgumentPack<ITensorInfo> &tensors,
const Attributes &attributes)
- : IGpuKernelComponent{ id, properties, tensors },
- _component_writer{ std::make_unique<ClTemplateLogits1DNorm>(id, tensors, attributes) }
+ : IGpuKernelComponent{id, properties, tensors},
+ _component_writer{std::make_unique<ClTemplateLogits1DNorm>(id, tensors, attributes)}
{
}
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DNorm.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DNorm.h
index 5bd350b9bd..74c0273604 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DNorm.h
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DNorm.h
@@ -25,6 +25,7 @@
#define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTLOGITS1DNORM
#include "arm_compute/dynamic_fusion/sketch/attributes/SoftmaxAttributes.h"
+
#include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h"
namespace arm_compute
@@ -86,10 +87,8 @@ public:
* |F16 | F16 | F16 |
* |F32 | F32 | F32 |
*/
- static Status validate(
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors,
- const Attributes &attributes);
+ static Status
+ validate(const Properties &properties, const ArgumentPack<ITensorInfo> &tensors, const Attributes &attributes);
/** Constructor
*
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentPool2d.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentPool2d.cpp
index d415769094..409b191df5 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentPool2d.cpp
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentPool2d.cpp
@@ -24,13 +24,15 @@
#include "ClComponentPool2d.h"
#include "arm_compute/core/Error.h"
-#include "arm_compute/core/Validate.h"
#include "arm_compute/core/utils/misc/ShapeCalculator.h"
+#include "arm_compute/core/Validate.h"
#include "arm_compute/dynamic_fusion/sketch/attributes/Pool2dAttributes.h"
+
#include "src/core/CL/CLValidate.h"
#include "src/dynamic_fusion/sketch/gpu/ckw_driver/components/GpuCkwPool2d.h"
#include "src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplatePool2d.h"
#include "src/dynamic_fusion/utils/Utils.h"
+
#include <memory>
namespace arm_compute
@@ -39,23 +41,24 @@ namespace experimental
{
namespace dynamic_fusion
{
-Status ClComponentPool2d::validate(
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors,
- const Attributes &attributes,
- const Settings &settings)
+Status ClComponentPool2d::validate(const Properties &properties,
+ const ArgumentPack<ITensorInfo> &tensors,
+ const Attributes &attributes,
+ const Settings &settings)
{
ARM_COMPUTE_UNUSED(properties);
const auto src = tensors.get_const_tensor(TensorType::ACL_SRC_0);
const auto dst = tensors.get_const_tensor(TensorType::ACL_DST_0);
ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(src, dst);
- ARM_COMPUTE_ERROR_ON_MSG((attributes.pool_type() != PoolingType::AVG && attributes.pool_type() != PoolingType::MAX), "Unsupported Pooling type");
+ ARM_COMPUTE_ERROR_ON_MSG((attributes.pool_type() != PoolingType::AVG && attributes.pool_type() != PoolingType::MAX),
+ "Unsupported Pooling type");
// 1. Check validity
// Check if pooling is valid
- ARM_COMPUTE_RETURN_ERROR_ON_MSG(is_pool_region_entirely_outside_input(convert_pool_attr_to_pool_info(attributes, settings.mixed_precision())),
- "Pooling region that is entirely outside input tensor is unsupported");
+ ARM_COMPUTE_RETURN_ERROR_ON_MSG(
+ is_pool_region_entirely_outside_input(convert_pool_attr_to_pool_info(attributes, settings.mixed_precision())),
+ "Pooling region that is entirely outside input tensor is unsupported");
// Matching data type
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(src, dst);
@@ -70,8 +73,9 @@ Status ClComponentPool2d::validate(
// Device requirements are met
ARM_COMPUTE_RETURN_ERROR_ON_F16_UNSUPPORTED(src);
- ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DIMENSIONS(dst->tensor_shape(),
- misc::shape_calculator::compute_pool_shape(*src, convert_pool_attr_to_pool_info(attributes, settings.mixed_precision())));
+ ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DIMENSIONS(
+ dst->tensor_shape(), misc::shape_calculator::compute_pool_shape(
+ *src, convert_pool_attr_to_pool_info(attributes, settings.mixed_precision())));
// 2. Check support level
// Data type
@@ -83,23 +87,16 @@ Status ClComponentPool2d::validate(
return Status{};
}
-ClComponentPool2d::ClComponentPool2d(
- ComponentId id,
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors,
- const Attributes &attributes,
- const Settings &settings)
- : IGpuKernelComponent{ id, properties, tensors },
+ClComponentPool2d::ClComponentPool2d(ComponentId id,
+ const Properties &properties,
+ const ArgumentPack<ITensorInfo> &tensors,
+ const Attributes &attributes,
+ const Settings &settings)
+ : IGpuKernelComponent{id, properties, tensors},
#ifndef ACL_INTERNAL_TEST_CKW_IN_DF
- _component_writer
-{
- std::make_unique<ClTemplatePool2d>(id, tensors, attributes, settings)
-}
+ _component_writer{std::make_unique<ClTemplatePool2d>(id, tensors, attributes, settings)}
#else //ACL_INTERNAL_TEST_CKW_IN_DF
- _component_writer
-{
- std::make_unique<GpuCkwPool2d>(id, tensors, attributes, settings)
-}
+ _component_writer{std::make_unique<GpuCkwPool2d>(id, tensors, attributes, settings)}
#endif //ACL_INTERNAL_TEST_CKW_IN_DF
{
}
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentPool2d.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentPool2d.h
index 6814bf9243..98fed65004 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentPool2d.h
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentPool2d.h
@@ -25,6 +25,7 @@
#define ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTPOOL2D_H
#include "arm_compute/dynamic_fusion/sketch/gpu/operators/GpuPool2d.h"
+
#include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h"
namespace arm_compute
@@ -82,11 +83,10 @@ public:
* |F16 |F16 |
* |F32 |F32 |
*/
- static Status validate(
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors,
- const Attributes &attributes,
- const Settings &settings);
+ static Status validate(const Properties &properties,
+ const ArgumentPack<ITensorInfo> &tensors,
+ const Attributes &attributes,
+ const Settings &settings);
/** Constructor
*
@@ -96,12 +96,11 @@ public:
* @param[in] attributes Component attributes
* @param[in] settings Component settings
*/
- ClComponentPool2d(
- ComponentId id,
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors,
- const Attributes &attributes,
- const Settings &settings);
+ ClComponentPool2d(ComponentId id,
+ const Properties &properties,
+ const ArgumentPack<ITensorInfo> &tensors,
+ const Attributes &attributes,
+ const Settings &settings);
/** Destructor */
~ClComponentPool2d() override;
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentReshape.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentReshape.cpp
index 66e2ee6956..0ece9de970 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentReshape.cpp
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentReshape.cpp
@@ -22,8 +22,10 @@
* SOFTWARE.
*/
#include "ClComponentReshape.h"
+
#include "arm_compute/core/Error.h"
#include "arm_compute/core/Validate.h"
+
#include "src/core/CL/CLValidate.h"
#include "src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateReshape.h"
@@ -49,12 +51,10 @@ Status ClComponentReshape::validate(const ArgumentPack<ITensorInfo> &tensors)
return Status{};
}
-ClComponentReshape::ClComponentReshape(
- ComponentId id,
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors)
- : IGpuKernelComponent{ id, properties, tensors },
- _component_writer{ std::make_unique<ClTemplateReshape>(id, tensors) }
+ClComponentReshape::ClComponentReshape(ComponentId id,
+ const Properties &properties,
+ const ArgumentPack<ITensorInfo> &tensors)
+ : IGpuKernelComponent{id, properties, tensors}, _component_writer{std::make_unique<ClTemplateReshape>(id, tensors)}
{
}
ClComponentReshape::~ClComponentReshape()
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentReshape.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentReshape.h
index f8d165b4c8..78163d6603 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentReshape.h
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentReshape.h
@@ -73,10 +73,7 @@ public:
* @param[in] properties Component properties @ref Properties
* @param[in] tensors Tensor arguments to the component
*/
- ClComponentReshape(
- ComponentId id,
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors);
+ ClComponentReshape(ComponentId id, const Properties &properties, const ArgumentPack<ITensorInfo> &tensors);
/** Destructor */
~ClComponentReshape() override;
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentResize.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentResize.cpp
index 6df1d9b3db..b05eb04698 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentResize.cpp
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentResize.cpp
@@ -66,7 +66,9 @@ Status ClComponentResize::validate(const IGpuKernelComponent::Properties &proper
ARM_COMPUTE_RETURN_ERROR_ON_F16_UNSUPPORTED(src);
// Align corners and sampling policy conformance
- ARM_COMPUTE_RETURN_ERROR_ON(attributes.align_corners() && !arm_compute::scale_utils::is_align_corners_allowed_sampling_policy(attributes.sampling_policy()));
+ ARM_COMPUTE_RETURN_ERROR_ON(
+ attributes.align_corners() &&
+ !arm_compute::scale_utils::is_align_corners_allowed_sampling_policy(attributes.sampling_policy()));
// All tensor infos are initialized
ARM_COMPUTE_RETURN_ERROR_ON(src->tensor_shape().total_size() == 0);
@@ -79,11 +81,11 @@ ClComponentResize::ClComponentResize(ComponentId id,
const IGpuKernelComponent::Properties &properties,
const ArgumentPack<ITensorInfo> &tensors,
const ClComponentResize::Attributes &attributes)
- : IGpuKernelComponent{ id, properties, tensors },
+ : IGpuKernelComponent{id, properties, tensors},
#ifndef ACL_INTERNAL_TEST_CKW_IN_DF
- _component_writer{ std::make_unique<ClTemplateResize>(id, tensors, attributes) }
-#else // ACL_INTERNAL_TEST_CKW_IN_DF
- _component_writer{ std::make_unique<GpuCkwResize>(id, tensors, attributes) }
+ _component_writer{std::make_unique<ClTemplateResize>(id, tensors, attributes)}
+#else // ACL_INTERNAL_TEST_CKW_IN_DF
+ _component_writer{std::make_unique<GpuCkwResize>(id, tensors, attributes)}
#endif // ACL_INTERNAL_TEST_CKW_IN_DF
{
}
@@ -94,7 +96,7 @@ ClComponentResize::~ClComponentResize()
#ifndef ACL_INTERNAL_TEST_CKW_IN_DF
const IGpuTemplateComponentWriter *ClComponentResize::template_writer() const
-#else // ACL_INTERNAL_TEST_CKW_IN_DF
+#else // ACL_INTERNAL_TEST_CKW_IN_DF
const IGpuCkwComponentDriver *ClComponentResize::ckw_component_driver() const
#endif // ACL_INTERNAL_TEST_CKW_IN_DF
{
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentResize.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentResize.h
index 474524f8fc..29276c3257 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentResize.h
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentResize.h
@@ -26,6 +26,7 @@
#define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTRESIZE
#include "arm_compute/dynamic_fusion/sketch/attributes/ResizeAttributes.h"
+
#include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h"
namespace arm_compute
@@ -43,7 +44,7 @@ class ArgumentPack;
/** Forward declaration */
#ifndef ACL_INTERNAL_TEST_CKW_IN_DF
class ClTemplateResize;
-#else // ACL_INTERNAL_TEST_CKW_IN_DF
+#else // ACL_INTERNAL_TEST_CKW_IN_DF
class GpuCkwResize;
#endif // ACL_INTERNAL_TEST_CKW_IN_DF
@@ -82,10 +83,8 @@ public:
* |U8 |U8 |
* |S16 |S16 |
*/
- static Status validate(
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors,
- const Attributes &attributes);
+ static Status
+ validate(const Properties &properties, const ArgumentPack<ITensorInfo> &tensors, const Attributes &attributes);
/** Constructor
*
@@ -114,7 +113,7 @@ public:
/** Get writer for the component */
#ifndef ACL_INTERNAL_TEST_CKW_IN_DF
const IGpuTemplateComponentWriter *template_writer() const override;
-#else // ACL_INTERNAL_TEST_CKW_IN_DF
+#else // ACL_INTERNAL_TEST_CKW_IN_DF
const IGpuCkwComponentDriver *ckw_component_driver() const override;
#endif // ACL_INTERNAL_TEST_CKW_IN_DF
@@ -127,7 +126,7 @@ public:
private:
#ifndef ACL_INTERNAL_TEST_CKW_IN_DF
std::unique_ptr<ClTemplateResize> _component_writer;
-#else // ACL_INTERNAL_TEST_CKW_IN_DF
+#else // ACL_INTERNAL_TEST_CKW_IN_DF
std::unique_ptr<GpuCkwResize> _component_writer;
#endif // ACL_INTERNAL_TEST_CKW_IN_DF
};
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.cpp
index 12b81c3d56..dcbecaff35 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.cpp
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.cpp
@@ -38,25 +38,19 @@ namespace experimental
{
namespace dynamic_fusion
{
-Status ClComponentStore::validate(
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors)
+Status ClComponentStore::validate(const Properties &properties, const ArgumentPack<ITensorInfo> &tensors)
{
ARM_COMPUTE_UNUSED(properties, tensors);
return Status{};
}
-ClComponentStore::ClComponentStore(ComponentId id, const Properties &properties, const ArgumentPack<ITensorInfo> &tensors)
- : IGpuKernelComponent{ id, properties, tensors },
+ClComponentStore::ClComponentStore(ComponentId id,
+ const Properties &properties,
+ const ArgumentPack<ITensorInfo> &tensors)
+ : IGpuKernelComponent{id, properties, tensors},
#ifndef ACL_INTERNAL_TEST_CKW_IN_DF
- _component_writer
-{
- std::make_unique<ClTemplateStore>(id, tensors)
-}
+ _component_writer{std::make_unique<ClTemplateStore>(id, tensors)}
#else //ACL_INTERNAL_TEST_CKW_IN_DF
- _component_writer
-{
- std::make_unique<GpuCkwStore>(id, tensors)
-}
+ _component_writer{std::make_unique<GpuCkwStore>(id, tensors)}
#endif //ACL_INTERNAL_TEST_CKW_IN_DF
{
}
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.h
index 853ee39012..948785c480 100644
--- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.h
+++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.h
@@ -25,6 +25,7 @@
#define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTSTORE
#include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h"
+
#include <memory>
namespace arm_compute
@@ -70,9 +71,7 @@ public:
* |:--------------|:--------------|
* |All |All |
*/
- static Status validate(
- const Properties &properties,
- const ArgumentPack<ITensorInfo> &tensors);
+ static Status validate(const Properties &properties, const ArgumentPack<ITensorInfo> &tensors);
/** Constructor
*
* Similar to @ref ClComponentStore::validate()
diff --git a/src/dynamic_fusion/sketch/gpu/components/utils/type_printer/ElementwiseBinary.h b/src/dynamic_fusion/sketch/gpu/components/utils/type_printer/ElementwiseBinary.h
index bc7133f4df..4c3e84e59d 100644
--- a/src/dynamic_fusion/sketch/gpu/components/utils/type_printer/ElementwiseBinary.h
+++ b/src/dynamic_fusion/sketch/gpu/components/utils/type_printer/ElementwiseBinary.h
@@ -46,18 +46,16 @@ using namespace experimental::dynamic_fusion;
*/
inline ::std::ostream &operator<<(::std::ostream &os, const ClComponentElementwiseBinary::Attributes::ElementwiseOp &op)
{
- const std::map<ClComponentElementwiseBinary::Attributes::ElementwiseOp, std::string> op_name =
- {
- { ClComponentElementwiseBinary::Attributes::ElementwiseOp::Add, "add" },
- { ClComponentElementwiseBinary::Attributes::ElementwiseOp::Div, "div" },
- { ClComponentElementwiseBinary::Attributes::ElementwiseOp::Max, "max" },
- { ClComponentElementwiseBinary::Attributes::ElementwiseOp::Min, "min" },
- { ClComponentElementwiseBinary::Attributes::ElementwiseOp::Mul, "mul" },
- { ClComponentElementwiseBinary::Attributes::ElementwiseOp::Power, "power" },
- { ClComponentElementwiseBinary::Attributes::ElementwiseOp::Prelu, "prelu" },
- { ClComponentElementwiseBinary::Attributes::ElementwiseOp::SquaredDiff, "squareddiff" },
- { ClComponentElementwiseBinary::Attributes::ElementwiseOp::Sub, "sub" }
- };
+ const std::map<ClComponentElementwiseBinary::Attributes::ElementwiseOp, std::string> op_name = {
+ {ClComponentElementwiseBinary::Attributes::ElementwiseOp::Add, "add"},
+ {ClComponentElementwiseBinary::Attributes::ElementwiseOp::Div, "div"},
+ {ClComponentElementwiseBinary::Attributes::ElementwiseOp::Max, "max"},
+ {ClComponentElementwiseBinary::Attributes::ElementwiseOp::Min, "min"},
+ {ClComponentElementwiseBinary::Attributes::ElementwiseOp::Mul, "mul"},
+ {ClComponentElementwiseBinary::Attributes::ElementwiseOp::Power, "power"},
+ {ClComponentElementwiseBinary::Attributes::ElementwiseOp::Prelu, "prelu"},
+ {ClComponentElementwiseBinary::Attributes::ElementwiseOp::SquaredDiff, "squareddiff"},
+ {ClComponentElementwiseBinary::Attributes::ElementwiseOp::Sub, "sub"}};
os << op_name.at(op);
return os;
}