Table of Contents

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

T

The element type.

Inherited Members
Extension Methods

Properties

Length

Number of elements in the buffer.

int Length { get; }

Property Value

int

Location

Buffer location.

BufferLocation Location { get; }

Property Value

BufferLocation

SizeInBytes

Size in bytes.

long SizeInBytes { get; }

Property Value

long

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

source ReadOnlySpan<T>
cancellationToken CancellationToken

Returns

ValueTask

CopyToAsync(Span<T>, CancellationToken)

Copies data from this buffer to a destination span.

ValueTask CopyToAsync(Span<T> destination, CancellationToken cancellationToken = default)

Parameters

destination Span<T>
cancellationToken CancellationToken

Returns

ValueTask

SynchronizeAsync(CancellationToken)

Synchronizes the buffer between host and device.

ValueTask SynchronizeAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask