aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/CL/CLSubTensor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/CL/CLSubTensor.cpp')
-rw-r--r--src/runtime/CL/CLSubTensor.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/runtime/CL/CLSubTensor.cpp b/src/runtime/CL/CLSubTensor.cpp
index d0822414c3..ace820bbb7 100644
--- a/src/runtime/CL/CLSubTensor.cpp
+++ b/src/runtime/CL/CLSubTensor.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019 Arm Limited.
+ * Copyright (c) 2017-2019, 2022 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -29,12 +29,14 @@
using namespace arm_compute;
-CLSubTensor::CLSubTensor()
- : _parent(nullptr), _info()
+CLSubTensor::CLSubTensor() : _parent(nullptr), _info()
{
}
-CLSubTensor::CLSubTensor(ICLTensor *parent, const TensorShape &tensor_shape, const Coordinates &coords, bool extend_parent)
+CLSubTensor::CLSubTensor(ICLTensor *parent,
+ const TensorShape &tensor_shape,
+ const Coordinates &coords,
+ bool extend_parent)
: _parent(nullptr), _info()
{
ARM_COMPUTE_ERROR_ON(parent == nullptr);
@@ -81,11 +83,15 @@ void CLSubTensor::unmap()
uint8_t *CLSubTensor::do_map(cl::CommandQueue &q, bool blocking)
{
ARM_COMPUTE_ERROR_ON(cl_buffer().get() == nullptr);
- return static_cast<uint8_t *>(q.enqueueMapBuffer(cl_buffer(), blocking ? CL_TRUE : CL_FALSE, CL_MAP_READ | CL_MAP_WRITE, 0, info()->total_size()));
+ if (_parent->buffer() == nullptr)
+ {
+ _parent->map(q, blocking);
+ }
+ return _parent->buffer();
}
void CLSubTensor::do_unmap(cl::CommandQueue &q)
{
ARM_COMPUTE_ERROR_ON(cl_buffer().get() == nullptr);
- q.enqueueUnmapMemObject(cl_buffer(), buffer());
+ _parent->unmap(q);
}