Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 1 | /* |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 2 | * Copyright (c) 2022-2024 Arm Limited. |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and associated documentation files (the "Software"), to |
| 8 | * deal in the Software without restriction, including without limitation the |
| 9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 10 | * sell copies of the Software, and to permit persons to whom the Software is |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included in all |
| 14 | * copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | * SOFTWARE. |
| 23 | */ |
| 24 | |
| 25 | #include "arm_compute/dynamic_fusion/sketch/gpu/operators/GpuDepthwiseConv2d.h" |
| 26 | |
| 27 | #include "tests/CL/CLAccessor.h" |
| 28 | #include "tests/datasets/DepthwiseConvolutionLayerDataset.h" |
| 29 | #include "tests/datasets/DilatedDepthwiseConvolutionLayerDataset.h" |
| 30 | #include "tests/framework/Asserts.h" |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 31 | #include "tests/framework/datasets/Datasets.h" |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 32 | #include "tests/framework/Fixture.h" |
| 33 | #include "tests/framework/Macros.h" |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 34 | #include "tests/validation/fixtures/dynamic_fusion/gpu/cl/DepthwiseConv2dFixture.h" |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 35 | #include "tests/validation/Validation.h" |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 36 | |
| 37 | namespace arm_compute |
| 38 | { |
| 39 | namespace test |
| 40 | { |
| 41 | namespace validation |
| 42 | { |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 43 | const auto depth_multipliers = framework::dataset::make("DepthMultiplier", {1U, 4U}); |
| 44 | const auto large_depth_multipliers = framework::dataset::make("DepthMultiplier", {1, 2, 5, 8}); |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 45 | |
| 46 | TEST_SUITE(CL) |
| 47 | TEST_SUITE(DYNAMIC_FUSION) |
| 48 | TEST_SUITE(DEPTHWISE_CONV2D) |
| 49 | |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 50 | RelativeTolerance<float> tolerance_f32( |
| 51 | 0.01f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F32 */ |
| 52 | RelativeTolerance<half_float::half> tolerance_f16(half_float::half( |
| 53 | 0.1)); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F16 */ |
| 54 | constexpr float tolerance_num = 0.02f; /**< Tolerance number */ |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 55 | |
| 56 | // *INDENT-OFF* |
| 57 | // clang-format off |
Gunes Bayir | cc28773 | 2023-01-19 15:56:00 +0000 | [diff] [blame] | 58 | DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip( // Explanations of failing tests |
| 59 | framework::dataset::make("InputInfo", { TensorInfo(TensorShape(2U, 27U, 13U), 1, DataType::F32, DataLayout::NHWC), // Mismatching data type input/weights |
| 60 | TensorInfo(TensorShape(3U, 27U, 13U), 1, DataType::F32, DataLayout::NHWC), // Mismatching input feature maps |
| 61 | TensorInfo(TensorShape(2U, 27U, 13U), 1, DataType::F32, DataLayout::NHWC), // Mismatching depth multiplier |
| 62 | TensorInfo(TensorShape(2U, 27U, 13U), 1, DataType::F32, DataLayout::NHWC), // Invalid biases size |
| 63 | TensorInfo(TensorShape(2U, 27U, 13U), 1, DataType::F32, DataLayout::NHWC), // Invalid biases dimensions |
| 64 | TensorInfo(TensorShape(8U, 27U, 13U), 1, DataType::F32, DataLayout::NHWC), // dilation < 1 |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 65 | TensorInfo(TensorShape(8U, 27U, 13U), 1, DataType::F32, DataLayout::NHWC), |
Gunes Bayir | cc28773 | 2023-01-19 15:56:00 +0000 | [diff] [blame] | 66 | TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::QASYMM8, DataLayout::NHWC), // Unsupported data type |
| 67 | TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::QASYMM8_SIGNED, DataLayout::NHWC), // Unsupported data type |
| 68 | TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::QSYMM16, DataLayout::NHWC), // Unsupported data type |
| 69 | TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::QSYMM8, DataLayout::NHWC), // Unsupported data type |
| 70 | TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::QSYMM8_PER_CHANNEL, DataLayout::NHWC), // Unsupported data type |
| 71 | TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::QASYMM16, DataLayout::NHWC), // Unsupported data type |
| 72 | TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::U8, DataLayout::NHWC), // Unsupported data type |
| 73 | TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::S8, DataLayout::NHWC), // Unsupported data type |
| 74 | TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::U16, DataLayout::NHWC), // Unsupported data type |
| 75 | TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::S16, DataLayout::NHWC), // Unsupported data type |
| 76 | TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::U32, DataLayout::NHWC), // Unsupported data type |
| 77 | TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::S32, DataLayout::NHWC), // Unsupported data type |
| 78 | TensorInfo(TensorShape(32U, 13U, 8U), 1, DataType::F32, DataLayout::NCHW), // Unsupported data layout |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 79 | TensorInfo(TensorShape(8U, 32U, 13U, 4U), 1, DataType::F32, DataLayout::NHWC), |
Gunes Bayir | cc28773 | 2023-01-19 15:56:00 +0000 | [diff] [blame] | 80 | TensorInfo(TensorShape(8U, 32U, 13U, 4U), 1, DataType::F32, DataLayout::NHWC), // weight dimension > 3 |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 81 | TensorInfo(TensorShape(8U, 32U, 13U, 4U), 1, DataType::F32, DataLayout::NHWC), |
| 82 | TensorInfo(TensorShape(8U, 32U, 13U, 4U), 1, DataType::F32, DataLayout::NHWC), |
| 83 | TensorInfo(TensorShape(8U, 32U, 13U, 4U), 1, DataType::F32, DataLayout::NHWC), |
| 84 | }), |
| 85 | framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(2U, 3U, 3U, 2U), 1, DataType::F16, DataLayout::NHWC), |
| 86 | TensorInfo(TensorShape(2U, 3U, 3U, 2U), 1, DataType::F32, DataLayout::NHWC), |
| 87 | TensorInfo(TensorShape(2U, 3U, 3U, 2U), 1, DataType::F32, DataLayout::NHWC), |
| 88 | TensorInfo(TensorShape(2U, 3U, 3U, 2U), 1, DataType::F32, DataLayout::NHWC), |
| 89 | TensorInfo(TensorShape(2U, 3U, 3U, 2U), 1, DataType::F32, DataLayout::NHWC), |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 90 | TensorInfo(TensorShape(16U, 3U, 3U), 1, DataType::F32, DataLayout::NHWC), |
| 91 | TensorInfo(TensorShape(16U, 3U, 3U), 1, DataType::F32, DataLayout::NHWC), |
| 92 | TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::QASYMM8, DataLayout::NHWC), |
| 93 | TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::QASYMM8_SIGNED, DataLayout::NHWC), |
| 94 | TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::QSYMM16, DataLayout::NHWC), |
| 95 | TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::QSYMM8, DataLayout::NHWC), |
| 96 | TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::QSYMM8_PER_CHANNEL, DataLayout::NHWC), |
| 97 | TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::QASYMM16, DataLayout::NHWC), |
| 98 | TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::U8, DataLayout::NHWC), |
| 99 | TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::S8, DataLayout::NHWC), |
| 100 | TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::U16, DataLayout::NHWC), |
| 101 | TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::S16, DataLayout::NHWC), |
| 102 | TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::U32, DataLayout::NHWC), |
| 103 | TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::S32, DataLayout::NHWC), |
| 104 | TensorInfo(TensorShape(3U, 3U, 24U), 1, DataType::F32, DataLayout::NCHW), |
| 105 | TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::F32, DataLayout::NHWC), |
| 106 | TensorInfo(TensorShape(24U, 3U, 3U, 5U), 1, DataType::F32, DataLayout::NHWC), |
| 107 | TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::F32, DataLayout::NHWC), |
| 108 | TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::F32, DataLayout::NHWC), |
| 109 | TensorInfo(TensorShape(24U, 4U, 3U), 1, DataType::F32, DataLayout::NHWC), |
| 110 | })), |
| 111 | framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32, DataLayout::NHWC), |
| 112 | TensorInfo(TensorShape(2U), 1, DataType::F32, DataLayout::NHWC), |
| 113 | TensorInfo(TensorShape(2U), 1, DataType::F32, DataLayout::NHWC), |
| 114 | TensorInfo(TensorShape(4U), 1, DataType::F32, DataLayout::NHWC), |
| 115 | TensorInfo(TensorShape(2U, 2U), 1, DataType::F32, DataLayout::NHWC), |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 116 | TensorInfo(TensorShape(16U), 1, DataType::F32, DataLayout::NHWC), |
| 117 | TensorInfo(TensorShape(16U), 1, DataType::F32, DataLayout::NHWC), |
| 118 | TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC), |
| 119 | TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC), |
| 120 | TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC), |
| 121 | TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC), |
| 122 | TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC), |
| 123 | TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC), |
| 124 | TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC), |
| 125 | TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC), |
| 126 | TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC), |
| 127 | TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC), |
| 128 | TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC), |
| 129 | TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC), |
| 130 | TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NCHW), |
| 131 | TensorInfo(TensorShape(24U), 1, DataType::F32, DataLayout::NHWC), |
| 132 | TensorInfo(TensorShape(24U), 1, DataType::F32, DataLayout::NHWC), |
| 133 | TensorInfo(TensorShape(24U), 1, DataType::F32, DataLayout::NHWC), |
| 134 | TensorInfo(TensorShape(24U), 1, DataType::F32, DataLayout::NHWC), |
| 135 | TensorInfo(TensorShape(24U), 1, DataType::F32, DataLayout::NHWC), |
| 136 | })), |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 137 | framework::dataset::make("Padding", { Padding2D(0, 0, 0, 0), |
| 138 | Padding2D(0, 0, 0, 0), |
| 139 | Padding2D(0, 0, 0, 0), |
| 140 | Padding2D(0, 0, 0, 0), |
| 141 | Padding2D(0, 0, 0, 0), |
| 142 | Padding2D(0, 0, 0, 0), |
| 143 | Padding2D(0, 0, 0, 0), |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 144 | Padding2D(1, 1, 0, 0), |
| 145 | Padding2D(1, 1, 0, 0), |
| 146 | Padding2D(1, 1, 0, 0), |
| 147 | Padding2D(1, 1, 0, 0), |
| 148 | Padding2D(1, 1, 0, 0), |
| 149 | Padding2D(1, 1, 0, 0), |
| 150 | Padding2D(1, 1, 0, 0), |
| 151 | Padding2D(1, 1, 0, 0), |
| 152 | Padding2D(1, 1, 0, 0), |
| 153 | Padding2D(1, 1, 0, 0), |
| 154 | Padding2D(1, 1, 0, 0), |
| 155 | Padding2D(1, 1, 0, 0), |
| 156 | Padding2D(1, 1, 0, 0), |
| 157 | Padding2D(1, 1, 0, 0), |
| 158 | Padding2D(1, 1, 0, 0), |
| 159 | Padding2D(2, 1, 2, 1), |
| 160 | Padding2D(2, 1, 2, 1), |
| 161 | Padding2D(2, 1, 2, 1), |
| 162 | })), |
| 163 | framework::dataset::make("Stride", { Size2D(1, 1), |
| 164 | Size2D(1, 1), |
| 165 | Size2D(1, 1), |
| 166 | Size2D(1, 1), |
| 167 | Size2D(1, 1), |
| 168 | Size2D(1, 1), |
| 169 | Size2D(1, 1), |
| 170 | Size2D(1, 1), |
| 171 | Size2D(1, 1), |
| 172 | Size2D(1, 1), |
| 173 | Size2D(1, 1), |
| 174 | Size2D(1, 1), |
| 175 | Size2D(1, 1), |
| 176 | Size2D(1, 1), |
| 177 | Size2D(1, 1), |
| 178 | Size2D(1, 1), |
| 179 | Size2D(1, 1), |
| 180 | Size2D(1, 1), |
| 181 | Size2D(1, 1), |
| 182 | Size2D(1, 1), |
| 183 | Size2D(1, 1), |
| 184 | Size2D(1, 1), |
| 185 | Size2D(1, 1), |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 186 | Size2D(2, 3), |
| 187 | Size2D(2, 3), |
| 188 | })), |
| 189 | framework::dataset::make("DepthMultiplier", { 1, |
| 190 | 1, |
| 191 | 3, |
| 192 | 1, |
| 193 | 1, |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 194 | 2, |
| 195 | 2, |
| 196 | 3, |
| 197 | 3, |
| 198 | 3, |
| 199 | 3, |
| 200 | 3, |
| 201 | 3, |
| 202 | 3, |
| 203 | 3, |
| 204 | 3, |
| 205 | 3, |
| 206 | 3, |
| 207 | 3, |
| 208 | 3, |
| 209 | 3, |
| 210 | 3, |
| 211 | 3, |
| 212 | 3, |
| 213 | 3, |
| 214 | })), |
| 215 | framework::dataset::make("Dilation", { Size2D(1U, 1U), |
| 216 | Size2D(1U, 1U), |
| 217 | Size2D(1U, 1U), |
| 218 | Size2D(1U, 1U), |
| 219 | Size2D(1U, 1U), |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 220 | Size2D(0U, 1U), |
| 221 | Size2D(1U, 1U), |
| 222 | Size2D(1U, 1U), |
| 223 | Size2D(1U, 1U), |
| 224 | Size2D(1U, 1U), |
| 225 | Size2D(1U, 1U), |
| 226 | Size2D(1U, 1U), |
| 227 | Size2D(1U, 1U), |
| 228 | Size2D(1U, 1U), |
| 229 | Size2D(1U, 1U), |
| 230 | Size2D(1U, 1U), |
| 231 | Size2D(1U, 1U), |
| 232 | Size2D(1U, 1U), |
| 233 | Size2D(1U, 1U), |
| 234 | Size2D(1U, 1U), |
| 235 | Size2D(1U, 1U), |
| 236 | Size2D(1U, 1U), |
| 237 | Size2D(1U, 1U), |
| 238 | Size2D(1U, 1U), |
| 239 | Size2D(2U, 3U), |
| 240 | })), |
Gunes Bayir | cc28773 | 2023-01-19 15:56:00 +0000 | [diff] [blame] | 241 | framework::dataset::make("Expected", { false, false, false, false, false, false, true, false, |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 242 | false, false, false, false, false, false, false, false, false, false, |
| 243 | false, false, true, false, true, true, true })), |
Gunes Bayir | cc28773 | 2023-01-19 15:56:00 +0000 | [diff] [blame] | 244 | input_info, weights_info, biases_info, padding, stride, depth_multiplier, dilation, expected) |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 245 | { |
| 246 | CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context(); |
Viet-Hoa Do | 3fcf3dc | 2023-05-17 15:17:48 +0100 | [diff] [blame] | 247 | GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx }; |
| 248 | GpuWorkloadSketch sketch{ &context }; |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 249 | |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 250 | const ITensorInfo* sketch_input_info = context.create_tensor_info(input_info); |
| 251 | const ITensorInfo* sketch_weights_info = context.create_tensor_info(weights_info); |
| 252 | const ITensorInfo* sketch_biases_info = context.create_tensor_info(biases_info); |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 253 | |
| 254 | DepthwiseConv2dAttributes attributes {}; |
| 255 | attributes.pad(padding) |
| 256 | .stride(stride) |
| 257 | .dilation(dilation) |
| 258 | .depth_multiplier(depth_multiplier); |
| 259 | |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 260 | const Status status = GpuDepthwiseConv2d::validate_op(sketch, sketch_input_info, sketch_weights_info, sketch_biases_info, attributes); |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 261 | const bool res = bool(status); |
| 262 | ARM_COMPUTE_EXPECT(res == expected, framework::LogLevel::ERRORS); |
| 263 | } |
| 264 | // clang-format on |
| 265 | // *INDENT-ON* |
| 266 | |
| 267 | template <typename T> |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 268 | using DynamicFusionGpuDepthwiseConv2dFixture = |
| 269 | DynamicFusionGpuDepthwiseConv2dValidationFixture<CLTensor, CLAccessor, GpuDepthwiseConv2d, T>; |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 270 | |
| 271 | TEST_SUITE(Float) |
| 272 | TEST_SUITE(FP16) |
| 273 | TEST_SUITE(W3x3) |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 274 | FIXTURE_DATA_TEST_CASE(RunSmall, |
| 275 | DynamicFusionGpuDepthwiseConv2dFixture<half>, |
| 276 | framework::DatasetMode::ALL, |
| 277 | combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), depth_multipliers), |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 278 | framework::dataset::make("DataType", DataType::F16)), |
| 279 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 280 | { |
| 281 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 282 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 283 | FIXTURE_DATA_TEST_CASE(RunLarge, |
| 284 | DynamicFusionGpuDepthwiseConv2dFixture<half>, |
| 285 | framework::DatasetMode::NIGHTLY, |
| 286 | combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(), |
| 287 | large_depth_multipliers), |
| 288 | framework::dataset::make("DataType", DataType::F16)), |
| 289 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 290 | { |
| 291 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 292 | } |
ramy.elgammal@arm.com | a04ae3e | 2023-07-27 18:23:17 +0100 | [diff] [blame] | 293 | #ifndef ACL_INTERNAL_TEST_CKW_IN_DF // Do not include this test as dilation not supported yet in DepthwiseConv2d CKW kernel |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 294 | TEST_SUITE(Dilation) |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 295 | FIXTURE_DATA_TEST_CASE(RunSmall, |
| 296 | DynamicFusionGpuDepthwiseConv2dFixture<half>, |
| 297 | framework::DatasetMode::ALL, |
| 298 | combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(), |
| 299 | depth_multipliers), |
| 300 | framework::dataset::make("DataType", DataType::F16)), |
| 301 | framework::dataset::make("DataLayout", {DataLayout::NHWC}))) |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 302 | { |
| 303 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 304 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 305 | FIXTURE_DATA_TEST_CASE(RunLarge, |
| 306 | DynamicFusionGpuDepthwiseConv2dFixture<half>, |
| 307 | framework::DatasetMode::NIGHTLY, |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 308 | combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(), |
| 309 | large_depth_multipliers), |
| 310 | framework::dataset::make("DataType", DataType::F16)), |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 311 | framework::dataset::make("DataLayout", {DataLayout::NHWC}))) |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 312 | { |
| 313 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 314 | } |
| 315 | TEST_SUITE_END() // Dilation |
ramy.elgammal@arm.com | a04ae3e | 2023-07-27 18:23:17 +0100 | [diff] [blame] | 316 | #endif // ACL_INTERNAL_TEST_CKW_IN_DF |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 317 | TEST_SUITE_END() // W3x3 |
| 318 | |
| 319 | TEST_SUITE(Generic) |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 320 | FIXTURE_DATA_TEST_CASE(RunSmall, |
| 321 | DynamicFusionGpuDepthwiseConv2dFixture<half>, |
| 322 | framework::DatasetMode::ALL, |
| 323 | combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(), depth_multipliers), |
| 324 | framework::dataset::make("DataType", DataType::F16)), |
| 325 | framework::dataset::make("DataLayout", {DataLayout::NHWC}))) |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 326 | { |
| 327 | validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num); |
| 328 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 329 | FIXTURE_DATA_TEST_CASE(RunLarge, |
| 330 | DynamicFusionGpuDepthwiseConv2dFixture<half>, |
| 331 | framework::DatasetMode::NIGHTLY, |
| 332 | combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(), |
| 333 | large_depth_multipliers), |
| 334 | framework::dataset::make("DataType", DataType::F16)), |
| 335 | framework::dataset::make("DataLayout", {DataLayout::NHWC}))) |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 336 | { |
| 337 | validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num); |
| 338 | } |
ramy.elgammal@arm.com | a04ae3e | 2023-07-27 18:23:17 +0100 | [diff] [blame] | 339 | #ifndef ACL_INTERNAL_TEST_CKW_IN_DF // Do not include this test as dilation not supported yet in DepthwiseConv2d CKW kernel |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 340 | TEST_SUITE(Dilation) |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 341 | FIXTURE_DATA_TEST_CASE(RunSmall, |
| 342 | DynamicFusionGpuDepthwiseConv2dFixture<half>, |
| 343 | framework::DatasetMode::ALL, |
| 344 | combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(), |
| 345 | depth_multipliers), |
| 346 | framework::dataset::make("DataType", DataType::F16)), |
| 347 | framework::dataset::make("DataLayout", {DataLayout::NHWC}))) |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 348 | { |
| 349 | validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num); |
| 350 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 351 | FIXTURE_DATA_TEST_CASE(RunLarge, |
| 352 | DynamicFusionGpuDepthwiseConv2dFixture<half>, |
| 353 | framework::DatasetMode::NIGHTLY, |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 354 | combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset(), |
| 355 | large_depth_multipliers), |
| 356 | framework::dataset::make("DataType", DataType::F16)), |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 357 | framework::dataset::make("DataLayout", {DataLayout::NHWC}))) |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 358 | { |
| 359 | validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num); |
| 360 | } |
| 361 | TEST_SUITE_END() // Dilation |
ramy.elgammal@arm.com | a04ae3e | 2023-07-27 18:23:17 +0100 | [diff] [blame] | 362 | #endif // ACL_INTERNAL_TEST_CKW_IN_DF |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 363 | TEST_SUITE_END() // Generic |
| 364 | TEST_SUITE_END() // FP16 |
| 365 | |
| 366 | TEST_SUITE(FP32) |
| 367 | TEST_SUITE(W3x3) |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 368 | FIXTURE_DATA_TEST_CASE(RunSmall, |
| 369 | DynamicFusionGpuDepthwiseConv2dFixture<float>, |
| 370 | framework::DatasetMode::ALL, |
| 371 | combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), depth_multipliers), |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 372 | framework::dataset::make("DataType", DataType::F32)), |
| 373 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 374 | { |
| 375 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 376 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 377 | FIXTURE_DATA_TEST_CASE(RunLarge, |
| 378 | DynamicFusionGpuDepthwiseConv2dFixture<float>, |
| 379 | framework::DatasetMode::NIGHTLY, |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 380 | combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(), |
| 381 | large_depth_multipliers), |
| 382 | framework::dataset::make("DataType", DataType::F32)), |
| 383 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 384 | { |
| 385 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 386 | } |
| 387 | |
ramy.elgammal@arm.com | a04ae3e | 2023-07-27 18:23:17 +0100 | [diff] [blame] | 388 | #ifndef ACL_INTERNAL_TEST_CKW_IN_DF // Do not include this test as dilation not supported yet in DepthwiseConv2d CKW kernel |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 389 | TEST_SUITE(Dilation) |
| 390 | |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 391 | FIXTURE_DATA_TEST_CASE(RunSmall, |
| 392 | DynamicFusionGpuDepthwiseConv2dFixture<float>, |
| 393 | framework::DatasetMode::ALL, |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 394 | combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(), |
| 395 | depth_multipliers), |
| 396 | framework::dataset::make("DataType", DataType::F32)), |
| 397 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 398 | { |
| 399 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 400 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 401 | FIXTURE_DATA_TEST_CASE(RunLarge, |
| 402 | DynamicFusionGpuDepthwiseConv2dFixture<float>, |
| 403 | framework::DatasetMode::NIGHTLY, |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 404 | combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(), |
| 405 | large_depth_multipliers), |
| 406 | framework::dataset::make("DataType", DataType::F32)), |
| 407 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 408 | { |
| 409 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 410 | } |
| 411 | TEST_SUITE_END() // Dilation |
ramy.elgammal@arm.com | a04ae3e | 2023-07-27 18:23:17 +0100 | [diff] [blame] | 412 | #endif // ACL_INTERNAL_TEST_CKW_IN_DF |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 413 | TEST_SUITE_END() // W3x3 |
| 414 | |
| 415 | TEST_SUITE(Generic) |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 416 | FIXTURE_DATA_TEST_CASE(RunSmall, |
| 417 | DynamicFusionGpuDepthwiseConv2dFixture<float>, |
| 418 | framework::DatasetMode::ALL, |
| 419 | combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(), depth_multipliers), |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 420 | framework::dataset::make("DataType", DataType::F32)), |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 421 | framework::dataset::make("DataLayout", {DataLayout::NHWC}))) |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 422 | { |
| 423 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 424 | } |
| 425 | |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 426 | FIXTURE_DATA_TEST_CASE(RunLarge, |
| 427 | DynamicFusionGpuDepthwiseConv2dFixture<float>, |
| 428 | framework::DatasetMode::NIGHTLY, |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 429 | combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(), |
| 430 | large_depth_multipliers), |
| 431 | framework::dataset::make("DataType", DataType::F32)), |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 432 | framework::dataset::make("DataLayout", {DataLayout::NHWC}))) |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 433 | { |
| 434 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 435 | } |
| 436 | |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 437 | FIXTURE_DATA_TEST_CASE(RunLargeKernelSize, |
| 438 | DynamicFusionGpuDepthwiseConv2dFixture<float>, |
| 439 | framework::DatasetMode::ALL, |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 440 | combine(combine(combine(datasets::LargeKernelSizeDepthwiseConvolutionLayerNHWCDataset(), |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 441 | framework::dataset::make("DepthMultiplier", {1})), |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 442 | framework::dataset::make("DataType", DataType::F32)), |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 443 | framework::dataset::make("DataLayout", {DataLayout::NHWC}))) |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 444 | { |
| 445 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 446 | } |
| 447 | |
ramy.elgammal@arm.com | a04ae3e | 2023-07-27 18:23:17 +0100 | [diff] [blame] | 448 | #ifndef ACL_INTERNAL_TEST_CKW_IN_DF // Do not include this test as dilation not supported yet in DepthwiseConv2d CKW kernel |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 449 | TEST_SUITE(Dilation) |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 450 | FIXTURE_DATA_TEST_CASE(RunSmall, |
| 451 | DynamicFusionGpuDepthwiseConv2dFixture<float>, |
| 452 | framework::DatasetMode::ALL, |
| 453 | combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(), |
| 454 | depth_multipliers), |
| 455 | framework::dataset::make("DataType", DataType::F32)), |
| 456 | framework::dataset::make("DataLayout", {DataLayout::NHWC}))) |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 457 | { |
| 458 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 459 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 460 | FIXTURE_DATA_TEST_CASE(RunLarge, |
| 461 | DynamicFusionGpuDepthwiseConv2dFixture<float>, |
| 462 | framework::DatasetMode::NIGHTLY, |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 463 | combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(), |
| 464 | large_depth_multipliers), |
| 465 | framework::dataset::make("DataType", DataType::F32)), |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 466 | framework::dataset::make("DataLayout", {DataLayout::NHWC}))) |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 467 | { |
| 468 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 469 | } |
| 470 | TEST_SUITE_END() // Dilation |
ramy.elgammal@arm.com | a04ae3e | 2023-07-27 18:23:17 +0100 | [diff] [blame] | 471 | #endif // ACL_INTERNAL_TEST_CKW_IN_DF |
Gunes Bayir | 7dc0234 | 2022-11-21 21:46:50 +0000 | [diff] [blame] | 472 | TEST_SUITE_END() // Generic |
| 473 | TEST_SUITE_END() // FP32 |
| 474 | TEST_SUITE_END() // Float |
| 475 | TEST_SUITE_END() // DEPTHWISE_CONV2D |
| 476 | TEST_SUITE_END() // DYNAMIC_FUSION |
| 477 | TEST_SUITE_END() // CL |
| 478 | } // namespace validation |
| 479 | } // namespace test |
| 480 | } // namespace arm_compute |