Class RingBuffer
- Namespace
- Orleans.GpuBridge.Runtime.Persistent
- Assembly
- Orleans.GpuBridge.Runtime.dll
Lock-free ring buffer for kernel I/O
public sealed class RingBuffer : IDisposable
- Inheritance
-
RingBuffer
- Implements
- Inherited Members
Constructors
RingBuffer(string, int, ILogger)
Initializes a new instance of the RingBuffer class.
public RingBuffer(string kernelId, int size, ILogger logger)
Parameters
kernelIdstringThe kernel identifier this buffer is associated with.
sizeintThe size of the buffer in bytes.
loggerILoggerThe logger for diagnostic output.
Properties
BufferPointer
Gets the pointer to the pinned buffer memory for direct GPU access.
public nint BufferPointer { get; }
Property Value
IsPinned
Gets a value indicating whether the buffer is pinned in memory.
public bool IsPinned { get; }
Property Value
Size
Gets the total size of the buffer in bytes.
public int Size { get; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
GetResultsAsync(CancellationToken)
Retrieves processed results
public IAsyncEnumerable<DataBatch> GetResultsAsync(CancellationToken ct = default)
Parameters
Returns
GetStats()
Gets buffer statistics
public RingBufferStats GetStats()
Returns
ReadAsync(CancellationToken)
Reads data from the ring buffer
public Task<Memory<byte>?> ReadAsync(CancellationToken ct = default)
Parameters
Returns
SubmitBatchAsync(DataBatch)
Submits a batch for processing
public Task SubmitBatchAsync(DataBatch batch)
Parameters
batchDataBatch
Returns
TryRead()
Tries to read data without waiting
public Memory<byte>? TryRead()
Returns
TryWrite(ReadOnlyMemory<byte>)
Tries to write data without waiting
public bool TryWrite(ReadOnlyMemory<byte> data)
Parameters
dataReadOnlyMemory<byte>
Returns
WriteAsync(ReadOnlyMemory<byte>, CancellationToken)
Writes data to the ring buffer
public Task<bool> WriteAsync(ReadOnlyMemory<byte> data, CancellationToken ct = default)
Parameters
dataReadOnlyMemory<byte>ctCancellationToken