aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/CL/GEMMReshapeLHSMatrix.cpp
diff options
context:
space:
mode:
authorGian Marco Iodice <gianmarco.iodice@arm.com>2020-08-10 21:44:14 +0100
committerGian Marco Iodice <gianmarco.iodice@arm.com>2020-08-11 13:26:10 +0000
commit73cdaac61d3121d4d6556846de259dd734afdccf (patch)
treea9d828cd3064d2c53d104495bdaf78e53f0e41f8 /tests/validation/CL/GEMMReshapeLHSMatrix.cpp
parentf650ea5be66be5c7b16faf5482e793e3a6d2430c (diff)
downloadComputeLibrary-73cdaac61d3121d4d6556846de259dd734afdccf.tar.gz
COMPMID-3335: Remove x/y-axis padding from CLGEMMReshapeLHSMatrixKernel
- Remove padding requirement for the input tensor of CLGEMMReshapeLHSMatrixKernel - Add utility function to load a boundary aware 2d tensor from buffer - Extend validation for validating the zero padding requirement Change-Id: I0ac6b1b517d75fd56998f406e0cce97b40918ce1 Signed-off-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3701 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: SiCong Li <sicong.li@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/validation/CL/GEMMReshapeLHSMatrix.cpp')
-rw-r--r--tests/validation/CL/GEMMReshapeLHSMatrix.cpp61
1 files changed, 60 insertions, 1 deletions
diff --git a/tests/validation/CL/GEMMReshapeLHSMatrix.cpp b/tests/validation/CL/GEMMReshapeLHSMatrix.cpp
index 985a8bb11b..d9439f63f1 100644
--- a/tests/validation/CL/GEMMReshapeLHSMatrix.cpp
+++ b/tests/validation/CL/GEMMReshapeLHSMatrix.cpp
@@ -81,10 +81,69 @@ const auto i_values = framework::dataset::make("interleave", { true, false });
/** Transpose values to test */
const auto t_values = framework::dataset::make("transpose", { true, false });
+
+/** Zero padding test */
+bool validate_zero_padding(unsigned int m_value, unsigned int k_value, unsigned int b_value, unsigned int m0_value, unsigned int k0_value, unsigned int v0_value,
+ bool i_value_lhs, bool t_value_lhs, bool input_as_3d, DataType dt)
+{
+ const unsigned int M = m_value;
+ const unsigned int K = k_value;
+ const unsigned int B = b_value;
+
+ GEMMLHSMatrixInfo lhs_info;
+ lhs_info.m0 = m0_value;
+ lhs_info.k0 = k0_value;
+ lhs_info.v0 = v0_value;
+ lhs_info.interleave = i_value_lhs;
+ lhs_info.transpose = t_value_lhs;
+
+ const TensorShape lhs_shape(K, M, B);
+ const TensorShape lhs_shape_reshaped = compute_lhs_reshaped_shape(TensorInfo(lhs_shape, 1, dt), lhs_info, input_as_3d);
+
+ // Create tensors
+ CLTensor lhs = create_tensor<CLTensor>(lhs_shape, dt);
+ CLTensor dst = create_tensor<CLTensor>(lhs_shape_reshaped, dt);
+
+ ARM_COMPUTE_EXPECT(lhs.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ // Validate zero-padding
+ CLGEMMReshapeLHSMatrixKernel lhs_reshape;
+
+ lhs_reshape.configure(&lhs, &dst, lhs_info, input_as_3d);
+
+ return lhs.info()->padding().empty();
+}
} // namespace
TEST_SUITE(CL)
TEST_SUITE(GEMMReshapeLHSMatrix)
+
+/** Validate zero padding tests for the LHS input tensor
+ *
+ * A series of validation tests to test the zero padding requirement
+ *
+ * Checks performed in order:
+ * - Case where M and K are smaller than M0 and K0
+ * - Generic test case with batch size = 1
+ * - Generic test case with batch size = 4
+ * - Generic test case with input_as_3d_value = true
+ */
+DATA_TEST_CASE(ValidateZeroPadding, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(
+framework::dataset::make("M", { 1, 23, 63, 101 }),
+framework::dataset::make("K", { 1, 47, 29, 27 })),
+framework::dataset::make("B", { 1, 1, 4, 7 })),
+framework::dataset::make("M0", { 4, 2, 4, 8 })),
+framework::dataset::make("K0", { 2, 2, 4, 8 })),
+framework::dataset::make("input_as_3d", { false, false, false, true })),
+m_value, k_value, b_value, m0_value, k0_value, input_as_3d_value)
+{
+ constexpr DataType dt = DataType::F32;
+
+ bool status = validate_zero_padding(m_value, k_value, b_value, m0_value, k0_value, 2, false, false, input_as_3d_value, dt);
+ ARM_COMPUTE_EXPECT(status, framework::LogLevel::ERRORS);
+}
+
FIXTURE_DATA_TEST_CASE(S32, CLGEMMReshapeLHSMatrixFixture<int>, framework::DatasetMode::ALL,
combine(combine(combine(combine(combine(combine(combine(datasets::SmallGEMMReshape2DShapes(),
b_values),
@@ -172,4 +231,4 @@ TEST_SUITE_END() // GEMMReshapeLHSMatrix
TEST_SUITE_END() // CL
} // namespace validation
} // namespace test
-} // namespace arm_compute \ No newline at end of file
+} // namespace arm_compute