diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2017-09-18 18:33:07 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:35:24 +0000 |
commit | 511347a7282b948bddfc071e9a8fa08e79da25b4 (patch) | |
tree | fc1d9aea0c6679ff758407da5bd32a954b578d6e /arm_compute/runtime/BlobLifetimeManager.h | |
parent | 96880cf00707d394938ec7fe31c21c79a2ac3f0c (diff) | |
download | ComputeLibrary-511347a7282b948bddfc071e9a8fa08e79da25b4.tar.gz |
COMPMID-485: Offset-based memory manager support.
Adds support for offset-based memory mappings used from CPU system
memory and SVM based allocations.
Change-Id: Ibee6a3c02a61df9b11fe8878cfe40dc6fd9a4be0
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/88307
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'arm_compute/runtime/BlobLifetimeManager.h')
-rw-r--r-- | arm_compute/runtime/BlobLifetimeManager.h | 41 |
1 files changed, 10 insertions, 31 deletions
diff --git a/arm_compute/runtime/BlobLifetimeManager.h b/arm_compute/runtime/BlobLifetimeManager.h index ec43f47fe6..edf4d43421 100644 --- a/arm_compute/runtime/BlobLifetimeManager.h +++ b/arm_compute/runtime/BlobLifetimeManager.h @@ -24,21 +24,20 @@ #ifndef __ARM_COMPUTE_BLOBLIFETIMEMANAGER_H__ #define __ARM_COMPUTE_BLOBLIFETIMEMANAGER_H__ -#include "arm_compute/runtime/ILifetimeManager.h" +#include "arm_compute/runtime/ISimpleLifetimeManager.h" -#include "arm_compute/runtime/IMemoryGroup.h" +#include "arm_compute/runtime/IMemoryPool.h" #include "arm_compute/runtime/Types.h" #include <cstddef> -#include <map> +#include <memory> #include <vector> namespace arm_compute { -class IMemoryGroup; - -/** Class that tracks the lifetime of registered tensors and calculates the systems memory requirements in terms of blobs */ -class BlobLifetimeManager : public ILifetimeManager +/** Concrete class that tracks the lifetime of registered tensors and + * calculates the systems memory requirements in terms of blobs */ +class BlobLifetimeManager : public ISimpleLifetimeManager { public: /** Constructor */ @@ -53,35 +52,15 @@ public: BlobLifetimeManager &operator=(BlobLifetimeManager &&) = default; // Inherited methods overridden: - void register_group(IMemoryGroup *group) override; - void start_lifetime(void *obj) override; - void end_lifetime(void *obj, void **handle, size_t size) override; std::unique_ptr<IMemoryPool> create_pool(IAllocator *allocator) override; - bool are_all_finalized() const override; MappingType mapping_type() const override; private: - /** Update blobs and mappings */ - void update_blobs_and_mappings(); + // Inherited methods overridden: + void update_blobs_and_mappings() override; private: - /** Element struct */ - struct Element - { - Element(void *id_ = nullptr, void **handle_ = nullptr, size_t size_ = 0, bool status_ = false) - : id(id_), handle(handle_), size(size_), status(status_) - { - } - void *id; /**< Element id */ - void **handle; /**< Element's memory handle */ - size_t size; /**< Element's size */ - bool status; /**< Lifetime status */ - }; - - IMemoryGroup *_active_group; /**< Active group */ - std::vector<Element> _active_elements; /**< A map that contains the active elements */ - std::map<IMemoryGroup *, std::vector<Element>> _finalized_groups; /**< A map that contains the finalized groups */ - std::vector<size_t> _blobs; + std::vector<size_t> _blobs; /**< Memory blobs' sizes */ }; -} // arm_compute +} // namespace arm_compute #endif /* __ARM_COMPUTE_BLOBLIFETIMEMANAGER_H__ */ |