Class MetalMathIntrinsics
- Namespace
- DotCompute.Backends.Metal.Compilation
- Assembly
- DotCompute.Backends.Metal.dll
Provides Metal Shading Language (MSL) math intrinsics support for Metal kernel compilation. Enables access to GPU-accelerated math functions using the metal:: namespace.
public static class MetalMathIntrinsics
- Inheritance
-
MetalMathIntrinsics
- Inherited Members
Remarks
Metal uses the metal:: namespace for math functions and relies on function overloading rather than type suffixes (e.g., metal::sin works for both float and half).
Fields
MathHeaderName
Gets the include name for the math header when used with Metal compilation.
public const string MathHeaderName = "metal_math_intrinsics.h"
Field Value
Properties
FastMathFunctions
Gets the list of supported fast math function names.
public static IReadOnlyList<string> FastMathFunctions { get; }
Property Value
MathHeader
Gets the MSL math intrinsics header content for Metal compilation. This header provides convenience macros and ensures metal math functions are available.
public static string MathHeader { get; }
Property Value
PreciseMathFunctions
Gets the list of supported precise math function names.
public static IReadOnlyList<string> PreciseMathFunctions { get; }
Property Value
Methods
GetTranslationMappings()
Gets the C# to MSL math function translation mappings.
public static IReadOnlyDictionary<string, string> GetTranslationMappings()
Returns
- IReadOnlyDictionary<string, string>
Dictionary mapping C# math functions to MSL equivalents.
RequiresMathIntrinsics(string)
Checks if the kernel source code requires math intrinsics.
public static bool RequiresMathIntrinsics(string source)
Parameters
sourcestringMSL source code to analyze.
Returns
- bool
True if math intrinsics are detected, false otherwise.