diff options
author | Jonathan Deakin <jonathan.deakin@arm.com> | 2023-01-12 11:41:14 +0000 |
---|---|---|
committer | Jonathan Deakin <jonathan.deakin@arm.com> | 2023-02-01 08:05:35 +0000 |
commit | 464ed2087c2ce2d2e741cc1e1dc4bd49d06e7d26 (patch) | |
tree | da07a18be246742773a729e264080d9a9b314d59 /tests/validation | |
parent | 7594f989963724e127c3e28210d60fed590b0524 (diff) | |
download | ComputeLibrary-464ed2087c2ce2d2e741cc1e1dc4bd49d06e7d26.tar.gz |
Remove fixed format strides hack
- Remove hack in CpuGemmAssemblyDispatch.cpp which tried to guess
strides for fixed format kernels. Instead, expect that strides will
have been correctly set on weights externally
- Update fixed format test fixtures to set the strides
- If the fixed format uses fast math mode, then weights should be of
type BFLOAT16. Change the validation logic to accept this.
Resolves: [ONCPUML-1131]
Co-authored-by: Milos Puzovic <Milos.Puzovic@arm.com>
Change-Id: I0f18d8b86b0f639be25fd122fa06a591e90645f2
Signed-off-by: Jonathan Deakin <jonathan.deakin@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8985
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Gunes Bayir <gunes.bayir@arm.com>
Benchmark: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/validation')
-rw-r--r-- | tests/validation/NEON/ConvolutionLayer.cpp | 7 | ||||
-rw-r--r-- | tests/validation/fixtures/ConvolutionLayerFixture.h | 17 |
2 files changed, 18 insertions, 6 deletions
diff --git a/tests/validation/NEON/ConvolutionLayer.cpp b/tests/validation/NEON/ConvolutionLayer.cpp index f03ac45bfc..08b6a02375 100644 --- a/tests/validation/NEON/ConvolutionLayer.cpp +++ b/tests/validation/NEON/ConvolutionLayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2022 Arm Limited. + * Copyright (c) 2017-2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -756,9 +756,8 @@ DATA_TEST_CASE(PrepareWeightShape, framework::DatasetMode::ALL, const DataType DT = DataType::F32; const DataLayout DL = DataLayout::NHWC; const auto TI = TensorInfo(input_shape, 1 /*num_channels, deprecated*/, DT, DL); - const TensorInfo computed = ::arm_compute::test::validation::prepare_weights(TI, wf); - const TensorInfo expected = TensorInfo(expected_shape, 1 /*num_channels, deprecated*/, DT, DL); - ARM_COMPUTE_EXPECT_EQUAL(computed, expected, framework::LogLevel::ERRORS); + const TensorInfo computed_info = ::arm_compute::test::validation::prepare_weights(TI, wf); + ARM_COMPUTE_EXPECT_EQUAL(computed_info.tensor_shape(), expected_shape, framework::LogLevel::ERRORS); } TEST_SUITE_END() // VariableWeightUtils diff --git a/tests/validation/fixtures/ConvolutionLayerFixture.h b/tests/validation/fixtures/ConvolutionLayerFixture.h index 63e6dc9377..5b8963ebfe 100644 --- a/tests/validation/fixtures/ConvolutionLayerFixture.h +++ b/tests/validation/fixtures/ConvolutionLayerFixture.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2022 Arm Limited. + * Copyright (c) 2017-2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -416,8 +416,21 @@ inline TensorInfo prepare_weights(const TensorInfo tensor_info, const arm_comput const int Ip = arm_gemm::roundup<unsigned int>(C, block_by); // C'=I' const int Op = arm_gemm::roundup<unsigned int>(N, interleave_by); // O'=N' + arm_compute::Strides strides_in_bytes = tensor_info.strides_in_bytes(); + strides_in_bytes.set(1, Ip * interleave_by * H * W * tensor_info.element_size()); + strides_in_bytes.set(2, Ip * Op * tensor_info.element_size()); + + const size_t offset_first_element_in_bytes = tensor_info.offset_first_element_in_bytes(); + + // Total size needs to include padded dimensions + const size_t total_size_in_bytes = Op * H * W * Ip * tensor_info.element_size(); + const TensorShape TS(Ip, W, H, Op); - return TensorInfo(TS, 1 /*num_channels*/, data_type, data_layout); + + TensorInfo new_tensor_info = tensor_info; + new_tensor_info.init(TS, 1 /*num_channels, deprecated*/, data_type, strides_in_bytes, + offset_first_element_in_bytes, total_size_in_bytes); + return new_tensor_info; } template <typename ScalarType, typename AccessorType> |