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>
diff --git a/arm_compute/runtime/CL/CLTensor.h b/arm_compute/runtime/CL/CLTensor.h
index bc72839..c108d1a 100644
--- a/arm_compute/runtime/CL/CLTensor.h
+++ b/arm_compute/runtime/CL/CLTensor.h
@@ -35,13 +35,32 @@
// Forward declarations
class ITensorAllocator;
class ITensorInfo;
-
+class IRuntimeContext;
+class CLRuntimeContext;
/** Basic implementation of the OpenCL tensor interface */
class CLTensor : public ICLTensor, public IMemoryManageable
{
public:
- /** Constructor */
- CLTensor();
+ /** Constructor.
+ *
+ * @param[in] ctx (Optional) Pointer to a @ref CLRuntimeContext.
+ * If nullptr is passed in, the legacy api using the singletons will be used. Otherwise the memory for the
+ * tensor will allocate on the context passed in.
+ * The singletons legacy api has been deprecated and will be removed.
+ */
+ CLTensor(IRuntimeContext *ctx = nullptr);
+
+ /** Destructor */
+ ~CLTensor() = default;
+ /** Default copy constructor */
+ CLTensor(const CLTensor &) = default;
+ /** Default move constructor */
+ CLTensor(CLTensor &&) = default;
+ /** Default copy assignment */
+ CLTensor &operator=(const CLTensor &) = default;
+ /** Default move assignment operator */
+ CLTensor &operator=(CLTensor &&) = default;
+
/** Return a pointer to the tensor's allocator
*
* @return A pointer to the tensor's allocator
@@ -69,6 +88,7 @@
const cl::Buffer &cl_buffer() const override;
CLQuantization quantization() const override;
void associate_memory_group(IMemoryGroup *memory_group) override;
+ CLRuntimeContext *context();
protected:
// Inherited methods overridden:
@@ -77,6 +97,7 @@
private:
mutable CLTensorAllocator _allocator; /**< Instance of the OpenCL tensor allocator */
+ CLRuntimeContext *_ctx{ nullptr };
};
/** OpenCL Image */