Documentation for microsoft::quantum::BasicAllocationManager

microsoft::quantum::BasicAllocationManager

More...

#include <AllocationManager/AllocationManager.hpp>

Inherits from microsoft::quantum::IAllocationManager

Public Classes

Name
struct AllocatedMemoryBlock

Public Types

Name
using std::vector< AllocatedMemoryBlock > Mappings
Vector of memory segments.
using std::shared_ptr< BasicAllocationManager > BasicAllocationManagerPtr
Allocator pointer type.

Public Functions

Name
BasicAllocationManagerPtr createNew()
virtual Address allocate(String const & name ="", Index const & count =1) override
virtual void release(Address const & address) override
Releases the segment by address.
virtual void reset() override
Resets the allocation manager and all its statistics.
void setReuseRegisters(bool val)

Additional inherited members

Public Types inherited from microsoft::quantum::IAllocationManager

Name
using uint64_t Address
Value type for address.
using uint64_t Index
Index type used to access an array element.
using std::shared_ptr< IAllocationManager > AllocationManagerPtr
Pointer interface.

Public Functions inherited from microsoft::quantum::IAllocationManager

Name
IAllocationManager(IAllocationManager const & )
IAllocationManager(IAllocationManager && )
IAllocationManager & operator=(IAllocationManager const & )
IAllocationManager & operator=(IAllocationManager && )
virtual ~IAllocationManager()
uint64_t allocationsInUse() const
uint64_t maxAllocationsUsed() const

Protected Functions inherited from microsoft::quantum::IAllocationManager

Name
IAllocationManager() =default
void updateRegistersInUse(uint64_t n)

Detailed Description

class microsoft::quantum::BasicAllocationManager;

AllocationManager is a simple qubit and results allocator that can be used at compile-time. It is based on an assumption that all qubit allocating function calls are inlined and that qubits/results can be allocated with strictly growing IDs.

Public Types Documentation

using Mappings

using microsoft::quantum::BasicAllocationManager::Mappings =  std::vector<AllocatedMemoryBlock>;

Vector of memory segments.

using BasicAllocationManagerPtr

using microsoft::quantum::BasicAllocationManager::BasicAllocationManagerPtr =  std::shared_ptr<BasicAllocationManager>;

Allocator pointer type.

Public Functions Documentation

function createNew

static BasicAllocationManagerPtr createNew()

Creates a new allocation manager. The manager is kept as a shared pointer to enable allocation across different passes and/or replacement rules.

function allocate

virtual Address allocate(
    String const & name ="",
    Index const & count =1
) override

Reimplements: microsoft::quantum::IAllocationManager::allocate

Allocates a possibly named segment of a given count. Calling allocate without and arguments allocates a single anonymous resource and returns the address. In case of a larger segment, the function returns the address pointing to the first element. Allocation is guaranteed to be sequential.

function release

virtual void release(
    Address const & address
) override

Releases the segment by address.

Reimplements: microsoft::quantum::IAllocationManager::release

function reset

virtual void reset() override

Resets the allocation manager and all its statistics.

Reimplements: microsoft::quantum::IAllocationManager::reset

function setReuseRegisters

void setReuseRegisters(
    bool val
)

Configuration function to set mode of qubit allocation. If function argument is true, the allocation manager will reuse qubits.


Updated on 1 August 2023 at 16:25:10 UTC