From 5c2df4e8aa3655800e764a29ad25cdbc560558be Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Mon, 27 Apr 2020 18:10:58 +0100 Subject: COMPMID-3288: Test improvement for CLGEMMReshapeRHSMatrixKernel (Kernel-level) Removed configuration tests as they don't add any real value. Since this is a memory copy kernel, I removed all the large shapes and created all possible configurations across the 3 data layouts. From a total of 5957 nightly and 2285 precommit tests now we have 233 in both cases. Change-Id: I219f771a0ee5b07e5de3d5df715fe5841b4ea5fe Signed-off-by: Michalis Spyrou Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/c/VisualCompute/ComputeLibrary/+/237083 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3106 Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins Reviewed-by: Sang-Hoon Park --- tests/validation/CL/GEMMReshapeRHSMatrix.cpp | 350 +++++++++------------------ 1 file changed, 114 insertions(+), 236 deletions(-) diff --git a/tests/validation/CL/GEMMReshapeRHSMatrix.cpp b/tests/validation/CL/GEMMReshapeRHSMatrix.cpp index aefa001928..55688cf160 100644 --- a/tests/validation/CL/GEMMReshapeRHSMatrix.cpp +++ b/tests/validation/CL/GEMMReshapeRHSMatrix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 ARM Limited. + * Copyright (c) 2018-2020 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -52,30 +52,27 @@ const auto data_types = framework::dataset::make("DataType", { DataType::QASYMM8 /** Batch size values to test */ const auto b_values = framework::dataset::make("batchsize", 1, 3); -/** N0 values to test - Precommit */ -const auto n0_values_precommit = framework::dataset::make("N0", { 2, 4 }); - -/** N0 values to test - Nightly */ -const auto n0_values_nightly = framework::dataset::make("N0", { 2, 3, 4, 8, 16 }); - -/** K0 values to test (transpose=true) - Precommit */ -const auto k0_t_values_precommit = framework::dataset::make("K0", { 4 }); - -/** K0 values to test (transpose=true) - Nightly */ -const auto k0_t_values_nightly = framework::dataset::make("K0", { 2, 3, 4, 8, 16 }); - -/** K0 values to test (transpose=false) - Precommit */ -const auto k0_nt_values_precommit = framework::dataset::make("K0", { 1, 2, 4 }); - -/** K0 values to test (transpose=false) - Nightly */ -const auto k0_nt_values_nightly = framework::dataset::make("K0", { 1, 2, 3, 4, 8, 16 }); +/** N0 values to test */ +const auto n0_values_nt_s32 = framework::dataset::make("N0", { 1, 2, 3 }); +const auto n0_values_nt_s16 = framework::dataset::make("N0", { 4, 8 }); +const auto n0_values_nt_s8 = framework::dataset::make("N0", { 16 }); +const auto n0_values_t_s32 = framework::dataset::make("N0", { 4, 8 }); +const auto n0_values_t_s16 = framework::dataset::make("N0", { 16 }); +const auto n0_values_t_s8 = framework::dataset::make("N0", { 2, 3 }); + +/** K0 values to test */ +const auto k0_values_nt_s32 = framework::dataset::make("K0", { 1, 2 }); +const auto k0_values_nt_s16 = framework::dataset::make("K0", { 16 }); +const auto k0_values_nt_s8 = framework::dataset::make("K0", { 3,4 }); +const auto k0_values_t_s32 = framework::dataset::make("K0", { 2, 3 }); +const auto k0_values_t_s16 = framework::dataset::make("K0", { 4, 8 }); +const auto k0_values_t_s8 = framework::dataset::make("K0", { 16 }); /** H0 values to test */ const auto h0_values = framework::dataset::make("H0", 1, 4); /** Interleave values to test */ const auto i_values = framework::dataset::make("interleave", { true, false }); - } // namespace using namespace arm_compute::misc::shape_calculator; @@ -89,257 +86,138 @@ using CLGEMMReshapeRHSMatrixFixture = GEMMReshapeRHSMatrixValidationFixture(shape_src, data_type); - CLTensor dst = create_tensor(shape_dst, data_type); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Create and configure function - CLGEMMReshapeRHSMatrixKernel reshape_rhs; - reshape_rhs.configure(&src, &dst, rhs_info); -} - -// This configuration tests only transpose = false -DATA_TEST_CASE(Configuration1, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(combine(datasets::SmallGEMMReshape2DShapes(), - b_values), - data_types), - n0_values_nightly), - k0_nt_values_nightly), - h0_values), - i_values), -shape_in, b_value, data_type, n0_value, k0_value, h0_value, i_value) +// *INDENT-OFF* +// clang-format off +DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip( + framework::dataset::make("InputInfo", { TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32), + TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32), // Mismatching data types + TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32), // Wrong n0 value + TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32), // Wrong k0 value + TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32), // Wrong h0 value + TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32), // n0 > 16 + TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32), // k0 > 16 + TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32), // k0 == 1 && transpose + }), + framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(64U, 2U, 2U), 1, DataType::F32), + TensorInfo(TensorShape(32U, 2U, 2U), 1, DataType::F16), + TensorInfo(TensorShape(32U, 2U, 2U), 1, DataType::F32), + TensorInfo(TensorShape(32U, 2U, 2U), 1, DataType::F32), + TensorInfo(TensorShape(32U, 2U, 2U), 1, DataType::F32), + TensorInfo(TensorShape(32U, 2U, 2U), 1, DataType::F32), + TensorInfo(TensorShape(32U, 2U, 2U), 1, DataType::F32), + TensorInfo(TensorShape(32U, 2U, 2U), 1, DataType::F32), + })), + framework::dataset::make("N0",{ 4, 0, 4, 4, 4, 17, 4, 4 })), + framework::dataset::make("K0",{ 4, 4, 0, 4, 4, 4, 17, 1 })), + framework::dataset::make("H0",{ 4, 4, 4, 0, 4, 4, 4, 4 })), + framework::dataset::make("Expected", { false, false, false, false, false, false, false})), + input_info, output_info, n0, k0, h0, expected) { GEMMRHSMatrixInfo rhs_info; - rhs_info.n0 = n0_value; - rhs_info.k0 = k0_value; - rhs_info.h0 = h0_value; - rhs_info.interleave = i_value; - rhs_info.transpose = false; - - const TensorShape shape_src(shape_in[0], shape_in[1], b_value); - const TensorShape shape_dst = compute_rhs_reshaped_shape(TensorInfo(shape_src, 1, data_type), rhs_info); - - // Create tensors - CLTensor src = create_tensor(shape_src, data_type); - CLTensor dst = create_tensor(shape_dst, data_type); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Create and configure function - CLGEMMReshapeRHSMatrixKernel reshape_rhs; - reshape_rhs.configure(&src, &dst, rhs_info); -} - -TEST_SUITE(S32) -// RunSmall tests only for transpose = false -FIXTURE_DATA_TEST_CASE(RunSmall0, CLGEMMReshapeRHSMatrixFixture, framework::DatasetMode::PRECOMMIT, - combine(combine(combine(combine(combine(combine(combine(datasets::SmallGEMMReshape2DShapes(), - b_values), - framework::dataset::make("DataType", DataType::S32)), - n0_values_precommit), - k0_nt_values_precommit), - h0_values), - i_values), - framework::dataset::make("transpose", false))) -{ - // Validate output - validate(CLAccessor(_target), _reference); + rhs_info.n0 = n0; + rhs_info.k0 = k0; + rhs_info.h0 = h0; + rhs_info.transpose = true; + rhs_info.interleave = true; + + 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); } - -// RunSmall tests only for transpose = true -FIXTURE_DATA_TEST_CASE(RunSmall1, CLGEMMReshapeRHSMatrixFixture, framework::DatasetMode::PRECOMMIT, - combine(combine(combine(combine(combine(combine(combine(datasets::SmallGEMMReshape2DShapes(), - b_values), - framework::dataset::make("DataType", DataType::S32)), - n0_values_precommit), - k0_t_values_precommit), - h0_values), - i_values), - framework::dataset::make("transpose", true))) +// clang-format on +// *INDENT-ON* + +// Run S32 tests only for transpose = false +FIXTURE_DATA_TEST_CASE(S32_NT, CLGEMMReshapeRHSMatrixFixture, framework::DatasetMode::ALL, + combine(combine(combine(combine(combine(combine(combine(datasets::SmallGEMMReshape2DShapes(), + b_values), + framework::dataset::make("DataType", DataType::S32)), + n0_values_nt_s32), + k0_values_nt_s32), + h0_values), + i_values), + framework::dataset::make("transpose", false))) { // Validate output validate(CLAccessor(_target), _reference); } -// RunLarge tests only for transpose = false -FIXTURE_DATA_TEST_CASE(RunLarge0, CLGEMMReshapeRHSMatrixFixture, framework::DatasetMode::NIGHTLY, - combine(combine(combine(combine(combine(combine(combine(datasets::LargeGEMMReshape2DShapes(), - b_values), - framework::dataset::make("DataType", DataType::S32)), - n0_values_nightly), - k0_nt_values_nightly), - h0_values), - i_values), - framework::dataset::make("transpose", false))) +// Run S32 tests only for transpose = true +FIXTURE_DATA_TEST_CASE(S32_T, CLGEMMReshapeRHSMatrixFixture, framework::DatasetMode::ALL, + combine(combine(combine(combine(combine(combine(combine(datasets::SmallGEMMReshape2DShapes(), + b_values), + framework::dataset::make("DataType", DataType::S32)), + n0_values_t_s32), + k0_values_t_s32), + h0_values), + i_values), + framework::dataset::make("transpose", true))) { // Validate output validate(CLAccessor(_target), _reference); } -// RunLarge tests only for transpose = true -FIXTURE_DATA_TEST_CASE(RunLarge1, CLGEMMReshapeRHSMatrixFixture, framework::DatasetMode::NIGHTLY, - combine(combine(combine(combine(combine(combine(combine(datasets::LargeGEMMReshape2DShapes(), - b_values), - framework::dataset::make("DataType", DataType::S32)), - n0_values_nightly), - k0_t_values_nightly), - h0_values), - i_values), - framework::dataset::make("transpose", true))) +// Run S16 tests only for transpose = false +FIXTURE_DATA_TEST_CASE(S16_NT, CLGEMMReshapeRHSMatrixFixture, framework::DatasetMode::ALL, + combine(combine(combine(combine(combine(combine(combine(datasets::SmallGEMMReshape2DShapes(), + b_values), + framework::dataset::make("DataType", DataType::S16)), + n0_values_nt_s16), + k0_values_nt_s16), + h0_values), + i_values), + framework::dataset::make("transpose", false))) { // Validate output validate(CLAccessor(_target), _reference); } -TEST_SUITE_END() // S32 -TEST_SUITE(S16) -// RunSmall tests only for transpose = false -FIXTURE_DATA_TEST_CASE(RunSmall0, CLGEMMReshapeRHSMatrixFixture, framework::DatasetMode::PRECOMMIT, - combine(combine(combine(combine(combine(combine(combine(datasets::SmallGEMMReshape2DShapes(), - b_values), - framework::dataset::make("DataType", DataType::S16)), - n0_values_precommit), - k0_nt_values_precommit), - h0_values), - i_values), - framework::dataset::make("transpose", false))) +// Run S16 tests only for transpose = true +FIXTURE_DATA_TEST_CASE(S16_T, CLGEMMReshapeRHSMatrixFixture, framework::DatasetMode::ALL, + combine(combine(combine(combine(combine(combine(combine(datasets::SmallGEMMReshape2DShapes(), + b_values), + framework::dataset::make("DataType", DataType::S16)), + n0_values_t_s16), + k0_values_t_s16), + h0_values), + i_values), + framework::dataset::make("transpose", true))) { // Validate output validate(CLAccessor(_target), _reference); } -// RunSmall tests only for transpose = true -FIXTURE_DATA_TEST_CASE(RunSmall1, CLGEMMReshapeRHSMatrixFixture, framework::DatasetMode::PRECOMMIT, - combine(combine(combine(combine(combine(combine(combine(datasets::SmallGEMMReshape2DShapes(), - b_values), - framework::dataset::make("DataType", DataType::S16)), - n0_values_precommit), - k0_t_values_precommit), - h0_values), - i_values), - framework::dataset::make("transpose", true))) +// Run S8 tests only for transpose = false +FIXTURE_DATA_TEST_CASE(S8_NT, CLGEMMReshapeRHSMatrixFixture, framework::DatasetMode::ALL, + combine(combine(combine(combine(combine(combine(combine(datasets::SmallGEMMReshape2DShapes(), + b_values), + framework::dataset::make("DataType", DataType::S8)), + n0_values_nt_s8), + k0_values_nt_s8), + h0_values), + i_values), + framework::dataset::make("transpose", false))) { // Validate output validate(CLAccessor(_target), _reference); } -// RunLarge tests only for transpose = false -FIXTURE_DATA_TEST_CASE(RunLarge0, CLGEMMReshapeRHSMatrixFixture, framework::DatasetMode::NIGHTLY, - combine(combine(combine(combine(combine(combine(combine(datasets::LargeGEMMReshape2DShapes(), - b_values), - framework::dataset::make("DataType", DataType::S16)), - n0_values_nightly), - k0_nt_values_nightly), - h0_values), - i_values), - framework::dataset::make("transpose", false))) +// Run S8 tests only for transpose = true +FIXTURE_DATA_TEST_CASE(S8_T, CLGEMMReshapeRHSMatrixFixture, framework::DatasetMode::ALL, + combine(combine(combine(combine(combine(combine(combine(datasets::SmallGEMMReshape2DShapes(), + b_values), + framework::dataset::make("DataType", DataType::S8)), + n0_values_t_s8), + k0_values_t_s8), + h0_values), + i_values), + framework::dataset::make("transpose", true))) { // Validate output validate(CLAccessor(_target), _reference); } -// RunLarge tests only for transpose = true -FIXTURE_DATA_TEST_CASE(RunLarge1, CLGEMMReshapeRHSMatrixFixture, framework::DatasetMode::NIGHTLY, - combine(combine(combine(combine(combine(combine(combine(datasets::LargeGEMMReshape2DShapes(), - b_values), - framework::dataset::make("DataType", DataType::S16)), - n0_values_nightly), - k0_t_values_nightly), - h0_values), - i_values), - framework::dataset::make("transpose", true))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -TEST_SUITE_END() // S16 - -TEST_SUITE(S8) -// RunSmall tests only for transpose = false -FIXTURE_DATA_TEST_CASE(RunSmall0, CLGEMMReshapeRHSMatrixFixture, framework::DatasetMode::PRECOMMIT, - combine(combine(combine(combine(combine(combine(combine(datasets::SmallGEMMReshape2DShapes(), - b_values), - framework::dataset::make("DataType", DataType::S8)), - n0_values_precommit), - k0_nt_values_precommit), - h0_values), - i_values), - framework::dataset::make("transpose", false))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} - -// RunSmall tests only for transpose = true -FIXTURE_DATA_TEST_CASE(RunSmall1, CLGEMMReshapeRHSMatrixFixture, framework::DatasetMode::PRECOMMIT, - combine(combine(combine(combine(combine(combine(combine(datasets::SmallGEMMReshape2DShapes(), - b_values), - framework::dataset::make("DataType", DataType::S8)), - n0_values_precommit), - k0_t_values_precommit), - h0_values), - i_values), - framework::dataset::make("transpose", true))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} - -// RunLarge tests only for transpose = false -FIXTURE_DATA_TEST_CASE(RunLarge0, CLGEMMReshapeRHSMatrixFixture, framework::DatasetMode::NIGHTLY, - combine(combine(combine(combine(combine(combine(combine(datasets::LargeGEMMReshape2DShapes(), - b_values), - framework::dataset::make("DataType", DataType::S8)), - n0_values_nightly), - k0_nt_values_nightly), - h0_values), - i_values), - framework::dataset::make("transpose", false))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} - -// RunLarge tests only for transpose = true -FIXTURE_DATA_TEST_CASE(RunLarge1, CLGEMMReshapeRHSMatrixFixture, framework::DatasetMode::NIGHTLY, - combine(combine(combine(combine(combine(combine(combine(datasets::LargeGEMMReshape2DShapes(), - b_values), - framework::dataset::make("DataType", DataType::S8)), - n0_values_nightly), - k0_t_values_nightly), - h0_values), - i_values), - framework::dataset::make("transpose", true))) -{ - // Validate output - validate(CLAccessor(_target), _reference); -} -TEST_SUITE_END() // S8 TEST_SUITE_END() // GEMMReshapeRHSMatrix TEST_SUITE_END() // CL } // namespace validation } // namespace test -} // namespace arm_compute \ No newline at end of file +} // namespace arm_compute -- cgit v1.2.1