Table of Contents

Interface IMemoryAllocator

Namespace
Orleans.GpuBridge.Abstractions.Providers.Memory.Allocators
Assembly
Orleans.GpuBridge.Abstractions.dll

Interface for memory allocation in GPU backends

public interface IMemoryAllocator : IDisposable
Inherited Members

Methods

AllocateAsync(long, MemoryAllocationOptions, CancellationToken)

Allocates memory on the device

Task<IDeviceMemory> AllocateAsync(long sizeBytes, MemoryAllocationOptions options, CancellationToken cancellationToken = default)

Parameters

sizeBytes long
options MemoryAllocationOptions
cancellationToken CancellationToken

Returns

Task<IDeviceMemory>

AllocateAsync<T>(int, MemoryAllocationOptions, CancellationToken)

Allocates memory for a specific type

Task<IDeviceMemory<T>> AllocateAsync<T>(int elementCount, MemoryAllocationOptions options, CancellationToken cancellationToken = default) where T : unmanaged

Parameters

elementCount int
options MemoryAllocationOptions
cancellationToken CancellationToken

Returns

Task<IDeviceMemory<T>>

Type Parameters

T

AllocatePinnedAsync(long, CancellationToken)

Allocates pinned host memory for efficient transfers

Task<IPinnedMemory> AllocatePinnedAsync(long sizeBytes, CancellationToken cancellationToken = default)

Parameters

sizeBytes long
cancellationToken CancellationToken

Returns

Task<IPinnedMemory>

AllocateUnifiedAsync(long, UnifiedMemoryOptions, CancellationToken)

Allocates unified memory accessible from both host and device

Task<IUnifiedMemory> AllocateUnifiedAsync(long sizeBytes, UnifiedMemoryOptions options, CancellationToken cancellationToken = default)

Parameters

sizeBytes long
options UnifiedMemoryOptions
cancellationToken CancellationToken

Returns

Task<IUnifiedMemory>

CompactAsync(CancellationToken)

Compacts the memory pool to reduce fragmentation

Task CompactAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task

GetPoolStatistics()

Gets memory pool statistics

MemoryPoolStatistics GetPoolStatistics()

Returns

MemoryPoolStatistics

ResetAsync(CancellationToken)

Resets the memory pool, freeing all allocations

Task ResetAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task