MLIR 22.0.0git
SparseTensorRewriting.cpp File Reference

Go to the source code of this file.

Functions

static bool isSparseTensor (Value v)
static bool isSparseTensor (OpOperand *op)
static bool isMaterializing (OpOperand *op, bool isZero)
static bool isSampling (GenericOp op)
static bool isMulChain (Value val, Value x)
static bool isSumOfMul (GenericOp op)
static bool isZeroYield (GenericOp op)
static void sizesForTensor (OpBuilder &builder, SmallVectorImpl< Value > &sizes, Location loc, ShapedType stp, Value tensor)
 Populates given sizes array from type (for static sizes) and from the tensor (for dynamic sizes).
static RankedTensorType getBufferType (const SparseTensorType &stt, bool needTmpCOO)
static void getDynamicSizes (RankedTensorType tp, ValueRange sizes, SmallVectorImpl< Value > &dynSizes)
 Collects the dynamic dimension sizes for tp with the assumption that sizes are the dimension sizes for the type.
static LogicalResult genForeachOnSparseConstant (ForeachOp op, RewriterBase &rewriter, SparseElementsAttr attr)
static void concatSizesFromInputs (OpBuilder &builder, SmallVectorImpl< Value > &sizes, Location loc, ShapedType dstTp, ValueRange srcs, unsigned dim)
 Populates the given sizes array for concatenation from types (for static sizes) and from the source tensors (for dynamic sizes).

Function Documentation

◆ concatSizesFromInputs()

void concatSizesFromInputs ( OpBuilder & builder,
SmallVectorImpl< Value > & sizes,
Location loc,
ShapedType dstTp,
ValueRange srcs,
unsigned dim )
static

Populates the given sizes array for concatenation from types (for static sizes) and from the source tensors (for dynamic sizes).

Definition at line 180 of file SparseTensorRewriting.cpp.

References mlir::sparse_tensor::constantIndex(), mlir::linalg::createOrFoldDimOp(), and mlir::sparse_tensor::sizesFromSrc().

◆ genForeachOnSparseConstant()

◆ getBufferType()

RankedTensorType getBufferType ( const SparseTensorType & stt,
bool needTmpCOO )
static

◆ getDynamicSizes()

void getDynamicSizes ( RankedTensorType tp,
ValueRange sizes,
SmallVectorImpl< Value > & dynSizes )
static

Collects the dynamic dimension sizes for tp with the assumption that sizes are the dimension sizes for the type.

Stores the dynamic dimension sizes to dynSizes.

Definition at line 141 of file SparseTensorRewriting.cpp.

◆ isMaterializing()

◆ isMulChain()

bool isMulChain ( Value val,
Value x )
static

Definition at line 83 of file SparseTensorRewriting.cpp.

References mlir::Value::getDefiningOp(), and isMulChain().

Referenced by isMulChain(), and isSumOfMul().

◆ isSampling()

bool isSampling ( GenericOp op)
static

Definition at line 68 of file SparseTensorRewriting.cpp.

◆ isSparseTensor() [1/2]

bool isSparseTensor ( OpOperand * op)
static

◆ isSparseTensor() [2/2]

bool isSparseTensor ( Value v)
static

◆ isSumOfMul()

bool isSumOfMul ( GenericOp op)
static

Definition at line 95 of file SparseTensorRewriting.cpp.

References isMulChain().

◆ isZeroYield()

bool isZeroYield ( GenericOp op)
static

Definition at line 108 of file SparseTensorRewriting.cpp.

References mlir::isZeroIntegerOrFloat().

◆ sizesForTensor()

void sizesForTensor ( OpBuilder & builder,
SmallVectorImpl< Value > & sizes,
Location loc,
ShapedType stp,
Value tensor )
static

Populates given sizes array from type (for static sizes) and from the tensor (for dynamic sizes).

Definition at line 120 of file SparseTensorRewriting.cpp.

References mlir::sparse_tensor::constantIndex().