blob: 9bbf926b5873b0e2a4450b992a050725fbbda593 [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
Georgios Pinitas4c5469b2019-05-21 13:32:43 +01002 * Copyright (c) 2016-2019 ARM Limited.
Anthony Barbier6ff3b192017-09-04 18:44:23 +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/CL/CLTensor.h"
25
26#include "arm_compute/runtime/CL/CLScheduler.h"
27
Georgios Pinitas26014cf2019-09-09 19:00:57 +010028namespace arm_compute
29{
Anthony Barbier6ff3b192017-09-04 18:44:23 +010030CLTensor::CLTensor()
Georgios Pinitasbaf174e2017-09-08 19:47:30 +010031 : _allocator(this)
Anthony Barbier6ff3b192017-09-04 18:44:23 +010032{
33}
34
35TensorInfo *CLTensor::info() const
36{
37 return &_allocator.info();
38}
39
40TensorInfo *CLTensor::info()
41{
42 return &_allocator.info();
43}
44
45const cl::Buffer &CLTensor::cl_buffer() const
46{
47 return _allocator.cl_data();
48}
49
Georgios Pinitas4c5469b2019-05-21 13:32:43 +010050CLQuantization CLTensor::quantization() const
51{
52 return _allocator.quantization();
53}
54
Georgios Pinitas99d40952018-04-23 16:26:46 +010055CLTensorAllocator *CLTensor::allocator()
Anthony Barbier6ff3b192017-09-04 18:44:23 +010056{
57 return &_allocator;
58}
59
60void CLTensor::map(bool blocking)
61{
62 ICLTensor::map(CLScheduler::get().queue(), blocking);
63}
64
65void CLTensor::unmap()
66{
67 ICLTensor::unmap(CLScheduler::get().queue());
68}
69
70uint8_t *CLTensor::do_map(cl::CommandQueue &q, bool blocking)
71{
72 return _allocator.map(q, blocking);
73}
74
75void CLTensor::do_unmap(cl::CommandQueue &q)
76{
77 _allocator.unmap(q, buffer());
78}
Georgios Pinitas26014cf2019-09-09 19:00:57 +010079
80void CLTensor::associate_memory_group(arm_compute::IMemoryGroup *memory_group)
81{
82 _allocator.set_associated_memory_group(memory_group);
83}
84} // namespace arm_compute