aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/runtime/CL/CLMemoryRegion.h
diff options
context:
space:
mode:
authorPablo Tello <pablo.tello@arm.com>2019-09-24 11:03:47 +0100
committerPablo Marquez <pablo.tello@arm.com>2019-10-15 14:05:55 +0000
commitdb8485ac24135f17e9882c76196924435abc064f (patch)
treedfe4ff6a50012ac93c6b1cf3fb29c099a7592522 /arm_compute/runtime/CL/CLMemoryRegion.h
parenta046e164b96a8441b2fa14ef578f7db46a0e97da (diff)
downloadComputeLibrary-db8485ac24135f17e9882c76196924435abc064f.tar.gz
COMPMID-2205: CL runtime context.
CL Interfaces implemented. Concrete classes implemented. One test (ActivationLayer) ported to the new interface. Change-Id: I283808bec36ccfc2f13fe048c45cbbee698ce525 Signed-off-by: Pablo Tello <pablo.tello@arm.com> Reviewed-on: https://review.mlplatform.org/c/1998 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/runtime/CL/CLMemoryRegion.h')
-rw-r--r--arm_compute/runtime/CL/CLMemoryRegion.h33
1 files changed, 18 insertions, 15 deletions
diff --git a/arm_compute/runtime/CL/CLMemoryRegion.h b/arm_compute/runtime/CL/CLMemoryRegion.h
index dbfd8225ca..6f7c3cd9a8 100644
--- a/arm_compute/runtime/CL/CLMemoryRegion.h
+++ b/arm_compute/runtime/CL/CLMemoryRegion.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -31,16 +31,17 @@
namespace arm_compute
{
+class CLCoreRuntimeContext;
/** OpenCL memory region interface */
class ICLMemoryRegion : public IMemoryRegion
{
public:
/** Constructor
*
- * @param[in] ctx OpenCL context
+ * @param[in] ctx Runtime context
* @param[in] size Region size
*/
- ICLMemoryRegion(cl::Context ctx, size_t size);
+ ICLMemoryRegion(CLCoreRuntimeContext *ctx, size_t size);
/** Default Destructor */
virtual ~ICLMemoryRegion() = default;
/** Prevent instances of this class from being copied (As this class contains pointers) */
@@ -86,9 +87,10 @@ public:
std::unique_ptr<IMemoryRegion> extract_subregion(size_t offset, size_t size) override;
protected:
- cl::Context _ctx;
- void *_mapping;
- cl::Buffer _mem;
+ cl::CommandQueue _queue;
+ cl::Context _ctx;
+ void *_mapping;
+ cl::Buffer _mem;
};
/** OpenCL buffer memory region implementation */
@@ -97,16 +99,17 @@ class CLBufferMemoryRegion final : public ICLMemoryRegion
public:
/** Constructor
*
- * @param[in] ctx OpenCL context
+ * @param[in] ctx Runtime context
* @param[in] flags Memory flags
* @param[in] size Region size
*/
- CLBufferMemoryRegion(cl::Context ctx, cl_mem_flags flags, size_t size);
+ CLBufferMemoryRegion(CLCoreRuntimeContext *ctx, 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);
+ CLBufferMemoryRegion(const cl::Buffer &buffer, CLCoreRuntimeContext *ctx);
// Inherited methods overridden :
void *ptr() final;
@@ -120,12 +123,12 @@ class ICLSVMMemoryRegion : public ICLMemoryRegion
protected:
/** Constructor
*
- * @param[in] ctx OpenCL context
+ * @param[in] ctx Runtime context
* @param[in] flags Memory flags
* @param[in] size Region size
* @param[in] alignment Alignment
*/
- ICLSVMMemoryRegion(cl::Context ctx, cl_mem_flags flags, size_t size, size_t alignment);
+ ICLSVMMemoryRegion(CLCoreRuntimeContext *ctx, 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) */
@@ -150,12 +153,12 @@ class CLCoarseSVMMemoryRegion final : public ICLSVMMemoryRegion
public:
/** Constructor
*
- * @param[in] ctx OpenCL context
+ * @param[in] ctx Runtime context
* @param[in] flags Memory flags
* @param[in] size Region size
* @param[in] alignment Alignment
*/
- CLCoarseSVMMemoryRegion(cl::Context ctx, cl_mem_flags flags, size_t size, size_t alignment);
+ CLCoarseSVMMemoryRegion(CLCoreRuntimeContext *ctx, cl_mem_flags flags, size_t size, size_t alignment);
// Inherited methods overridden :
void *map(cl::CommandQueue &q, bool blocking) final;
@@ -168,12 +171,12 @@ class CLFineSVMMemoryRegion final : public ICLSVMMemoryRegion
public:
/** Constructor
*
- * @param[in] ctx OpenCL context
+ * @param[in] ctx Runtime context
* @param[in] flags Memory flags
* @param[in] size Region size
* @param[in] alignment Alignment
*/
- CLFineSVMMemoryRegion(cl::Context ctx, cl_mem_flags flags, size_t size, size_t alignment);
+ CLFineSVMMemoryRegion(CLCoreRuntimeContext *ctx, cl_mem_flags flags, size_t size, size_t alignment);
// Inherited methods overridden :
void *map(cl::CommandQueue &q, bool blocking) final;