From 801e2d55de7a02b98f3d77dc9775b10b2bd9f16b Mon Sep 17 00:00:00 2001 From: David Monahan Date: Mon, 19 Jul 2021 17:06:30 +0100 Subject: IVGCVSW-6077 Add the Custom Memory Allocator interface definition * Added ICustomAllocator.hpp to include/armnn/backends/ * Added the ability to specify an ICustomAllocator to the CreationOptions Signed-off-by: David Monahan Change-Id: I820e468b691aa032c9bd2c1e1257dc9d02f981d9 --- include/armnn/backends/ICustomAllocator.hpp | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 include/armnn/backends/ICustomAllocator.hpp (limited to 'include/armnn/backends/ICustomAllocator.hpp') diff --git a/include/armnn/backends/ICustomAllocator.hpp b/include/armnn/backends/ICustomAllocator.hpp new file mode 100644 index 0000000000..1d4df0cb86 --- /dev/null +++ b/include/armnn/backends/ICustomAllocator.hpp @@ -0,0 +1,35 @@ +// +// Copyright © 2021 Arm Ltd and Contributors. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#pragma once + +#include +#include + +namespace armnn +{ +/** Custom Allocator interface */ +class ICustomAllocator +{ +public: + /** Default virtual destructor. */ + virtual ~ICustomAllocator() = default; + + /** Interface to be implemented by the child class to allocate bytes + * + * @param[in] size Size to allocate + * @param[in] alignment Alignment that the returned pointer should comply with + * + * @return A pointer to the allocated memory + */ + virtual void *allocate(size_t size, size_t alignment) = 0; + /** Interface to be implemented by the child class to free the allocated tensor */ + virtual void free(void *ptr) = 0; + + // Utility Function to define the Custom Memory Allocators capabilities + virtual bool SupportsProtectedMemory() = 0; + +}; +} // namespace armnn \ No newline at end of file -- cgit v1.2.1