blob: 09ffb06cf305b73145c7c569a23e4d0a4e97fdc4 [file] [log] [blame]
Georgios Pinitasc3c352e2021-03-18 10:59:40 +00001/*
2 * Copyright (c) 2021 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#ifndef SRC_GPU_CLQUEUE_H
25#define SRC_GPU_CLQUEUE_H
26
Georgios Pinitasc3c352e2021-03-18 10:59:40 +000027#include "arm_compute/runtime/CL/CLScheduler.h"
28
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010029#include "src/common/IQueue.h"
30
Georgios Pinitasc3c352e2021-03-18 10:59:40 +000031#include <memory>
32
33namespace arm_compute
34{
35// Forward declarations
36class CLTuner;
37
38namespace gpu
39{
40namespace opencl
41{
42/** OpenCL queue implementation class */
43class ClQueue final : public IQueue
44{
45public:
46 /** Construct a new CpuQueue object
47 *
48 * @param[in] ctx Context to be used
49 * @param[in] options Command queue options
50 */
51 ClQueue(IContext *ctx, const AclQueueOptions *options);
52
53 /** Return legacy scheduler
54 *
55 * @return arm_compute::IScheduler&
56 */
57 arm_compute::CLScheduler &scheduler();
58
59 /** Underlying cl command queue accessor
60 *
61 * @return the cl command queue used
62 */
63 ::cl::CommandQueue cl_queue();
64
65 /** Update/inject an underlying cl command queue object
66 *
67 * @warning Command queue needs to come from the same context as the AclQueue
68 *
69 * @param[in] queue Underlying cl command queue to be used
70 *
71 * @return true if the queue was set successfully else falseS
72 */
73 bool set_cl_queue(::cl::CommandQueue queue);
74
75 // Inherited functions overridden
76 StatusCode finish() override;
77
78private:
79 std::unique_ptr<CLTuner> _tuner;
80};
81} // namespace opencl
82} // namespace gpu
83} // namespace arm_compute
84#endif /* SRC_GPU_CLQUEUE_H */