diff options
author | David Svantesson <david.svantesson@arm.com> | 2023-03-28 14:13:32 +0000 |
---|---|---|
committer | David Svantesson <david.svantesson@arm.com> | 2023-04-28 16:07:43 +0000 |
commit | 3b162e53267d13d18891baf3372f971f1d4213d3 (patch) | |
tree | 529f0588165ce40753e7ee79f5933d79d57d30bf /tests | |
parent | a25582c4e7dddd26419e0a3316614e8309928934 (diff) | |
download | ComputeLibrary-3b162e53267d13d18891baf3372f971f1d4213d3.tar.gz |
Reorder added
Adds Reorder kernel exposing blocking reorders from arm_gemm
Resolves ONCPUML-1232
Change-Id: I42bf4166311fe1771565134d3ed7039fc8e30230
Signed-off-by: David Svantesson <david.svantesson@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/9500
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: SiCong Li <sicong.li@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Benchmark: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/BUILD.bazel | 7 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/datasets/ReorderLayerDataset.h | 158 | ||||
-rw-r--r-- | tests/validation/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/validation/NEON/ReorderLayer.cpp | 66 | ||||
-rw-r--r-- | tests/validation/fixtures/ReorderFixture.h | 109 | ||||
-rw-r--r-- | tests/validation/reference/Reorder.cpp | 156 | ||||
-rw-r--r-- | tests/validation/reference/Reorder.h | 44 |
8 files changed, 542 insertions, 0 deletions
diff --git a/tests/BUILD.bazel b/tests/BUILD.bazel index 8122652991..606f403f38 100644 --- a/tests/BUILD.bazel +++ b/tests/BUILD.bazel @@ -106,6 +106,13 @@ cc_binary( "ARM_COMPUTE_ENABLE_BF16", ], "//conditions:default": [], + }) + + select({ + "//:sve_validation_flag": [ + "ENABLE_SVE", + "ARM_COMPUTE_ENABLE_SVE", + ], + "//conditions:default": [], }) ) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 163ab82e91..c4b12e770a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -107,6 +107,7 @@ target_sources( validation/reference/DepthwiseConvolutionLayer.cpp validation/reference/FullyConnectedLayer.cpp validation/reference/ConvolutionLayer.cpp + validation/reference/Reorder.cpp framework/Framework.cpp framework/Utils.cpp framework/Exceptions.cpp diff --git a/tests/datasets/ReorderLayerDataset.h b/tests/datasets/ReorderLayerDataset.h new file mode 100644 index 0000000000..8e1a8422b2 --- /dev/null +++ b/tests/datasets/ReorderLayerDataset.h @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2023 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 ACL_TESTS_DATASETS_REORDERLAYERDATASET +#define ACL_TESTS_DATASETS_REORDERLAYERDATASET + +#include "arm_compute/core/TensorShape.h" +#include "arm_compute/core/Types.h" +#include "utils/TypePrinter.h" + +namespace arm_compute +{ +namespace test +{ +namespace datasets +{ +/** [ReorderLayer datasets] **/ +class ReorderLayerDataset +{ +public: + using type = std::tuple<TensorShape, TensorShape, WeightFormat, WeightFormat>; + + struct iterator + { + iterator(std::vector<TensorShape>::const_iterator in_it, + std::vector<TensorShape>::const_iterator out_it, + std::vector<WeightFormat>::const_iterator _wf_in_it, + std::vector<WeightFormat>::const_iterator _wf_out_it) + : _in_it{ std::move(in_it) }, + _out_it{ std::move(out_it) }, + _wf_in_it{ std::move(_wf_in_it) }, + _wf_out_it{ std::move(_wf_out_it) } + { + } + + std::string description() const + { + std::stringstream description; + description << "In=" << *_in_it << ":"; + description << "Out=" << *_out_it << ":"; + description << "Wf_In=" << *_wf_in_it << ":"; + description << "Wf_Out=" << *_wf_out_it; + return description.str(); + } + + ReorderLayerDataset::type operator*() const + { + return std::make_tuple(*_in_it, *_out_it, *_wf_in_it, *_wf_out_it); + } + + iterator &operator++() + { + ++_in_it; + ++_out_it; + ++_wf_in_it; + ++_wf_out_it; + + return *this; + } + + private: + std::vector<TensorShape>::const_iterator _in_it; + std::vector<TensorShape>::const_iterator _out_it; + std::vector<WeightFormat>::const_iterator _wf_in_it; + std::vector<WeightFormat>::const_iterator _wf_out_it; + }; + + iterator begin() const + { + return iterator(_in_shapes.begin(), _out_shapes.begin(), _in_wfs.begin(), _out_wfs.begin()); + } + + int size() const + { + return std::min(_in_shapes.size(), std::min(_out_shapes.size(), std::min(_in_wfs.size(), _out_wfs.size()))); + } + + void add_config(TensorShape in, TensorShape out, WeightFormat in_wf, WeightFormat out_wf) + { + _in_shapes.emplace_back(std::move(in)); + _out_shapes.emplace_back(std::move(out)); + _in_wfs.emplace_back(std::move(in_wf)); + _out_wfs.emplace_back(std::move(out_wf)); + } + + // protected: + ReorderLayerDataset() = default; + ReorderLayerDataset(ReorderLayerDataset &&) = default; + + private: + std::vector<TensorShape> _in_shapes{}; + std::vector<TensorShape> _out_shapes{}; + std::vector<WeightFormat> _in_wfs{}; + std::vector<WeightFormat> _out_wfs{}; +}; + +/** [ReorderLayer datasets] **/ + +class ReorderLayerDatasetBlock4 final : public ReorderLayerDataset +{ + public: + ReorderLayerDatasetBlock4() + { + add_config(TensorShape(10U, 9U), TensorShape(10U, 12U), WeightFormat::OHWI, WeightFormat::OHWIo4); + add_config(TensorShape(16U, 16U), TensorShape(16U, 16U), WeightFormat::OHWI, WeightFormat::OHWIo4); + add_config(TensorShape(10U, 511U), TensorShape(10U, 512U), WeightFormat::OHWI, WeightFormat::OHWIo4); + add_config(TensorShape(234U, 301U), TensorShape(234U, 304U), WeightFormat::OHWI, WeightFormat::OHWIo4); + add_config(TensorShape(1024U, 1024U), TensorShape(1024U, 1024U), WeightFormat::OHWI, WeightFormat::OHWIo4); + add_config(TensorShape(10U, 9U, 1U, 1U), TensorShape(10U, 12U, 1U, 1U), WeightFormat::OHWI, WeightFormat::OHWIo4); + add_config(TensorShape(16U, 16U, 1U, 1U), TensorShape(16U, 16U, 1U, 1U), WeightFormat::OHWI, WeightFormat::OHWIo4); + add_config(TensorShape(10U, 511U, 1U, 1U), TensorShape(10U, 512U, 1U, 1U), WeightFormat::OHWI, WeightFormat::OHWIo4); + add_config(TensorShape(234U, 301U, 1U, 1U), TensorShape(234U, 304U, 1U, 1U), WeightFormat::OHWI, WeightFormat::OHWIo4); + add_config(TensorShape(1024U, 1024U, 1U, 1U), TensorShape(1024U, 1024U, 1U, 1U), WeightFormat::OHWI, WeightFormat::OHWIo4); + } +}; + +class ReorderLayerDatasetBlock8 final : public ReorderLayerDataset +{ + public: + ReorderLayerDatasetBlock8() + { + add_config(TensorShape(10U, 9U), TensorShape(10U, 16U), WeightFormat::OHWI, WeightFormat::OHWIo8); + add_config(TensorShape(16U, 16U), TensorShape(16U, 16U), WeightFormat::OHWI, WeightFormat::OHWIo8); + add_config(TensorShape(10U, 511U), TensorShape(10U, 512U), WeightFormat::OHWI, WeightFormat::OHWIo8); + add_config(TensorShape(234U, 301U), TensorShape(234U, 304U), WeightFormat::OHWI, WeightFormat::OHWIo8); + add_config(TensorShape(1024U, 1024U), TensorShape(1024U, 1024U), WeightFormat::OHWI, WeightFormat::OHWIo8); + add_config(TensorShape(10U, 9U, 1U, 1U), TensorShape(10U, 16U, 1U, 1U), WeightFormat::OHWI, WeightFormat::OHWIo8); + add_config(TensorShape(16U, 16U, 1U, 1U), TensorShape(16U, 16U, 1U, 1U), WeightFormat::OHWI, WeightFormat::OHWIo8); + add_config(TensorShape(10U, 511U, 1U, 1U), TensorShape(10U, 512U, 1U, 1U), WeightFormat::OHWI, WeightFormat::OHWIo8); + add_config(TensorShape(234U, 301U, 1U, 1U), TensorShape(234U, 304U, 1U, 1U), WeightFormat::OHWI, WeightFormat::OHWIo8); + add_config(TensorShape(1024U, 1024U, 1U, 1U), TensorShape(1024U, 1024U, 1U, 1U), WeightFormat::OHWI, WeightFormat::OHWIo8); + } +}; + +} // namespace datasets +} // namespace test +} // namespace arm_compute +#endif /* ACL_TESTS_DATASETS_REORDERLAYERDATASET */ diff --git a/tests/validation/CMakeLists.txt b/tests/validation/CMakeLists.txt index eef062b5f9..448e96c4f9 100644 --- a/tests/validation/CMakeLists.txt +++ b/tests/validation/CMakeLists.txt @@ -138,6 +138,7 @@ if(ENABLE_NEON) NEON/FullyConnectedLayer.cpp NEON/ConvolutionLayer.cpp NEON/StridedSlice.cpp + NEON/ReorderLayer.cpp NEON/UNIT/DynamicTensor.cpp NEON/UNIT/TensorAllocator.cpp NEON/UNIT/MemoryManager.cpp diff --git a/tests/validation/NEON/ReorderLayer.cpp b/tests/validation/NEON/ReorderLayer.cpp new file mode 100644 index 0000000000..89d860fa4f --- /dev/null +++ b/tests/validation/NEON/ReorderLayer.cpp @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2023 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 "arm_compute/runtime/NEON/functions/NEReorderLayer.h" +#include "arm_compute/runtime/Tensor.h" +#include "tests/NEON/Accessor.h" +#include "tests/datasets/ReorderLayerDataset.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/ReorderFixture.h" + +namespace arm_compute +{ +namespace test +{ +namespace validation +{ +TEST_SUITE(NEON) +TEST_SUITE(ReorderLayer) + +template <typename T> +using NEReorderLayerAlias = ReorderValidationFixture<Tensor, Accessor, NEReorderLayer, T>; + +TEST_SUITE(FP32) +#if defined(ARM_COMPUTE_ENABLE_SVE) +FIXTURE_DATA_TEST_CASE(RunBlock8, NEReorderLayerAlias<float>, framework::DatasetMode::ALL, combine(datasets::ReorderLayerDatasetBlock8(), framework::dataset::make("DataType", DataType::F32))) +{ + // Validate output + validate(Accessor(_target), _reference); +} +#endif // ARM_COMPUTE_ENABLE_SVE +FIXTURE_DATA_TEST_CASE(RunBlock4, NEReorderLayerAlias<float>, framework::DatasetMode::ALL, combine(datasets::ReorderLayerDatasetBlock4(), framework::dataset::make("DataType", DataType::F32))) +{ + // Validate output + validate(Accessor(_target), _reference); +} + +TEST_SUITE_END() // FP32 + +TEST_SUITE_END() // ReorderLayer +TEST_SUITE_END() // NEON +} // namespace validation +} // namespace test +} // namespace arm_compute diff --git a/tests/validation/fixtures/ReorderFixture.h b/tests/validation/fixtures/ReorderFixture.h new file mode 100644 index 0000000000..bb3e3730df --- /dev/null +++ b/tests/validation/fixtures/ReorderFixture.h @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2023 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 ACL_TESTS_VALIDATION_FIXTURES_REORDERFIXTURE +#define ACL_TESTS_VALIDATION_FIXTURES_REORDERFIXTURE + +#include "arm_compute/core/TensorShape.h" +#include "arm_compute/core/Types.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/IAccessor.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/reference/Reorder.h" + +namespace arm_compute +{ +namespace test +{ +namespace validation +{ +/** [ReorderLayer fixture] **/ +template <typename TensorType, typename AccessorType, typename FunctionType, typename T> +class ReorderValidationFixture : public framework::Fixture +{ +public: + template <typename...> + void setup(TensorShape input_shape, TensorShape output_shape, WeightFormat input_wf, WeightFormat output_wf, DataType data_type) + { + _target = compute_target(input_shape, output_shape, input_wf, output_wf, data_type); + _reference = compute_reference(input_shape, output_shape, output_wf, data_type); + } + + protected: + template <typename U> + void fill(U &&tensor) + { + library->fill_tensor_uniform(tensor, 0); + } + + TensorType compute_target(const TensorShape &input_shape, const TensorShape &output_shape, WeightFormat input_wf, WeightFormat output_wf, DataType data_type) + { + // Create tensors + TensorType src = create_tensor<TensorType>(input_shape, data_type); + TensorType dst = create_tensor<TensorType>(output_shape, data_type); + + // Create and configure function + FunctionType reorder; + + reorder.configure(&src, &dst, input_wf, output_wf); + + ARM_COMPUTE_ASSERT(src.info()->is_resizable()); + ARM_COMPUTE_ASSERT(dst.info()->is_resizable()); + + // Allocate tensors + src.allocator()->allocate(); + dst.allocator()->allocate(); + + ARM_COMPUTE_ASSERT(!src.info()->is_resizable()); + ARM_COMPUTE_ASSERT(!dst.info()->is_resizable()); + + // Fill tensors + fill(AccessorType(src)); + + // Compute function + reorder.run(); + + return dst; + } + + SimpleTensor<T> compute_reference(const TensorShape &input_shape, const TensorShape &output_shape, WeightFormat output_wf, DataType data_type) + { + // Create reference + SimpleTensor<T> src{ input_shape, data_type }; + + // Fill reference + fill(src); + + return reference::reorder_layer<T>(src, output_shape, output_wf); + } + + TensorType _target{}; + SimpleTensor<T> _reference{}; +}; +/** [ReorderLayer fixture] **/ +} // namespace validation +} // namespace test +} // namespace arm_compute +#endif /* ACL_TESTS_VALIDATION_FIXTURES_REORDERFIXTURE */ diff --git a/tests/validation/reference/Reorder.cpp b/tests/validation/reference/Reorder.cpp new file mode 100644 index 0000000000..8abb372596 --- /dev/null +++ b/tests/validation/reference/Reorder.cpp @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2023 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 "Reorder.h" +#include "src/core/NEON/kernels/arm_gemm/utils.hpp" + +namespace arm_compute +{ +namespace test +{ +namespace validation +{ +namespace reference +{ + +/* + * Generic transform. + * + * Assuming the untransposed case, this works by first reading <BlockBy> + * consecutive values from the first input row. This same number of values + * are then read from the next <IntBy-1> rows. Now return to the first + * input row and repeat. + * + * Need to cope with the work requested in either dimension not actually + * being a multiple of the block sizes. + */ +template <unsigned int tIntBy, unsigned int BlockBy, bool Transposed, size_t TOutSize, size_t TInSize, typename d_type, arm_gemm::VLType vlt> +struct Transform_ref +{ + template <typename TOut, typename TIn> + static void Transform(TOut &out, const TIn in, const int stride, + const int y0, const int ymax, const int x0, const int xmax) + { + // NOTE: This code is disabled to avoid the call to get_vector_length(), so templated transforms will not be + // correct for SVE. This is not an issue as we have specializations for all SVE cases. + // For SVE cases we multiply the interleave factor by the vector length. + // const unsigned int IntBy = tIntBy * (vlt == VLType::SVE ? get_vector_length<TOut>() / BlockBy : 1); + const unsigned int IntBy = tIntBy; + int out_index = 0; + + const int n_whole_y_blocks = (ymax - y0) / IntBy; + const int y_remainders = (ymax - y0) % IntBy; + const int n_y_blocks = n_whole_y_blocks + (y_remainders ? 1 : 0); + + const int n_whole_x_blocks = (xmax - x0) / BlockBy; + const int x_remainders = (xmax - x0) % BlockBy; + const int n_x_blocks = n_whole_x_blocks + (x_remainders ? 1 : 0); + + // "Y" loop: advance down the rows of the source IntBy rows at a time. + // Set up fill_rows to show the number rows to copy from, and blank_rows + // for the number of blank rows to add. + for(int y_block = 0; y_block < n_y_blocks; y_block++) + { + const int fill_rows = (y_block < n_whole_y_blocks) ? IntBy : y_remainders; + const int blank_rows = IntBy - fill_rows; + + const int y_base = y0 + (y_block * IntBy); + + // So now advance along this block of rows, BlockBy columns at a time. + for(int x_block = 0; x_block < n_x_blocks; x_block++) + { + const int fill_cols = (x_block < n_whole_x_blocks) ? BlockBy : x_remainders; + const int blank_cols = BlockBy - fill_cols; + + const int x_base = x0 + (x_block * BlockBy); + + for(int row = 0; row < fill_rows; row++) + { + for(int col = 0; col < fill_cols; col++) + { + // In-range copy. If it's transposed, we reverse the sense of rows and columns here. + if(Transposed) + { + out[out_index] = in[(x_base + col) * stride + y_base + row]; + out_index++; + } + else + { + out[out_index] = in[(y_base + row) * stride + x_base + col]; + out_index++; + } + } + // "col" tail - row is in range but column is out of range. + for(int col = 0; col < blank_cols; col++) + { + out[out_index] = 0; + out_index++; + } + } + // "row" tail - row is out of range so fill with zeros always. + const d_type zeroval = 0; + const int pads = blank_rows * (fill_cols + blank_cols); + + for(int i = 0; i < pads; i++) + { + out[out_index] = zeroval; + } + + out_index += pads; + } + } + } +}; + +template <typename T> +SimpleTensor<T> reorder_layer(const SimpleTensor<T> &src, const TensorShape &output_shape, WeightFormat output_wf) +{ + SimpleTensor<T> dst{ output_shape, src.data_type() }; + const int cols = src.shape()[0]; + const int rows = src.shape()[1]; + + switch(output_wf) + { + case WeightFormat::OHWIo4: + { + Transform_ref<4, 1, true, sizeof(float), sizeof(float), float, arm_gemm::VLType::None>::Transform<SimpleTensor<T> &, SimpleTensor<T>>(dst, src, rows, 0, rows, 0, cols); + break; + } + case WeightFormat::OHWIo8: + { + Transform_ref<8, 1, true, sizeof(float), sizeof(float), float, arm_gemm::VLType::None>::Transform<SimpleTensor<T> &, SimpleTensor<T>>(dst, src, rows, 0, rows, 0, cols); + break; + } + default: + break; + } + + return dst; +} + +template SimpleTensor<float> reorder_layer(const SimpleTensor<float> &src, const TensorShape &output_shape, WeightFormat output_wf); + +} // namespace reference +} // namespace validation +} // namespace test +} // namespace arm_compute diff --git a/tests/validation/reference/Reorder.h b/tests/validation/reference/Reorder.h new file mode 100644 index 0000000000..94ee5078f8 --- /dev/null +++ b/tests/validation/reference/Reorder.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2023 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 ACL_TESTS_VALIDATION_REFERENCE_REORDER +#define ACL_TESTS_VALIDATION_REFERENCE_REORDER + +#include "tests/SimpleTensor.h" +#include "tests/Types.h" + +namespace arm_compute +{ +namespace test +{ +namespace validation +{ +namespace reference +{ +template <typename T> +SimpleTensor<T> reorder_layer(const SimpleTensor<T> &src, const TensorShape &output_shape, WeightFormat output_wf); +} // namespace reference +} // namespace validation +} // namespace test +} // namespace arm_compute +#endif /* ACL_TESTS_VALIDATION_REFERENCE_REORDER */ |