MLIR 22.0.0git
CodegenUtils.h File Reference

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

namespace  mlir
 Include the generated interface declarations.
namespace  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.
OverheadType mlir::sparse_tensor::overheadTypeEncoding (Type tp)
 Converts an overhead storage type to its internal type-encoding.
Type mlir::sparse_tensor::getOverheadType (Builder &builder, OverheadType ot)
 Converts the internal type-encoding for overhead storage to an mlir::Type.
OverheadType mlir::sparse_tensor::posTypeEncoding (SparseTensorEncodingAttr enc)
 Returns the OverheadType for position overhead storage.
OverheadType mlir::sparse_tensor::crdTypeEncoding (SparseTensorEncodingAttr enc)
 Returns the OverheadType for coordinate overhead storage.
StringRef mlir::sparse_tensor::overheadTypeFunctionSuffix (OverheadType ot)
 Convert OverheadType to its function-name suffix.
StringRef mlir::sparse_tensor::overheadTypeFunctionSuffix (Type overheadTp)
 Converts an overhead storage type to its function-name suffix.
PrimaryType mlir::sparse_tensor::primaryTypeEncoding (Type elemTp)
 Converts a primary storage type to its internal type-encoding.
StringRef mlir::sparse_tensor::primaryTypeFunctionSuffix (PrimaryType pt)
 Convert PrimaryType to its function-name suffix.
StringRef mlir::sparse_tensor::primaryTypeFunctionSuffix (Type elemTp)
 Converts a primary storage type to its function-name suffix.
Value mlir::sparse_tensor::genCast (OpBuilder &builder, Location loc, Value value, Type dstTy)
 Add type casting between arith and index types when needed.
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).
Value mlir::sparse_tensor::genIndexLoad (OpBuilder &builder, Location loc, Value mem, ValueRange s)
 Generates a pointer/index load from the sparse storage scheme.
TypedAttr mlir::sparse_tensor::getOneAttr (Builder &builder, Type tp)
 Generates a 1-valued attribute of the given type.
Value mlir::sparse_tensor::genIsNonzero (OpBuilder &builder, Location loc, Value v)
 Generates the comparison v != 0 where v is of numeric type.
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.
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.
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).
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.
Type mlir::sparse_tensor::getOpaquePointerType (MLIRContext *ctx)
 Returns the equivalent of void* for opaque arguments to the execution engine.
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<?
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<?
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>.
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<?
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.
void mlir::sparse_tensor::deallocDenseTensor (OpBuilder &builder, Location loc, Value buffer)
 Generates code to deallocate a dense buffer.
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.
Operationmlir::sparse_tensor::getTop (Operation *op)
 Scans to top of generated loop.
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.
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.
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().
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.
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.
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.
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.
Value mlir::sparse_tensor::constantZero (OpBuilder &builder, Location loc, Type tp)
 Generates a 0-valued constant of the given type.
Value mlir::sparse_tensor::constantOne (OpBuilder &builder, Location loc, Type tp)
 Generates a 1-valued constant of the given type.
Value mlir::sparse_tensor::constantIndex (OpBuilder &builder, Location loc, int64_t i)
 Generates a constant of index type.
Value mlir::sparse_tensor::constantI64 (OpBuilder &builder, Location loc, int64_t i)
 Generates a constant of i64 type.
Value mlir::sparse_tensor::constantI32 (OpBuilder &builder, Location loc, int32_t i)
 Generates a constant of i32 type.
Value mlir::sparse_tensor::constantI16 (OpBuilder &builder, Location loc, int16_t i)
 Generates a constant of i16 type.
Value mlir::sparse_tensor::constantI8 (OpBuilder &builder, Location loc, int8_t i)
 Generates a constant of i8 type.
Value mlir::sparse_tensor::constantI1 (OpBuilder &builder, Location loc, bool b)
 Generates a constant of i1 type.
Value mlir::sparse_tensor::constantAction (OpBuilder &builder, Location loc, Action action)
 Generates a constant of the given Action.
Value mlir::sparse_tensor::constantOverheadTypeEncoding (OpBuilder &builder, Location loc, unsigned width)
 Generates a constant of the internal type-encoding for overhead storage.
Value mlir::sparse_tensor::constantPosTypeEncoding (OpBuilder &builder, Location loc, SparseTensorEncodingAttr enc)
 Generates a constant of the internal type-encoding for position overhead storage.
Value mlir::sparse_tensor::constantCrdTypeEncoding (OpBuilder &builder, Location loc, SparseTensorEncodingAttr enc)
 Generates a constant of the internal type-encoding for coordinate overhead storage.
Value mlir::sparse_tensor::constantPrimaryTypeEncoding (OpBuilder &builder, Location loc, Type elemTp)
 Generates a constant of the internal type-encoding for primary storage.
Value mlir::sparse_tensor::constantLevelTypeEncoding (OpBuilder &builder, Location loc, LevelType lt)
 Generates a constant of the internal dimension level type encoding.
Value mlir::sparse_tensor::genValFromAttr (OpBuilder &builder, Location loc, Attribute attr)
bool mlir::sparse_tensor::isZeroRankedTensorOrScalar (Type type)