MLIR  20.0.0git
Functions
SparseTensor.cpp File Reference
#include "mlir-c/Dialect/SparseTensor.h"
#include "mlir-c/IR.h"
#include "mlir/CAPI/AffineMap.h"
#include "mlir/CAPI/Registration.h"
#include "mlir/Dialect/SparseTensor/IR/SparseTensor.h"
#include "mlir/Support/LLVM.h"

Go to the source code of this file.

Functions

 MLIR_DEFINE_CAPI_DIALECT_REGISTRATION (SparseTensor, sparse_tensor, mlir::sparse_tensor::SparseTensorDialect) static_assert(static_cast< int >(MLIR_SPARSE_TENSOR_LEVEL_DENSE)
 
 MlirSparseTensorLevelFormat (C-API) and LevelFormat(C++) mismatch")
 
bool mlirAttributeIsASparseTensorEncodingAttr (MlirAttribute attr)
 Checks whether the given attribute is a sparse_tensor.encoding attribute. More...
 
MlirAttribute mlirSparseTensorEncodingAttrGet (MlirContext ctx, intptr_t lvlRank, MlirSparseTensorLevelType const *lvlTypes, MlirAffineMap dimToLvl, MlirAffineMap lvlToDim, int posWidth, int crdWidth, MlirAttribute explicitVal, MlirAttribute implicitVal)
 Creates a sparse_tensor.encoding attribute with the given parameters. More...
 
MlirAffineMap mlirSparseTensorEncodingAttrGetDimToLvl (MlirAttribute attr)
 Returns the dimension-to-level mapping of the sparse_tensor.encoding attribute. More...
 
MlirAffineMap mlirSparseTensorEncodingAttrGetLvlToDim (MlirAttribute attr)
 Returns the level-to-dimension mapping of the sparse_tensor.encoding attribute. More...
 
intptr_t mlirSparseTensorEncodingGetLvlRank (MlirAttribute attr)
 Returns the level-rank of the sparse_tensor.encoding attribute. More...
 
MlirSparseTensorLevelType mlirSparseTensorEncodingAttrGetLvlType (MlirAttribute attr, intptr_t lvl)
 Returns a specified level-type of the sparse_tensor.encoding attribute. More...
 
enum MlirSparseTensorLevelFormat mlirSparseTensorEncodingAttrGetLvlFmt (MlirAttribute attr, intptr_t lvl)
 Returns a specified level-format of the sparse_tensor.encoding attribute. More...
 
int mlirSparseTensorEncodingAttrGetPosWidth (MlirAttribute attr)
 Returns the position bitwidth of the sparse_tensor.encoding attribute. More...
 
int mlirSparseTensorEncodingAttrGetCrdWidth (MlirAttribute attr)
 Returns the coordinate bitwidth of the sparse_tensor.encoding attribute. More...
 
MlirAttribute mlirSparseTensorEncodingAttrGetExplicitVal (MlirAttribute attr)
 Returns the explicit value of the sparse_tensor.encoding attribute. More...
 
MlirAttribute mlirSparseTensorEncodingAttrGetImplicitVal (MlirAttribute attr)
 Returns the implicit value of the sparse_tensor.encoding attribute. More...
 
MlirSparseTensorLevelType mlirSparseTensorEncodingAttrBuildLvlType (enum MlirSparseTensorLevelFormat lvlFmt, const enum MlirSparseTensorLevelPropertyNondefault *properties, unsigned size, unsigned n, unsigned m)
 
unsigned mlirSparseTensorEncodingAttrGetStructuredN (MlirSparseTensorLevelType lvlType)
 
unsigned mlirSparseTensorEncodingAttrGetStructuredM (MlirSparseTensorLevelType lvlType)
 

Function Documentation

◆ MLIR_DEFINE_CAPI_DIALECT_REGISTRATION()

MLIR_DEFINE_CAPI_DIALECT_REGISTRATION ( SparseTensor  ,
sparse_tensor  ,
mlir::sparse_tensor::SparseTensorDialect   
)

◆ mlirAttributeIsASparseTensorEncodingAttr()

bool mlirAttributeIsASparseTensorEncodingAttr ( MlirAttribute  attr)

Checks whether the given attribute is a sparse_tensor.encoding attribute.

Definition at line 45 of file SparseTensor.cpp.

References unwrap().

◆ mlirSparseTensorEncodingAttrBuildLvlType()

MlirSparseTensorLevelType mlirSparseTensorEncodingAttrBuildLvlType ( enum MlirSparseTensorLevelFormat  lvlFmt,
const enum MlirSparseTensorLevelPropertyNondefault properties,
unsigned  size,
unsigned  n,
unsigned  m 
)

Definition at line 106 of file SparseTensor.cpp.

◆ mlirSparseTensorEncodingAttrGet()

MlirAttribute mlirSparseTensorEncodingAttrGet ( MlirContext  ctx,
intptr_t  lvlRank,
MlirSparseTensorLevelType const *  lvlTypes,
MlirAffineMap  dimToLvl,
MlirAffineMap  lvlToDim,
int  posWidth,
int  crdWidth,
MlirAttribute  explicitVal,
MlirAttribute  implicitVal 
)

Creates a sparse_tensor.encoding attribute with the given parameters.

Definition at line 49 of file SparseTensor.cpp.

References mlir::get(), unwrap(), and wrap().

◆ mlirSparseTensorEncodingAttrGetCrdWidth()

int mlirSparseTensorEncodingAttrGetCrdWidth ( MlirAttribute  attr)

Returns the coordinate bitwidth of the sparse_tensor.encoding attribute.

Definition at line 94 of file SparseTensor.cpp.

References unwrap().

◆ mlirSparseTensorEncodingAttrGetDimToLvl()

MlirAffineMap mlirSparseTensorEncodingAttrGetDimToLvl ( MlirAttribute  attr)

Returns the dimension-to-level mapping of the sparse_tensor.encoding attribute.

Definition at line 65 of file SparseTensor.cpp.

References unwrap(), and wrap().

◆ mlirSparseTensorEncodingAttrGetExplicitVal()

MlirAttribute mlirSparseTensorEncodingAttrGetExplicitVal ( MlirAttribute  attr)

Returns the explicit value of the sparse_tensor.encoding attribute.

Definition at line 98 of file SparseTensor.cpp.

References unwrap(), and wrap().

◆ mlirSparseTensorEncodingAttrGetImplicitVal()

MlirAttribute mlirSparseTensorEncodingAttrGetImplicitVal ( MlirAttribute  attr)

Returns the implicit value of the sparse_tensor.encoding attribute.

Definition at line 102 of file SparseTensor.cpp.

References unwrap(), and wrap().

◆ mlirSparseTensorEncodingAttrGetLvlFmt()

enum MlirSparseTensorLevelFormat mlirSparseTensorEncodingAttrGetLvlFmt ( MlirAttribute  attr,
intptr_t  lvl 
)

Returns a specified level-format of the sparse_tensor.encoding attribute.

Definition at line 78 of file SparseTensor.cpp.

References unwrap().

◆ mlirSparseTensorEncodingAttrGetLvlToDim()

MlirAffineMap mlirSparseTensorEncodingAttrGetLvlToDim ( MlirAttribute  attr)

Returns the level-to-dimension mapping of the sparse_tensor.encoding attribute.

Definition at line 69 of file SparseTensor.cpp.

References unwrap(), and wrap().

◆ mlirSparseTensorEncodingAttrGetLvlType()

MlirSparseTensorLevelType mlirSparseTensorEncodingAttrGetLvlType ( MlirAttribute  attr,
intptr_t  lvl 
)

Returns a specified level-type of the sparse_tensor.encoding attribute.

Definition at line 78 of file SparseTensor.cpp.

◆ mlirSparseTensorEncodingAttrGetPosWidth()

int mlirSparseTensorEncodingAttrGetPosWidth ( MlirAttribute  attr)

Returns the position bitwidth of the sparse_tensor.encoding attribute.

Definition at line 90 of file SparseTensor.cpp.

References unwrap().

◆ mlirSparseTensorEncodingAttrGetStructuredM()

unsigned mlirSparseTensorEncodingAttrGetStructuredM ( MlirSparseTensorLevelType  lvlType)

Definition at line 126 of file SparseTensor.cpp.

References mlir::sparse_tensor::getM().

◆ mlirSparseTensorEncodingAttrGetStructuredN()

unsigned mlirSparseTensorEncodingAttrGetStructuredN ( MlirSparseTensorLevelType  lvlType)

Definition at line 121 of file SparseTensor.cpp.

References mlir::sparse_tensor::getN().

◆ mlirSparseTensorEncodingGetLvlRank()

intptr_t mlirSparseTensorEncodingGetLvlRank ( MlirAttribute  attr)

Returns the level-rank of the sparse_tensor.encoding attribute.

Definition at line 73 of file SparseTensor.cpp.

References unwrap().

◆ MlirSparseTensorLevelFormat()