MLIR 22.0.0git
mlir::arith Namespace Reference

Namespaces

namespace  impl

Classes

struct  ArithEmulateUnsupportedFloatsOptions
struct  ArithEmulateWideIntOptions
struct  ArithExpandOpsPassOptions
struct  ArithIntRangeNarrowingOptions
class  AttrConverterConstrainedFPToLLVM
class  AttrConvertFastMathToLLVM
class  AttrConvertOverflowToLLVM
class  ConstantFloatOp
 Specialization of arith.constant op that returns a floating point value. More...
class  ConstantIndexOp
 Specialization of arith.constant op that returns an integer of index type. More...
class  ConstantIntOp
 Specialization of arith.constant op that returns an integer value. More...
class  NarrowTypeEmulationConverter
 Converts narrow integer or float types that are not supported by the target hardware to wider types. More...
class  WideIntEmulationConverter
 Converts integer types that are too wide for the target by splitting them in two halves and thus turning into supported ones, i.e., i2*N --> iN, where N is the widest integer bitwidth supported by the target. More...

Functions

LLVM::FastmathFlags convertArithFastMathFlagsToLLVM (arith::FastMathFlags arithFMF)
 Maps arithmetic fastmath enum values to LLVM enum values.
LLVM::FastmathFlagsAttr convertArithFastMathAttrToLLVM (arith::FastMathFlagsAttr fmfAttr)
 Creates an LLVM fastmath attribute from a given arithmetic fastmath attribute.
LLVM::IntegerOverflowFlags convertArithOverflowFlagsToLLVM (arith::IntegerOverflowFlags arithFlags)
 Maps arithmetic overflow enum values to LLVM enum values.
LLVM::RoundingMode convertArithRoundingModeToLLVM (arith::RoundingMode roundingMode)
 Creates an LLVM rounding mode enum value from a given arithmetic rounding mode enum value.
LLVM::RoundingModeAttr convertArithRoundingModeAttrToLLVM (arith::RoundingModeAttr roundingModeAttr)
 Creates an LLVM rounding mode attribute from a given arithmetic rounding mode attribute.
LLVM::FPExceptionBehaviorAttr getLLVMDefaultFPExceptionBehavior (MLIRContext &context)
 Returns an attribute for the default LLVM FP exception behavior.
void populateArithToAMDGPUConversionPatterns (RewritePatternSet &patterns, bool convertFP8Arithmetic, bool saturateFP8Truncf, bool allowPackedF16Rtz, bool supportsScaledExtTrunc, amdgpu::Chipset chipset, PatternBenefit benefit=1)
 Add patterns for rewriting arith.extf and arith.truncf on FP8 types to wrappers around AMDGPU–specific intrinsics.
void populateArithToArmSMEConversionPatterns (RewritePatternSet &patterns)
void populateArithToLLVMConversionPatterns (const LLVMTypeConverter &converter, RewritePatternSet &patterns)
void registerConvertArithToLLVMInterface (DialectRegistry &registry)
void populateArithToSPIRVPatterns (const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns)
std::unique_ptr< OperationPass<> > createConvertArithToSPIRVPass ()
bool applyCmpPredicate (arith::CmpIPredicate predicate, const APInt &lhs, const APInt &rhs)
 Compute lhs pred rhs, where pred is one of the known integer comparison predicates.
bool applyCmpPredicate (arith::CmpFPredicate predicate, const APFloat &lhs, const APFloat &rhs)
 Compute lhs pred rhs, where pred is one of the known floating point comparison predicates.
TypedAttr getIdentityValueAttr (AtomicRMWKind kind, Type resultType, OpBuilder &builder, Location loc, bool useOnlyFiniteValue=false)
 Returns the identity value attribute associated with an AtomicRMWKind op.
std::optional< TypedAttr > getNeutralElement (Operation *op)
 Return the identity numeric value associated to the give op.
Value getIdentityValue (AtomicRMWKind op, Type resultType, OpBuilder &builder, Location loc, bool useOnlyFiniteValue=false)
 Returns the identity value associated with an AtomicRMWKind op.
Value getReductionOp (AtomicRMWKind op, OpBuilder &builder, Location loc, Value lhs, Value rhs)
 Returns the value obtained by applying the reduction operation kind associated with a binary AtomicRMWKind op to lhs and rhs.
arith::CmpIPredicate invertPredicate (arith::CmpIPredicate pred)
 Invert an integer comparison predicate.
Value getZeroConstant (OpBuilder &builder, Location loc, Type type)
 Creates an arith.constant operation with a zero value of type type.
void registerValueBoundsOpInterfaceExternalModels (DialectRegistry &registry)
void registerBufferDeallocationOpInterfaceExternalModels (DialectRegistry &registry)
void registerBufferizableOpInterfaceExternalModels (DialectRegistry &registry)
void registerBufferViewFlowOpInterfaceExternalModels (DialectRegistry &registry)
std::unique_ptr<::mlir::PasscreateArithEmulateUnsupportedFloats ()
std::unique_ptr<::mlir::PasscreateArithEmulateUnsupportedFloats (ArithEmulateUnsupportedFloatsOptions options)
std::unique_ptr<::mlir::PasscreateArithEmulateWideInt ()
std::unique_ptr<::mlir::PasscreateArithEmulateWideInt (ArithEmulateWideIntOptions options)
std::unique_ptr<::mlir::PasscreateArithExpandOpsPass ()
std::unique_ptr<::mlir::PasscreateArithExpandOpsPass (ArithExpandOpsPassOptions options)
std::unique_ptr<::mlir::PasscreateArithIntRangeNarrowing ()
std::unique_ptr<::mlir::PasscreateArithIntRangeNarrowing (ArithIntRangeNarrowingOptions options)
std::unique_ptr<::mlir::PasscreateArithIntRangeOpts ()
std::unique_ptr<::mlir::PasscreateArithUnsignedWhenEquivalentPass ()
void populateArithWideIntEmulationPatterns (const WideIntEmulationConverter &typeConverter, RewritePatternSet &patterns)
 Adds patterns to emulate wide Arith and Function ops over integer types into supported ones.
void populateArithNarrowTypeEmulationPatterns (const NarrowTypeEmulationConverter &typeConverter, RewritePatternSet &patterns)
 Adds patterns to emulate narrow Arith and Function ops into wide supported types.
void populateEmulateUnsupportedFloatsConversions (TypeConverter &converter, ArrayRef< Type > sourceTypes, Type targetType)
 Populate the type conversions needed to emulate the unsupported sourceTypes with destType
void populateEmulateUnsupportedFloatsPatterns (RewritePatternSet &patterns, const TypeConverter &converter)
 Add rewrite patterns for converting operations that use illegal float types to ones that use legal ones.
void populateEmulateUnsupportedFloatsLegality (ConversionTarget &target, const TypeConverter &converter)
 Set up a dialect conversion to reject arithmetic operations on unsupported float types.
void populateCeilFloorDivExpandOpsPatterns (RewritePatternSet &patterns)
 Add patterns to expand Arith ceil/floor division ops.
void populateExpandBFloat16Patterns (RewritePatternSet &patterns)
 Add patterns to expand Arith bf16 patterns to lower level bitcasts/shifts.
void populateExpandF4E2M1Patterns (RewritePatternSet &patterns)
 Add patterns to expand Arith f4e2m1 patterns to lower level bitcasts/shifts.
void populateExpandF8E8M0Patterns (RewritePatternSet &patterns)
 Add patterns to expand Arith f8e8m0 patterns to lower level bitcasts/shifts.
void populateExpandScalingExtTruncPatterns (RewritePatternSet &patterns)
 Add patterns to expand scaling ExtF/TruncF ops to equivalent arith ops.
void populateArithExpandOpsPatterns (RewritePatternSet &patterns)
 Add patterns to expand Arith ops.
void populateIntRangeOptimizationsPatterns (RewritePatternSet &patterns, DataFlowSolver &solver)
 Add patterns for int range based optimizations.
void populateUnsignedWhenEquivalentPatterns (RewritePatternSet &patterns, DataFlowSolver &solver)
 Replace signed ops with unsigned ones where they are proven equivalent.
std::unique_ptr< PasscreateIntRangeOptimizationsPass ()
 Create a pass which do optimizations based on integer range analysis.
void populateIntRangeNarrowingPatterns (RewritePatternSet &patterns, DataFlowSolver &solver, ArrayRef< unsigned > bitwidthsSupported)
 Add patterns for int range based narrowing.
void registerArithEmulateUnsupportedFloats ()
void registerArithEmulateUnsupportedFloatsPass ()
void registerArithEmulateWideInt ()
void registerArithEmulateWideIntPass ()
void registerArithExpandOpsPass ()
void registerArithExpandOpsPassPass ()
void registerArithIntRangeNarrowing ()
void registerArithIntRangeNarrowingPass ()
void registerArithIntRangeOpts ()
void registerArithIntRangeOptsPass ()
void registerArithUnsignedWhenEquivalentPass ()
void registerArithUnsignedWhenEquivalentPassPass ()
void registerArithPasses ()
void registerShardingInterfaceExternalModels (DialectRegistry &registry)
FailureOr< OpFoldResultreifyValueBound (OpBuilder &b, Location loc, presburger::BoundType type, const ValueBoundsConstraintSet::Variable &var, ValueBoundsConstraintSet::StopConditionFn stopCondition, bool closedUB=false)
 Reify a bound for the given variable in terms of SSA values for which stopCondition is met.
FailureOr< OpFoldResultreifyIndexValueBound (OpBuilder &b, Location loc, presburger::BoundType type, Value value, const ValueBoundsConstraintSet::StopConditionFn &stopCondition=nullptr, bool closedUB=false)
 Reify a bound for the given index-typed value in terms of SSA values for which stopCondition is met.
FailureOr< OpFoldResultreifyShapedValueDimBound (OpBuilder &b, Location loc, presburger::BoundType type, Value value, int64_t dim, const ValueBoundsConstraintSet::StopConditionFn &stopCondition=nullptr, bool closedUB=false)
 Reify a bound for the specified dimension of the given shaped value in terms of SSA values for which stopCondition is met.
Value createProduct (OpBuilder &builder, Location loc, ArrayRef< Value > values)
Value createProduct (OpBuilder &builder, Location loc, ArrayRef< Value > values, Type resultType)
std::optional< FloatType > parseFloatType (MLIRContext *ctx, StringRef name)
 Map strings to float types.

Function Documentation

◆ applyCmpPredicate() [1/2]

bool mlir::arith::applyCmpPredicate ( arith::CmpFPredicate predicate,
const APFloat & lhs,
const APFloat & rhs )

Compute lhs pred rhs, where pred is one of the known floating point comparison predicates.

Definition at line 2082 of file ArithOps.cpp.

References lhs, and rhs.

◆ applyCmpPredicate() [2/2]

bool mlir::arith::applyCmpPredicate ( arith::CmpIPredicate predicate,
const APInt & lhs,
const APInt & rhs )

Compute lhs pred rhs, where pred is one of the known integer comparison predicates.

Definition at line 1939 of file ArithOps.cpp.

References lhs, and rhs.

◆ convertArithFastMathAttrToLLVM()

LLVM::FastmathFlagsAttr mlir::arith::convertArithFastMathAttrToLLVM ( arith::FastMathFlagsAttr fmfAttr)

Creates an LLVM fastmath attribute from a given arithmetic fastmath attribute.

Definition at line 32 of file AttrToLLVMConverter.cpp.

References convertArithFastMathFlagsToLLVM().

Referenced by mlir::arith::AttrConvertFastMathToLLVM< SourceOp, TargetOp >::AttrConvertFastMathToLLVM().

◆ convertArithFastMathFlagsToLLVM()

LLVM::FastmathFlags mlir::arith::convertArithFastMathFlagsToLLVM ( arith::FastMathFlags arithFMF)

Maps arithmetic fastmath enum values to LLVM enum values.

Definition at line 14 of file AttrToLLVMConverter.cpp.

Referenced by convertArithFastMathAttrToLLVM().

◆ convertArithOverflowFlagsToLLVM()

LLVM::IntegerOverflowFlags mlir::arith::convertArithOverflowFlagsToLLVM ( arith::IntegerOverflowFlags arithFlags)

Maps arithmetic overflow enum values to LLVM enum values.

Definition at line 38 of file AttrToLLVMConverter.cpp.

Referenced by mlir::arith::AttrConvertOverflowToLLVM< SourceOp, TargetOp >::AttrConvertOverflowToLLVM().

◆ convertArithRoundingModeAttrToLLVM()

LLVM::RoundingModeAttr mlir::arith::convertArithRoundingModeAttrToLLVM ( arith::RoundingModeAttr roundingModeAttr)

Creates an LLVM rounding mode attribute from a given arithmetic rounding mode attribute.

Definition at line 69 of file AttrToLLVMConverter.cpp.

References convertArithRoundingModeToLLVM().

Referenced by mlir::arith::AttrConverterConstrainedFPToLLVM< SourceOp, TargetOp >::AttrConverterConstrainedFPToLLVM().

◆ convertArithRoundingModeToLLVM()

LLVM::RoundingMode mlir::arith::convertArithRoundingModeToLLVM ( arith::RoundingMode roundingMode)

Creates an LLVM rounding mode enum value from a given arithmetic rounding mode enum value.

Definition at line 53 of file AttrToLLVMConverter.cpp.

Referenced by convertArithRoundingModeAttrToLLVM().

◆ createArithEmulateUnsupportedFloats() [1/2]

std::unique_ptr<::mlir::Pass > mlir::arith::createArithEmulateUnsupportedFloats ( )

Definition at line 103 of file EmulateUnsupportedFloats.cpp.

◆ createArithEmulateUnsupportedFloats() [2/2]

std::unique_ptr<::mlir::Pass > mlir::arith::createArithEmulateUnsupportedFloats ( ArithEmulateUnsupportedFloatsOptions options)

Definition at line 107 of file EmulateUnsupportedFloats.cpp.

References mlir::patterns.

◆ createArithEmulateWideInt() [1/2]

std::unique_ptr<::mlir::Pass > mlir::arith::createArithEmulateWideInt ( )

Definition at line 198 of file EmulateWideInt.cpp.

◆ createArithEmulateWideInt() [2/2]

std::unique_ptr<::mlir::Pass > mlir::arith::createArithEmulateWideInt ( ArithEmulateWideIntOptions options)

Definition at line 202 of file EmulateWideInt.cpp.

◆ createArithExpandOpsPass() [1/2]

std::unique_ptr<::mlir::Pass > mlir::arith::createArithExpandOpsPass ( )

Definition at line 299 of file ExpandOps.cpp.

References b.

Referenced by mlir::sparse_tensor::buildSparsifier().

◆ createArithExpandOpsPass() [2/2]

std::unique_ptr<::mlir::Pass > mlir::arith::createArithExpandOpsPass ( ArithExpandOpsPassOptions options)

Definition at line 303 of file ExpandOps.cpp.

References b, and result.

◆ createArithIntRangeNarrowing() [1/2]

std::unique_ptr<::mlir::Pass > mlir::arith::createArithIntRangeNarrowing ( )

Definition at line 394 of file IntRangeOptimizations.cpp.

◆ createArithIntRangeNarrowing() [2/2]

std::unique_ptr<::mlir::Pass > mlir::arith::createArithIntRangeNarrowing ( ArithIntRangeNarrowingOptions options)

Definition at line 398 of file IntRangeOptimizations.cpp.

◆ createArithIntRangeOpts()

std::unique_ptr<::mlir::Pass > mlir::arith::createArithIntRangeOpts ( )

We declare an explicit private instantiation because Pass classes should only be visible by the current library.

Definition at line 473 of file IntRangeOptimizations.cpp.

◆ createArithUnsignedWhenEquivalentPass()

std::unique_ptr<::mlir::Pass > mlir::arith::createArithUnsignedWhenEquivalentPass ( )

We declare an explicit private instantiation because Pass classes should only be visible by the current library.

Definition at line 548 of file UnsignedWhenEquivalent.cpp.

◆ createConvertArithToSPIRVPass()

std::unique_ptr< OperationPass<> > mlir::arith::createConvertArithToSPIRVPass ( )

Definition at line 785 of file ArithToSPIRV.cpp.

◆ createIntRangeOptimizationsPass()

std::unique_ptr< Pass > mlir::arith::createIntRangeOptimizationsPass ( )

Create a pass which do optimizations based on integer range analysis.

Definition at line 551 of file IntRangeOptimizations.cpp.

◆ createProduct() [1/2]

Value mlir::arith::createProduct ( OpBuilder & builder,
Location loc,
ArrayRef< Value > values )

◆ createProduct() [2/2]

Value mlir::arith::createProduct ( OpBuilder & builder,
Location loc,
ArrayRef< Value > values,
Type resultType )

◆ getIdentityValue()

Value mlir::arith::getIdentityValue ( AtomicRMWKind op,
Type resultType,
OpBuilder & builder,
Location loc,
bool useOnlyFiniteValue = false )

Returns the identity value associated with an AtomicRMWKind op.

See also
getIdentityValueAttr for a description of what useOnlyFiniteValue does.

Definition at line 2776 of file ArithOps.cpp.

References getIdentityValueAttr().

◆ getIdentityValueAttr()

TypedAttr mlir::arith::getIdentityValueAttr ( AtomicRMWKind kind,
Type resultType,
OpBuilder & builder,
Location loc,
bool useOnlyFiniteValue = false )

Returns the identity value attribute associated with an AtomicRMWKind op.

useOnlyFiniteValue defines whether the identity value should steer away from infinity representations or anything that is not a proper finite number. E.g., The identity value for maxf is in theory -Inf, but if we want to stay in the finite range, it would be BiggestRepresentableNegativeFloat. The purpose of this boolean is to offer constants that will play nice with fast math related optimizations.

Definition at line 2666 of file ArithOps.cpp.

References mlir::emitOptionalError(), mlir::Builder::getFloatAttr(), mlir::Builder::getIntegerAttr(), and mlir::Builder::getZeroAttr().

Referenced by getIdentityValue(), and getNeutralElement().

◆ getLLVMDefaultFPExceptionBehavior()

LLVM::FPExceptionBehaviorAttr mlir::arith::getLLVMDefaultFPExceptionBehavior ( MLIRContext & context)

Returns an attribute for the default LLVM FP exception behavior.

Definition at line 78 of file AttrToLLVMConverter.cpp.

Referenced by mlir::arith::AttrConverterConstrainedFPToLLVM< SourceOp, TargetOp >::AttrConverterConstrainedFPToLLVM().

◆ getNeutralElement()

std::optional< TypedAttr > mlir::arith::getNeutralElement ( Operation * op)

Return the identity numeric value associated to the give op.

Returns the identity numeric value of the given op.

Return std::nullopt if there is no known neutral element. If op has FastMathFlags::ninf, only finite values will be used as neutral element.

Definition at line 2734 of file ArithOps.cpp.

References b, mlir::Operation::getContext(), getIdentityValueAttr(), mlir::Operation::getLoc(), mlir::Operation::getResult(), and mlir::Value::getType().

Referenced by mlir::linalg::createDestinationPassingStyleInitOperand(), mlir::linalg::splitReduction(), and mlir::linalg::splitReductionByScaling().

◆ getReductionOp()

Value mlir::arith::getReductionOp ( AtomicRMWKind op,
OpBuilder & builder,
Location loc,
Value lhs,
Value rhs )

Returns the value obtained by applying the reduction operation kind associated with a binary AtomicRMWKind op to lhs and rhs.

Return the value obtained by applying the reduction operation kind associated with a binary AtomicRMWKind op to lhs and rhs.

Definition at line 2786 of file ArithOps.cpp.

References mlir::emitOptionalError(), lhs, and rhs.

Referenced by mlir::affine::loopUnrollJamByFactor(), and vectorizeAffineForOp().

◆ getZeroConstant()

Value mlir::arith::getZeroConstant ( OpBuilder & builder,
Location loc,
Type type )

Creates an arith.constant operation with a zero value of type type.

This method asserts if type is invalid for representing zero with arith.constant.

Definition at line 380 of file ArithOps.cpp.

References mlir::getElementTypeOrSelf(), and mlir::Builder::getZeroAttr().

◆ invertPredicate()

arith::CmpIPredicate mlir::arith::invertPredicate ( arith::CmpIPredicate pred)

Invert an integer comparison predicate.

Definition at line 75 of file ArithOps.cpp.

References invertPredicate().

Referenced by invertPredicate(), and invertPredicate().

◆ parseFloatType()

std::optional< FloatType > mlir::arith::parseFloatType ( MLIRContext * ctx,
StringRef name )

Map strings to float types.

Definition at line 360 of file Utils.cpp.

References b, and parseFloatType().

Referenced by parseFloatType(), and mlir::math::impl::MathExtendToSupportedTypesBase< DerivedT >::~MathExtendToSupportedTypesBase().

◆ populateArithExpandOpsPatterns()

void mlir::arith::populateArithExpandOpsPatterns ( RewritePatternSet & patterns)

Add patterns to expand Arith ops.

Definition at line 827 of file ExpandOps.cpp.

References mlir::patterns, populateCeilFloorDivExpandOpsPatterns(), and populateExpandScalingExtTruncPatterns().

◆ populateArithNarrowTypeEmulationPatterns()

void mlir::arith::populateArithNarrowTypeEmulationPatterns ( const NarrowTypeEmulationConverter & typeConverter,
RewritePatternSet & patterns )

Adds patterns to emulate narrow Arith and Function ops into wide supported types.

Users need to add conversions about the computation domain of narrow types.

Definition at line 50 of file EmulateNarrowType.cpp.

References mlir::patterns, mlir::populateCallOpTypeConversionPattern(), and mlir::populateReturnOpTypeConversionPattern().

◆ populateArithToAMDGPUConversionPatterns()

void mlir::arith::populateArithToAMDGPUConversionPatterns ( RewritePatternSet & patterns,
bool convertFP8Arithmetic,
bool saturateFP8Truncf,
bool allowPackedF16Rtz,
bool supportsScaledExtTrunc,
amdgpu::Chipset chipset,
PatternBenefit benefit = 1 )

Add patterns for rewriting arith.extf and arith.truncf on FP8 types to wrappers around AMDGPU–specific intrinsics.

If saturateFP8TruncF is set, values outside the range of the destination type are clamped to the largest value of that type instead of being rewritten to Inf (aka NaN).

Definition at line 687 of file ArithToAMDGPU.cpp.

References mlir::patterns.

◆ populateArithToArmSMEConversionPatterns()

void mlir::arith::populateArithToArmSMEConversionPatterns ( RewritePatternSet & patterns)

Definition at line 102 of file ArithToArmSME.cpp.

References mlir::patterns.

◆ populateArithToLLVMConversionPatterns()

void mlir::arith::populateArithToLLVMConversionPatterns ( const LLVMTypeConverter & converter,
RewritePatternSet & patterns )

Definition at line 603 of file ArithToLLVM.cpp.

References mlir::patterns.

◆ populateArithToSPIRVPatterns()

void mlir::arith::populateArithToSPIRVPatterns ( const SPIRVTypeConverter & typeConverter,
RewritePatternSet & patterns )

Definition at line 1349 of file ArithToSPIRV.cpp.

References mlir::patterns.

◆ populateArithWideIntEmulationPatterns()

void mlir::arith::populateArithWideIntEmulationPatterns ( const WideIntEmulationConverter & typeConverter,
RewritePatternSet & patterns )

Adds patterns to emulate wide Arith and Function ops over integer types into supported ones.

This is done by splitting original power-of-two i2N integer types into two iN halves.

Definition at line 1288 of file EmulateWideInt.cpp.

References mlir::patterns.

◆ populateCeilFloorDivExpandOpsPatterns()

void mlir::arith::populateCeilFloorDivExpandOpsPatterns ( RewritePatternSet & patterns)

Add patterns to expand Arith ceil/floor division ops.

Definition at line 799 of file ExpandOps.cpp.

References mlir::patterns.

Referenced by populateArithExpandOpsPatterns().

◆ populateEmulateUnsupportedFloatsConversions()

void mlir::arith::populateEmulateUnsupportedFloatsConversions ( TypeConverter & converter,
ArrayRef< Type > sourceTypes,
Type targetType )

Populate the type conversions needed to emulate the unsupported sourceTypes with destType

Definition at line 87 of file EmulateUnsupportedFloats.cpp.

◆ populateEmulateUnsupportedFloatsLegality()

void mlir::arith::populateEmulateUnsupportedFloatsLegality ( ConversionTarget & target,
const TypeConverter & converter )

Set up a dialect conversion to reject arithmetic operations on unsupported float types.

Definition at line 112 of file EmulateUnsupportedFloats.cpp.

References target.

◆ populateEmulateUnsupportedFloatsPatterns()

void mlir::arith::populateEmulateUnsupportedFloatsPatterns ( RewritePatternSet & patterns,
const TypeConverter & converter )

Add rewrite patterns for converting operations that use illegal float types to ones that use legal ones.

Definition at line 107 of file EmulateUnsupportedFloats.cpp.

◆ populateExpandBFloat16Patterns()

void mlir::arith::populateExpandBFloat16Patterns ( RewritePatternSet & patterns)

Add patterns to expand Arith bf16 patterns to lower level bitcasts/shifts.

Definition at line 806 of file ExpandOps.cpp.

References mlir::patterns.

◆ populateExpandF4E2M1Patterns()

void mlir::arith::populateExpandF4E2M1Patterns ( RewritePatternSet & patterns)

Add patterns to expand Arith f4e2m1 patterns to lower level bitcasts/shifts.

Definition at line 811 of file ExpandOps.cpp.

References mlir::patterns.

◆ populateExpandF8E8M0Patterns()

void mlir::arith::populateExpandF8E8M0Patterns ( RewritePatternSet & patterns)

Add patterns to expand Arith f8e8m0 patterns to lower level bitcasts/shifts.

Definition at line 816 of file ExpandOps.cpp.

References mlir::patterns.

◆ populateExpandScalingExtTruncPatterns()

void mlir::arith::populateExpandScalingExtTruncPatterns ( RewritePatternSet & patterns)

Add patterns to expand scaling ExtF/TruncF ops to equivalent arith ops.

Definition at line 821 of file ExpandOps.cpp.

References mlir::patterns.

Referenced by populateArithExpandOpsPatterns().

◆ populateIntRangeNarrowingPatterns()

void mlir::arith::populateIntRangeNarrowingPatterns ( RewritePatternSet & patterns,
DataFlowSolver & solver,
ArrayRef< unsigned > bitwidthsSupported )

Add patterns for int range based narrowing.

Definition at line 541 of file IntRangeOptimizations.cpp.

References mlir::patterns.

◆ populateIntRangeOptimizationsPatterns()

void mlir::arith::populateIntRangeOptimizationsPatterns ( RewritePatternSet & patterns,
DataFlowSolver & solver )

Add patterns for int range based optimizations.

Definition at line 535 of file IntRangeOptimizations.cpp.

References mlir::patterns.

◆ populateUnsignedWhenEquivalentPatterns()

void mlir::arith::populateUnsignedWhenEquivalentPatterns ( RewritePatternSet & patterns,
DataFlowSolver & solver )

Replace signed ops with unsigned ones where they are proven equivalent.

Definition at line 143 of file UnsignedWhenEquivalent.cpp.

References mlir::patterns.

◆ registerArithEmulateUnsupportedFloats()

void mlir::arith::registerArithEmulateUnsupportedFloats ( )
inline

Definition at line 568 of file Passes.h.

◆ registerArithEmulateUnsupportedFloatsPass()

void mlir::arith::registerArithEmulateUnsupportedFloatsPass ( )
inline

Definition at line 575 of file Passes.h.

◆ registerArithEmulateWideInt()

void mlir::arith::registerArithEmulateWideInt ( )
inline

Definition at line 589 of file Passes.h.

◆ registerArithEmulateWideIntPass()

void mlir::arith::registerArithEmulateWideIntPass ( )
inline

Definition at line 596 of file Passes.h.

◆ registerArithExpandOpsPass()

void mlir::arith::registerArithExpandOpsPass ( )
inline

Definition at line 610 of file Passes.h.

◆ registerArithExpandOpsPassPass()

void mlir::arith::registerArithExpandOpsPassPass ( )
inline

Definition at line 617 of file Passes.h.

◆ registerArithIntRangeNarrowing()

void mlir::arith::registerArithIntRangeNarrowing ( )
inline

Definition at line 631 of file Passes.h.

◆ registerArithIntRangeNarrowingPass()

void mlir::arith::registerArithIntRangeNarrowingPass ( )
inline

Definition at line 638 of file Passes.h.

◆ registerArithIntRangeOpts()

void mlir::arith::registerArithIntRangeOpts ( )
inline

Definition at line 652 of file Passes.h.

◆ registerArithIntRangeOptsPass()

void mlir::arith::registerArithIntRangeOptsPass ( )
inline

Definition at line 659 of file Passes.h.

◆ registerArithPasses()

void mlir::arith::registerArithPasses ( )
inline

Definition at line 694 of file Passes.h.

Referenced by mlir::registerAllPasses().

◆ registerArithUnsignedWhenEquivalentPass()

void mlir::arith::registerArithUnsignedWhenEquivalentPass ( )
inline

Definition at line 673 of file Passes.h.

◆ registerArithUnsignedWhenEquivalentPassPass()

void mlir::arith::registerArithUnsignedWhenEquivalentPassPass ( )
inline

Definition at line 680 of file Passes.h.

◆ registerBufferDeallocationOpInterfaceExternalModels()

void mlir::arith::registerBufferDeallocationOpInterfaceExternalModels ( DialectRegistry & registry)

◆ registerBufferizableOpInterfaceExternalModels()

void mlir::arith::registerBufferizableOpInterfaceExternalModels ( DialectRegistry & registry)

◆ registerBufferViewFlowOpInterfaceExternalModels()

void mlir::arith::registerBufferViewFlowOpInterfaceExternalModels ( DialectRegistry & registry)

◆ registerConvertArithToLLVMInterface()

void mlir::arith::registerConvertArithToLLVMInterface ( DialectRegistry & registry)

Definition at line 592 of file ArithToLLVM.cpp.

References mlir::DialectRegistry::addExtension().

Referenced by mlir::registerAllExtensions().

◆ registerShardingInterfaceExternalModels()

void mlir::arith::registerShardingInterfaceExternalModels ( DialectRegistry & registry)

◆ registerValueBoundsOpInterfaceExternalModels()

void mlir::arith::registerValueBoundsOpInterfaceExternalModels ( DialectRegistry & registry)

◆ reifyIndexValueBound()

FailureOr< OpFoldResult > mlir::arith::reifyIndexValueBound ( OpBuilder & b,
Location loc,
presburger::BoundType type,
Value value,
const ValueBoundsConstraintSet::StopConditionFn & stopCondition = nullptr,
bool closedUB = false )

Reify a bound for the given index-typed value in terms of SSA values for which stopCondition is met.

If no stop condition is specified, reify in terms of the operands of the owner op.

By default, lower/equal bounds are closed and upper bounds are open. If closedUB is set to "true", upper bounds are also closed.

Example: %0 = arith.addi a, b : index %1 = arith.addi %0, c : index

  • If stopCondition evaluates to "true" for %0 and c, "%0 + %c" is an EQ bound for %1.
  • If stopCondition evaluates to "true" for a, b and c, "%a + %b + %c" is an EQ bound for %1.
  • Otherwise, if the owners of a, b or c do not implement the ValueBoundsOpInterface, no bound can be computed.

Definition at line 138 of file ReifyValueBounds.cpp.

References b, and reifyValueBound().

◆ reifyShapedValueDimBound()

FailureOr< OpFoldResult > mlir::arith::reifyShapedValueDimBound ( OpBuilder & b,
Location loc,
presburger::BoundType type,
Value value,
int64_t dim,
const ValueBoundsConstraintSet::StopConditionFn & stopCondition = nullptr,
bool closedUB = false )

Reify a bound for the specified dimension of the given shaped value in terms of SSA values for which stopCondition is met.

If no stop condition is specified, reify in terms of the operands of the owner op.

By default, lower/equal bounds are closed and upper bounds are open. If closedUB is set to "true", upper bounds are also closed.

Definition at line 120 of file ReifyValueBounds.cpp.

References b, and reifyValueBound().

◆ reifyValueBound()

FailureOr< OpFoldResult > mlir::arith::reifyValueBound ( OpBuilder & b,
Location loc,
presburger::BoundType type,
const ValueBoundsConstraintSet::Variable & var,
ValueBoundsConstraintSet::StopConditionFn stopCondition,
bool closedUB = false )

Reify a bound for the given variable in terms of SSA values for which stopCondition is met.

By default, lower/equal bounds are closed and upper bounds are open. If closedUB is set to "true", upper bounds are also closed.

Definition at line 66 of file ReifyValueBounds.cpp.

References b, buildArithValue(), mlir::ValueBoundsConstraintSet::computeBound(), mlir::AffineMap::getNumDims(), mlir::AffineMap::getResult(), mlir::AffineMap::getSingleConstantResult(), mlir::Value::getType(), mlir::Type::isIndex(), and mlir::AffineMap::isSingleConstant().

Referenced by reifyIndexValueBound(), and reifyShapedValueDimBound().