blob: 582f9363516279486c5d1532f55b95211111f444 [file] [log] [blame]
Anthony Barbier2a07e182017-08-04 18:20:27 +01001/*
2 * Copyright (c) 2017 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 */
Anthony Barbier2a07e182017-08-04 18:20:27 +010024#include "arm_compute/graph/INode.h"
25
26#include "arm_compute/core/CL/OpenCL.h"
27#include "arm_compute/core/Validate.h"
28
Anthony Barbier2a07e182017-08-04 18:20:27 +010029using namespace arm_compute::graph;
30
Georgios Pinitasff421f22017-10-04 16:53:58 +010031TargetHint INode::override_target_hint(TargetHint target_hint) const
Anthony Barbier2a07e182017-08-04 18:20:27 +010032{
Georgios Pinitasff421f22017-10-04 16:53:58 +010033 if(target_hint == TargetHint::OPENCL && !opencl_is_available())
Anthony Barbier2a07e182017-08-04 18:20:27 +010034 {
Georgios Pinitasff421f22017-10-04 16:53:58 +010035 target_hint = TargetHint::DONT_CARE;
Anthony Barbier2a07e182017-08-04 18:20:27 +010036 }
Georgios Pinitasff421f22017-10-04 16:53:58 +010037 GraphHints hints{ target_hint };
38 target_hint = node_override_hints(hints).target_hint();
39 ARM_COMPUTE_ERROR_ON(target_hint == TargetHint::OPENCL && !opencl_is_available());
40 return target_hint;
Anthony Barbier2a07e182017-08-04 18:20:27 +010041}
Georgios Pinitasff421f22017-10-04 16:53:58 +010042GraphHints INode::node_override_hints(GraphHints hints) const
Anthony Barbier2a07e182017-08-04 18:20:27 +010043{
Georgios Pinitasff421f22017-10-04 16:53:58 +010044 TargetHint target_hint = hints.target_hint();
45 hints.set_target_hint((target_hint == TargetHint::DONT_CARE) ? TargetHint::NEON : target_hint);
46 return hints;
Anthony Barbier2a07e182017-08-04 18:20:27 +010047}