aboutsummaryrefslogtreecommitdiff
path: root/include/armnn/backends/ICustomAllocator.hpp
diff options
context:
space:
mode:
authorFrancis Murtagh <francis.murtagh@arm.com>2021-10-14 17:30:24 +0100
committerTeresa Charlin <teresa.charlinreyes@arm.com>2021-10-19 22:26:45 +0100
commite8d7ccb1a18b5c39ecf17fb063fcc50baacc74b3 (patch)
treed1a072111807145a786b4c4221707bd34c1373be /include/armnn/backends/ICustomAllocator.hpp
parentfc7c2f3c1dd990620a01ecf1a6641813e6f46ef8 (diff)
downloadarmnn-e8d7ccb1a18b5c39ecf17fb063fcc50baacc74b3.tar.gz
IVGCVSW-6310 Update ICustomAllocator and add GetDefaultAllocator function to backends
Signed-off-by: Francis Murtagh <francis.murtagh@arm.com> Change-Id: If2879e8a82692285e7fa3f4d09abd608ca28de12
Diffstat (limited to 'include/armnn/backends/ICustomAllocator.hpp')
-rw-r--r--include/armnn/backends/ICustomAllocator.hpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/include/armnn/backends/ICustomAllocator.hpp b/include/armnn/backends/ICustomAllocator.hpp
index 2cb5f41f78..eb8dfe1459 100644
--- a/include/armnn/backends/ICustomAllocator.hpp
+++ b/include/armnn/backends/ICustomAllocator.hpp
@@ -8,6 +8,7 @@
#include <cstddef>
#include <memory>
#include <armnn/MemorySources.hpp>
+#include <armnn/utility/IgnoreUnused.hpp>
namespace armnn
{
@@ -31,13 +32,26 @@ public:
/** Interface to be implemented by the child class to free the allocated bytes */
virtual void free(void* ptr) = 0;
- // Used to specify what type of memory is being allocated by this allocator.
- // Supported types are:
- // MemorySource::Malloc
- // MemorySource::DmaBuf
- // Unsupported types are:
- // MemorySource::DmaBufProtected
+ /** Used to specify what type of memory is being allocated by this allocator.
+ * Supported types are:
+ * MemorySource::Malloc
+ * MemorySource::DmaBuf
+ * Unsupported types are:
+ * MemorySource::DmaBufProtected
+ */
virtual armnn::MemorySource GetMemorySourceType() = 0;
+ /** Interface that may be implemented to allow retrieval of Memory Region
+ * from allocated buffer at a certain offset
+ */
+ virtual void* GetMemoryRegionAtOffset(void* buffer, size_t offset, size_t alignment = 0)
+ {
+ IgnoreUnused(offset);
+ IgnoreUnused(alignment);
+ IgnoreUnused(buffer);
+ throw armnn::Exception(
+ "ICustomerAllocator::GetMemoryRegionAtOffset(): This function should be overridden in subclass.");
+ }
+
};
} // namespace armnn \ No newline at end of file