aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2021-05-04 21:39:57 +0100
committerGeorgios Pinitas <georgios.pinitas@arm.com>2021-05-12 05:50:43 +0000
commit2cd5b31d729984f938e2253532424daf157029c4 (patch)
tree00ea795cfd043742507feafd04ae9b9cce01adca
parentee22030441e869a7c4ff632d27a7d45c6168a14e (diff)
downloadComputeLibrary-2cd5b31d729984f938e2253532424daf157029c4.tar.gz
Remove unused CLCoreRuntimeContext
CLCoreRuntime context is currently unused and is planned to be replaced by the Context infrastructure Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com> Change-Id: Ic2874800960ca954f647e8867e7db951ce823e1c Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5571 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michalis Spyrou <michalis.spyrou@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
-rw-r--r--Android.bp1
-rw-r--r--arm_compute/core/CL/CLCoreRuntimeContext.h75
-rw-r--r--arm_compute/runtime/CL/CLBufferAllocator.h17
-rw-r--r--arm_compute/runtime/CL/CLMemoryRegion.h21
-rw-r--r--arm_compute/runtime/CL/CLRuntimeContext.h7
-rw-r--r--src/core/CL/CLCoreRuntimeContext.cpp52
-rw-r--r--src/core/gpu/cl/kernels/ClActivationKernel.cpp1
-rw-r--r--src/graph/backends/CL/CLDeviceBackend.cpp3
-rw-r--r--src/runtime/CL/CLBufferAllocator.cpp20
-rw-r--r--src/runtime/CL/CLMemoryRegion.cpp35
-rw-r--r--src/runtime/CL/CLRuntimeContext.cpp8
-rw-r--r--src/runtime/CL/CLTensorAllocator.cpp27
12 files changed, 38 insertions, 229 deletions
diff --git a/Android.bp b/Android.bp
index 543f5ab123..6ece3f8636 100644
--- a/Android.bp
+++ b/Android.bp
@@ -65,7 +65,6 @@ cc_library_static {
"src/core/AccessWindowStatic.cpp",
"src/core/AccessWindowTranspose.cpp",
"src/core/CL/CLCompileContext.cpp",
- "src/core/CL/CLCoreRuntimeContext.cpp",
"src/core/CL/CLHelpers.cpp",
"src/core/CL/CLKernelLibrary.cpp",
"src/core/CL/CLUtils.cpp",
diff --git a/arm_compute/core/CL/CLCoreRuntimeContext.h b/arm_compute/core/CL/CLCoreRuntimeContext.h
deleted file mode 100644
index 23f282354c..0000000000
--- a/arm_compute/core/CL/CLCoreRuntimeContext.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2019 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_CLCORERUNTIME_CONTEXT_H
-#define ARM_COMPUTE_CLCORERUNTIME_CONTEXT_H
-
-#include "arm_compute/core/CL/OpenCL.h"
-
-namespace arm_compute
-{
-// Forward declarations
-class CLKernelLibrary;
-
-/** Core runtime context for OpenCL */
-class CLCoreRuntimeContext final
-{
-public:
- /** Legacy constructor */
- CLCoreRuntimeContext();
-
- /** Constructor */
- CLCoreRuntimeContext(CLKernelLibrary *kernel_lib, cl::Context ctx, cl::CommandQueue queue);
- /** Destructor */
- ~CLCoreRuntimeContext() = default;
- /** Default copy constructor */
- CLCoreRuntimeContext(const CLCoreRuntimeContext &) = default;
- /** Default move constructor */
- CLCoreRuntimeContext(CLCoreRuntimeContext &&) = default;
- /** Default copy assignment */
- CLCoreRuntimeContext &operator=(const CLCoreRuntimeContext &) = default;
- /** Default move assignment operator */
- CLCoreRuntimeContext &operator=(CLCoreRuntimeContext &&) = default;
- /** Kernel Library accessor
- *
- * @return The kernel library instance used by the core context
- */
- CLKernelLibrary *kernel_library() const;
- /** OpenCL context accessor
- *
- * @return The OpenCL context used by the core context
- */
- cl::Context context();
- /** OpenCL command queue accessor
- *
- * @return The OpenCL queue used by the core context
- */
- cl::CommandQueue queue();
-
-private:
- CLKernelLibrary *_kernel_lib{ nullptr };
- cl::Context _ctx{};
- cl::CommandQueue _queue{};
-};
-} // namespace arm_compute
-#endif /*ARM_COMPUTE_CLCORERUNTIME_CONTEXT_H */
diff --git a/arm_compute/runtime/CL/CLBufferAllocator.h b/arm_compute/runtime/CL/CLBufferAllocator.h
index 69eac21ec2..7467e9d1c6 100644
--- a/arm_compute/runtime/CL/CLBufferAllocator.h
+++ b/arm_compute/runtime/CL/CLBufferAllocator.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019 Arm Limited.
+ * Copyright (c) 2017-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -30,29 +30,14 @@
namespace arm_compute
{
-class CLCoreRuntimeContext;
/** Default OpenCL cl buffer allocator implementation */
class CLBufferAllocator final : public IAllocator
{
public:
- /** Default constructor
- *
- * @param[in] ctx A runtime context.
- */
- CLBufferAllocator(CLCoreRuntimeContext *ctx = nullptr);
-
- /** Default copy constructor */
- CLBufferAllocator(const CLBufferAllocator &) = default;
- /** Default copy assignment operator */
- CLBufferAllocator &operator=(const CLBufferAllocator &) = default;
-
// Inherited methods overridden:
void *allocate(size_t size, size_t alignment) override;
void free(void *ptr) override;
std::unique_ptr<IMemoryRegion> make_region(size_t size, size_t alignment) override;
-
-private:
- CLCoreRuntimeContext *_ctx;
};
} // arm_compute
#endif /*ARM_COMPUTE_CLBUFFERALLOCATOR_H */
diff --git a/arm_compute/runtime/CL/CLMemoryRegion.h b/arm_compute/runtime/CL/CLMemoryRegion.h
index 9d08f197c9..1fd8fdb79e 100644
--- a/arm_compute/runtime/CL/CLMemoryRegion.h
+++ b/arm_compute/runtime/CL/CLMemoryRegion.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020 Arm Limited.
+ * Copyright (c) 2018-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -31,17 +31,15 @@
namespace arm_compute
{
-class CLCoreRuntimeContext;
/** OpenCL memory region interface */
class ICLMemoryRegion : public IMemoryRegion
{
public:
/** Constructor
*
- * @param[in] ctx Runtime context
* @param[in] size Region size
*/
- ICLMemoryRegion(CLCoreRuntimeContext *ctx, size_t size);
+ ICLMemoryRegion(size_t size);
/** Default Destructor */
virtual ~ICLMemoryRegion() = default;
/** Prevent instances of this class from being copied (As this class contains pointers) */
@@ -99,17 +97,15 @@ class CLBufferMemoryRegion final : public ICLMemoryRegion
public:
/** Constructor
*
- * @param[in] ctx Runtime context
* @param[in] flags Memory flags
* @param[in] size Region size
*/
- CLBufferMemoryRegion(CLCoreRuntimeContext *ctx, cl_mem_flags flags, size_t size);
+ CLBufferMemoryRegion(cl_mem_flags flags, size_t size);
/** Constructor
*
* @param[in] buffer Buffer to be used as a memory region
- * @param[in] ctx Runtime context
*/
- CLBufferMemoryRegion(const cl::Buffer &buffer, CLCoreRuntimeContext *ctx);
+ CLBufferMemoryRegion(const cl::Buffer &buffer);
// Inherited methods overridden :
void *ptr() final;
@@ -123,12 +119,11 @@ class ICLSVMMemoryRegion : public ICLMemoryRegion
protected:
/** Constructor
*
- * @param[in] ctx Runtime context
* @param[in] flags Memory flags
* @param[in] size Region size
* @param[in] alignment Alignment
*/
- ICLSVMMemoryRegion(CLCoreRuntimeContext *ctx, cl_mem_flags flags, size_t size, size_t alignment);
+ ICLSVMMemoryRegion(cl_mem_flags flags, size_t size, size_t alignment);
/** Destructor */
virtual ~ICLSVMMemoryRegion();
/** Prevent instances of this class from being copied (As this class contains pointers) */
@@ -153,12 +148,11 @@ class CLCoarseSVMMemoryRegion final : public ICLSVMMemoryRegion
public:
/** Constructor
*
- * @param[in] ctx Runtime context
* @param[in] flags Memory flags
* @param[in] size Region size
* @param[in] alignment Alignment
*/
- CLCoarseSVMMemoryRegion(CLCoreRuntimeContext *ctx, cl_mem_flags flags, size_t size, size_t alignment);
+ CLCoarseSVMMemoryRegion(cl_mem_flags flags, size_t size, size_t alignment);
// Inherited methods overridden :
void *map(cl::CommandQueue &q, bool blocking) final;
@@ -171,12 +165,11 @@ class CLFineSVMMemoryRegion final : public ICLSVMMemoryRegion
public:
/** Constructor
*
- * @param[in] ctx Runtime context
* @param[in] flags Memory flags
* @param[in] size Region size
* @param[in] alignment Alignment
*/
- CLFineSVMMemoryRegion(CLCoreRuntimeContext *ctx, cl_mem_flags flags, size_t size, size_t alignment);
+ CLFineSVMMemoryRegion(cl_mem_flags flags, size_t size, size_t alignment);
// Inherited methods overridden :
void *map(cl::CommandQueue &q, bool blocking) final;
diff --git a/arm_compute/runtime/CL/CLRuntimeContext.h b/arm_compute/runtime/CL/CLRuntimeContext.h
index 4ab8f70887..dd17645fa7 100644
--- a/arm_compute/runtime/CL/CLRuntimeContext.h
+++ b/arm_compute/runtime/CL/CLRuntimeContext.h
@@ -24,7 +24,6 @@
#ifndef ARM_COMPUTE_CLRUNTIME_CONTEXT_H
#define ARM_COMPUTE_CLRUNTIME_CONTEXT_H
-#include "arm_compute/core/CL/CLCoreRuntimeContext.h"
#include "arm_compute/core/CL/CLKernelLibrary.h"
#include "arm_compute/core/CL/OpenCL.h"
#include "arm_compute/runtime/CL/CLScheduler.h"
@@ -51,16 +50,14 @@ public:
void set_gpu_scheduler(CLScheduler *scheduler);
// Inherited overridden methods
- CLScheduler *gpu_scheduler();
- CLKernelLibrary &kernel_library();
- CLCoreRuntimeContext *core_runtime_context();
+ CLScheduler *gpu_scheduler();
+ CLKernelLibrary &kernel_library();
private:
std::unique_ptr<CLScheduler> _gpu_owned_scheduler{ nullptr };
CLScheduler *_gpu_scheduler{ nullptr };
CLTuner _tuner{ false };
CLSymbols _symbols{};
- CLCoreRuntimeContext _core_context{};
CLBackendType _backend_type{ CLBackendType::Native };
};
} // namespace arm_compute
diff --git a/src/core/CL/CLCoreRuntimeContext.cpp b/src/core/CL/CLCoreRuntimeContext.cpp
deleted file mode 100644
index 6b1b1f5e7b..0000000000
--- a/src/core/CL/CLCoreRuntimeContext.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2019 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.
- */
-#include "arm_compute/core/CL/CLCoreRuntimeContext.h"
-
-namespace arm_compute
-{
-cl::Context CLCoreRuntimeContext::context()
-{
- return _ctx;
-}
-
-cl::CommandQueue CLCoreRuntimeContext::queue()
-{
- return _queue;
-}
-
-CLCoreRuntimeContext::CLCoreRuntimeContext()
- : _kernel_lib(nullptr), _ctx(), _queue()
-{
-}
-
-CLCoreRuntimeContext::CLCoreRuntimeContext(CLKernelLibrary *kernel_lib, cl::Context ctx, cl::CommandQueue queue)
- : _kernel_lib(kernel_lib), _ctx(ctx), _queue(queue)
-{
-}
-
-CLKernelLibrary *CLCoreRuntimeContext::kernel_library() const
-{
- return _kernel_lib;
-}
-} // namespace arm_compute
diff --git a/src/core/gpu/cl/kernels/ClActivationKernel.cpp b/src/core/gpu/cl/kernels/ClActivationKernel.cpp
index f48425f7cd..17a8c6498d 100644
--- a/src/core/gpu/cl/kernels/ClActivationKernel.cpp
+++ b/src/core/gpu/cl/kernels/ClActivationKernel.cpp
@@ -23,7 +23,6 @@
*/
#include "src/core/gpu/cl/kernels/ClActivationKernel.h"
-#include "arm_compute/core/CL/CLCoreRuntimeContext.h"
#include "arm_compute/core/CL/CLHelpers.h"
#include "arm_compute/core/CL/ICLTensor.h"
#include "arm_compute/core/TensorInfo.h"
diff --git a/src/graph/backends/CL/CLDeviceBackend.cpp b/src/graph/backends/CL/CLDeviceBackend.cpp
index eafda98669..b6b25cc7d0 100644
--- a/src/graph/backends/CL/CLDeviceBackend.cpp
+++ b/src/graph/backends/CL/CLDeviceBackend.cpp
@@ -34,7 +34,6 @@
#include "arm_compute/graph/backends/CL/CLSubTensorHandle.h"
#include "arm_compute/graph/backends/CL/CLTensorHandle.h"
-#include "arm_compute/core/CL/CLCoreRuntimeContext.h"
#include "arm_compute/core/TensorInfo.h"
#include "arm_compute/runtime/BlobLifetimeManager.h"
#include "arm_compute/runtime/CL/CLBufferAllocator.h"
@@ -89,7 +88,7 @@ void CLDeviceBackend::initialize_backend()
// Setup Scheduler
CLScheduler::get().default_init(&_tuner, &_gemm_heuristics, _backend_type);
// Create allocator with new context
- _allocator = std::make_unique<CLBufferAllocator>(nullptr /* legacy path for CLCoreRuntimeContext */);
+ _allocator = std::make_unique<CLBufferAllocator>();
}
void CLDeviceBackend::release_backend_context(GraphContext &ctx)
diff --git a/src/runtime/CL/CLBufferAllocator.cpp b/src/runtime/CL/CLBufferAllocator.cpp
index 3673d65111..e06ef3d37d 100644
--- a/src/runtime/CL/CLBufferAllocator.cpp
+++ b/src/runtime/CL/CLBufferAllocator.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2020 Arm Limited.
+ * Copyright (c) 2017-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -23,7 +23,6 @@
*/
#include "arm_compute/runtime/CL/CLBufferAllocator.h"
-#include "arm_compute/core/CL/CLCoreRuntimeContext.h"
#include "arm_compute/core/CL/OpenCL.h"
#include "arm_compute/core/Error.h"
#include "arm_compute/runtime/CL/CLMemoryRegion.h"
@@ -33,23 +32,10 @@
namespace arm_compute
{
-CLBufferAllocator::CLBufferAllocator(CLCoreRuntimeContext *ctx)
- : _ctx(ctx)
-{
-}
-
void *CLBufferAllocator::allocate(size_t size, size_t alignment)
{
ARM_COMPUTE_UNUSED(alignment);
- cl_mem buf;
- if(_ctx == nullptr)
- {
- buf = clCreateBuffer(CLScheduler::get().context().get(), CL_MEM_ALLOC_HOST_PTR | CL_MEM_READ_WRITE, size, nullptr, nullptr);
- }
- else
- {
- buf = clCreateBuffer(_ctx->context().get(), CL_MEM_ALLOC_HOST_PTR | CL_MEM_READ_WRITE, size, nullptr, nullptr);
- }
+ cl_mem buf{ clCreateBuffer(CLScheduler::get().context().get(), CL_MEM_ALLOC_HOST_PTR | CL_MEM_READ_WRITE, size, nullptr, nullptr) };
return static_cast<void *>(buf);
}
@@ -62,6 +48,6 @@ void CLBufferAllocator::free(void *ptr)
std::unique_ptr<IMemoryRegion> CLBufferAllocator::make_region(size_t size, size_t alignment)
{
ARM_COMPUTE_UNUSED(alignment);
- return std::make_unique<CLBufferMemoryRegion>(_ctx, CL_MEM_ALLOC_HOST_PTR | CL_MEM_READ_WRITE, size);
+ return std::make_unique<CLBufferMemoryRegion>(CL_MEM_ALLOC_HOST_PTR | CL_MEM_READ_WRITE, size);
}
} // namespace arm_compute
diff --git a/src/runtime/CL/CLMemoryRegion.cpp b/src/runtime/CL/CLMemoryRegion.cpp
index 0952139a8b..780a563d63 100644
--- a/src/runtime/CL/CLMemoryRegion.cpp
+++ b/src/runtime/CL/CLMemoryRegion.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020 Arm Limited.
+ * Copyright (c) 2018-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -23,16 +23,15 @@
*/
#include "arm_compute/runtime/CL/CLMemoryRegion.h"
-#include "arm_compute/core/CL/CLCoreRuntimeContext.h"
#include "arm_compute/core/Error.h"
#include "arm_compute/runtime/CL/CLScheduler.h"
namespace arm_compute
{
-ICLMemoryRegion::ICLMemoryRegion(CLCoreRuntimeContext *ctx, size_t size)
+ICLMemoryRegion::ICLMemoryRegion(size_t size)
: IMemoryRegion(size),
- _queue((ctx != nullptr) ? ctx->queue() : CLScheduler::get().queue()),
- _ctx((ctx != nullptr) ? ctx->context() : CLScheduler::get().context()),
+ _queue(CLScheduler::get().queue()),
+ _ctx(CLScheduler::get().context()),
_mapping(nullptr),
_mem()
{
@@ -59,17 +58,17 @@ std::unique_ptr<IMemoryRegion> ICLMemoryRegion::extract_subregion(size_t offset,
return nullptr;
}
-CLBufferMemoryRegion::CLBufferMemoryRegion(CLCoreRuntimeContext *ctx, cl_mem_flags flags, size_t size)
- : ICLMemoryRegion(ctx, size)
+CLBufferMemoryRegion::CLBufferMemoryRegion(cl_mem_flags flags, size_t size)
+ : ICLMemoryRegion(size)
{
if(_size != 0)
{
- _mem = cl::Buffer((ctx != nullptr) ? ctx->context() : CLScheduler::get().context(), flags, _size);
+ _mem = cl::Buffer(CLScheduler::get().context(), flags, _size);
}
}
-CLBufferMemoryRegion::CLBufferMemoryRegion(const cl::Buffer &buffer, CLCoreRuntimeContext *ctx)
- : ICLMemoryRegion(ctx, buffer.getInfo<CL_MEM_SIZE>())
+CLBufferMemoryRegion::CLBufferMemoryRegion(const cl::Buffer &buffer)
+ : ICLMemoryRegion(buffer.getInfo<CL_MEM_SIZE>())
{
_mem = buffer;
}
@@ -93,15 +92,15 @@ void CLBufferMemoryRegion::unmap(cl::CommandQueue &q)
_mapping = nullptr;
}
-ICLSVMMemoryRegion::ICLSVMMemoryRegion(CLCoreRuntimeContext *ctx, cl_mem_flags flags, size_t size, size_t alignment)
- : ICLMemoryRegion(ctx, size), _ptr(nullptr)
+ICLSVMMemoryRegion::ICLSVMMemoryRegion(cl_mem_flags flags, size_t size, size_t alignment)
+ : ICLMemoryRegion(size), _ptr(nullptr)
{
if(size != 0)
{
- _ptr = clSVMAlloc((ctx != nullptr) ? ctx->context().get() : CLScheduler::get().context().get(), flags, size, alignment);
+ _ptr = clSVMAlloc(CLScheduler::get().context().get(), flags, size, alignment);
if(_ptr != nullptr)
{
- _mem = cl::Buffer((ctx != nullptr) ? ctx->context() : CLScheduler::get().context(), CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR, _size, _ptr);
+ _mem = cl::Buffer(CLScheduler::get().context(), CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR, _size, _ptr);
}
}
}
@@ -127,8 +126,8 @@ void *ICLSVMMemoryRegion::ptr()
return _ptr;
}
-CLCoarseSVMMemoryRegion::CLCoarseSVMMemoryRegion(CLCoreRuntimeContext *ctx, cl_mem_flags flags, size_t size, size_t alignment)
- : ICLSVMMemoryRegion(ctx, flags, size, alignment)
+CLCoarseSVMMemoryRegion::CLCoarseSVMMemoryRegion(cl_mem_flags flags, size_t size, size_t alignment)
+ : ICLSVMMemoryRegion(flags, size, alignment)
{
}
@@ -147,8 +146,8 @@ void CLCoarseSVMMemoryRegion::unmap(cl::CommandQueue &q)
_mapping = nullptr;
}
-CLFineSVMMemoryRegion::CLFineSVMMemoryRegion(CLCoreRuntimeContext *ctx, cl_mem_flags flags, size_t size, size_t alignment)
- : ICLSVMMemoryRegion(ctx, flags, size, alignment)
+CLFineSVMMemoryRegion::CLFineSVMMemoryRegion(cl_mem_flags flags, size_t size, size_t alignment)
+ : ICLSVMMemoryRegion(flags, size, alignment)
{
}
diff --git a/src/runtime/CL/CLRuntimeContext.cpp b/src/runtime/CL/CLRuntimeContext.cpp
index 0c1d011f9a..5083b4b0c5 100644
--- a/src/runtime/CL/CLRuntimeContext.cpp
+++ b/src/runtime/CL/CLRuntimeContext.cpp
@@ -29,7 +29,7 @@
namespace arm_compute
{
CLRuntimeContext::CLRuntimeContext()
- : _gpu_owned_scheduler(std::make_unique<CLScheduler>()), _gpu_scheduler(_gpu_owned_scheduler.get()), _symbols(), _core_context(), _backend_type()
+ : _gpu_owned_scheduler(std::make_unique<CLScheduler>()), _gpu_scheduler(_gpu_owned_scheduler.get()), _symbols(), _backend_type()
{
_symbols.load_default();
auto ctx_dev_err = create_opencl_context_and_device(_backend_type);
@@ -40,7 +40,6 @@ CLRuntimeContext::CLRuntimeContext()
_gpu_owned_scheduler->init(ctx, queue, dev, &_tuner);
const std::string cl_kernels_folder("./cl_kernels");
CLKernelLibrary::get().init(cl_kernels_folder, ctx, dev);
- _core_context = CLCoreRuntimeContext(&CLKernelLibrary::get(), _gpu_owned_scheduler->context(), _gpu_owned_scheduler->queue());
}
CLKernelLibrary &CLRuntimeContext::kernel_library()
@@ -48,11 +47,6 @@ CLKernelLibrary &CLRuntimeContext::kernel_library()
return CLKernelLibrary::get();
}
-CLCoreRuntimeContext *CLRuntimeContext::core_runtime_context()
-{
- return &_core_context;
-}
-
void CLRuntimeContext::set_gpu_scheduler(CLScheduler *scheduler)
{
ARM_COMPUTE_ERROR_ON_NULLPTR(scheduler);
diff --git a/src/runtime/CL/CLTensorAllocator.cpp b/src/runtime/CL/CLTensorAllocator.cpp
index c82e9dfc67..f85b8ae777 100644
--- a/src/runtime/CL/CLTensorAllocator.cpp
+++ b/src/runtime/CL/CLTensorAllocator.cpp
@@ -38,29 +38,27 @@ static IAllocator *static_global_cl_allocator = nullptr;
/** Helper function used to allocate the backing memory of a tensor
*
- * @param[in] context OpenCL context to use
* @param[in] size Size of the allocation
* @param[in] alignment Alignment of the allocation
*
* @return A wrapped memory region
*/
-std::unique_ptr<ICLMemoryRegion> allocate_region(CLCoreRuntimeContext *ctx, size_t size, cl_uint alignment)
+std::unique_ptr<ICLMemoryRegion> allocate_region(size_t size, cl_uint alignment)
{
// Try fine-grain SVM
- std::unique_ptr<ICLMemoryRegion> region = std::make_unique<CLFineSVMMemoryRegion>(ctx,
- CL_MEM_READ_WRITE | CL_MEM_SVM_FINE_GRAIN_BUFFER,
+ std::unique_ptr<ICLMemoryRegion> region = std::make_unique<CLFineSVMMemoryRegion>(CL_MEM_READ_WRITE | CL_MEM_SVM_FINE_GRAIN_BUFFER,
size,
alignment);
// Try coarse-grain SVM in case of failure
if(region != nullptr && region->ptr() == nullptr)
{
- region = std::make_unique<CLCoarseSVMMemoryRegion>(ctx, CL_MEM_READ_WRITE, size, alignment);
+ region = std::make_unique<CLCoarseSVMMemoryRegion>(CL_MEM_READ_WRITE, size, alignment);
}
// Try legacy buffer memory in case of failure
if(region != nullptr && region->ptr() == nullptr)
{
- region = std::make_unique<CLBufferMemoryRegion>(ctx, CL_MEM_ALLOC_HOST_PTR | CL_MEM_READ_WRITE, size);
+ region = std::make_unique<CLBufferMemoryRegion>(CL_MEM_ALLOC_HOST_PTR | CL_MEM_READ_WRITE, size);
}
return region;
}
@@ -136,14 +134,9 @@ void CLTensorAllocator::allocate()
{
_memory.set_owned_region(static_global_cl_allocator->make_region(info().total_size(), 0));
}
- else if(_ctx == nullptr)
- {
- auto legacy_ctx = CLCoreRuntimeContext(nullptr, CLScheduler::get().context(), CLScheduler::get().queue());
- _memory.set_owned_region(allocate_region(&legacy_ctx, info().total_size(), 0));
- }
else
{
- _memory.set_owned_region(allocate_region(_ctx->core_runtime_context(), info().total_size(), 0));
+ _memory.set_owned_region(allocate_region(info().total_size(), 0));
}
}
else
@@ -178,15 +171,7 @@ Status CLTensorAllocator::import_memory(cl::Buffer buffer)
ARM_COMPUTE_RETURN_ERROR_ON(buffer.getInfo<CL_MEM_CONTEXT>().get() != CLScheduler::get().context().get());
ARM_COMPUTE_RETURN_ERROR_ON(_associated_memory_group != nullptr);
- if(_ctx == nullptr)
- {
- auto legacy_ctx = CLCoreRuntimeContext(nullptr, CLScheduler::get().context(), CLScheduler::get().queue());
- _memory.set_owned_region(std::make_unique<CLBufferMemoryRegion>(buffer, &legacy_ctx));
- }
- else
- {
- _memory.set_owned_region(std::make_unique<CLBufferMemoryRegion>(buffer, _ctx->core_runtime_context()));
- }
+ _memory.set_owned_region(std::make_unique<CLBufferMemoryRegion>(buffer));
info().set_is_resizable(false);
return Status{};