aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/CL/GEMMReshapeRHSMatrix.cpp
diff options
context:
space:
mode:
authorGian Marco Iodice <gianmarco.iodice@arm.com>2020-06-02 12:12:35 +0100
committerGian Marco Iodice <gianmarco.iodice@arm.com>2020-06-02 17:18:29 +0000
commita98dee2da0aef1c53a31045b0c681fb0abc8f8ba (patch)
treeb4f0a130b19c47f19d9e5b326c18cb9cc8e765e2 /tests/validation/CL/GEMMReshapeRHSMatrix.cpp
parent16bd6dd97fb704e31cd96e404e8c4148fe24d834 (diff)
downloadComputeLibrary-a98dee2da0aef1c53a31045b0c681fb0abc8f8ba.tar.gz
COMPMID-3319: Force padding requirement in CLGEMMReshapeRHSMatrixKernel
Added padding requirement in CLGEMMReshapeRHSMatrixKernel in order to create 2d image from a cl_buffer. Test extended in order to validate the padding requirement Change-Id: I36bcaf3e9299ee186602b4e3456851cc8cda6ce6 Signed-off-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3292 Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/validation/CL/GEMMReshapeRHSMatrix.cpp')
-rw-r--r--tests/validation/CL/GEMMReshapeRHSMatrix.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/validation/CL/GEMMReshapeRHSMatrix.cpp b/tests/validation/CL/GEMMReshapeRHSMatrix.cpp
index 55688cf160..aa6667666c 100644
--- a/tests/validation/CL/GEMMReshapeRHSMatrix.cpp
+++ b/tests/validation/CL/GEMMReshapeRHSMatrix.cpp
@@ -123,6 +123,49 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(
bool has_error = bool(CLGEMMReshapeRHSMatrixKernel::validate(&input_info.clone()->set_is_resizable(false), (output_info.total_size() == 0) ? nullptr : &output_info.clone()->set_is_resizable(false), rhs_info));
ARM_COMPUTE_EXPECT(has_error == expected, framework::LogLevel::ERRORS);
}
+
+DATA_TEST_CASE(ValidatePadding, framework::DatasetMode::ALL, combine(combine(combine(
+ framework::dataset::make("InputShape", { TensorShape(32U, 16U, 1U),
+ TensorShape(32U, 16U, 2U)
+ }),
+ framework::dataset::make("N0",{ 4 })),
+ framework::dataset::make("K0",{ 2, 4, 8 })),
+ framework::dataset::make("H0",{ 1, 2, 4 })),
+ input_shape, n0, k0, h0)
+{
+ CLTensor input;
+ CLTensor output;
+
+ input.info()->init(input_shape, 1, DataType::F32);
+
+ unsigned int padding = 0;
+
+ GEMMRHSMatrixInfo rhs_info;
+ rhs_info.n0 = n0;
+ rhs_info.k0 = k0;
+ rhs_info.h0 = h0;
+ rhs_info.transpose = true;
+ rhs_info.interleave = true;
+ rhs_info.export_to_cl_image = image2d_from_buffer_supported(CLKernelLibrary::get().get_device()) && (get_cl_image_pitch_alignment(CLKernelLibrary::get().get_device()) != 0);
+
+ if(rhs_info.export_to_cl_image)
+ {
+ TensorShape output_shape = compute_rhs_reshaped_shape(*input.info(), rhs_info);
+ constexpr unsigned int num_floats_per_pixel = 4;
+
+ const unsigned int pixel_aligment = get_cl_image_pitch_alignment(CLKernelLibrary::get().get_device());
+ const unsigned int row_pitch_alignment = pixel_aligment * num_floats_per_pixel;
+ const unsigned int round_up_width = ((output_shape[0] + row_pitch_alignment - 1) / row_pitch_alignment) * row_pitch_alignment;
+
+ padding = round_up_width - output_shape[0];
+ }
+
+ CLGEMMReshapeRHSMatrixKernel kernel;
+
+ kernel.configure(&input, &output, rhs_info);
+
+ ARM_COMPUTE_EXPECT((output.info()->padding().right == padding), framework::LogLevel::ERRORS);
+}
// clang-format on
// *INDENT-ON*