Class P2PBufferFactory
- Namespace
- DotCompute.Core.Memory
- Assembly
- DotCompute.Core.dll
P2P-aware buffer factory that creates optimized buffers for multi-GPU scenarios. Handles direct P2P transfers, host-mediated transfers, and memory pooling.
public sealed class P2PBufferFactory : IAsyncDisposable
- Inheritance
-
P2PBufferFactory
- Implements
- Inherited Members
Constructors
P2PBufferFactory(ILogger, P2PCapabilityDetector)
P2P-aware buffer factory that creates optimized buffers for multi-GPU scenarios. Handles direct P2P transfers, host-mediated transfers, and memory pooling.
public P2PBufferFactory(ILogger logger, P2PCapabilityDetector capabilityDetector)
Parameters
loggerILoggercapabilityDetectorP2PCapabilityDetector
Methods
CreateEmptyP2PBufferAsync<T>(IAccelerator, int, P2PBufferOptions?, CancellationToken)
Creates an empty P2P buffer with specified parameters.
public ValueTask<P2PBuffer<T>> CreateEmptyP2PBufferAsync<T>(IAccelerator device, int length, P2PBufferOptions? options = null, CancellationToken cancellationToken = default) where T : unmanaged
Parameters
deviceIAcceleratorlengthintoptionsP2PBufferOptionscancellationTokenCancellationToken
Returns
Type Parameters
T
CreateP2PBufferAsync<T>(IUnifiedMemoryBuffer<T>, IAccelerator, P2PBufferOptions?, CancellationToken)
Creates a P2P-optimized buffer on the target device with data from the source buffer.
public ValueTask<P2PBuffer<T>> CreateP2PBufferAsync<T>(IUnifiedMemoryBuffer<T> sourceBuffer, IAccelerator targetDevice, P2PBufferOptions? options = null, CancellationToken cancellationToken = default) where T : unmanaged
Parameters
sourceBufferIUnifiedMemoryBuffer<T>targetDeviceIAcceleratoroptionsP2PBufferOptionscancellationTokenCancellationToken
Returns
Type Parameters
T
CreateP2PBufferSliceAsync<T>(P2PBuffer<T>, IAccelerator, int, int, P2PBufferOptions?, CancellationToken)
Creates a buffer slice optimized for P2P operations.
public ValueTask<P2PBuffer<T>> CreateP2PBufferSliceAsync<T>(P2PBuffer<T> sourceBuffer, IAccelerator targetDevice, int startIndex, int elementCount, P2PBufferOptions? options = null, CancellationToken cancellationToken = default) where T : unmanaged
Parameters
sourceBufferP2PBuffer<T>targetDeviceIAcceleratorstartIndexintelementCountintoptionsP2PBufferOptionscancellationTokenCancellationToken
Returns
Type Parameters
T
DisposeAsync()
Gets dispose asynchronously.
public ValueTask DisposeAsync()
Returns
- ValueTask
The result of the operation.
EstablishP2PConnectionAsync(IAccelerator, IAccelerator, CancellationToken)
Enables P2P connection between two devices and manages connection state.
public ValueTask<bool> EstablishP2PConnectionAsync(IAccelerator device1, IAccelerator device2, CancellationToken cancellationToken = default)
Parameters
device1IAcceleratordevice2IAcceleratorcancellationTokenCancellationToken
Returns
GetBufferPoolStatistics()
Gets buffer pool statistics for all devices.
public IReadOnlyList<DeviceBufferPoolStatistics> GetBufferPoolStatistics()
Returns
GetConnectionStatistics()
Gets P2P connection statistics.
public P2PConnectionStatistics GetConnectionStatistics()