diff options
Diffstat (limited to 'arm_compute')
-rw-r--r-- | arm_compute/runtime/CL/CLScheduler.h | 36 | ||||
-rw-r--r-- | arm_compute/runtime/CL/tuners/Tuners.h | 56 |
2 files changed, 79 insertions, 13 deletions
diff --git a/arm_compute/runtime/CL/CLScheduler.h b/arm_compute/runtime/CL/CLScheduler.h index bdd779bd91..8eb287c942 100644 --- a/arm_compute/runtime/CL/CLScheduler.h +++ b/arm_compute/runtime/CL/CLScheduler.h @@ -94,15 +94,6 @@ public: return CLKernelLibrary::get().context(); } - /** Accessor to set the CL context to be used by the scheduler. - * - * @param[in] context A CL context. - */ - void set_context(cl::Context context) - { - CLKernelLibrary::get().set_context(context); - } - /** Accessor for the associated CL command queue. * * @return A CL command queue. @@ -122,6 +113,15 @@ public: return _target; } + /** Accessor to set the CL context to be used by the scheduler. + * + * @param[in] context A CL context. + */ + void set_context(cl::Context context) + { + CLKernelLibrary::get().set_context(context); + } + /** Accessor to set the CL command queue to be used by the scheduler. * * @param[in] queue A CL command queue. @@ -140,6 +140,15 @@ public: _target = target; } + /** Accessor to set the CL tuner to be used by the scheduler. + * + * @param[in] tuner A CL tuner + */ + void set_tuner(ICLTuner *tuner) + { + _cl_tuner = tuner; + } + /** Blocks until all commands in the associated command queue have finished. */ void sync() { @@ -179,10 +188,11 @@ private: /** Flag to ensure symbols initialisation is happening before Scheduler creation */ static std::once_flag _initialize_symbols; - cl::CommandQueue _queue; - GPUTarget _target; - bool _is_initialised; - ICLTuner *_cl_tuner; + cl::CommandQueue _queue; + GPUTarget _target; + bool _is_initialised; + ICLTuner *_cl_tuner; + std::unique_ptr<ICLTuner> _cl_default_static_tuner; }; } #endif /* __ARM_COMPUTE_CLSCHEDULER_H__ */ diff --git a/arm_compute/runtime/CL/tuners/Tuners.h b/arm_compute/runtime/CL/tuners/Tuners.h new file mode 100644 index 0000000000..a9eaa074aa --- /dev/null +++ b/arm_compute/runtime/CL/tuners/Tuners.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2018 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef __ARM_COMPUTE_TUNERS_H__ +#define __ARM_COMPUTE_TUNERS_H__ + +#include "arm_compute/runtime/CL/tuners/BifrostTuner.h" +#include "arm_compute/runtime/CL/tuners/MidgardTuner.h" + +#include <memory> + +namespace arm_compute +{ +namespace tuners +{ +/** Tuner factory class */ +class TunerFactory final +{ +public: + static std::unique_ptr<ICLTuner> create_tuner(GPUTarget target) + { + GPUTarget arch = get_arch_from_target(target); + switch(arch) + { + case GPUTarget::BIFROST: + return support::cpp14::make_unique<BifrostTuner>(); + case GPUTarget::MIDGARD: + return support::cpp14::make_unique<MidgardTuner>(); + default: + return nullptr; + } + } +}; +} // namespace tuners +} // namespace arm_compute +#endif /*__ARM_COMPUTE_TUNERS_H__ */ |