MLIR  20.0.0git
Classes | Namespaces | Enumerations | Functions
CodegenUtils.h File Reference
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Complex/IR/Complex.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/SparseTensor/IR/Enums.h"
#include "mlir/Dialect/SparseTensor/IR/SparseTensor.h"
#include "mlir/Dialect/SparseTensor/IR/SparseTensorType.h"
#include "mlir/Dialect/Utils/ReshapeOpsUtils.h"
#include "mlir/IR/Builders.h"

Go to the source code of this file.

Classes

class  mlir::sparse_tensor::FuncCallOrInlineGenerator< SubClass >
 A helper class to simplify lowering operations with/without function calls. More...
 

Namespaces

 mlir
 Include the generated interface declarations.
 
 mlir::sparse_tensor
 

Enumerations

enum class  mlir::sparse_tensor::EmitCInterface : bool { mlir::sparse_tensor::Off = false , mlir::sparse_tensor::On = true }
 Shorthand aliases for the emitCInterface argument to getFunc(), createFuncCall(), and replaceOpWithFuncCall(). More...
 

Functions

OverheadType mlir::sparse_tensor::overheadTypeEncoding (unsigned width)
 Converts an overhead storage bitwidth to its internal type-encoding. More...
 
OverheadType mlir::sparse_tensor::overheadTypeEncoding (Type tp)
 Converts an overhead storage type to its internal type-encoding. More...
 
Type mlir::sparse_tensor::getOverheadType (Builder &builder, OverheadType ot)
 Converts the internal type-encoding for overhead storage to an mlir::Type. More...
 
OverheadType mlir::sparse_tensor::posTypeEncoding (SparseTensorEncodingAttr enc)
 Returns the OverheadType for position overhead storage. More...
 
OverheadType mlir::sparse_tensor::crdTypeEncoding (SparseTensorEncodingAttr enc)
 Returns the OverheadType for coordinate overhead storage. More...
 
StringRef mlir::sparse_tensor::overheadTypeFunctionSuffix (OverheadType ot)
 Convert OverheadType to its function-name suffix. More...
 
StringRef mlir::sparse_tensor::overheadTypeFunctionSuffix (Type overheadTp)
 Converts an overhead storage type to its function-name suffix. More...
 
PrimaryType mlir::sparse_tensor::primaryTypeEncoding (Type elemTp)
 Converts a primary storage type to its internal type-encoding. More...
 
StringRef mlir::sparse_tensor::primaryTypeFunctionSuffix (PrimaryType pt)
 Convert PrimaryType to its function-name suffix. More...
 
StringRef mlir::sparse_tensor::primaryTypeFunctionSuffix (Type elemTp)
 Converts a primary storage type to its function-name suffix. More...
 
Value mlir::sparse_tensor::genCast (OpBuilder &builder, Location loc, Value value, Type dstTy)
 Add type casting between arith and index types when needed. More...
 
Value mlir::sparse_tensor::genScalarToTensor (OpBuilder &builder, Location loc, Value elem, Type dstTp)
 Add conversion from scalar to given type (possibly a 0-rank tensor). More...
 
Value mlir::sparse_tensor::genIndexLoad (OpBuilder &builder, Location loc, Value mem, ValueRange s)
 Generates a pointer/index load from the sparse storage scheme. More...
 
TypedAttr mlir::sparse_tensor::getOneAttr (Builder &builder, Type tp)
 Generates a 1-valued attribute of the given type. More...
 
Value mlir::sparse_tensor::genIsNonzero (OpBuilder &builder, Location loc, Value v)
 Generates the comparison v != 0 where v is of numeric type. More...
 
void mlir::sparse_tensor::genReshapeDstShape (OpBuilder &builder, Location loc, SmallVectorImpl< Value > &dstShape, ArrayRef< Value > srcShape, ArrayRef< Size > staticDstShape, ArrayRef< ReassociationIndices > reassociation)
 Computes the shape of destination tensor of a reshape operator. More...
 
void mlir::sparse_tensor::reshapeCvs (OpBuilder &builder, Location loc, ArrayRef< ReassociationIndices > reassociation, ValueRange srcSizes, ValueRange srcCvs, ValueRange dstSizes, SmallVectorImpl< Value > &dstCvs)
 Reshape coordinates during a reshaping operation. More...
 
FlatSymbolRefAttr mlir::sparse_tensor::getFunc (ModuleOp module, StringRef name, TypeRange resultType, ValueRange operands, EmitCInterface emitCInterface)
 Returns a function reference (first hit also inserts into module). More...
 
func::CallOp mlir::sparse_tensor::createFuncCall (OpBuilder &builder, Location loc, StringRef name, TypeRange resultType, ValueRange operands, EmitCInterface emitCInterface)
 Creates a CallOp to the function reference returned by getFunc() in the builder's module. More...
 
Type mlir::sparse_tensor::getOpaquePointerType (MLIRContext *ctx)
 Returns the equivalent of void* for opaque arguments to the execution engine. More...
 
Type mlir::sparse_tensor::getOpaquePointerType (Builder &builder)
 
Value mlir::sparse_tensor::genAlloca (OpBuilder &builder, Location loc, Value sz, Type tp)
 Generates an uninitialized temporary buffer of the given size and type, but returns it as type memref<? x $tp> (rather than as type memref<$sz x $tp>). More...
 
Value mlir::sparse_tensor::genAlloca (OpBuilder &builder, Location loc, unsigned sz, Type tp, bool staticShape=false)
 Generates an uninitialized temporary buffer of the given size and type, and returns it as type memref<? x $tp> (staticShape=false) or memref<$sz x $tp> (staticShape=true). More...
 
Value mlir::sparse_tensor::genAllocaScalar (OpBuilder &builder, Location loc, Type tp)
 Generates an uninitialized temporary buffer with room for one value of the given type, and returns the memref<$tp>. More...
 
Value mlir::sparse_tensor::allocaBuffer (OpBuilder &builder, Location loc, ValueRange values)
 Generates a temporary buffer, initializes it with the given contents, and returns it as type memref<? x $tp> (rather than specifying the size of the buffer). More...
 
Value mlir::sparse_tensor::allocDenseTensor (OpBuilder &builder, Location loc, RankedTensorType tensorTp, ValueRange sizes)
 Generates code to allocate a buffer of the given type, and zero initialize it. More...
 
void mlir::sparse_tensor::deallocDenseTensor (OpBuilder &builder, Location loc, Value buffer)
 Generates code to deallocate a dense buffer. More...
 
void mlir::sparse_tensor::sizesFromSrc (OpBuilder &builder, SmallVectorImpl< Value > &sizes, Location loc, Value src)
 Populates given sizes array from dense tensor or sparse tensor constant. More...
 
Operationmlir::sparse_tensor::getTop (Operation *op)
 Scans to top of generated loop. More...
 
void mlir::sparse_tensor::foreachInSparseConstant (OpBuilder &builder, Location loc, SparseElementsAttr attr, AffineMap order, function_ref< void(ArrayRef< Value >, Value)> callback)
 Iterate over a sparse constant, generates constantOp for value and coordinates. More...
 
SmallVector< Valuemlir::sparse_tensor::loadAll (OpBuilder &builder, Location loc, size_t size, Value mem, size_t offsetIdx=0, Value offsetVal=Value())
 Loads size-many values from the memref, which must have rank-1 and size greater-or-equal to size. More...
 
void mlir::sparse_tensor::storeAll (OpBuilder &builder, Location loc, Value mem, ValueRange vs, size_t offsetIdx=0, Value offsetVal=Value())
 Stores all the values of vs into the memref mem, which must have rank-1 and size greater-or-equal to vs.size(). More...
 
TypedValue< BaseMemRefTypemlir::sparse_tensor::genToMemref (OpBuilder &builder, Location loc, Value tensor)
 
Value mlir::sparse_tensor::createOrFoldSliceOffsetOp (OpBuilder &builder, Location loc, Value tensor, Dimension dim)
 Generates code to retrieve the slice offset for the sparse tensor slice, return a constant if the offset is statically known. More...
 
Value mlir::sparse_tensor::createOrFoldSliceStrideOp (OpBuilder &builder, Location loc, Value tensor, Dimension dim)
 Generates code to retrieve the slice slice for the sparse tensor slice, return a constant if the offset is statically known. More...
 
Value mlir::sparse_tensor::genReader (OpBuilder &builder, Location loc, SparseTensorType stt, Value tensor, SmallVectorImpl< Value > &dimSizesValues, Value &dimSizesBuffer)
 Generates code that opens a reader and sets the dimension sizes. More...
 
Value mlir::sparse_tensor::genMapBuffers (OpBuilder &builder, Location loc, SparseTensorType stt, ArrayRef< Value > dimSizesValues, Value dimSizesBuffer, SmallVectorImpl< Value > &lvlSizesValues, Value &dim2lvlBuffer, Value &lvl2dimBuffer)
 Generates code to set up the buffer parameters for a map. More...
 
Value mlir::sparse_tensor::constantZero (OpBuilder &builder, Location loc, Type tp)
 Generates a 0-valued constant of the given type. More...
 
Value mlir::sparse_tensor::constantOne (OpBuilder &builder, Location loc, Type tp)
 Generates a 1-valued constant of the given type. More...
 
Value mlir::sparse_tensor::constantIndex (OpBuilder &builder, Location loc, int64_t i)
 Generates a constant of index type. More...
 
Value mlir::sparse_tensor::constantI64 (OpBuilder &builder, Location loc, int64_t i)
 Generates a constant of i64 type. More...
 
Value mlir::sparse_tensor::constantI32 (OpBuilder &builder, Location loc, int32_t i)
 Generates a constant of i32 type. More...
 
Value mlir::sparse_tensor::constantI16 (OpBuilder &builder, Location loc, int16_t i)
 Generates a constant of i16 type. More...
 
Value mlir::sparse_tensor::constantI8 (OpBuilder &builder, Location loc, int8_t i)
 Generates a constant of i8 type. More...
 
Value mlir::sparse_tensor::constantI1 (OpBuilder &builder, Location loc, bool b)
 Generates a constant of i1 type. More...
 
Value mlir::sparse_tensor::constantAction (OpBuilder &builder, Location loc, Action action)
 Generates a constant of the given Action. More...
 
Value mlir::sparse_tensor::constantOverheadTypeEncoding (OpBuilder &builder, Location loc, unsigned width)
 Generates a constant of the internal type-encoding for overhead storage. More...
 
Value mlir::sparse_tensor::constantPosTypeEncoding (OpBuilder &builder, Location loc, SparseTensorEncodingAttr enc)
 Generates a constant of the internal type-encoding for position overhead storage. More...
 
Value mlir::sparse_tensor::constantCrdTypeEncoding (OpBuilder &builder, Location loc, SparseTensorEncodingAttr enc)
 Generates a constant of the internal type-encoding for coordinate overhead storage. More...
 
Value mlir::sparse_tensor::constantPrimaryTypeEncoding (OpBuilder &builder, Location loc, Type elemTp)
 Generates a constant of the internal type-encoding for primary storage. More...
 
Value mlir::sparse_tensor::constantLevelTypeEncoding (OpBuilder &builder, Location loc, LevelType lt)
 Generates a constant of the internal dimension level type encoding. More...
 
Value mlir::sparse_tensor::genValFromAttr (OpBuilder &builder, Location loc, Attribute attr)
 
bool mlir::sparse_tensor::isZeroRankedTensorOrScalar (Type type)