Class ConstNode
public sealed class ConstNode : NDExpr
- Inheritance
-
ConstNode
- Inherited Members
Constructors
ConstNode(bool)
public ConstNode(bool v)
Parameters
vbool
ConstNode(char)
public ConstNode(char v)
Parameters
vchar
ConstNode(decimal)
public ConstNode(decimal v)
Parameters
vdecimal
ConstNode(double)
public ConstNode(double v)
Parameters
vdouble
ConstNode(Half)
public ConstNode(Half v)
Parameters
vHalf
ConstNode(int)
public ConstNode(int v)
Parameters
vint
ConstNode(long)
public ConstNode(long v)
Parameters
vlong
ConstNode(Complex)
public ConstNode(Complex v)
Parameters
vComplex
ConstNode(float)
public ConstNode(float v)
Parameters
vfloat
ConstNode(uint)
public ConstNode(uint v)
Parameters
vuint
ConstNode(ulong)
public ConstNode(ulong v)
Parameters
vulong
Properties
SupportsSimd
True if this node and its entire sub-tree have a SIMD emit path. Structural and type-independent — prefer SupportsSimdAt(NPTypeCode) for the compile decision, since some ops only vectorize at certain element types/runtimes.
public override bool SupportsSimd { get; }
Property Value
Methods
AppendSignature(StringBuilder)
Appends the literal's part of the kernel key: its kind and its exact value, so two literals that differ in either compile to distinct kernels (2 and 2.0 type differently; 2m and 2 emit differently at a Decimal target).
public override void AppendSignature(StringBuilder sb)
Parameters
sbStringBuilderThe key being built.
Remarks
The kernel cache is keyed by this text, and the kernel bakes the literal into its IL, so the text must be
INJECTIVE over the values the IL can tell apart: a float is written as its 64 bits (hex), as the structural
cache compares it (StructureEquals(NDExpr, NDExprOperandScratch)). Text from .NET's formatter is not injective, and a collision
hands a tree another literal's kernel — a wrong result, silently: ToString("R") prints every NaN alike,
on the .NET 10 runtime (10.0.1) prints 2^-25 and the double below it as the same 16 digits, and without an
invariant culture prints Complex(1.5, 2) and Complex(1, 5.2) alike under a comma decimal separator
("1,5,2"). A decimal's invariant text is exact and keeps its scale (1.0m and 1.00m, which emit different
constants, stay apart); an integer's digits are exact in every culture.
EmitScalar(ILGenerator, NDExprCompileContext)
Emit scalar code. On exit, the evaluation stack must have exactly
one value of dtype ctx.OutputType.
public override void EmitScalar(ILGenerator il, NDExprCompileContext ctx)
Parameters
ilILGeneratorctxNDExprCompileContext
EmitVector(ILGenerator, NDExprCompileContext)
Emit vector code. On exit, the evaluation stack must have exactly
one Vector{W}<T> of element type ctx.OutputType.
Called only when SupportsSimd is true and all input
types equal the output type.
public override void EmitVector(ILGenerator il, NDExprCompileContext ctx)
Parameters
ilILGeneratorctxNDExprCompileContext