blob: 152569fb6759db06116f5ea9b00042bf7586714c [file] [log] [blame]
Anthony Barbierdbdab852017-06-23 15:42:00 +01001/*
Jenkins0e205f72019-11-28 16:53:35 +00002 * Copyright (c) 2017-2019 ARM Limited.
Anthony Barbierdbdab852017-06-23 15:42:00 +01003 *
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/runtime/SingleThreadScheduler.h"
25
26#include "arm_compute/core/CPP/ICPPKernel.h"
27#include "arm_compute/core/Error.h"
28#include "arm_compute/core/Utils.h"
29
Kaizen8938bd32017-09-28 14:38:23 +010030namespace arm_compute
31{
Anthony Barbierdbdab852017-06-23 15:42:00 +010032void SingleThreadScheduler::set_num_threads(unsigned int num_threads)
33{
34 ARM_COMPUTE_UNUSED(num_threads);
Kaizen8938bd32017-09-28 14:38:23 +010035 ARM_COMPUTE_ERROR_ON(num_threads != 1);
Anthony Barbierdbdab852017-06-23 15:42:00 +010036}
37
Jenkins52ba29e2018-08-29 15:32:11 +000038void SingleThreadScheduler::schedule(ICPPKernel *kernel, const Hints &hints)
Anthony Barbierdbdab852017-06-23 15:42:00 +010039{
Jenkins52ba29e2018-08-29 15:32:11 +000040 ARM_COMPUTE_UNUSED(hints);
Kaizen8938bd32017-09-28 14:38:23 +010041 ThreadInfo info;
Jenkinsb3a371b2018-05-23 11:36:53 +010042 info.cpu_info = &_cpu_info;
Kaizen8938bd32017-09-28 14:38:23 +010043 kernel->run(kernel->window(), info);
Anthony Barbierdbdab852017-06-23 15:42:00 +010044}
45
Jenkins52ba29e2018-08-29 15:32:11 +000046void SingleThreadScheduler::run_workloads(std::vector<Workload> &workloads)
47{
48 ThreadInfo info;
49 info.cpu_info = &_cpu_info;
50 for(auto &wl : workloads)
51 {
52 wl(info);
53 }
54}
Anthony Barbierdbdab852017-06-23 15:42:00 +010055unsigned int SingleThreadScheduler::num_threads() const
56{
57 return 1;
58}
Kaizen8938bd32017-09-28 14:38:23 +010059} // namespace arm_compute