blob: cf2513bf2c25e22fe23d8ee1e0e7cf518ea01b3c [file] [log] [blame]
Georgios Pinitasc0d1c862018-03-23 15:13:15 +00001/*
Michele Di Giorgiod9eaf612020-07-08 11:12:57 +01002 * Copyright (c) 2018-2020 Arm Limited.
Georgios Pinitasc0d1c862018-03-23 15:13:15 +00003 *
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 */
Georgios Pinitasc0d1c862018-03-23 15:13:15 +000024#include "arm_compute/runtime/CL/CLScheduler.h"
25#include "arm_compute/runtime/CL/CLTensor.h"
26#include "arm_compute/runtime/CL/tuners/BifrostTuner.h"
Sang-Hoon Parkbef7fa22020-10-21 15:58:54 +010027#include "src/core/CL/kernels/CLDirectConvolutionLayerKernel.h"
Georgios Pinitasc0d1c862018-03-23 15:13:15 +000028#include "tests/Utils.h"
29#include "tests/framework/Asserts.h"
30#include "tests/framework/Macros.h"
31
32namespace arm_compute
33{
34namespace test
35{
36namespace validation
37{
38TEST_SUITE(CL)
39TEST_SUITE(UNIT)
40TEST_SUITE(Tuner)
41
42/** Validates static tuning of Bifrost tuner */
43TEST_CASE(BifrostTunerSimple, framework::DatasetMode::ALL)
44{
45 // Create tuner
46 tuners::BifrostTuner tuner;
47
48 // Create tensors
49 auto src = create_tensor<CLTensor>(TensorShape(13U, 13U, 16U), DataType::F32);
50 auto weights = create_tensor<CLTensor>(TensorShape(3U, 3U, 16U, 3U), DataType::F32);
51 auto bias = create_tensor<CLTensor>(TensorShape(3U), DataType::F32);
52 auto dst = create_tensor<CLTensor>(TensorShape(13U, 13U, 3U), DataType::F32);
53
54 // Create kernel
55 cl::NDRange fake_lws(2000);
56 CLDirectConvolutionLayerKernel conv;
57 conv.set_target(GPUTarget::G72);
58
Georgios Pinitasc0d1c862018-03-23 15:13:15 +000059 // Configure
60 conv.configure(&src, &weights, &bias, &dst, PadStrideInfo(1, 1, 1, 1));
Anthony Barbierb6eb3532018-08-08 13:20:04 +010061
62 // Hard-wire lws to kernel and validate lws
63 conv.set_lws_hint(fake_lws);
Georgios Pinitasc0d1c862018-03-23 15:13:15 +000064 ARM_COMPUTE_EXPECT(conv.lws_hint()[0] == 2000, framework::LogLevel::ERRORS);
65
66 // Tune kernel and validate
67 tuner.tune_kernel_static(conv);
68 ARM_COMPUTE_EXPECT(conv.lws_hint()[0] != 2000, framework::LogLevel::ERRORS);
69
70 // Clear tuner
71 CLScheduler::get().default_init();
72}
73TEST_SUITE_END()
74TEST_SUITE_END()
75TEST_SUITE_END()
76} // namespace validation
77} // namespace test
78} // namespace arm_compute