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
definitionKernelDefinitionpipelineStatenintcommandQueuenintmaxTotalThreadsPerThreadgroupintthreadExecutionWidth(int x, int y, int z)metadataCompilationMetadataloggerILoggercommandBufferPoolMetalCommandBufferPool
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
definitionKernelDefinitionpipelineStatenintcommandQueuenintmaxTotalThreadsPerThreadgroupintthreadExecutionWidth(int x, int y, int z)metadataCompilationMetadataloggerILoggercommandBufferPoolMetalCommandBufferPoolthreadgroupOptimizerMetalThreadgroupOptimizer
Properties
BackendType
public static string BackendType { get; }
Property Value
CompilationMetadata
Gets the compilation metadata for this kernel.
public CompilationMetadata CompilationMetadata { get; }
Property Value
Id
Gets the kernel unique identifier.
public Guid Id { get; }
Property Value
IsReady
public bool IsReady { get; }
Property Value
Metadata
public object Metadata { get; }
Property Value
Name
Gets the kernel name.
public string Name { get; }
Property Value
SourceCode
Gets the source code of the kernel.
public string? SourceCode { get; }
Property Value
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
argumentsKernelArgumentscancellationTokenCancellationToken
Returns
ExecuteAsync(object[], CancellationToken)
public Task ExecuteAsync(object[] parameters, CancellationToken cancellationToken = default)
Parameters
parametersobject[]cancellationTokenCancellationToken
Returns
~MetalCompiledKernel()
protected ~MetalCompiledKernel()