Table of Contents

Class MetalMPSOrchestrator

Namespace
DotCompute.Backends.Metal.MPS
Assembly
DotCompute.Backends.Metal.dll

Intelligent orchestrator that automatically selects between MPS and custom kernels based on operation type, data size, and device capabilities.

public sealed class MetalMPSOrchestrator : IDisposable
Inheritance
MetalMPSOrchestrator
Implements
Inherited Members
Extension Methods

Constructors

MetalMPSOrchestrator(nint, ILogger<MetalMPSOrchestrator>)

public MetalMPSOrchestrator(nint device, ILogger<MetalMPSOrchestrator> logger)

Parameters

device nint
logger ILogger<MetalMPSOrchestrator>

Properties

Metrics

Gets performance metrics for MPS vs CPU operations.

public PerformanceMetrics Metrics { get; }

Property Value

PerformanceMetrics

Methods

Convolution2D(ReadOnlySpan<float>, int, int, int, ReadOnlySpan<float>, int, int, int, Span<float>, int, int, int, int, int, int)

Performs convolution with automatic backend selection.

public void Convolution2D(ReadOnlySpan<float> input, int inputHeight, int inputWidth, int inputChannels, ReadOnlySpan<float> kernel, int kernelHeight, int kernelWidth, int outputChannels, Span<float> output, int outputHeight, int outputWidth, int strideY = 1, int strideX = 1, int paddingY = 0, int paddingX = 0)

Parameters

input ReadOnlySpan<float>
inputHeight int
inputWidth int
inputChannels int
kernel ReadOnlySpan<float>
kernelHeight int
kernelWidth int
outputChannels int
output Span<float>
outputHeight int
outputWidth int
strideY int
strideX int
paddingY int
paddingX int

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

MatrixMultiply(ReadOnlySpan<float>, int, int, ReadOnlySpan<float>, int, int, Span<float>, int, int, float, float, bool, bool)

Performs matrix multiplication with automatic backend selection.

public void MatrixMultiply(ReadOnlySpan<float> a, int rowsA, int colsA, ReadOnlySpan<float> b, int rowsB, int colsB, Span<float> c, int rowsC, int colsC, float alpha = 1, float beta = 0, bool transposeA = false, bool transposeB = false)

Parameters

a ReadOnlySpan<float>
rowsA int
colsA int
b ReadOnlySpan<float>
rowsB int
colsB int
c Span<float>
rowsC int
colsC int
alpha float
beta float
transposeA bool
transposeB bool

ReLU(ReadOnlySpan<float>, Span<float>)

Applies ReLU activation with automatic backend selection.

public void ReLU(ReadOnlySpan<float> input, Span<float> output)

Parameters

input ReadOnlySpan<float>
output Span<float>