diff options
Diffstat (limited to 'src/graph/backends/GLES')
-rw-r--r-- | src/graph/backends/GLES/GCDeviceBackend.cpp | 12 | ||||
-rw-r--r-- | src/graph/backends/GLES/GCTensorHandle.cpp | 35 |
2 files changed, 41 insertions, 6 deletions
diff --git a/src/graph/backends/GLES/GCDeviceBackend.cpp b/src/graph/backends/GLES/GCDeviceBackend.cpp index 0185598965..770cca5d42 100644 --- a/src/graph/backends/GLES/GCDeviceBackend.cpp +++ b/src/graph/backends/GLES/GCDeviceBackend.cpp @@ -36,6 +36,7 @@ #include "arm_compute/core/TensorInfo.h" #include "arm_compute/runtime/BlobLifetimeManager.h" #include "arm_compute/runtime/GLES_COMPUTE/GCBufferAllocator.h" +#include "arm_compute/runtime/GLES_COMPUTE/GCMemoryGroup.h" #include "arm_compute/runtime/GLES_COMPUTE/GCScheduler.h" #include "arm_compute/runtime/MemoryManagerOnDemand.h" #include "arm_compute/runtime/PoolManager.h" @@ -68,8 +69,10 @@ void GCDeviceBackend::setup_backend_context(GraphContext &ctx) if(ctx.memory_management_ctx(Target::GC) == nullptr) { MemoryManagerContext mm_ctx; - mm_ctx.target = Target::GC; - mm_ctx.mm = create_memory_manager(MemoryManagerAffinity::Buffer); + mm_ctx.target = Target::GC; + mm_ctx.intra_mm = create_memory_manager(MemoryManagerAffinity::Buffer); + mm_ctx.cross_mm = create_memory_manager(MemoryManagerAffinity::Buffer); + mm_ctx.cross_group = std::make_shared<GCMemoryGroup>(mm_ctx.cross_mm); ctx.insert_memory_management_ctx(std::move(mm_ctx)); } @@ -80,6 +83,11 @@ bool GCDeviceBackend::is_backend_supported() return arm_compute::opengles31_is_available(); } +IAllocator *GCDeviceBackend::backend_allocator() +{ + return &_allocator; +} + std::unique_ptr<ITensorHandle> GCDeviceBackend::create_tensor(const Tensor &tensor) { // Get tensor descriptor diff --git a/src/graph/backends/GLES/GCTensorHandle.cpp b/src/graph/backends/GLES/GCTensorHandle.cpp index ae7c778130..4e5c652120 100644 --- a/src/graph/backends/GLES/GCTensorHandle.cpp +++ b/src/graph/backends/GLES/GCTensorHandle.cpp @@ -23,6 +23,9 @@ */ #include "arm_compute/graph/backends/GLES/GCTensorHandle.h" +#include "arm_compute/core/utils/misc/Cast.h" +#include "arm_compute/runtime/GLES_COMPUTE/GCMemoryGroup.h" + namespace arm_compute { namespace graph @@ -40,14 +43,18 @@ void GCTensorHandle::allocate() _tensor.allocator()->allocate(); } -const arm_compute::ITensor &GCTensorHandle::tensor() const +void GCTensorHandle::free() { - return _tensor; + _tensor.allocator()->free(); } -arm_compute::ITensor &GCTensorHandle::tensor() +void GCTensorHandle::manage(IMemoryGroup *mg) { - return _tensor; + if(mg != nullptr) + { + auto *gc_mg = arm_compute::utils::cast::polymorphic_downcast<GCMemoryGroup *>(mg); + gc_mg->manage(&_tensor); + } } void GCTensorHandle::map(bool blocking) @@ -69,10 +76,30 @@ void GCTensorHandle::release_if_unused() } } +const arm_compute::ITensor &GCTensorHandle::tensor() const +{ + return _tensor; +} + +arm_compute::ITensor &GCTensorHandle::tensor() +{ + return _tensor; +} + +ITensorHandle *GCTensorHandle::parent_handle() +{ + return this; +} + bool GCTensorHandle::is_subtensor() const { return false; } + +Target GCTensorHandle::target() const +{ + return Target::GC; +} } // namespace backends } // namespace graph } // namespace arm_compute
\ No newline at end of file |