Interface IPortBuffer<T>
- Namespace
- DotCompute.Abstractions.Ports
- Assembly
- DotCompute.Abstractions.dll
A buffer allocated through the memory management port.
public interface IPortBuffer<T> : IAsyncDisposable, IDisposable where T : unmanaged
Type Parameters
TThe element type.
- Inherited Members
- Extension Methods
Properties
Length
Number of elements in the buffer.
int Length { get; }
Property Value
Location
Buffer location.
BufferLocation Location { get; }
Property Value
SizeInBytes
Size in bytes.
long SizeInBytes { get; }
Property Value
Methods
AsReadOnlySpan()
Gets a read-only span.
ReadOnlySpan<T> AsReadOnlySpan()
Returns
- ReadOnlySpan<T>
AsSpan()
Gets a span for CPU access (may require synchronization).
Span<T> AsSpan()
Returns
- Span<T>
CopyFromAsync(ReadOnlySpan<T>, CancellationToken)
Copies data from a source span to this buffer.
ValueTask CopyFromAsync(ReadOnlySpan<T> source, CancellationToken cancellationToken = default)
Parameters
sourceReadOnlySpan<T>cancellationTokenCancellationToken
Returns
CopyToAsync(Span<T>, CancellationToken)
Copies data from this buffer to a destination span.
ValueTask CopyToAsync(Span<T> destination, CancellationToken cancellationToken = default)
Parameters
destinationSpan<T>cancellationTokenCancellationToken
Returns
SynchronizeAsync(CancellationToken)
Synchronizes the buffer between host and device.
ValueTask SynchronizeAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken