aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJakub Sujak <jakub.sujak@arm.com>2023-08-24 14:01:20 +0100
committerJakub Sujak <jakub.sujak@arm.com>2023-09-04 14:41:16 +0000
commit0d27b2ee8d811d66693555ac1e7be44d93e662e2 (patch)
tree8b62a464a8bb9cd46702c8b5a60f3a97e3821b41 /tests
parent7ff03b67ba7ce669223f4d807e18fa3efa2f729b (diff)
downloadComputeLibrary-0d27b2ee8d811d66693555ac1e7be44d93e662e2.tar.gz
Remove legacy PostOps code
PostOps was the experimental interface for Dynamic Fusion. It is now replaced by the new Dynamic Fusion interface with code generation using the Compute Kernel Writer. Resolves: COMPMID-6190 Change-Id: I813b48facef2fd6f3aee332588886b4f9b3d33d8 Signed-off-by: Jakub Sujak <jakub.sujak@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/10219 Benchmark: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: SiCong Li <sicong.li@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt1
-rw-r--r--tests/validation/CL/ConvolutionLayer.cpp291
-rw-r--r--tests/validation/CL/GEMMMatrixMultiplyNative.cpp244
-rw-r--r--tests/validation/CL/GEMMMatrixMultiplyReshaped.cpp421
-rw-r--r--tests/validation/CL/GEMMMatrixMultiplyReshapedOnlyRHS.cpp294
-rw-r--r--tests/validation/dynamic_fusion/gpu/cl/DirectConv2d.cpp10
-rw-r--r--tests/validation/fixtures/GEMMFixture.h740
-rw-r--r--tests/validation/reference/PostOps.cpp93
-rw-r--r--tests/validation/reference/PostOps.h47
9 files changed, 40 insertions, 2101 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index c4b12e770a..3f2223596f 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -67,7 +67,6 @@ target_sources(
validation/reference/L2NormalizeLayer.cpp
validation/reference/ActivationLayer.cpp
validation/reference/SpaceToBatch.cpp
- validation/reference/PostOps.cpp
validation/reference/Im2Col.cpp
validation/reference/DequantizationLayer.cpp
validation/reference/DeconvolutionLayer.cpp
diff --git a/tests/validation/CL/ConvolutionLayer.cpp b/tests/validation/CL/ConvolutionLayer.cpp
index bced540d2a..986d76708d 100644
--- a/tests/validation/CL/ConvolutionLayer.cpp
+++ b/tests/validation/CL/ConvolutionLayer.cpp
@@ -22,7 +22,6 @@
* SOFTWARE.
*/
#include "arm_compute/core/Types.h"
-#include "arm_compute/core/experimental/PostOps.h"
#include "arm_compute/core/utils/misc/ShapeCalculator.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/CL/CLTensorAllocator.h"
@@ -69,53 +68,30 @@ constexpr float tolerance_num = 0.07f; /**< T
const auto CNNDataTypes = framework::dataset::make("DataType",
{
DataType::F16,
- DataType::F32,
- DataType::QASYMM8,
- DataType::QASYMM8_SIGNED,
+ DataType::F32,
+ DataType::QASYMM8,
+ DataType::QASYMM8_SIGNED,
});
/** Grouped CNN data types */
const auto GroupedCNNDataTypes = framework::dataset::make("DataType",
{
DataType::F16,
- DataType::F32
+ DataType::F32
});
-const auto ActivationFunctionsDataset = framework::dataset::make("ActivationInfo",
+const auto ActivationFunctionsDataset = framework::dataset::make("ActivationInfo",
{
ActivationLayerInfo(),
- ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
- ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 0.5f),
- ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 0.5f)
+ ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
+ ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 0.5f),
+ ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 0.5f)
});
const auto ActivationFunctionsSmallDataset = framework::dataset::make("ActivationInfo",
{
ActivationLayerInfo(),
- ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 0.5f)
+ ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 0.5f)
});
-
-bool is_post_op_list_valid_in_gemmconv(const TensorShape &input_shape, const TensorShape &weights_shape, const TensorShape &output_shape, DataType data_type, DataLayout data_layout,
- const PadStrideInfo &conv_info, const experimental::PostOpList<ITensorInfo *> &post_ops)
-{
- const int idx_width = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH);
- const int idx_height = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT);
- const int idx_kernels = get_data_layout_dimension_index(data_layout, DataLayoutDimension::BATCHES);
-
- const auto dilation = Size2D(1U, 1U);
- const unsigned int num_groups = 1U;
-
- TensorInfo input_info(input_shape, 1, data_type, data_layout);
- TensorInfo weights_info(weights_shape, 1, data_type, data_layout);
-
- TensorInfo output_info(output_shape, 1, data_type, data_layout);
-
- WeightsInfo w_info(false, weights_info.dimension(idx_width), weights_info.dimension(idx_height), weights_info.dimension(idx_kernels));
-
- const auto status = CLGEMMConvolutionLayer::validate(&input_info.clone()->set_is_resizable(true),
- &weights_info.clone()->set_is_resizable(true), nullptr, &output_info.clone()->set_is_resizable(true),
- conv_info, w_info, dilation, ActivationLayerInfo(), num_groups, post_ops);
- return bool(status);
-}
} // namespace
TEST_SUITE(CL)
@@ -207,72 +183,6 @@ DATA_TEST_CASE(ValidateConvolutionMethod, framework::DatasetMode::ALL, zip(zip(z
enable_fast_math);
ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
}
-
-DATA_TEST_CASE(ValidatePostOpSupportInConvolutionMethod, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(
- framework::dataset::make("InputInfo", { TensorInfo(TensorShape(2U, 17U, 31U), 1, DataType::F32, DataLayout::NHWC), // Select GEMM
- TensorInfo(TensorShape(17U, 31U, 32U), 1, DataType::F32, DataLayout::NCHW), // Select WINOGRAD
- TensorInfo(TensorShape(27U, 27U, 48U), 1, DataType::F32, DataLayout::NCHW), // Select Direct
- TensorInfo(TensorShape(27U, 27U, 48U), 1, DataType::F32, DataLayout::NCHW), // Select FFT
- }),
- framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(2U, 1U, 1U, 19U), 1, DataType::F32, DataLayout::NHWC),
- TensorInfo(TensorShape(5U, 5U, 32U, 19U), 1, DataType::F32, DataLayout::NCHW),
- TensorInfo(TensorShape(5U, 5U, 48U, 128U), 1, DataType::F32, DataLayout::NCHW),
- TensorInfo(TensorShape(11U, 11U, 48U, 24), 1, DataType::F32, DataLayout::NCHW),
- })),
- framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(19U, 17U, 31U), 1, DataType::F32, DataLayout::NHWC),
- TensorInfo(TensorShape(17U, 31U, 19U), 1, DataType::F32, DataLayout::NCHW),
- TensorInfo(TensorShape(27U, 27U, 128U), 1, DataType::F32, DataLayout::NCHW),
- TensorInfo(TensorShape(27U, 27U, 24U), 1, DataType::F32, DataLayout::NCHW),
- })),
- framework::dataset::make("ConvInfo", { PadStrideInfo(1U, 1U, 0U, 0U),
- PadStrideInfo(1U, 1U, 2U, 2U),
- PadStrideInfo(1U, 1U, 2U, 2U),
- PadStrideInfo(1U, 1U, 5U, 5U),
- })),
- framework::dataset::make("EnableFastMath", { false, true, false, false})),
- framework::dataset::make("ExpectedMethod",{ ConvolutionMethod::GEMM,
- ConvolutionMethod::WINOGRAD,
- ConvolutionMethod::DIRECT,
- ConvolutionMethod::FFT,
- })),
- framework::dataset::make("PostOpSupported",{ true, false, false, false
- })),
- input_info, weights_info, output_info, conv_info, enable_fast_math, expected_method, post_op_supported)
-{
- const int idx_width = get_data_layout_dimension_index(input_info.data_layout(), DataLayoutDimension::WIDTH);
- const int idx_height = get_data_layout_dimension_index(input_info.data_layout(), DataLayoutDimension::HEIGHT);
- const int idx_kernels = get_data_layout_dimension_index(input_info.data_layout(), DataLayoutDimension::BATCHES);
-
- const auto dilation = Size2D(1U, 1U);
- const unsigned int num_groups = 1U;
-
- WeightsInfo w_info(false, weights_info.dimension(idx_width), weights_info.dimension(idx_height), weights_info.dimension(idx_kernels));
-
- experimental::PostOpList<ITensorInfo*> post_ops{};
- post_ops.push_back_op<experimental::PostOpAct<ITensorInfo*>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::LINEAR, 0.5F, 0.0F});
-
- ConvolutionMethod actual_method = CLConvolutionLayer::get_convolution_method(&input_info.clone()->set_is_resizable(true),
- &weights_info.clone()->set_is_resizable(true),
- &output_info.clone()->set_is_resizable(true), conv_info,
- WeightsInfo(),
- ActivationLayerInfo(),
- GPUTarget::BIFROST,
- dilation,
- enable_fast_math);
- ARM_COMPUTE_EXPECT(actual_method == expected_method, framework::LogLevel::ERRORS);
- const auto is_valid = CLConvolutionLayer::validate(&input_info.clone()->set_is_resizable(true),
- &weights_info.clone()->set_is_resizable(true),
- nullptr,
- &output_info.clone()->set_is_resizable(true),
- conv_info,
- w_info,
- dilation,
- ActivationLayerInfo(),
- enable_fast_math,
- num_groups,
- post_ops);
- ARM_COMPUTE_EXPECT( bool(is_valid) == post_op_supported, framework::LogLevel::ERRORS);
-}
// clang-format on
// *INDENT-ON*
TEST_SUITE_END() // ConvolutionLayer
@@ -285,167 +195,11 @@ using CLGEMMConvolutionLayerMixedDataLayoutFixture = ConvolutionValidationFixtur
template <typename T>
using CLConvolutionValidationWithPaddingFixture = ConvolutionValidationWithPaddingFixture<CLTensor, CLAccessor, CLGEMMConvolutionLayer, T>;
-TEST_SUITE(ValidateFusedPostOpsConfigs)
-TEST_SUITE(Invalid)
-TEST_CASE(UnsupportedPostOpSequence, framework::DatasetMode::ALL)
-{
- const auto data_type = DataType::F32;
- const auto data_layout = DataLayout::NHWC;
- const auto conv_info = PadStrideInfo(1, 1, 0, 0);
- const auto input_shape = TensorShape(16U, 14U, 12U, 2U);
- const auto weights_shape = TensorShape(16U, 1U, 1U, 24U);
-
- const auto output_shape = misc::shape_calculator::compute_deep_convolution_shape(input_shape, data_layout, weights_shape, conv_info);
-
- const TensorShape post_op_arg0_shape(output_shape);
- TensorInfo post_op_arg_info(post_op_arg0_shape, 1, data_type);
- auto post_op_arg1_info = post_op_arg_info.clone();
-
- // Unsupported sequence of post ops
- experimental::PostOpList<ITensorInfo *> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo *>>(
- &post_op_arg_info,
- 1,
- ConvertPolicy::SATURATE);
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo *>>(
- post_op_arg1_info.get(),
- 0,
- ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid_in_gemmconv(input_shape, weights_shape, output_shape, data_type, data_layout, conv_info, post_ops) == false, framework::LogLevel::ERRORS);
-}
-TEST_CASE(OnlyNHWCIsSupported, framework::DatasetMode::ALL)
-{
- const auto data_type = DataType::F32;
- const auto data_layout = DataLayout::NCHW;
- const auto conv_info = PadStrideInfo(1, 1, 0, 0);
- const auto input_shape = TensorShape(14U, 12U, 16U, 2U);
- const auto weights_shape = TensorShape(1U, 1U, 16U, 24U);
-
- const auto output_shape = misc::shape_calculator::compute_deep_convolution_shape(input_shape, data_layout, weights_shape, conv_info);
-
- const TensorShape post_op_arg0_shape(output_shape);
- TensorInfo post_op_arg_info(post_op_arg0_shape, 1, data_type);
-
- experimental::PostOpList<ITensorInfo *> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo *>>(
- &post_op_arg_info,
- 1,
- ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid_in_gemmconv(input_shape, weights_shape, output_shape, data_type, data_layout, conv_info, post_ops) == false, framework::LogLevel::ERRORS);
-}
-TEST_CASE(OnlyFloatingTypeIsSupported, framework::DatasetMode::ALL)
-{
- const auto data_type = DataType::QASYMM8;
- const auto data_layout = DataLayout::NHWC;
- const auto conv_info = PadStrideInfo(1, 1, 0, 0);
- const auto input_shape = TensorShape(16U, 14U, 12U, 2U);
- const auto weights_shape = TensorShape(16U, 1U, 1U, 24U);
-
- const auto output_shape = misc::shape_calculator::compute_deep_convolution_shape(input_shape, data_layout, weights_shape, conv_info);
-
- const TensorShape post_op_arg0_shape(output_shape);
- TensorInfo post_op_arg_info(post_op_arg0_shape, 1, data_type);
-
- experimental::PostOpList<ITensorInfo *> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo *>>(
- &post_op_arg_info,
- 1,
- ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid_in_gemmconv(input_shape, weights_shape, output_shape, data_type, data_layout, conv_info, post_ops) == false, framework::LogLevel::ERRORS);
-}
-TEST_CASE(OnlyConv1x1Stride1IsSupported_UnsupportedKernelSize, framework::DatasetMode::ALL)
-{
- const auto data_type = DataType::F32;
- const auto data_layout = DataLayout::NHWC;
- const auto conv_info = PadStrideInfo(1, 1, 0, 0);
- const auto input_shape = TensorShape(16U, 14U, 12U, 2U);
- const auto weights_shape = TensorShape(16U, 3U, 3U, 24U);
-
- const auto output_shape = misc::shape_calculator::compute_deep_convolution_shape(input_shape, data_layout, weights_shape, conv_info);
-
- const TensorShape post_op_arg0_shape(output_shape);
- TensorInfo post_op_arg_info(post_op_arg0_shape, 1, data_type);
-
- experimental::PostOpList<ITensorInfo *> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo *>>(
- &post_op_arg_info,
- 1,
- ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid_in_gemmconv(input_shape, weights_shape, output_shape, data_type, data_layout, conv_info, post_ops) == false, framework::LogLevel::ERRORS);
-}
-TEST_CASE(OnlyConv1x1Stride1IsSupported_UnsupportedStride, framework::DatasetMode::ALL)
-{
- const auto data_type = DataType::F32;
- const auto data_layout = DataLayout::NHWC;
- const auto conv_info = PadStrideInfo(3, 3, 0, 0);
- const auto input_shape = TensorShape(16U, 14U, 12U, 2U);
- const auto weights_shape = TensorShape(16U, 1U, 1U, 24U);
-
- const auto output_shape = misc::shape_calculator::compute_deep_convolution_shape(input_shape, data_layout, weights_shape, conv_info);
-
- const TensorShape post_op_arg0_shape(output_shape);
- TensorInfo post_op_arg_info(post_op_arg0_shape, 1, data_type);
-
- experimental::PostOpList<ITensorInfo *> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo *>>(
- &post_op_arg_info,
- 1,
- ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid_in_gemmconv(input_shape, weights_shape, output_shape, data_type, data_layout, conv_info, post_ops) == false, framework::LogLevel::ERRORS);
-}
-TEST_SUITE_END() // Invalid
-TEST_SUITE(Valid)
-TEST_CASE(EmptyPostOpList, framework::DatasetMode::ALL)
-{
- const auto data_type = DataType::F32;
- const auto data_layout = DataLayout::NHWC;
- const auto conv_info = PadStrideInfo(1, 1, 0, 0);
- const auto input_shape = TensorShape(16U, 14U, 12U, 2U);
- const auto weights_shape = TensorShape(16U, 1U, 1U, 24U);
-
- const auto output_shape = misc::shape_calculator::compute_deep_convolution_shape(input_shape, data_layout, weights_shape, conv_info);
-
- experimental::PostOpList<ITensorInfo *> post_ops{};
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid_in_gemmconv(input_shape, weights_shape, output_shape, data_type, data_layout, conv_info, post_ops) == true, framework::LogLevel::ERRORS);
-}
-TEST_CASE(SupportedPostOps, framework::DatasetMode::ALL)
-{
- const auto data_type = DataType::F32;
- const auto data_layout = DataLayout::NHWC;
- const auto conv_info = PadStrideInfo(1, 1, 0, 0);
- const auto input_shape = TensorShape(16U, 14U, 12U, 2U);
- const auto weights_shape = TensorShape(16U, 1U, 1U, 24U);
-
- const auto output_shape = misc::shape_calculator::compute_deep_convolution_shape(input_shape, data_layout, weights_shape, conv_info);
-
- TensorShape post_op_arg0_shape(output_shape);
- post_op_arg0_shape[1] = 1; // Broadcast in "Y" (second) dimension
- TensorInfo post_op_arg_info(post_op_arg0_shape, 1, data_type);
-
- experimental::PostOpList<ITensorInfo *> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo *>>(
- &post_op_arg_info,
- 1,
- ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid_in_gemmconv(input_shape, weights_shape, output_shape, data_type, data_layout, conv_info, post_ops) == true, framework::LogLevel::ERRORS);
-}
-TEST_SUITE_END() // Valid
-TEST_SUITE_END() // ValidateFusedPostOps
TEST_SUITE(Float)
TEST_SUITE(FP16)
FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType",
- DataType::F16)),
- framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
+ framework::dataset::make("ReshapeWeights", { true })), framework::dataset::make("DataType", DataType::F16)), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
ActivationFunctionsSmallDataset))
{
// Validate output
@@ -456,10 +210,7 @@ TEST_SUITE_END() // FP16
TEST_SUITE(FP32)
FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMConvolutionLayerFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType",
- DataType::F32)),
- framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
+ framework::dataset::make("ReshapeWeights", { true })), framework::dataset::make("DataType", DataType::F32)), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
ActivationFunctionsSmallDataset))
{
// Validate output
@@ -503,16 +254,16 @@ using CLGEMMConvolutionLayerQuantizedMixedDataLayoutFixture = ConvolutionValidat
template <typename T>
using CLGEMMConvolutionLayerQuantizedPerChannelFixture = ConvolutionValidationQuantizedPerChannelFixture<CLTensor, CLAccessor, CLGEMMConvolutionLayer, T, int8_t>;
-const auto QuantizedActivationFunctionsDataset = framework::dataset::make("ActivationInfo",
+const auto QuantizedActivationFunctionsDataset = framework::dataset::make("ActivationInfo",
{
ActivationLayerInfo(),
- ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
- ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 6.f)
+ ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
+ ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 6.f)
});
const auto QuantizedActivationFunctionsSmallDataset = framework::dataset::make("ActivationInfo",
{
ActivationLayerInfo(),
- ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 6.f)
+ ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 6.f)
});
TEST_SUITE(Quantized)
@@ -520,8 +271,8 @@ TEST_SUITE(Quantized)
const auto QuantizationData = framework::dataset::make("QuantizationInfo",
{
QuantizationInfo(0.5f, 10),
- QuantizationInfo(0.3f, 3),
- QuantizationInfo(1.1f, 10),
+ QuantizationInfo(0.3f, 3),
+ QuantizationInfo(1.1f, 10),
});
TEST_SUITE(QASYMM8)
@@ -637,9 +388,7 @@ TEST_SUITE(Float)
TEST_SUITE(FP32)
FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMGroupedConvolutionLayerFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallGroupedConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType", DataType::F32)),
- framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ framework::dataset::make("ReshapeWeights", { true })), framework::dataset::make("DataType", DataType::F32)), framework::dataset::make("DataLayout", { DataLayout::NCHW })),
ActivationFunctionsSmallDataset))
{
// Validate output
@@ -661,9 +410,7 @@ TEST_SUITE_END() // FP32
TEST_SUITE(FP16)
FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMGroupedConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallGroupedConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType", DataType::F16)),
- framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ framework::dataset::make("ReshapeWeights", { true })), framework::dataset::make("DataType", DataType::F16)), framework::dataset::make("DataLayout", { DataLayout::NCHW })),
ActivationFunctionsSmallDataset))
{
// Validate output
diff --git a/tests/validation/CL/GEMMMatrixMultiplyNative.cpp b/tests/validation/CL/GEMMMatrixMultiplyNative.cpp
index 7f63a03371..0ddf43766f 100644
--- a/tests/validation/CL/GEMMMatrixMultiplyNative.cpp
+++ b/tests/validation/CL/GEMMMatrixMultiplyNative.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2022 Arm Limited.
+ * Copyright (c) 2019-2023 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -53,11 +53,6 @@ using CLGEMMMatrixMultiplyNative = CLSynthetizeOperator<ClGemmMatrixMultiplyNati
template <typename T>
using CLGEMMMatrixMultiplyNativeFixture = GEMMMatrixMultiplyNativeValidationFixture<CLTensor, CLAccessor, T, CLGEMMMatrixMultiplyNative>;
-// Fixture for CLGEMMMatrixMultiplyNative with post ops
-template <typename T>
-using CLGEMMMatrixMultiplyNativeWithPostOpsFixture =
- GEMMMatrixMultiplyNativeWithPostOpsValidationFixture<CLTensor, CLAccessor, T, CLGEMMMatrixMultiplyNative>;
-
// Fixture for CLGEMMMatrixMultiplyNative3D
template <typename T>
using CLGEMMMatrixMultiplyNative3DFixture = GEMMMatrixMultiplyNative3DValidationFixture<CLTensor, CLAccessor, T, CLGEMMMatrixMultiplyNative>;
@@ -146,105 +141,6 @@ const auto boundary_handling_cases = combine(combine(combine(combine(combine(com
broadcast_bias_values),
framework::dataset::make("Activation", ActivationLayerInfo()));
-/** Post Ops */
-using PostOpArgBroadcast = CLGEMMMatrixMultiplyNativeWithPostOpsFixture<float>::PostOpArgBroadcast;
-experimental::PostOpList<PostOpArgBroadcast> post_ops_1()
-{
- experimental::PostOpList<PostOpArgBroadcast> post_ops{};
- post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::LINEAR, 0.5F, 0.0F});
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<PostOpArgBroadcast>>(
- std::make_tuple(true, true, false), // If broadcast in dims 0, 1 and 2
- 0,
- ConvertPolicy::SATURATE);
- post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::RELU, 2.1F, 1.3F});
- return post_ops;
-}
-experimental::PostOpList<PostOpArgBroadcast> post_ops_2()
-{
- experimental::PostOpList<PostOpArgBroadcast> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<PostOpArgBroadcast>>(
- std::make_tuple(false, true, true), // If broadcast in dims 0, 1 and 2
- 1,
- ConvertPolicy::SATURATE);
- post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::RELU, 2.1F, 1.3F});
- return post_ops;
-}
-experimental::PostOpList<PostOpArgBroadcast> post_ops_3()
-{
- experimental::PostOpList<PostOpArgBroadcast> post_ops{};
- // post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::RELU, 2.1F, 1.3F});
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<PostOpArgBroadcast>>(
- std::make_tuple(false, false, false), // If broadcast in dims 0, 1 and 2
- 1,
- ConvertPolicy::SATURATE);
- return post_ops;
-}
-// To test that the output of the main op is the first parameter in prelu post op
-experimental::PostOpList<PostOpArgBroadcast> post_ops_4()
-{
- experimental::PostOpList<PostOpArgBroadcast> post_ops{};
- post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::LINEAR, 0.5F, 0.0F});
- post_ops.push_back_op<experimental::PostOpEltwisePRelu<PostOpArgBroadcast>>(
- std::make_tuple(false, false, true), // If true, broadcast in corresponding dim: 0, 1 or 2
- 0,
- ConvertPolicy::SATURATE);
- post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::RELU, 2.1F, 1.3F});
- return post_ops;
-}
-// To test that the output of the main op is the second parameter in prelu post op i.e. it is the alpha_param
-experimental::PostOpList<PostOpArgBroadcast> post_ops_5()
-{
- experimental::PostOpList<PostOpArgBroadcast> post_ops{};
- post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::LINEAR, 0.5F, 0.0F});
- post_ops.push_back_op<experimental::PostOpEltwisePRelu<PostOpArgBroadcast>>(
- std::make_tuple(false, false, false), // If true, broadcast in corresponding dim: 0, 1 or 2
- 1,
- ConvertPolicy::SATURATE);
- post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::RELU, 2.1F, 1.3F});
- return post_ops;
-}
-/** Different Post Op Lists */
-const auto post_op_lists = framework::dataset::make("post_op_lists", {
- post_ops_1(),
- post_ops_2(),
- post_ops_3(),
- post_ops_4(),
- post_ops_5()
- } );
-
-bool is_post_op_list_valid(unsigned int m, unsigned int n, unsigned int k, unsigned int batch, DataType data_type, const experimental::PostOpList<ITensorInfo*>& post_ops)
-{
- const auto lhs_info = GEMMLHSMatrixInfo(4,4,1,false,true);
- const auto rhs_info = GEMMRHSMatrixInfo(4,4,1,true,true,false);
-
- // Create TensorInfo for post op arguments
- TensorInfo input0_info(TensorShape(k, m, batch), 1, data_type);
- TensorInfo input1_info(TensorShape(n, k, batch), 1, data_type);
- TensorInfo input2_info(TensorShape(n), 1, data_type);
- TensorInfo output_info(TensorShape(n, m, batch), 1, data_type);
-
- GEMMKernelInfo gemm_info(m, n, k, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
- false /**< reinterpret the input as 3D */,
- true /**< Flag used to broadcast the bias addition */,
- false /**< wider accumm */,
- false /**< has pad y */,
- ActivationLayerInfo::ActivationFunction::IDENTITY,
- 1 /**< Multiplication factor for the width of the 1xW transposed block */,
- 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
- lhs_info,
- rhs_info,
- 0 /**< Offset to be added to each element of the matrix A */,
- 0 /**< Offset to be added to each element of the matrix B */,
- post_ops);
- return bool(ClGemmMatrixMultiplyNativeKernel::validate(&input0_info.clone()->set_is_resizable(true),
- &input1_info.clone()->set_is_resizable(true),
- &input2_info.clone()->set_is_resizable(true),
- &output_info.clone()->set_is_resizable(true),1.f,1.f,
- lhs_info,
- rhs_info,
- gemm_info));
-}
-
/** Configuration test */
void validate_configuration(unsigned int m_value, unsigned int n_value, unsigned int k_value, unsigned int b_value, unsigned int m0_value, unsigned int n0_value, unsigned int k0_value, bool broadcast_bias, DataType data_type, const ActivationLayerInfo &act_info)
{
@@ -295,119 +191,6 @@ void validate_configuration(unsigned int m_value, unsigned int n_value, unsigned
TEST_SUITE(CL)
TEST_SUITE(GEMMMatrixMultiplyNative)
-TEST_SUITE(ValidateFusedPostOpsConfigs)
-TEST_SUITE(Invalid)
-TEST_CASE(UnsupportedPostOpSequence, framework::DatasetMode::ALL)
-{
- const auto data_type = DataType::F32;
- const unsigned int m = 17;
- const unsigned int n = 1;
- const unsigned int k = 13;
- const unsigned int batch = 2;
- TensorShape post_op_arg0_shape(n, m, batch);
- TensorInfo post_op_arg_info(post_op_arg0_shape, 1, data_type);
- auto post_op_arg1_info = post_op_arg_info.clone();
-
- // Unsupported sequence of post ops
- experimental::PostOpList<ITensorInfo*> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>(
- &post_op_arg_info,
- 1,
- ConvertPolicy::SATURATE);
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>(
- post_op_arg1_info.get(),
- 0,
- ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == false, framework::LogLevel::ERRORS);
-}
-TEST_CASE(OutputWidened, framework::DatasetMode::ALL)
-{
- // Invalid broadcast: post op tensors "widen" the output tensor
- const auto data_type = DataType::F32;
- const unsigned int m = 1;
- const unsigned int n = 18;
- const unsigned int k = 13;
- const unsigned int batch = 2;
- TensorShape post_op_arg_shape(n, m + 1, batch); // output's Y dimension (m) is "widened", which is not allowed
- TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
- experimental::PostOpList<ITensorInfo*> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == false, framework::LogLevel::ERRORS);
-}
-TEST_CASE(BroadcastInXDimOnly, framework::DatasetMode::ALL)
-{
- // Invalid broadcast: post op tensors broadcast in the first dimension (X) only
- const auto data_type = DataType::F32;
- const unsigned int m = 22;
- const unsigned int n = 16;
- const unsigned int k = 15;
- const unsigned int batch = 3;
- TensorShape post_op_arg_shape(1, m, batch);
- TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
- experimental::PostOpList<ITensorInfo*> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == false, framework::LogLevel::ERRORS);
-}
-TEST_SUITE_END() // Invalid
-TEST_SUITE(Valid)
-TEST_CASE(EmptyPostOpList, framework::DatasetMode::ALL)
-{
- const auto data_type = DataType::F32;
- const unsigned int m = 22;
- const unsigned int n = 16;
- const unsigned int k = 15;
- const unsigned int batch = 3;
- experimental::PostOpList<ITensorInfo*> post_ops{};
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == true, framework::LogLevel::ERRORS);
-}
-TEST_CASE(BroadcastInYDimOnly, framework::DatasetMode::ALL)
-{
- const auto data_type = DataType::F32;
- const unsigned int m = 22;
- const unsigned int n = 16;
- const unsigned int k = 15;
- const unsigned int batch = 3;
- TensorShape post_op_arg_shape(n, 1, batch);
- TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
- experimental::PostOpList<ITensorInfo*> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == true, framework::LogLevel::ERRORS);
-}
-TEST_CASE(BroadcastInBothXandYDims, framework::DatasetMode::ALL)
-{
- const auto data_type = DataType::F32;
- const unsigned int m = 22;
- const unsigned int n = 16;
- const unsigned int k = 15;
- const unsigned int batch = 3;
- TensorShape post_op_arg_shape(1, 1, batch);
- TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
- experimental::PostOpList<ITensorInfo*> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == true, framework::LogLevel::ERRORS);
-}
-TEST_CASE(BroadcastInAllDims, framework::DatasetMode::ALL)
-{
- const auto data_type = DataType::F32;
- const unsigned int m = 22;
- const unsigned int n = 16;
- const unsigned int k = 15;
- const unsigned int batch = 3;
- TensorShape post_op_arg_shape(1, 1, 1);
- TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
- experimental::PostOpList<ITensorInfo*> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == true, framework::LogLevel::ERRORS);
-}
-TEST_SUITE_END() // Valid
-TEST_SUITE_END() // ValidateFusedPostOps
TEST_SUITE(Float)
TEST_SUITE(FP32)
DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(combine(combine(combine(
@@ -541,31 +324,6 @@ FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyNative3DFixture<float>, f
validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
}
-TEST_SUITE(FusedPostOps)
-
-FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyNativeWithPostOpsFixture<float>, framework::DatasetMode::ALL,
- combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
- m_values,
- n_values),
- k_values),
- b_values),
- framework::dataset::make("M0", { 4 })),
- n0_values_precommit),
- k0_values_precommit),
- framework::dataset::make("DataType", DataType::F32)),
- framework::dataset::make("alpha", {1.0f} )),
- framework::dataset::make("beta", {1.0f} )),
- framework::dataset::make("broadcast_bias", { false, true } )),
- framework::dataset::make("Activation", { ActivationLayerInfo() })),
- post_op_lists)
- )
-{
- // Validate output
- validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
-}
-
-TEST_SUITE_END() // FusedPostOps
-
TEST_SUITE_END() // FP32
TEST_SUITE_END() // Float
TEST_SUITE_END() // GEMMMatrixMulipltyNative
diff --git a/tests/validation/CL/GEMMMatrixMultiplyReshaped.cpp b/tests/validation/CL/GEMMMatrixMultiplyReshaped.cpp
index cdd89670fa..b06e4bf213 100644
--- a/tests/validation/CL/GEMMMatrixMultiplyReshaped.cpp
+++ b/tests/validation/CL/GEMMMatrixMultiplyReshaped.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2022 Arm Limited.
+ * Copyright (c) 2018-2023 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -23,7 +23,6 @@
*/
#include "arm_compute/core/KernelDescriptors.h"
#include "arm_compute/core/Types.h"
-#include "arm_compute/core/experimental/PostOps.h"
#include "arm_compute/core/utils/misc/ShapeCalculator.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/CL/CLTensorAllocator.h"
@@ -62,21 +61,11 @@ using CLGEMMMatrixMultiplyReshaped = CLSynthetizeOperator<ClGemmMatrixMultiplyRe
template <typename T>
using CLGEMMMatrixMultiplyReshapedFixture = GEMMMatrixMultiplyReshapedValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeLHSMatrix, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshaped>;
-// Fixture for CLGEMMMatrixMultiplyReshaped with post ops
-template <typename T>
-using CLGEMMMatrixMultiplyReshapedWithPostOpsFixture =
- GEMMMatrixMultiplyReshapedWithPostOpsValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeLHSMatrix, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshaped>;
-
// Fixture for CLGEMMMatrixMultiplyReshaped mixed precision
template <typename T>
using CLGEMMMatrixMultiplyReshapedMixedPrecisionFixture =
GEMMMatrixMultiplyReshapedValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeLHSMatrix, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshaped, true>;
-// Fixture for CLGEMMMatrixMultiplyReshaped mixed precision with post ops
-template <typename T>
-using CLGEMMMatrixMultiplyReshapedMixedPrecisionWithPostOpsFixture =
- GEMMMatrixMultiplyReshapedWithPostOpsValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeLHSMatrix, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshaped, true>;
-
// Fixture for CLGEMMMatrixMultiplyReshaped3D
template <typename T>
using CLGEMMMatrixMultiplyReshaped3DFixture = GEMMMatrixMultiplyReshaped3DValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeLHSMatrix, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshaped>;
@@ -184,108 +173,6 @@ const auto broadcast_bias_values = framework::dataset::make("broadcast_bias", {
/** LHS transposed values */
const auto lhs_transpose_values = framework::dataset::make("lhs_transpose", { false, true } );
-/** Post Ops */
-using PostOpArgBroadcast = CLGEMMMatrixMultiplyReshapedWithPostOpsFixture<float>::PostOpArgBroadcast;
-experimental::PostOpList<PostOpArgBroadcast> post_ops_1()
-{
- experimental::PostOpList<PostOpArgBroadcast> post_ops{};
- post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::LINEAR, 0.5F, 0.0F});
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<PostOpArgBroadcast>>(
- std::make_tuple(true, true, false), // If broadcast in dims 0, 1 and 2
- 0,
- ConvertPolicy::SATURATE);
- post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::RELU, 2.1F, 1.3F});
- return post_ops;
-}
-experimental::PostOpList<PostOpArgBroadcast> post_ops_2()
-{
- experimental::PostOpList<PostOpArgBroadcast> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<PostOpArgBroadcast>>(
- std::make_tuple(false, true, true), // If broadcast in dims 0, 1 and 2
- 1,
- ConvertPolicy::SATURATE);
- post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::RELU, 2.1F, 1.3F});
- return post_ops;
-}
-experimental::PostOpList<PostOpArgBroadcast> post_ops_3()
-{
- experimental::PostOpList<PostOpArgBroadcast> post_ops{};
- post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::RELU, 2.1F, 1.3F});
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<PostOpArgBroadcast>>(
- std::make_tuple(false, false, true), // If broadcast in dims 0, 1 and 2
- 1,
- ConvertPolicy::SATURATE);
- return post_ops;
-}
-// To test that the output of the main op is the first parameter in prelu post op
-experimental::PostOpList<PostOpArgBroadcast> post_ops_4()
-{
- experimental::PostOpList<PostOpArgBroadcast> post_ops{};
- post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::LINEAR, 0.5F, 0.0F});
- post_ops.push_back_op<experimental::PostOpEltwisePRelu<PostOpArgBroadcast>>(
- std::make_tuple(false, false, true), // If true, broadcast in corresponding dim: 0, 1 or 2
- 0,
- ConvertPolicy::SATURATE);
- post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::RELU, 2.1F, 1.3F});
- return post_ops;
-}
-// To test that the output of the main op is the second parameter in prelu post op i.e. it is the alpha_param
-experimental::PostOpList<PostOpArgBroadcast> post_ops_5()
-{
- experimental::PostOpList<PostOpArgBroadcast> post_ops{};
- post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::LINEAR, 0.5F, 0.0F});
- post_ops.push_back_op<experimental::PostOpEltwisePRelu<PostOpArgBroadcast>>(
- std::make_tuple(false, false, false), // If true, broadcast in corresponding dim: 0, 1 or 2
- 1,
- ConvertPolicy::SATURATE);
- post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::RELU, 2.1F, 1.3F});
- return post_ops;
-}
-/** Different Post Op Lists */
-const auto post_op_lists = framework::dataset::make("post_op_lists", {
- post_ops_1(),
- post_ops_2(),
- post_ops_3(),
- post_ops_4(),
- post_ops_5()
- } );
-
-bool is_post_op_list_valid(unsigned int m, unsigned int n, unsigned int k, unsigned int batch, DataType data_type, const experimental::PostOpList<ITensorInfo*>& post_ops)
-{
- const auto lhs_info = GEMMLHSMatrixInfo(4,4,1,false,true);
- const auto rhs_info = GEMMRHSMatrixInfo(4,4,1,true,true,false);
-
- // Create TensorInfo for post op arguments
- TensorInfo input0_info(TensorShape(k, m, batch), 1, data_type);
- TensorInfo input1_info(TensorShape(n, k, batch), 1, data_type);
- TensorInfo input2_info(TensorShape(n), 1, data_type);
- TensorInfo output_info(TensorShape(n, m, batch), 1, data_type);
-
- const TensorInfo reshaped_input0_info = input0_info.clone()->set_tensor_shape(misc::shape_calculator::compute_lhs_reshaped_shape(input0_info, lhs_info));
- const TensorInfo reshaped_input1_info = input1_info.clone()->set_tensor_shape(misc::shape_calculator::compute_rhs_reshaped_shape(input1_info, rhs_info));
-
- GEMMKernelInfo gemm_info(m, n, k, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
- false /**< reinterpret the input as 3D */,
- true /**< Flag used to broadcast the bias addition */,
- false /**< wider accumm */,
- false /**< has pad y */,
- ActivationLayerInfo::ActivationFunction::IDENTITY,
- 1 /**< Multiplication factor for the width of the 1xW transposed block */,
- 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
- lhs_info,
- rhs_info,
- 0 /**< Offset to be added to each element of the matrix A */,
- 0 /**< Offset to be added to each element of the matrix B */,
- post_ops);
- return bool(ClGemmMatrixMultiplyReshapedKernel::validate(&reshaped_input0_info.clone()->set_is_resizable(true),
- &reshaped_input1_info.clone()->set_is_resizable(true),
- &input2_info.clone()->set_is_resizable(true),
- &output_info.clone()->set_is_resizable(true),1.f,1.f,
- lhs_info,
- rhs_info,
- gemm_info));
-}
-
} // namespace
TEST_SUITE(CL)
@@ -450,119 +337,7 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zi
rhs_info,
gemm_info)) == expected, framework::LogLevel::ERRORS);
}
-TEST_SUITE(ValidateFusedPostOpsConfigs)
-TEST_SUITE(Invalid)
-TEST_CASE(UnsupportedPostOpSequence, framework::DatasetMode::ALL)
-{
- const auto data_type = DataType::F32;
- const unsigned int m = 17;
- const unsigned int n = 1;
- const unsigned int k = 13;
- const unsigned int batch = 2;
- TensorShape post_op_arg0_shape(n, m, batch);
- TensorInfo post_op_arg_info(post_op_arg0_shape, 1, data_type);
- auto post_op_arg1_info = post_op_arg_info.clone();
-
- // Unsupported sequence of post ops
- experimental::PostOpList<ITensorInfo*> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>(
- &post_op_arg_info,
- 1,
- ConvertPolicy::SATURATE);
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>(
- post_op_arg1_info.get(),
- 0,
- ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == false, framework::LogLevel::ERRORS);
-}
-TEST_CASE(OutputWidened, framework::DatasetMode::ALL)
-{
- // Invalid broadcast: post op tensors "widen" the output tensor
- const auto data_type = DataType::F32;
- const unsigned int m = 17;
- const unsigned int n = 1;
- const unsigned int k = 13;
- const unsigned int batch = 2;
- TensorShape post_op_arg_shape(n + 4, m, batch); // output's X dimension (n) is "widened", which is not allowed
- TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
- experimental::PostOpList<ITensorInfo*> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == false, framework::LogLevel::ERRORS);
-}
-TEST_CASE(BroadcastInXDimOnly, framework::DatasetMode::ALL)
-{
- // Invalid broadcast: post op tensors broadcast in the first dimension (X) only
- const auto data_type = DataType::F32;
- const unsigned int m = 22;
- const unsigned int n = 16;
- const unsigned int k = 15;
- const unsigned int batch = 3;
- TensorShape post_op_arg_shape(1, m, batch);
- TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
- experimental::PostOpList<ITensorInfo*> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == false, framework::LogLevel::ERRORS);
-}
-TEST_SUITE_END() // Invalid
-TEST_SUITE(Valid)
-TEST_CASE(EmptyPostOpList, framework::DatasetMode::ALL)
-{
- const auto data_type = DataType::F32;
- const unsigned int m = 22;
- const unsigned int n = 16;
- const unsigned int k = 15;
- const unsigned int batch = 3;
- experimental::PostOpList<ITensorInfo*> post_ops{};
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == true, framework::LogLevel::ERRORS);
-}
-TEST_CASE(BroadcastInYDimOnly, framework::DatasetMode::ALL)
-{
- const auto data_type = DataType::F32;
- const unsigned int m = 22;
- const unsigned int n = 16;
- const unsigned int k = 15;
- const unsigned int batch = 3;
- TensorShape post_op_arg_shape(n, 1, batch);
- TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
- experimental::PostOpList<ITensorInfo*> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == true, framework::LogLevel::ERRORS);
-}
-TEST_CASE(BroadcastInBothXandYDims, framework::DatasetMode::ALL)
-{
- const auto data_type = DataType::F32;
- const unsigned int m = 22;
- const unsigned int n = 16;
- const unsigned int k = 15;
- const unsigned int batch = 3;
- TensorShape post_op_arg_shape(1, 1, batch);
- TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
- experimental::PostOpList<ITensorInfo*> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == true, framework::LogLevel::ERRORS);
-}
-TEST_CASE(BroadcastInAllDims, framework::DatasetMode::ALL)
-{
- const auto data_type = DataType::F32;
- const unsigned int m = 22;
- const unsigned int n = 16;
- const unsigned int k = 15;
- const unsigned int batch = 3;
- TensorShape post_op_arg_shape(1, 1, 1);
- TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
- experimental::PostOpList<ITensorInfo*> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == true, framework::LogLevel::ERRORS);
-}
-TEST_SUITE_END() // Valid
-TEST_SUITE_END() // ValidateFusedPostOps
+
TEST_SUITE(Float)
TEST_SUITE(FP32)
@@ -697,44 +472,6 @@ FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DFixture<float>,
framework::ARM_COMPUTE_PRINT_INFO();
}
}
-TEST_SUITE(FusedPostOps)
-
-FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedWithPostOpsFixture<float>, framework::DatasetMode::ALL,
- combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
- m_values,
- n_values),
- k_values),
- b_values),
- m0_values_precommit),
- n0_values_precommit),
- k0_values_precommit),
- v0_values_precommit),
- h0_values_precommit),
- framework::dataset::make("interleave_lhs", { false })),
- framework::dataset::make("interleave_rhs", { false })),
- framework::dataset::make("export_to_cl_image_rhs", false)),
- framework::dataset::make("DataType", DataType::F32)),
- a_values_precommit),
- beta_values_precommit),
- framework::dataset::make("broadcast_bias", { true } )),
- lhs_transpose_values),
- act_values),
- post_op_lists)
- )
-{
- // Validate output
- if(validate_result)
- {
- validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
- }
- else
- {
- ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
- framework::ARM_COMPUTE_PRINT_INFO();
- }
-}
-
-TEST_SUITE_END() // FusedPostOps
TEST_SUITE(ExportToCLImage)
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
@@ -1002,44 +739,6 @@ FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DFixture<float>,
framework::ARM_COMPUTE_PRINT_INFO();
}
}
-TEST_SUITE(FusedPostOps)
-
-FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedWithPostOpsFixture<float>, framework::DatasetMode::ALL,
- combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
- m_values,
- n_values),
- k_values),
- b_values),
- m0_values_precommit),
- n0_values_precommit),
- k0_values_precommit),
- v0_values_precommit),
- h0_values_precommit),
- framework::dataset::make("interleave_lhs", { false })),
- framework::dataset::make("interleave_rhs", { false })),
- framework::dataset::make("export_to_cl_image_rhs", true)),
- framework::dataset::make("DataType", DataType::F32)),
- a_values_precommit),
- beta_values_precommit),
- framework::dataset::make("broadcast_bias", { true } )),
- lhs_transpose_values),
- act_values),
- post_op_lists)
- )
-{
- // Validate output only if validate() is successful
- if(validate_result)
- {
- validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
- }
- else
- {
- ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
- framework::ARM_COMPUTE_PRINT_INFO();
- }
-}
-
-TEST_SUITE_END() // FusedPostOps
TEST_SUITE_END() // ExportToCLImage
TEST_SUITE_END() // FP32
@@ -1178,45 +877,6 @@ FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DFixture<half>,
}
}
-TEST_SUITE(FusedPostOps)
-
-FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedWithPostOpsFixture<half>, framework::DatasetMode::ALL,
- combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
- m_values,
- n_values),
- k_values),
- b_values),
- m0_values_precommit),
- n0_values_precommit),
- k0_values_precommit),
- v0_values_precommit),
- h0_values_precommit),
- framework::dataset::make("interleave_lhs", { false })),
- framework::dataset::make("interleave_rhs", { false })),
- framework::dataset::make("export_to_cl_image_rhs", false)),
- framework::dataset::make("DataType", DataType::F16)),
- a_values_precommit),
- beta_values_precommit),
- framework::dataset::make("broadcast_bias", { true } )),
- lhs_transpose_values),
- act_values),
- post_op_lists)
- )
-{
- // Validate output
- if(validate_result)
- {
- validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
- }
- else
- {
- ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
- framework::ARM_COMPUTE_PRINT_INFO();
- }
-}
-
-TEST_SUITE_END() // FusedPostOps
-
TEST_SUITE(ExportToCLImage)
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
framework::dataset::make("Input0Info", { TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16), // OK or incorrect if cl_khr_image2d_from_buffer not supported
@@ -1483,44 +1143,6 @@ FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DFixture<half>,
framework::ARM_COMPUTE_PRINT_INFO();
}
}
-TEST_SUITE(FusedPostOps)
-
-FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedWithPostOpsFixture<half>, framework::DatasetMode::ALL,
- combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
- m_values,
- n_values),
- k_values),
- b_values),
- m0_values_precommit),
- n0_values_precommit),
- k0_values_precommit),
- v0_values_precommit),
- h0_values_precommit),
- framework::dataset::make("interleave_lhs", { false })),
- framework::dataset::make("interleave_rhs", { false })),
- framework::dataset::make("export_to_cl_image_rhs", true)),
- framework::dataset::make("DataType", DataType::F16)),
- a_values_precommit),
- beta_values_precommit),
- framework::dataset::make("broadcast_bias", { true } )),
- lhs_transpose_values),
- act_values),
- post_op_lists)
- )
-{
- // Validate output only if validate() is successful
- if(validate_result)
- {
- validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
- }
- else
- {
- ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
- framework::ARM_COMPUTE_PRINT_INFO();
- }
-}
-
-TEST_SUITE_END() // FusedPostOps
TEST_SUITE_END() // ExportToCLImage
TEST_SUITE_END() // FP16
@@ -1659,45 +1281,6 @@ FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DMixedPrecisionF
}
}
-TEST_SUITE(FusedPostOps)
-
-FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedMixedPrecisionWithPostOpsFixture<half>, framework::DatasetMode::ALL,
- combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
- m_values,
- n_values),
- k_values),
- b_values),
- m0_values_precommit),
- n0_values_precommit),
- k0_values_precommit),
- v0_values_precommit),
- h0_values_precommit),
- framework::dataset::make("interleave_lhs", { false })),
- framework::dataset::make("interleave_rhs", { false })),
- framework::dataset::make("export_to_cl_image_rhs", { true, false })),
- framework::dataset::make("DataType", DataType::F16)),
- a_values_precommit),
- beta_values_precommit),
- framework::dataset::make("broadcast_bias", { true } )),
- lhs_transpose_values),
- act_values),
- post_op_lists)
- )
-{
- // Validate output
- if(validate_result)
- {
- validate(CLAccessor(_target), _reference, rel_tolerance_f16_mixed_precision, 0.f, abs_tolerance_f16_mixed_precision);
- }
- else
- {
- ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
- framework::ARM_COMPUTE_PRINT_INFO();
- }
-}
-
-TEST_SUITE_END() // FusedPostOps
-
TEST_SUITE_END() // MixedPrecision
TEST_SUITE_END() // Float
TEST_SUITE_END() // GEMMMatrixMultiplyReshaped
diff --git a/tests/validation/CL/GEMMMatrixMultiplyReshapedOnlyRHS.cpp b/tests/validation/CL/GEMMMatrixMultiplyReshapedOnlyRHS.cpp
index 53038c8177..dafc8dc5ec 100644
--- a/tests/validation/CL/GEMMMatrixMultiplyReshapedOnlyRHS.cpp
+++ b/tests/validation/CL/GEMMMatrixMultiplyReshapedOnlyRHS.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2022 Arm Limited.
+ * Copyright (c) 2019-2023 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -23,7 +23,6 @@
*/
#include "arm_compute/core/KernelDescriptors.h"
#include "arm_compute/core/Types.h"
-#include "arm_compute/core/experimental/PostOps.h"
#include "arm_compute/core/utils/misc/ShapeCalculator.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/CL/CLTensorAllocator.h"
@@ -62,11 +61,6 @@ using CLGEMMMatrixMultiplyReshapedOnlyRHSFixture = GEMMMatrixMultiplyReshapedOnl
template <typename T>
using CLGEMMMatrixMultiplyReshapedOnlyRHS3DFixture = GEMMMatrixMultiplyReshapedOnlyRHS3DValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshapedOnlyRHS>;
-// Fixture for CLGEMMMatrixMultiplyReshapedOnlyRHS with post ops
-template <typename T>
-using CLGEMMMatrixMultiplyReshapedOnlyRHSWithPostOpsFixture =
- GEMMMatrixMultiplyReshapedOnlyRHSWithPostOpsValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshapedOnlyRHS>;
-
namespace
{
// *INDENT-OFF*
@@ -164,106 +158,6 @@ const auto boundary_handling_cases = combine(combine(combine(combine(combine(com
broadcast_bias_values),
framework::dataset::make("Activation", ActivationLayerInfo()));
-/** Post Ops */
-using PostOpArgBroadcast = CLGEMMMatrixMultiplyReshapedOnlyRHSWithPostOpsFixture<float>::PostOpArgBroadcast;
-experimental::PostOpList<PostOpArgBroadcast> post_ops_1()
-{
- experimental::PostOpList<PostOpArgBroadcast> post_ops{};
- post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::LINEAR, 0.5F, 0.0F});
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<PostOpArgBroadcast>>(
- std::make_tuple(true, true, false), // If broadcast in dims 0, 1 and 2
- 0,
- ConvertPolicy::SATURATE);
- post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::RELU, 2.1F, 1.3F});
- return post_ops;
-}
-experimental::PostOpList<PostOpArgBroadcast> post_ops_2()
-{
- experimental::PostOpList<PostOpArgBroadcast> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<PostOpArgBroadcast>>(
- std::make_tuple(false, true, true), // If broadcast in dims 0, 1 and 2
- 1,
- ConvertPolicy::SATURATE);
- post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::RELU, 2.1F, 1.3F});
- return post_ops;
-}
-experimental::PostOpList<PostOpArgBroadcast> post_ops_3()
-{
- experimental::PostOpList<PostOpArgBroadcast> post_ops{};
- post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::RELU, 2.1F, 1.3F});
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<PostOpArgBroadcast>>(
- std::make_tuple(false, false, true), // If broadcast in dims 0, 1 and 2
- 1,
- ConvertPolicy::SATURATE);
- return post_ops;
-}
-// To test that the output of the main op is the first parameter in prelu post op
-experimental::PostOpList<PostOpArgBroadcast> post_ops_4()
-{
- experimental::PostOpList<PostOpArgBroadcast> post_ops{};
- post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::LINEAR, 0.5F, 0.0F});
- post_ops.push_back_op<experimental::PostOpEltwisePRelu<PostOpArgBroadcast>>(
- std::make_tuple(false, false, true), // If true, broadcast in corresponding dim: 0, 1 or 2
- 0,
- ConvertPolicy::SATURATE);
- post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::RELU, 2.1F, 1.3F});
- return post_ops;
-}
-// To test that the output of the main op is the second parameter in prelu post op i.e. it is the alpha_param
-experimental::PostOpList<PostOpArgBroadcast> post_ops_5()
-{
- experimental::PostOpList<PostOpArgBroadcast> post_ops{};
- post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::LINEAR, 0.5F, 0.0F});
- post_ops.push_back_op<experimental::PostOpEltwisePRelu<PostOpArgBroadcast>>(
- std::make_tuple(false, false, false), // If true, broadcast in corresponding dim: 0, 1 or 2
- 1,
- ConvertPolicy::SATURATE);
- post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::RELU, 2.1F, 1.3F});
- return post_ops;
-}
-/** Different Post Op Lists */
-const auto post_op_lists = framework::dataset::make("post_op_lists", {
- post_ops_1(),
- post_ops_2(),
- post_ops_3(),
- post_ops_4(),
- post_ops_5()
- } );
-
- bool is_post_op_list_valid(unsigned int m, unsigned int n, unsigned int k, unsigned int batch, DataType data_type, const experimental::PostOpList<ITensorInfo*>& post_ops)
-{
- const auto lhs_info = GEMMLHSMatrixInfo(4,4,1,false,true);
- const auto rhs_info = GEMMRHSMatrixInfo(4,4,1,true,true,false);
-
- // Create TensorInfo for post op arguments
- TensorInfo input0_info(TensorShape(k, m, batch), 1, data_type);
- TensorInfo input1_info(TensorShape(n, k, batch), 1, data_type);
- TensorInfo input2_info(TensorShape(n), 1, data_type);
- TensorInfo output_info(TensorShape(n, m, batch), 1, data_type);
-
- const TensorInfo reshaped_input1_info = input1_info.clone()->set_tensor_shape(misc::shape_calculator::compute_rhs_reshaped_shape(input1_info, rhs_info));
-
- GEMMKernelInfo gemm_info(m, n, k, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
- false /**< reinterpret the input as 3D */,
- true /**< Flag used to broadcast the bias addition */,
- false /**< wider accumm */,
- false /**< has pad y */,
- ActivationLayerInfo::ActivationFunction::IDENTITY,
- 1 /**< Multiplication factor for the width of the 1xW transposed block */,
- 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
- lhs_info,
- rhs_info,
- 0 /**< Offset to be added to each element of the matrix A */,
- 0 /**< Offset to be added to each element of the matrix B */,
- post_ops);
- return bool(ClGemmMatrixMultiplyReshapedOnlyRhsKernel::validate(&input0_info.clone()->set_is_resizable(true),
- &reshaped_input1_info.clone()->set_is_resizable(true),
- &input2_info.clone()->set_is_resizable(true),
- &output_info.clone()->set_is_resizable(true),1.f,1.f,
- lhs_info,
- rhs_info,
- gemm_info));
-}
/** Configuration test */
bool validate_configuration(unsigned int m_value, unsigned int n_value, unsigned int k_value, unsigned int b_value,
unsigned int m0_value, unsigned int n0_value, unsigned int k0_value, unsigned int h0_value,
@@ -370,119 +264,6 @@ b_value, m0_value, n0_value, k0_value, broadcast_bias, input_as_3d, depth_output
ARM_COMPUTE_EXPECT(status == expected_value, framework::LogLevel::ERRORS);
}
-TEST_SUITE(ValidateFusedPostOpsConfigs)
-TEST_SUITE(Invalid)
-TEST_CASE(UnsupportedPostOpSequence, framework::DatasetMode::ALL)
-{
- const auto data_type = DataType::F32;
- const unsigned int m = 17;
- const unsigned int n = 1;
- const unsigned int k = 13;
- const unsigned int batch = 2;
- TensorShape post_op_arg0_shape(n, m, batch);
- TensorInfo post_op_arg_info(post_op_arg0_shape, 1, data_type);
- auto post_op_arg1_info = post_op_arg_info.clone();
-
- // Unsupported sequence of post ops
- experimental::PostOpList<ITensorInfo*> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>(
- &post_op_arg_info,
- 1,
- ConvertPolicy::SATURATE);
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>(
- post_op_arg1_info.get(),
- 0,
- ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == false, framework::LogLevel::ERRORS);
-}
-TEST_CASE(OutputWidened, framework::DatasetMode::ALL)
-{
- // Invalid broadcast: post op tensors "widen" the output tensor
- const auto data_type = DataType::F32;
- const unsigned int m = 17;
- const unsigned int n = 1;
- const unsigned int k = 1;
- const unsigned int batch = 1;
- TensorShape post_op_arg_shape(n, m, batch + 4); // output's batch dimension is "widened", which is not allowed
- TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
- experimental::PostOpList<ITensorInfo*> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == false, framework::LogLevel::ERRORS);
-}
-TEST_CASE(BroadcastInXDimOnly, framework::DatasetMode::ALL)
-{
- // Invalid broadcast: post op tensors broadcast in the first dimension (X) only
- const auto data_type = DataType::F32;
- const unsigned int m = 22;
- const unsigned int n = 16;
- const unsigned int k = 15;
- const unsigned int batch = 3;
- TensorShape post_op_arg_shape(1, m, batch);
- TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
- experimental::PostOpList<ITensorInfo*> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == false, framework::LogLevel::ERRORS);
-}
-TEST_SUITE_END() // Invalid
-TEST_SUITE(Valid)
-TEST_CASE(EmptyPostOpList, framework::DatasetMode::ALL)
-{
- const auto data_type = DataType::F32;
- const unsigned int m = 22;
- const unsigned int n = 16;
- const unsigned int k = 15;
- const unsigned int batch = 3;
- experimental::PostOpList<ITensorInfo*> post_ops{};
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == true, framework::LogLevel::ERRORS);
-}
-TEST_CASE(BroadcastInYDimOnly, framework::DatasetMode::ALL)
-{
- const auto data_type = DataType::F32;
- const unsigned int m = 22;
- const unsigned int n = 16;
- const unsigned int k = 15;
- const unsigned int batch = 3;
- TensorShape post_op_arg_shape(n, 1, batch);
- TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
- experimental::PostOpList<ITensorInfo*> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == true, framework::LogLevel::ERRORS);
-}
-TEST_CASE(BroadcastInBothXandYDims, framework::DatasetMode::ALL)
-{
- const auto data_type = DataType::F32;
- const unsigned int m = 22;
- const unsigned int n = 16;
- const unsigned int k = 15;
- const unsigned int batch = 3;
- TensorShape post_op_arg_shape(1, 1, batch);
- TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
- experimental::PostOpList<ITensorInfo*> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == true, framework::LogLevel::ERRORS);
-}
-TEST_CASE(BroadcastInAllDims, framework::DatasetMode::ALL)
-{
- const auto data_type = DataType::F32;
- const unsigned int m = 22;
- const unsigned int n = 16;
- const unsigned int k = 15;
- const unsigned int batch = 3;
- TensorShape post_op_arg_shape(1, 1, 1);
- TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
- experimental::PostOpList<ITensorInfo*> post_ops{};
- post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
-
- ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == true, framework::LogLevel::ERRORS);
-}
-TEST_SUITE_END() // Valid
-TEST_SUITE_END() // ValidateFusedPostOps
TEST_SUITE(Float)
TEST_SUITE(FP32)
@@ -684,43 +465,6 @@ FIXTURE_DATA_TEST_CASE(RunNightly3D, CLGEMMMatrixMultiplyReshapedOnlyRHS3DFixtur
}
}
-TEST_SUITE(FusedPostOps)
-
-FIXTURE_DATA_TEST_CASE(RunPrecommit, CLGEMMMatrixMultiplyReshapedOnlyRHSWithPostOpsFixture<float>, framework::DatasetMode::ALL,
- combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
- m_values,
- n_values),
- k_values),
- b_values),
- m0_values_precommit),
- n0_values_precommit),
- k0_values_precommit),
- framework::dataset::make("H0", {1})),
- framework::dataset::make("interleave_rhs", { true })),
- t_values_rhs),
- framework::dataset::make("export_to_cl_image_rhs", {false, true})),
- framework::dataset::make("DataType", DataType::F32)),
- a_values),
- beta_values),
- framework::dataset::make("broadcast_bias", { false } )),
- act_values),
- post_op_lists)
- )
-{
- // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
- if(validate_result)
- {
- validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
- }
- else
- {
- ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
- framework::ARM_COMPUTE_PRINT_INFO();
- }
-}
-
-TEST_SUITE_END() // FusedPostOps
-
TEST_SUITE_END() // FP32
TEST_SUITE(FP16)
@@ -849,42 +593,6 @@ FIXTURE_DATA_TEST_CASE(RunNightly3D, CLGEMMMatrixMultiplyReshapedOnlyRHS3DFixtur
framework::ARM_COMPUTE_PRINT_INFO();
}
}
-TEST_SUITE(FusedPostOps)
-
-FIXTURE_DATA_TEST_CASE(RunPrecommit, CLGEMMMatrixMultiplyReshapedOnlyRHSWithPostOpsFixture<half>, framework::DatasetMode::ALL,
- combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
- m_values,
- n_values),
- k_values),
- b_values),
- m0_values_precommit),
- n0_values_precommit),
- k0_values_precommit),
- framework::dataset::make("H0", {1})),
- framework::dataset::make("interleave_rhs", { true })),
- t_values_rhs),
- framework::dataset::make("export_to_cl_image_rhs", true)),
- framework::dataset::make("DataType", DataType::F16)),
- a_values),
- beta_values),
- framework::dataset::make("broadcast_bias", { false } )),
- act_values),
- post_op_lists)
- )
-{
- // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
- if(validate_result)
- {
- validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
- }
- else
- {
- ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
- framework::ARM_COMPUTE_PRINT_INFO();
- }
-}
-
-TEST_SUITE_END() // FusedPostOps
TEST_SUITE_END() // FP16
diff --git a/tests/validation/dynamic_fusion/gpu/cl/DirectConv2d.cpp b/tests/validation/dynamic_fusion/gpu/cl/DirectConv2d.cpp
index f27a1796c9..bae8cbf868 100644
--- a/tests/validation/dynamic_fusion/gpu/cl/DirectConv2d.cpp
+++ b/tests/validation/dynamic_fusion/gpu/cl/DirectConv2d.cpp
@@ -58,7 +58,7 @@ TEST_SUITE(DYNAMIC_FUSION)
* No quantized tests | Not supported yet
* No grouped CNN tests | Not supported yet
* No mixed layout tests | Not needed; only NHWC is supported
- * No activation/post op tests | Not needed in fusion
+ * No activation | Not needed in fusion
* No ValidateConvolutionMethod | Only a single method (direct conv2d) is supported
* No ReshapeWeights = true tests | Not applicable yet. This parameter only concerns gemm-based conv2d
* No RunSmallWithPadding tests | Padding is removed
@@ -70,9 +70,7 @@ template <typename T>
using DynamicFusionGpuConv2dFixture = DynamicFusionGpuConv2dValidationFixture<CLTensor, CLAccessor, GpuConv2d, T>;
TEST_SUITE(FP32)
FIXTURE_DATA_TEST_CASE(RunSmall, DynamicFusionGpuConv2dFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallConvolutionLayerDataset(),
- framework::dataset::make("DataType", DataType::F32)),
- framework::dataset::make("DataLayout", { DataLayout::NHWC })),
- framework::dataset::make("QuantizationInfo", QuantizationInfo())))
+ framework::dataset::make("DataType", DataType::F32)), framework::dataset::make("DataLayout", { DataLayout::NHWC })), framework::dataset::make("QuantizationInfo", QuantizationInfo())))
{
// Validate output
validate(CLAccessor(_target), _reference, tolerance_f32);
@@ -81,9 +79,7 @@ TEST_SUITE_END() // FP32
TEST_SUITE(FP16)
FIXTURE_DATA_TEST_CASE(RunSmall, DynamicFusionGpuConv2dFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallConvolutionLayerDataset(),
- framework::dataset::make("DataType", DataType::F16)),
- framework::dataset::make("DataLayout", { DataLayout::NHWC })),
- framework::dataset::make("QuantizationInfo", QuantizationInfo())))
+ framework::dataset::make("DataType", DataType::F16)), framework::dataset::make("DataLayout", { DataLayout::NHWC })), framework::dataset::make("QuantizationInfo", QuantizationInfo())))
{
// Validate output
validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
diff --git a/tests/validation/fixtures/GEMMFixture.h b/tests/validation/fixtures/GEMMFixture.h
index f1e0ee9150..afde3d8067 100644
--- a/tests/validation/fixtures/GEMMFixture.h
+++ b/tests/validation/fixtures/GEMMFixture.h
@@ -21,14 +21,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef ARM_COMPUTE_TEST_GEMM_FIXTURE
-#define ARM_COMPUTE_TEST_GEMM_FIXTURE
+#ifndef ACL_TESTS_VALIDATION_FIXTURES_GEMMFIXTURE_H
+#define ACL_TESTS_VALIDATION_FIXTURES_GEMMFIXTURE_H
#include "arm_compute/core/KernelDescriptors.h"
#include "arm_compute/core/TensorShape.h"
#include "arm_compute/core/Types.h"
-#include "arm_compute/core/experimental/IPostOp.h"
-#include "src/core/experimental/PostOpUtils.h"
#include "tests/AssetsLibrary.h"
#include "tests/Globals.h"
#include "tests/IAccessor.h"
@@ -38,7 +36,6 @@
#include "tests/validation/reference/ActivationLayer.h"
#include "tests/validation/reference/ElementwiseOperations.h"
#include "tests/validation/reference/GEMM.h"
-#include "tests/validation/reference/PostOps.h"
#include <random>
@@ -304,8 +301,7 @@ protected:
ITensorPack gemm_pack({ { ACL_SRC_0, &lhs },
{ ACL_SRC_1, &rhs },
{ ACL_SRC_2, &bias },
- { ACL_DST, &dst }
- });
+ { ACL_DST, &dst } });
gemm.run(gemm_pack);
return dst;
@@ -426,8 +422,7 @@ protected:
ITensorPack gemm_pack({ { ACL_SRC_0, &lhs },
{ ACL_SRC_1, &rhs },
{ ACL_SRC_2, &bias },
- { ACL_DST, &dst }
- });
+ { ACL_DST, &dst } });
gemm.run(gemm_pack);
return dst;
@@ -580,8 +575,7 @@ protected:
ITensorPack gemm_pack({ { ACL_SRC_0, &lhs_reshaped },
{ ACL_SRC_1, &rhs_reshaped },
{ ACL_SRC_2, &bias },
- { ACL_DST, &dst }
- });
+ { ACL_DST, &dst } });
gemm.run(gemm_pack);
return dst;
@@ -734,8 +728,7 @@ protected:
ITensorPack gemm_pack({ { ACL_SRC_0, &lhs_reshaped },
{ ACL_SRC_1, &rhs_reshaped },
{ ACL_SRC_2, &bias },
- { ACL_DST, &dst }
- });
+ { ACL_DST, &dst } });
gemm.run(gemm_pack);
return dst;
@@ -908,8 +901,7 @@ protected:
ITensorPack gemm_pack({ { ACL_SRC_0, &lhs_reshaped },
{ ACL_SRC_1, &rhs_reshaped },
{ ACL_SRC_2, &bias },
- { ACL_DST, &dst }
- });
+ { ACL_DST, &dst } });
gemm.run(gemm_pack);
return dst;
@@ -960,262 +952,6 @@ protected:
SimpleTensor<T> _reference{};
};
-/** (EXPERIMENTAL_POST_OPS)*/
-template <typename TensorType, typename AccessorType, typename T, typename ReshapeLHSOperatorType, typename ReshapeRHSOperatorType, typename GEMMOperatorType, bool fp_mixed_precision = false>
-class GEMMMatrixMultiplyReshapedWithPostOpsValidationFixture : public framework::Fixture
-{
-public:
- using PostOpArgBroadcast = std::tuple<bool, bool, bool>; // Instruct fixture if we need broadcasting in dimension 0, 1, 2 of each PostOp argument
-public:
- void setup(unsigned int m, unsigned int n, unsigned int k, unsigned int batch_size, unsigned int m0, unsigned int n0, unsigned int k0, unsigned int v0, unsigned int h0, bool interleave_lhs,
- bool interleave_rhs, bool export_to_cl_image, DataType data_type, float alpha, float beta, bool broadcast_bias, bool lhs_transpose, const ActivationLayerInfo &act_info,
- const experimental::PostOpList<PostOpArgBroadcast> &post_ops)
- {
- GEMMLHSMatrixInfo lhs_info;
- lhs_info.m0 = m0;
- lhs_info.k0 = k0;
- lhs_info.v0 = v0;
- lhs_info.interleave = interleave_lhs;
- lhs_info.transpose = lhs_transpose;
-
- GEMMRHSMatrixInfo rhs_info;
- rhs_info.n0 = n0;
- rhs_info.k0 = k0;
- rhs_info.h0 = h0;
- rhs_info.interleave = interleave_rhs;
- rhs_info.transpose = !lhs_transpose;
- rhs_info.export_to_cl_image = export_to_cl_image;
-
- // Set the tensor shapes for LHS and RHS matrices
- const TensorShape lhs_shape(k, m, batch_size);
- const TensorShape rhs_shape(n, k, batch_size);
- const TensorShape bias_shape(n,
- broadcast_bias ? 1 : m,
- broadcast_bias ? 1 : batch_size);
- auto post_ops_with_shapes = experimental::transform_post_op_list_arguments<PostOpArgBroadcast, TensorShape>(post_ops,
- [ = ](auto broadcast)
- {
- return TensorShape
- {
- std::get<0>(broadcast) ? 1 : n,
- std::get<1>(broadcast) ? 1 : m,
- std::get<2>(broadcast) ? 1 : batch_size,
- };
- });
-
- _target = compute_target(lhs_shape, rhs_shape, bias_shape, lhs_info, rhs_info, data_type, alpha, beta, broadcast_bias, act_info, post_ops_with_shapes);
- if(validate_result)
- {
- _reference = compute_reference(lhs_shape, rhs_shape, data_type, alpha, beta, broadcast_bias, act_info, post_ops_with_shapes);
- }
- }
-
-protected:
- template <typename U>
- void fill(U &&tensor, int i)
- {
- static_assert(std::is_floating_point<T>::value || std::is_same<T, half>::value, "Only floating point data types supported.");
- using DistributionType = typename std::conditional<std::is_same<T, half>::value, arm_compute::utils::uniform_real_distribution_16bit<T>, std::uniform_real_distribution<T>>::type;
-
- DistributionType distribution{ T(-1.0f), T(1.0f) };
- library->fill(tensor, distribution, i);
-
- // Fill border with infinity in order to check the presence of NaN values (i.e. inf * 0)
- DistributionType distribution_inf{ T(std::numeric_limits<float>::infinity()), T(std::numeric_limits<float>::infinity()) };
- library->fill_borders_with_garbage(tensor, distribution_inf, i);
- }
-
- TensorType compute_target(const TensorShape &lhs_shape, const TensorShape &rhs_shape, const TensorShape &bias_shape, const GEMMLHSMatrixInfo &lhs_info, const GEMMRHSMatrixInfo &rhs_info,
- DataType data_type, float alpha, float beta, bool broadcast_bias, const ActivationLayerInfo &act_info, const experimental::PostOpList<TensorShape> &post_ops)
- {
- // Create tensors
- TensorType lhs = create_tensor<TensorType>(lhs_shape, data_type, 1);
- TensorType rhs = create_tensor<TensorType>(rhs_shape, data_type, 1);
- TensorType bias = create_tensor<TensorType>(bias_shape, data_type, 1);
-
- // Create post op tensors and populate post op with them
- std::vector<TensorType> post_op_tensors_holder{};
- auto populated_post_ops = experimental::transform_post_op_list_arguments<TensorShape, ITensorInfo *>(post_ops,
- [&post_op_tensors_holder, &data_type](auto shape)
- {
- auto t = create_tensor<TensorType>(shape, data_type, 1);
- post_op_tensors_holder.push_back(std::move(t));
- return post_op_tensors_holder.back().info();
- });
- TensorType lhs_reshaped;
- TensorType rhs_reshaped;
- TensorType dst;
-
- const unsigned int M = lhs_shape[1];
- const unsigned int N = rhs_shape[0];
- const unsigned int K = lhs_shape[0];
- GEMMKernelInfo kernel_info;
- kernel_info.m = M;
- kernel_info.n = N;
- kernel_info.k = K;
- kernel_info.depth_output_gemm3d = 0;
- kernel_info.reinterpret_input_as_3d = false;
- kernel_info.broadcast_bias = broadcast_bias;
- kernel_info.activation_info = act_info;
- kernel_info.fp_mixed_precision = fp_mixed_precision;
- kernel_info.post_ops = populated_post_ops;
-
- // The output tensor will be auto-initialized within the function
-
- // Create and configure function
- ReshapeLHSOperatorType reshape_lhs;
- ReshapeRHSOperatorType reshape_rhs;
- GEMMOperatorType gemm;
-
- validate_result = bool(reshape_rhs.validate(rhs.info(), rhs_reshaped.info(), rhs_info));
- validate_result = validate_result || !rhs_info.export_to_cl_image;
- if(!validate_result)
- {
- return nullptr;
- }
-
- reshape_lhs.configure(lhs.info(), lhs_reshaped.info(), lhs_info);
- reshape_rhs.configure(rhs.info(), rhs_reshaped.info(), rhs_info);
- gemm.configure(lhs_reshaped.info(), rhs_reshaped.info(), bias.info(), dst.info(), alpha, beta, lhs_info, rhs_info, kernel_info);
-
- ARM_COMPUTE_ASSERT(lhs.info()->is_resizable());
- ARM_COMPUTE_ASSERT(rhs.info()->is_resizable());
- ARM_COMPUTE_ASSERT(bias.info()->is_resizable());
- for(const auto &tensor : post_op_tensors_holder)
- {
- ARM_COMPUTE_ASSERT(tensor.info()->is_resizable());
- }
-
- // We do not pad when using image as it needs to comply to strict pitch alignment restrictions
- if(!rhs_info.export_to_cl_image)
- {
- add_padding_x({ &lhs, &rhs, &lhs_reshaped, &rhs_reshaped, &bias, &dst });
- for(auto &tensor : post_op_tensors_holder)
- {
- add_padding_x({ &tensor });
- }
- }
-
- // Allocate tensors
- lhs.allocator()->allocate();
- rhs.allocator()->allocate();
- lhs_reshaped.allocator()->allocate();
- rhs_reshaped.allocator()->allocate();
- bias.allocator()->allocate();
- dst.allocator()->allocate();
- for(auto &tensor : post_op_tensors_holder)
- {
- tensor.allocator()->allocate();
- }
-
- ARM_COMPUTE_ASSERT(!lhs.info()->is_resizable());
- ARM_COMPUTE_ASSERT(!rhs.info()->is_resizable());
- ARM_COMPUTE_ASSERT(!bias.info()->is_resizable());
- ARM_COMPUTE_ASSERT(!lhs_reshaped.info()->is_resizable());
- ARM_COMPUTE_ASSERT(!rhs_reshaped.info()->is_resizable());
- ARM_COMPUTE_ASSERT(!dst.info()->is_resizable());
- for(const auto &tensor : post_op_tensors_holder)
- {
- ARM_COMPUTE_ASSERT(!tensor.info()->is_resizable());
- }
-
- // Fill tensors
- fill(AccessorType(lhs), 0);
- fill(AccessorType(rhs), 1);
- fill(AccessorType(bias), 2);
- for(size_t i = 0; i < post_op_tensors_holder.size(); ++i)
- {
- fill(AccessorType(post_op_tensors_holder.at(i)), 3 + i);
- }
-
- // Compute GEMM
- ITensorPack reshape_lhs_pack = { { ACL_SRC, &lhs }, { ACL_DST, &lhs_reshaped } };
- reshape_lhs.run(reshape_lhs_pack);
- ITensorPack reshape_rhs_pack = { { ACL_SRC, &rhs }, { ACL_DST, &rhs_reshaped } };
- reshape_rhs.run(reshape_rhs_pack);
- ITensorPack gemm_pack({ { ACL_SRC_0, &lhs_reshaped },
- { ACL_SRC_1, &rhs_reshaped },
- { ACL_SRC_2, &bias },
- { ACL_DST, &dst }
- });
- for(size_t i = 0; i < post_op_tensors_holder.size(); ++i)
- {
- gemm_pack.add_tensor(experimental::get_post_op_arg_type(i), &post_op_tensors_holder.at(i));
- }
- gemm.run(gemm_pack);
-
- return dst;
- }
-
- SimpleTensor<T> compute_reference(const TensorShape &lhs_shape, const TensorShape &rhs_shape, DataType data_type, float alpha, float beta, bool broadcast_bias,
- const ActivationLayerInfo &act_info, const experimental::PostOpList<TensorShape> &post_ops)
- {
- TensorShape dst_shape = lhs_shape;
- dst_shape[0] = rhs_shape[0];
- dst_shape[1] = lhs_shape[1];
-
- // Create reference
- SimpleTensor<T> lhs{ lhs_shape, data_type, 1 };
- SimpleTensor<T> rhs{ rhs_shape, data_type, 1 };
- SimpleTensor<T> bias{ dst_shape, data_type, 1 };
- // Create post op tensors and populate post op with them
- auto populated_post_ops = experimental::transform_post_op_list_arguments<TensorShape, SimpleTensor<T>>(post_ops, [&data_type](auto shape)
- {
- return SimpleTensor<T> { shape, data_type, 1 };
- });
-
- const int n = rhs_shape[0];
- const int m = lhs_shape[1];
- const int batch_size = lhs_shape[2];
-
- // Fill reference
- int tensor_idx = 0;
- fill(lhs, tensor_idx++);
- fill(rhs, tensor_idx++);
- fill(bias, tensor_idx++);
- for(auto &op : populated_post_ops.get_list())
- {
- for(auto tensor : op->arguments())
- {
- fill(*tensor, tensor_idx++);
- }
- }
-
- if(broadcast_bias)
- {
- // In case of broadcast, we need to simply copy the first into the following "M" ones
- for(int i = 1; i < m * batch_size; i++)
- {
- memcpy(bias.data() + i * n, bias.data(), n * sizeof(T));
- }
- }
-
- SimpleTensor<T> out;
- if(fp_mixed_precision)
- {
- out = reference::gemm_mixed_precision<T>(lhs, rhs, bias, alpha, beta);
- }
- else
- {
- out = reference::gemm<T>(lhs, rhs, bias, alpha, beta);
- }
- // Ignore activation info if post ops are used instead
- if(populated_post_ops.size() > 0)
- {
- out = reference::post_ops<T>(out, populated_post_ops);
- }
- else
- {
- out = reference::activation_layer(out, act_info);
- }
- return out;
- }
-
- bool validate_result = true;
- TensorType _target{};
- SimpleTensor<T> _reference{};
-};
-
template <typename TensorType, typename AccessorType, typename T, typename ReshapeLHSOperatorType, typename ReshapeRHSOperatorType, typename GEMMOperatorType, bool fp_mixed_precision = false>
class GEMMMatrixMultiplyReshaped3DValidationFixture : public framework::Fixture
{
@@ -1344,8 +1080,7 @@ protected:
ITensorPack gemm_pack({ { ACL_SRC_0, &lhs_reshaped },
{ ACL_SRC_1, &rhs_reshaped },
{ ACL_SRC_2, &bias },
- { ACL_DST, &dst }
- });
+ { ACL_DST, &dst } });
gemm.run(gemm_pack);
return dst;
@@ -1515,8 +1250,7 @@ protected:
ITensorPack gemm_pack({ { ACL_SRC_0, &lhs },
{ ACL_SRC_1, &rhs_reshaped },
{ ACL_SRC_2, &bias },
- { ACL_DST, &dst }
- });
+ { ACL_DST, &dst } });
gemm.run(gemm_pack);
return dst;
@@ -1560,242 +1294,6 @@ protected:
SimpleTensor<T> _reference{};
};
-/** (EXPERIMENTAL_POST_OPS)*/
-template <typename TensorType, typename AccessorType, typename T, typename ReshapeRHSOperatorType, typename GEMMOperatorType>
-class GEMMMatrixMultiplyReshapedOnlyRHSWithPostOpsValidationFixture : public framework::Fixture
-{
-public:
- using PostOpArgBroadcast = std::tuple<bool, bool, bool>; // Instruct fixture if we need broadcasting in dimension 0, 1, 2 of each PostOp argument
- void setup(unsigned int m, unsigned int n, unsigned int k, unsigned int batch_size, unsigned int m0, unsigned int n0, unsigned int k0, unsigned int h0,
- bool interleave_rhs, bool transpose_rhs, bool export_to_cl_image, DataType data_type, float alpha, float beta, bool broadcast_bias, const ActivationLayerInfo &act_info,
- const experimental::PostOpList<PostOpArgBroadcast> &post_ops)
- {
- GEMMLHSMatrixInfo lhs_info;
- lhs_info.m0 = m0;
- lhs_info.k0 = k0;
-
- GEMMRHSMatrixInfo rhs_info;
- rhs_info.n0 = n0;
- rhs_info.k0 = k0;
- rhs_info.h0 = h0;
- rhs_info.interleave = interleave_rhs;
- rhs_info.transpose = transpose_rhs;
- rhs_info.export_to_cl_image = export_to_cl_image;
-
- // Set the tensor shapes for LHS and RHS matrices
- const TensorShape lhs_shape(k, m, batch_size);
- const TensorShape rhs_shape(n, k, batch_size);
- const TensorShape bias_shape(n,
- broadcast_bias ? 1 : m,
- broadcast_bias ? 1 : batch_size);
- auto post_ops_with_shapes = experimental::transform_post_op_list_arguments<PostOpArgBroadcast, TensorShape>(post_ops,
- [ = ](auto broadcast)
- {
- return TensorShape
- {
- std::get<0>(broadcast) ? 1 : n,
- std::get<1>(broadcast) ? 1 : m,
- std::get<2>(broadcast) ? 1 : batch_size,
- };
- });
-
- _target = compute_target(lhs_shape, rhs_shape, bias_shape, lhs_info, rhs_info, data_type, alpha, beta, broadcast_bias, act_info, post_ops_with_shapes);
- if(validate_result)
- {
- _reference = compute_reference(lhs_shape, rhs_shape, data_type, alpha, beta, broadcast_bias, act_info, post_ops_with_shapes);
- }
- }
-
-protected:
- template <typename U>
- void fill(U &&tensor, int i)
- {
- static_assert(std::is_floating_point<T>::value || std::is_same<T, half>::value, "Only floating point data types supported.");
- using DistributionType = typename std::conditional<std::is_same<T, half>::value, arm_compute::utils::uniform_real_distribution_16bit<T>, std::uniform_real_distribution<T>>::type;
-
- DistributionType distribution{ T(-1.0f), T(1.0f) };
- library->fill(tensor, distribution, i);
-
- // Fill border with infinity in order to check the presence of NaN values (i.e. inf * 0)
- DistributionType distribution_inf{ T(std::numeric_limits<float>::infinity()), T(std::numeric_limits<float>::infinity()) };
- library->fill_borders_with_garbage(tensor, distribution_inf, i);
- }
-
- TensorType compute_target(const TensorShape &lhs_shape, const TensorShape &rhs_shape, const TensorShape &bias_shape, const GEMMLHSMatrixInfo &lhs_info, const GEMMRHSMatrixInfo &rhs_info,
- DataType data_type, float alpha, float beta, bool broadcast_bias, const ActivationLayerInfo &act_info, const experimental::PostOpList<TensorShape> &post_ops)
- {
- // Create tensors
- TensorType lhs = create_tensor<TensorType>(lhs_shape, data_type, 1);
- TensorType rhs = create_tensor<TensorType>(rhs_shape, data_type, 1);
- TensorType bias = create_tensor<TensorType>(bias_shape, data_type, 1);
- TensorType rhs_reshaped;
- TensorType dst;
- // Create post op tensors and populate post op with them
- std::vector<TensorType> post_op_tensors_holder{};
- auto populated_post_ops = experimental::transform_post_op_list_arguments<TensorShape, ITensorInfo *>(post_ops,
- [&post_op_tensors_holder, &data_type](auto shape)
- {
- auto t = create_tensor<TensorType>(shape, data_type, 1);
- post_op_tensors_holder.push_back(std::move(t));
- return post_op_tensors_holder.back().info();
- });
-
- const unsigned int M = lhs_shape[1];
- const unsigned int N = rhs_shape[0];
- const unsigned int K = lhs_shape[0];
- GEMMKernelInfo kernel_info;
- kernel_info.m = M;
- kernel_info.n = N;
- kernel_info.k = K;
- kernel_info.depth_output_gemm3d = 0;
- kernel_info.reinterpret_input_as_3d = false;
- kernel_info.broadcast_bias = broadcast_bias;
- kernel_info.activation_info = act_info;
- kernel_info.post_ops = populated_post_ops;
-
- // The output tensor will be auto-initialized within the function
-
- // Create and configure function
- ReshapeRHSOperatorType reshape_rhs;
- GEMMOperatorType gemm;
-
- validate_result = bool(reshape_rhs.validate(rhs.info(), rhs_reshaped.info(), rhs_info));
- validate_result = validate_result || !rhs_info.export_to_cl_image;
- if(!validate_result)
- {
- return nullptr;
- }
-
- reshape_rhs.configure(rhs.info(), rhs_reshaped.info(), rhs_info);
- gemm.configure(lhs.info(), rhs_reshaped.info(), bias.info(), dst.info(), alpha, beta, lhs_info, rhs_info, kernel_info);
-
- ARM_COMPUTE_ASSERT(lhs.info()->is_resizable());
- ARM_COMPUTE_ASSERT(rhs.info()->is_resizable());
- ARM_COMPUTE_ASSERT(bias.info()->is_resizable());
- for(const auto &tensor : post_op_tensors_holder)
- {
- ARM_COMPUTE_ASSERT(tensor.info()->is_resizable());
- }
-
- // We do not pad when using image as it needs to comply to strict pitch alignment restrictions
- if(!rhs_info.export_to_cl_image)
- {
- add_padding_x({ &lhs, &rhs, &rhs_reshaped, &bias, &dst });
- for(auto &tensor : post_op_tensors_holder)
- {
- add_padding_x({ &tensor });
- }
- }
-
- // Allocate tensors
- lhs.allocator()->allocate();
- rhs.allocator()->allocate();
- rhs_reshaped.allocator()->allocate();
- bias.allocator()->allocate();
- dst.allocator()->allocate();
- for(auto &tensor : post_op_tensors_holder)
- {
- tensor.allocator()->allocate();
- }
-
- ARM_COMPUTE_ASSERT(!lhs.info()->is_resizable());
- ARM_COMPUTE_ASSERT(!rhs.info()->is_resizable());
- ARM_COMPUTE_ASSERT(!rhs_reshaped.info()->is_resizable());
- ARM_COMPUTE_ASSERT(!bias.info()->is_resizable());
- ARM_COMPUTE_ASSERT(!dst.info()->is_resizable());
- for(const auto &tensor : post_op_tensors_holder)
- {
- ARM_COMPUTE_ASSERT(!tensor.info()->is_resizable());
- }
-
- // Fill tensors
- fill(AccessorType(lhs), 0);
- fill(AccessorType(rhs), 1);
- fill(AccessorType(bias), 2);
- for(size_t i = 0; i < post_op_tensors_holder.size(); ++i)
- {
- fill(AccessorType(post_op_tensors_holder.at(i)), 3 + i);
- }
-
- // Compute GEMM
- ITensorPack reshape_rhs_pack = { { ACL_SRC, &rhs }, { ACL_DST, &rhs_reshaped } };
- reshape_rhs.run(reshape_rhs_pack);
- ITensorPack gemm_pack({ { ACL_SRC_0, &lhs },
- { ACL_SRC_1, &rhs_reshaped },
- { ACL_SRC_2, &bias },
- { ACL_DST, &dst }
- });
- for(size_t i = 0; i < post_op_tensors_holder.size(); ++i)
- {
- gemm_pack.add_tensor(experimental::get_post_op_arg_type(i), &post_op_tensors_holder.at(i));
- }
- gemm.run(gemm_pack);
-
- return dst;
- }
-
- SimpleTensor<T> compute_reference(const TensorShape &lhs_shape, const TensorShape &rhs_shape, DataType data_type, float alpha, float beta, bool broadcast_bias,
- const ActivationLayerInfo &act_info, const experimental::PostOpList<TensorShape> &post_ops)
- {
- TensorShape dst_shape = lhs_shape;
- dst_shape[0] = rhs_shape[0];
- dst_shape[1] = lhs_shape[1];
-
- // Create reference
- SimpleTensor<T> lhs{ lhs_shape, data_type, 1 };
- SimpleTensor<T> rhs{ rhs_shape, data_type, 1 };
- SimpleTensor<T> bias{ dst_shape, data_type, 1 };
- // Create post op tensors and populate post op with them
- auto populated_post_ops = experimental::transform_post_op_list_arguments<TensorShape, SimpleTensor<T>>(post_ops, [&data_type](auto shape)
- {
- return SimpleTensor<T> { shape, data_type, 1 };
- });
-
- const int n = rhs_shape[0];
- const int m = lhs_shape[1];
- const int batch_size = lhs_shape[2];
-
- // Fill reference
- int tensor_idx = 0;
- fill(lhs, tensor_idx++);
- fill(rhs, tensor_idx++);
- fill(bias, tensor_idx++);
- for(auto &op : populated_post_ops.get_list())
- {
- for(auto tensor : op->arguments())
- {
- fill(*tensor, tensor_idx++);
- }
- }
-
- if(broadcast_bias)
- {
- // In case of broadcast, we need to simply copy the first into the following "M" ones
- for(int i = 1; i < m * batch_size; i++)
- {
- memcpy(bias.data() + i * n, bias.data(), n * sizeof(T));
- }
- }
-
- SimpleTensor<T> out;
- out = reference::gemm<T>(lhs, rhs, bias, alpha, beta);
- // Ignore activation info if post ops are used instead
- if(populated_post_ops.size() > 0)
- {
- out = reference::post_ops<T>(out, populated_post_ops);
- }
- else
- {
- out = reference::activation_layer(out, act_info);
- }
- return out;
- }
-
- bool validate_result = true;
- TensorType _target{};
- SimpleTensor<T> _reference{};
-};
-
template <typename TensorType, typename AccessorType, typename T, typename ReshapeRHSOperatorType, typename GEMMOperatorType>
class GEMMMatrixMultiplyReshapedOnlyRHS3DValidationFixture : public framework::Fixture
{
@@ -1921,8 +1419,7 @@ protected:
ITensorPack gemm_pack({ { ACL_SRC_0, &lhs },
{ ACL_SRC_1, &rhs_reshaped },
{ ACL_SRC_2, &bias },
- { ACL_DST, &dst }
- });
+ { ACL_DST, &dst } });
gemm.run(gemm_pack);
return dst;
@@ -2057,8 +1554,7 @@ protected:
ITensorPack gemm_pack({ { ACL_SRC_0, &lhs },
{ ACL_SRC_1, &rhs },
{ ACL_SRC_2, &bias },
- { ACL_DST, &dst }
- });
+ { ACL_DST, &dst } });
gemm.run(gemm_pack);
return dst;
@@ -2102,212 +1598,6 @@ protected:
};
template <typename TensorType, typename AccessorType, typename T, typename GEMMOperatorType>
-class GEMMMatrixMultiplyNativeWithPostOpsValidationFixture : public framework::Fixture
-{
-public:
- using PostOpArgBroadcast = std::tuple<bool, bool, bool>; // Instruct fixture if we need broadcasting in dimension 0, 1, 2 of each PostOp argument
-public:
- void setup(unsigned int m, unsigned int n, unsigned int k, unsigned int batch_size, unsigned int m0, unsigned int n0, unsigned int k0, DataType data_type, float alpha, float beta, bool broadcast_bias,
- const ActivationLayerInfo &act_info, const experimental::PostOpList<PostOpArgBroadcast> &post_ops)
- {
- GEMMLHSMatrixInfo lhs_info;
- lhs_info.m0 = m0;
- lhs_info.k0 = k0;
-
- GEMMRHSMatrixInfo rhs_info;
- rhs_info.n0 = n0;
- rhs_info.k0 = k0;
-
- // Set the tensor shapes for LHS and RHS matrices
- const TensorShape lhs_shape(k, m, batch_size);
- const TensorShape rhs_shape(n, k, batch_size);
- const TensorShape bias_shape(n,
- broadcast_bias ? 1 : m,
- broadcast_bias ? 1 : batch_size);
- const auto post_ops_with_shapes = experimental::transform_post_op_list_arguments<PostOpArgBroadcast, TensorShape>(post_ops,
- [ = ](auto broadcast)
- {
- return TensorShape
- {
- std::get<0>(broadcast) ? 1 : n,
- std::get<1>(broadcast) ? 1 : m,
- std::get<2>(broadcast) ? 1 : batch_size,
- };
- });
-
- _target = compute_target(lhs_shape, rhs_shape, bias_shape, lhs_info, rhs_info, data_type, alpha, beta, broadcast_bias, act_info, post_ops_with_shapes);
- _reference = compute_reference(lhs_shape, rhs_shape, data_type, alpha, beta, broadcast_bias, act_info, post_ops_with_shapes);
- }
-
-protected:
- template <typename U>
- void fill(U &&tensor, int i)
- {
- static_assert(std::is_floating_point<T>::value || std::is_same<T, half>::value, "Only floating point data types supported.");
- using DistributionType = typename std::conditional<std::is_same<T, half>::value, arm_compute::utils::uniform_real_distribution_16bit<T>, std::uniform_real_distribution<T>>::type;
-
- DistributionType distribution{ T(-1.0f), T(1.0f) };
- library->fill(tensor, distribution, i);
-
- // Fill border with infinity in order to check the presence of NaN values (i.e. inf * 0)
- DistributionType distribution_inf{ T(std::numeric_limits<float>::infinity()), T(std::numeric_limits<float>::infinity()) };
- library->fill_borders_with_garbage(tensor, distribution_inf, i);
- }
-
- TensorType compute_target(const TensorShape &lhs_shape, const TensorShape &rhs_shape, const TensorShape &bias_shape, const GEMMLHSMatrixInfo &lhs_info, const GEMMRHSMatrixInfo &rhs_info,
- DataType data_type, float alpha, float beta, bool broadcast_bias, const ActivationLayerInfo &act_info, const experimental::PostOpList<TensorShape> &post_ops)
- {
- // Create tensors
- TensorType lhs = create_tensor<TensorType>(lhs_shape, data_type, 1);
- TensorType rhs = create_tensor<TensorType>(rhs_shape, data_type, 1);
- TensorType bias = create_tensor<TensorType>(bias_shape, data_type, 1);
- TensorType dst;
- // Create post op tensors and populate post op with them
- std::vector<TensorType> post_op_tensors_holder{};
- auto populated_post_ops = experimental::transform_post_op_list_arguments<TensorShape, ITensorInfo *>(post_ops,
- [&post_op_tensors_holder, &data_type](auto shape)
- {
- auto t = create_tensor<TensorType>(shape, data_type, 1);
- post_op_tensors_holder.push_back(std::move(t));
- return post_op_tensors_holder.back().info();
- });
-
- const unsigned int M = lhs_shape[1];
- const unsigned int N = rhs_shape[0];
- const unsigned int K = lhs_shape[0];
- GEMMKernelInfo kernel_info;
- kernel_info.m = M;
- kernel_info.n = N;
- kernel_info.k = K;
- kernel_info.depth_output_gemm3d = 0;
- kernel_info.reinterpret_input_as_3d = false;
- kernel_info.broadcast_bias = broadcast_bias;
- kernel_info.activation_info = act_info;
- kernel_info.post_ops = populated_post_ops;
-
- // Create and configure function
- GEMMOperatorType gemm;
- gemm.configure(lhs.info(), rhs.info(), bias.info(), dst.info(), alpha, beta, lhs_info, rhs_info, kernel_info);
-
- ARM_COMPUTE_ASSERT(lhs.info()->is_resizable());
- ARM_COMPUTE_ASSERT(rhs.info()->is_resizable());
- ARM_COMPUTE_ASSERT(bias.info()->is_resizable());
- for(const auto &tensor : post_op_tensors_holder)
- {
- ARM_COMPUTE_ASSERT(tensor.info()->is_resizable());
- }
-
- add_padding_x({ &lhs, &rhs, &bias, &dst });
- for(auto &tensor : post_op_tensors_holder)
- {
- add_padding_x({ &tensor });
- }
-
- // Allocate tensors
- lhs.allocator()->allocate();
- rhs.allocator()->allocate();
- bias.allocator()->allocate();
- dst.allocator()->allocate();
- for(auto &tensor : post_op_tensors_holder)
- {
- tensor.allocator()->allocate();
- }
-
- ARM_COMPUTE_ASSERT(!lhs.info()->is_resizable());
- ARM_COMPUTE_ASSERT(!rhs.info()->is_resizable());
- ARM_COMPUTE_ASSERT(!bias.info()->is_resizable());
- ARM_COMPUTE_ASSERT(!dst.info()->is_resizable());
- for(const auto &tensor : post_op_tensors_holder)
- {
- ARM_COMPUTE_ASSERT(!tensor.info()->is_resizable());
- }
-
- // Fill tensors
- fill(AccessorType(lhs), 0);
- fill(AccessorType(rhs), 1);
- fill(AccessorType(bias), 2);
- for(size_t i = 0; i < post_op_tensors_holder.size(); ++i)
- {
- fill(AccessorType(post_op_tensors_holder.at(i)), 3 + i);
- }
-
- // Compute GEMM
- ITensorPack gemm_pack({ { ACL_SRC_0, &lhs },
- { ACL_SRC_1, &rhs },
- { ACL_SRC_2, &bias },
- { ACL_DST, &dst }
- });
- for(size_t i = 0; i < post_op_tensors_holder.size(); ++i)
- {
- gemm_pack.add_tensor(experimental::get_post_op_arg_type(i), &post_op_tensors_holder.at(i));
- }
- gemm.run(gemm_pack);
-
- return dst;
- }
-
- SimpleTensor<T> compute_reference(const TensorShape &lhs_shape, const TensorShape &rhs_shape, DataType data_type, float alpha, float beta, bool broadcast_bias,
- const ActivationLayerInfo &act_info, const experimental::PostOpList<TensorShape> &post_ops)
- {
- TensorShape dst_shape = lhs_shape;
- dst_shape[0] = rhs_shape[0];
- dst_shape[1] = lhs_shape[1];
-
- // Create reference
- SimpleTensor<T> lhs{ lhs_shape, data_type, 1 };
- SimpleTensor<T> rhs{ rhs_shape, data_type, 1 };
- SimpleTensor<T> bias{ dst_shape, data_type, 1 };
- // Create post op tensors and populate post op with them
- auto populated_post_ops = experimental::transform_post_op_list_arguments<TensorShape, SimpleTensor<T>>(post_ops, [&data_type](auto shape)
- {
- return SimpleTensor<T> { shape, data_type, 1 };
- });
-
- const int n = rhs_shape[0];
- const int m = lhs_shape[1];
- const int batch_size = lhs_shape[2];
-
- // Fill reference
- int tensor_idx = 0;
- fill(lhs, tensor_idx++);
- fill(rhs, tensor_idx++);
- fill(bias, tensor_idx++);
- for(auto &op : populated_post_ops.get_list())
- {
- for(auto tensor : op->arguments())
- {
- fill(*tensor, tensor_idx++);
- }
- }
-
- if(broadcast_bias)
- {
- // In case of broadcast, we need to simply copy the first into the following "M" ones
- for(int i = 1; i < m * batch_size; i++)
- {
- memcpy(bias.data() + i * n, bias.data(), n * sizeof(T));
- }
- }
-
- SimpleTensor<T> out;
- out = reference::gemm<T>(lhs, rhs, bias, alpha, beta);
- // Ignore activation info if post ops are used instead
- if(populated_post_ops.size() > 0)
- {
- out = reference::post_ops<T>(out, populated_post_ops);
- }
- else
- {
- out = reference::activation_layer(out, act_info);
- }
- return out;
- }
-
- TensorType _target{};
- SimpleTensor<T> _reference{};
-};
-
-template <typename TensorType, typename AccessorType, typename T, typename GEMMOperatorType>
class GEMMMatrixMultiplyNative3DValidationFixture : public framework::Fixture
{
public:
@@ -2398,8 +1688,7 @@ protected:
ITensorPack gemm_pack({ { ACL_SRC_0, &lhs },
{ ACL_SRC_1, &rhs },
{ ACL_SRC_2, &bias },
- { ACL_DST, &dst }
- });
+ { ACL_DST, &dst } });
gemm.run(gemm_pack);
return dst;
@@ -2557,8 +1846,7 @@ protected:
ITensorPack gemm_pack({ { ACL_SRC_0, &lhs },
{ ACL_SRC_1, &rhs_reshaped },
{ ACL_SRC_2, &bias },
- { ACL_DST, &dst }
- });
+ { ACL_DST, &dst } });
gemm.run(gemm_pack);
return dst;
@@ -2608,4 +1896,4 @@ protected:
} // namespace validation
} // namespace test
} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_GEMM_FIXTURE */
+#endif // ACL_TESTS_VALIDATION_FIXTURES_GEMMFIXTURE_H
diff --git a/tests/validation/reference/PostOps.cpp b/tests/validation/reference/PostOps.cpp
deleted file mode 100644
index ecfed4c48f..0000000000
--- a/tests/validation/reference/PostOps.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2021 Arm Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "PostOps.h"
-
-#include "arm_compute/core/Helpers.h"
-#include "arm_compute/core/Types.h"
-#include "arm_compute/core/experimental/PostOps.h"
-#include "support/Cast.h"
-#include "tests/validation/reference/ActivationLayer.h"
-#include "tests/validation/reference/ElementwiseOperations.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace validation
-{
-namespace reference
-{
-template <typename T, typename std::enable_if<is_floating_point<T>::value, int>::type>
-SimpleTensor<T> post_ops(const SimpleTensor<T> &a, experimental::PostOpList<SimpleTensor<T>> post_ops)
-{
- // Create reference
- SimpleTensor<T> dst{ a };
-
- for(auto &post_op : post_ops.get_list())
- {
- switch(post_op->type())
- {
- case experimental::PostOpType::Activation:
- {
- const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpAct<SimpleTensor<T>> *>(post_op.get());
- dst = reference::activation_layer(dst, _post_op->_act_info);
- break;
- }
- case experimental::PostOpType::Eltwise_Add:
- {
- const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpEltwiseAdd<SimpleTensor<T>> *>(post_op.get());
- dst = reference::arithmetic_operation(ArithmeticOperation::ADD, dst, _post_op->_addend, dst, _post_op->_policy);
- break;
- }
- case experimental::PostOpType::Eltwise_PRelu:
- {
- const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpEltwisePRelu<SimpleTensor<T>> *>(post_op.get());
-
- // If previous main operation output is the the first pRelu argument, then pass it as src1 parameter of the arithmetic operation
- if(_post_op->_prev_dst_pos == 0)
- {
- dst = reference::arithmetic_operation(ArithmeticOperation::PRELU, dst, _post_op->_alpha_param, dst, _post_op->_policy);
- }
- // If previous main operation output is the the second pRelu argument, then pass it as src2 parameter of the arithmetic operation
- else if(_post_op->_prev_dst_pos == 1)
- {
- dst = reference::arithmetic_operation(ArithmeticOperation::PRELU, _post_op->_alpha_param, dst, dst, _post_op->_policy);
- }
- break;
- }
- default:
- {
- ARM_COMPUTE_ERROR("Unsupported PostOpType");
- }
- }
- }
- return dst;
-}
-
-template SimpleTensor<float> post_ops(const SimpleTensor<float> &a, experimental::PostOpList<SimpleTensor<float>> post_ops);
-template SimpleTensor<half> post_ops(const SimpleTensor<half> &a, experimental::PostOpList<SimpleTensor<half>> post_ops);
-} // namespace reference
-} // namespace validation
-} // namespace test
-} // namespace arm_compute \ No newline at end of file
diff --git a/tests/validation/reference/PostOps.h b/tests/validation/reference/PostOps.h
deleted file mode 100644
index 5fe0fe71f5..0000000000
--- a/tests/validation/reference/PostOps.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2021 Arm Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef ARM_COMPUTE_TEST_POSTOPS_H
-#define ARM_COMPUTE_TEST_POSTOPS_H
-
-#include "arm_compute/core/experimental/IPostOp.h"
-#include "tests/SimpleTensor.h"
-#include "tests/validation/Helpers.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace validation
-{
-namespace reference
-{
-/** (EXPERIMENTAL_POST_OPS) */
-template <typename T, typename std::enable_if<is_floating_point<T>::value, int>::type = 0>
-SimpleTensor<T> post_ops(const SimpleTensor<T> &a, experimental::PostOpList<SimpleTensor<T>> post_ops);
-
-} // namespace reference
-} // namespace validation
-} // namespace test
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_POSTOPS_H */