Table of Contents

Class MetalCompiledKernel

Namespace
DotCompute.Backends.Metal.Kernels
Assembly
DotCompute.Backends.Metal.dll

Represents a compiled Metal kernel ready for execution.

public sealed class MetalCompiledKernel : ICompiledKernel, IAsyncDisposable, IDisposable
Inheritance
MetalCompiledKernel
Implements
Inherited Members
Extension Methods

Constructors

MetalCompiledKernel(KernelDefinition, nint, nint, int, (int x, int y, int z), CompilationMetadata, ILogger, MetalCommandBufferPool?)

Represents a compiled Metal kernel ready for execution.

public MetalCompiledKernel(KernelDefinition definition, nint pipelineState, nint commandQueue, int maxTotalThreadsPerThreadgroup, (int x, int y, int z) threadExecutionWidth, CompilationMetadata metadata, ILogger logger, MetalCommandBufferPool? commandBufferPool = null)

Parameters

definition KernelDefinition
pipelineState nint
commandQueue nint
maxTotalThreadsPerThreadgroup int
threadExecutionWidth (int x, int y, int z)
metadata CompilationMetadata
logger ILogger
commandBufferPool MetalCommandBufferPool

MetalCompiledKernel(KernelDefinition, nint, nint, int, (int x, int y, int z), CompilationMetadata, ILogger, MetalCommandBufferPool?, MetalThreadgroupOptimizer?)

Initializes a new instance with threadgroup optimization enabled.

public MetalCompiledKernel(KernelDefinition definition, nint pipelineState, nint commandQueue, int maxTotalThreadsPerThreadgroup, (int x, int y, int z) threadExecutionWidth, CompilationMetadata metadata, ILogger logger, MetalCommandBufferPool? commandBufferPool, MetalThreadgroupOptimizer? threadgroupOptimizer)

Parameters

definition KernelDefinition
pipelineState nint
commandQueue nint
maxTotalThreadsPerThreadgroup int
threadExecutionWidth (int x, int y, int z)
metadata CompilationMetadata
logger ILogger
commandBufferPool MetalCommandBufferPool
threadgroupOptimizer MetalThreadgroupOptimizer

Properties

BackendType

public static string BackendType { get; }

Property Value

string

CompilationMetadata

Gets the compilation metadata for this kernel.

public CompilationMetadata CompilationMetadata { get; }

Property Value

CompilationMetadata

Id

Gets the kernel unique identifier.

public Guid Id { get; }

Property Value

Guid

IsReady

public bool IsReady { get; }

Property Value

bool

Metadata

public object Metadata { get; }

Property Value

object

Name

Gets the kernel name.

public string Name { get; }

Property Value

string

SourceCode

Gets the source code of the kernel.

public string? SourceCode { get; }

Property Value

string

Methods

Dispose()

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

public void Dispose()

DisposeAsync()

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

public ValueTask DisposeAsync()

Returns

ValueTask

A task that represents the asynchronous dispose operation.

ExecuteAsync(KernelArguments, CancellationToken)

Executes the kernel with given arguments.

public ValueTask ExecuteAsync(KernelArguments arguments, CancellationToken cancellationToken = default)

Parameters

arguments KernelArguments
cancellationToken CancellationToken

Returns

ValueTask

ExecuteAsync(object[], CancellationToken)

public Task ExecuteAsync(object[] parameters, CancellationToken cancellationToken = default)

Parameters

parameters object[]
cancellationToken CancellationToken

Returns

Task

~MetalCompiledKernel()

protected ~MetalCompiledKernel()