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