From db8485ac24135f17e9882c76196924435abc064f Mon Sep 17 00:00:00 2001 From: Pablo Tello Date: Tue, 24 Sep 2019 11:03:47 +0100 Subject: 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 Reviewed-on: https://review.mlplatform.org/c/1998 Tested-by: Arm Jenkins Reviewed-by: Georgios Pinitas Comments-Addressed: Arm Jenkins --- arm_compute/runtime/CL/CLTensor.h | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'arm_compute/runtime/CL/CLTensor.h') diff --git a/arm_compute/runtime/CL/CLTensor.h b/arm_compute/runtime/CL/CLTensor.h index bc72839492..c108d1afad 100644 --- a/arm_compute/runtime/CL/CLTensor.h +++ b/arm_compute/runtime/CL/CLTensor.h @@ -35,13 +35,32 @@ namespace arm_compute // 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 @@ public: 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 @@ protected: private: mutable CLTensorAllocator _allocator; /**< Instance of the OpenCL tensor allocator */ + CLRuntimeContext *_ctx{ nullptr }; }; /** OpenCL Image */ -- cgit v1.2.1