Table of Contents

Class UnifiedMemoryService

Namespace
DotCompute.Runtime.Services.Memory
Assembly
DotCompute.Runtime.dll

Implementation of unified memory service with cross-device coherence support.

public class UnifiedMemoryService : IUnifiedMemoryService, IDisposable
Inheritance
UnifiedMemoryService
Implements
Inherited Members
Extension Methods

Constructors

UnifiedMemoryService(ILogger<UnifiedMemoryService>)

Implementation of unified memory service with cross-device coherence support.

public UnifiedMemoryService(ILogger<UnifiedMemoryService> logger)

Parameters

logger ILogger<UnifiedMemoryService>

Methods

AllocateUnifiedAsync(long, params string[])

Allocates unified memory that can be accessed by multiple accelerators.

public Task<IUnifiedMemoryBuffer> AllocateUnifiedAsync(long sizeInBytes, params string[] acceleratorIds)

Parameters

sizeInBytes long

The size in bytes to allocate.

acceleratorIds string[]

The accelerator IDs that will access this memory.

Returns

Task<IUnifiedMemoryBuffer>

The allocated unified memory buffer.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

GetAssociatedAccelerators(IUnifiedMemoryBuffer)

Gets the accelerator IDs associated with a buffer.

public IReadOnlySet<string> GetAssociatedAccelerators(IUnifiedMemoryBuffer buffer)

Parameters

buffer IUnifiedMemoryBuffer

The buffer to query.

Returns

IReadOnlySet<string>

The associated accelerator IDs.

GetCoherenceStatus(IUnifiedMemoryBuffer)

Gets the coherence status for a buffer.

public MemoryCoherenceStatus GetCoherenceStatus(IUnifiedMemoryBuffer buffer)

Parameters

buffer IUnifiedMemoryBuffer

The buffer to check.

Returns

MemoryCoherenceStatus

The coherence status.

MarkDirty(IUnifiedMemoryBuffer, string)

Marks a buffer as modified on a specific device, making it incoherent.

public void MarkDirty(IUnifiedMemoryBuffer buffer, string acceleratorId)

Parameters

buffer IUnifiedMemoryBuffer

The buffer that was modified.

acceleratorId string

The accelerator ID where modification occurred.

MigrateAsync(IUnifiedMemoryBuffer, string, string)

Migrates data between accelerators with proper coherence management.

public Task MigrateAsync(IUnifiedMemoryBuffer buffer, string sourceAcceleratorId, string targetAcceleratorId)

Parameters

buffer IUnifiedMemoryBuffer

The buffer to migrate.

sourceAcceleratorId string

The source accelerator ID.

targetAcceleratorId string

The target accelerator ID.

Returns

Task

SynchronizeCoherenceAsync(IUnifiedMemoryBuffer, params string[])

Synchronizes memory coherence across the specified accelerators.

public Task SynchronizeCoherenceAsync(IUnifiedMemoryBuffer buffer, params string[] acceleratorIds)

Parameters

buffer IUnifiedMemoryBuffer

The buffer to synchronize.

acceleratorIds string[]

The accelerator IDs to synchronize.

Returns

Task

UnregisterBuffer(IUnifiedMemoryBuffer)

Unregisters a buffer from the service.

public void UnregisterBuffer(IUnifiedMemoryBuffer buffer)

Parameters

buffer IUnifiedMemoryBuffer

The buffer to unregister.