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
sizeByteslongoptionsMemoryAllocationOptionscancellationTokenCancellationToken
Returns
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
elementCountintoptionsMemoryAllocationOptionscancellationTokenCancellationToken
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
sizeByteslongcancellationTokenCancellationToken
Returns
AllocateUnifiedAsync(long, UnifiedMemoryOptions, CancellationToken)
Allocates unified memory accessible from both host and device
Task<IUnifiedMemory> AllocateUnifiedAsync(long sizeBytes, UnifiedMemoryOptions options, CancellationToken cancellationToken = default)
Parameters
sizeByteslongoptionsUnifiedMemoryOptionscancellationTokenCancellationToken
Returns
CompactAsync(CancellationToken)
Compacts the memory pool to reduce fragmentation
Task CompactAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
GetPoolStatistics()
Gets memory pool statistics
MemoryPoolStatistics GetPoolStatistics()
Returns
ResetAsync(CancellationToken)
Resets the memory pool, freeing all allocations
Task ResetAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken