rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
memory_allocator.hpp
1// SPDX-License-Identifier: GPL-3.0-only
2
3#pragma once
4
5#include <memory>
6
7#include <rexlib/core/platform/dynamic_shared_object.h>
8
9namespace rexlib
10{
11
12class buffer;
13class command_queue;
14class command_token;
15class memory_resource;
16
29class REXLIB_API memory_allocator
30{
31public:
32 memory_allocator() noexcept;
33 memory_allocator(const memory_allocator &other) = delete;
34 memory_allocator(memory_allocator &&other) = delete;
35 virtual ~memory_allocator();
36
37 memory_allocator& operator=(const memory_allocator &other) = delete;
38 memory_allocator& operator=(memory_allocator &&other) = delete;
39
45 virtual
46 const memory_resource& get_memory_resource() const noexcept = 0;
47
57 virtual std::size_t get_max_alignment() const noexcept = 0;
58
83 virtual
84 std::shared_ptr<buffer> allocate(
85 std::size_t size,
86 std::size_t alignment,
87 command_queue *queue_hint,
88 command_token &pending
89 ) = 0;
90};
91
92} // namespace rexlib
Represents an untyped memory allocation at a given memory resource.
Definition buffer.hpp:25
Abstract command queue belonging to a device.
Definition command_queue.hpp:27
Identifies a command submitted to a command_queue.
Definition command_token.hpp:27
Abstract allocator of buffer objects on a memory_resource.
Definition memory_allocator.hpp:30
virtual const memory_resource & get_memory_resource() const noexcept=0
Get the memory resource backing this allocator.
Abstract description of a physical memory region.
Definition memory_resource.hpp:21
Arrays, the operations on them and the devices that run those operations.
Definition cpu_device.hpp:10