Table of Contents

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

kernelId string

The kernel identifier this buffer is associated with.

size int

The size of the buffer in bytes.

logger ILogger

The logger for diagnostic output.

Properties

BufferPointer

Gets the pointer to the pinned buffer memory for direct GPU access.

public nint BufferPointer { get; }

Property Value

nint

IsPinned

Gets a value indicating whether the buffer is pinned in memory.

public bool IsPinned { get; }

Property Value

bool

Size

Gets the total size of the buffer in bytes.

public int Size { get; }

Property Value

int

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

ct CancellationToken

Returns

IAsyncEnumerable<DataBatch>

GetStats()

Gets buffer statistics

public RingBufferStats GetStats()

Returns

RingBufferStats

ReadAsync(CancellationToken)

Reads data from the ring buffer

public Task<Memory<byte>?> ReadAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

Returns

Task<Memory<byte>?>

SubmitBatchAsync(DataBatch)

Submits a batch for processing

public Task SubmitBatchAsync(DataBatch batch)

Parameters

batch DataBatch

Returns

Task

TryRead()

Tries to read data without waiting

public Memory<byte>? TryRead()

Returns

Memory<byte>?

TryWrite(ReadOnlyMemory<byte>)

Tries to write data without waiting

public bool TryWrite(ReadOnlyMemory<byte> data)

Parameters

data ReadOnlyMemory<byte>

Returns

bool

WriteAsync(ReadOnlyMemory<byte>, CancellationToken)

Writes data to the ring buffer

public Task<bool> WriteAsync(ReadOnlyMemory<byte> data, CancellationToken ct = default)

Parameters

data ReadOnlyMemory<byte>
ct CancellationToken

Returns

Task<bool>