MathExt

‘math_ext’ Dialect

Math-related operations we require for HEIR which do not (yet) exist in upstream math.

MathExt ops

math_ext.sign (heir::math_ext::SignOp)

Returns the sign of the input value

Syntax:

operation ::= `math_ext.sign` $value attr-dict `:` type($result)

Returns -1 if the input is negative, 0 if it is zero, and 1 if it is positive. The behavior is undefined for NaN inputs.

Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType, Scalarizable, Tensorizable, Vectorizable

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
valuesignless-integer-like or floating-point-like

Results:

ResultDescription
resultsignless-integer-like or floating-point-like