Class UnifiedBufferHelpers
- Namespace
- DotCompute.Memory
- Assembly
- DotCompute.Memory.dll
Helper methods and utilities for UnifiedBuffer operations.
public static class UnifiedBufferHelpers
- Inheritance
-
UnifiedBufferHelpers
- Inherited Members
Methods
CopyAsync<T>(UnifiedBuffer<T>, int, UnifiedBuffer<T>, int, int, CancellationToken)
Copies data between unified buffers.
public static Task CopyAsync<T>(UnifiedBuffer<T> source, int sourceOffset, UnifiedBuffer<T> destination, int destinationOffset, int length, CancellationToken cancellationToken = default) where T : unmanaged
Parameters
sourceUnifiedBuffer<T>sourceOffsetintdestinationUnifiedBuffer<T>destinationOffsetintlengthintcancellationTokenCancellationToken
Returns
Type Parameters
T
CreateFromArray<T>(T[], IUnifiedMemoryManager)
Creates a unified buffer from an existing array.
public static UnifiedBuffer<T> CreateFromArray<T>(T[] array, IUnifiedMemoryManager memoryManager) where T : unmanaged
Parameters
arrayT[]memoryManagerIUnifiedMemoryManager
Returns
Type Parameters
T
CreateFromSpan<T>(ReadOnlySpan<T>, IUnifiedMemoryManager)
Creates a unified buffer from a span.
public static UnifiedBuffer<T> CreateFromSpan<T>(ReadOnlySpan<T> span, IUnifiedMemoryManager memoryManager) where T : unmanaged
Parameters
spanReadOnlySpan<T>memoryManagerIUnifiedMemoryManager
Returns
Type Parameters
T
CreateSlice<T>(UnifiedBuffer<T>, int, int)
Creates a slice view of a buffer.
public static UnifiedBufferSlice<T> CreateSlice<T>(UnifiedBuffer<T> buffer, int offset, int length) where T : unmanaged
Parameters
bufferUnifiedBuffer<T>offsetintlengthint
Returns
Type Parameters
T
CreateView<TOriginal, TNew>(UnifiedBuffer<TOriginal>)
Creates a type view of a buffer.
public static UnifiedBufferView<TOriginal, TNew> CreateView<TOriginal, TNew>(UnifiedBuffer<TOriginal> buffer) where TOriginal : unmanaged where TNew : unmanaged
Parameters
bufferUnifiedBuffer<TOriginal>
Returns
- UnifiedBufferView<TOriginal, TNew>
Type Parameters
TOriginalTNew
EqualsAsync<T>(UnifiedBuffer<T>, UnifiedBuffer<T>, CancellationToken)
Compares two buffers for equality.
public static Task<bool> EqualsAsync<T>(UnifiedBuffer<T> first, UnifiedBuffer<T> second, CancellationToken cancellationToken = default) where T : unmanaged, IEquatable<T>
Parameters
firstUnifiedBuffer<T>secondUnifiedBuffer<T>cancellationTokenCancellationToken
Returns
Type Parameters
T
FillAsync<T>(UnifiedBuffer<T>, T, int, int?, CancellationToken)
Fills a buffer with a specific value.
public static Task FillAsync<T>(UnifiedBuffer<T> buffer, T value, int offset = 0, int? length = null, CancellationToken cancellationToken = default) where T : unmanaged
Parameters
bufferUnifiedBuffer<T>valueToffsetintlengthint?cancellationTokenCancellationToken
Returns
Type Parameters
T