MLIR  20.0.0git
Functions
SparseTensorRewriting.cpp File Reference
#include "Utils/CodegenUtils.h"
#include "Utils/LoopEmitter.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Linalg/Utils/Utils.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/SparseTensor/IR/SparseTensor.h"
#include "mlir/Dialect/SparseTensor/IR/SparseTensorStorageLayout.h"
#include "mlir/Dialect/SparseTensor/IR/SparseTensorType.h"
#include "mlir/Dialect/SparseTensor/Transforms/Passes.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/Matchers.h"
#include "mlir/Support/LLVM.h"

Go to the source code of this file.

Functions

static bool isZeroValue (Value val)
 
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). More...
 
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. More...
 
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). More...
 

Function Documentation

◆ concatSizesFromInputs()

static 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 185 of file SparseTensorRewriting.cpp.

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

◆ genForeachOnSparseConstant()

static LogicalResult genForeachOnSparseConstant ( ForeachOp  op,
RewriterBase rewriter,
SparseElementsAttr  attr 
)
static

◆ getBufferType()

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

◆ getDynamicSizes()

static 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 146 of file SparseTensorRewriting.cpp.

References mlir::detail::enumerate().

◆ isMaterializing()

static bool isMaterializing ( OpOperand op,
bool  isZero 
)
static

◆ isMulChain()

static bool isMulChain ( Value  val,
Value  x 
)
static

Definition at line 88 of file SparseTensorRewriting.cpp.

References mlir::Value::getDefiningOp().

Referenced by isSumOfMul().

◆ isSampling()

static bool isSampling ( GenericOp  op)
static

Definition at line 73 of file SparseTensorRewriting.cpp.

◆ isSparseTensor() [1/2]

static bool isSparseTensor ( OpOperand op)
static

◆ isSparseTensor() [2/2]

static bool isSparseTensor ( Value  v)
static

◆ isSumOfMul()

static bool isSumOfMul ( GenericOp  op)
static

Definition at line 100 of file SparseTensorRewriting.cpp.

References isMulChain().

◆ isZeroValue()

static bool isZeroValue ( Value  val)
static

◆ isZeroYield()

static bool isZeroYield ( GenericOp  op)
static

Definition at line 113 of file SparseTensorRewriting.cpp.

References isZeroValue().

◆ sizesForTensor()

static 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 125 of file SparseTensorRewriting.cpp.

References mlir::sparse_tensor::constantIndex(), mlir::OpBuilder::create(), and mlir::detail::enumerate().