MLIR  19.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)
 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...
 
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 43 of file SparseTensor.cpp.

References unwrap().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrBuildLvlType()

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

◆ mlirSparseTensorEncodingAttrGet()

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

Creates a sparse_tensor.encoding attribute with the given parameters.

Definition at line 48 of file SparseTensor.cpp.

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

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGetCrdWidth()

int mlirSparseTensorEncodingAttrGetCrdWidth ( MlirAttribute  attr)

Returns the coordinate bitwidth of the sparse_tensor.encoding attribute.

Definition at line 90 of file SparseTensor.cpp.

References unwrap().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGetDimToLvl()

MlirAffineMap mlirSparseTensorEncodingAttrGetDimToLvl ( MlirAttribute  attr)

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

Definition at line 61 of file SparseTensor.cpp.

References unwrap(), and wrap().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGetLvlFmt()

enum MlirSparseTensorLevelFormat mlirSparseTensorEncodingAttrGetLvlFmt ( MlirAttribute  attr,
intptr_t  lvl 
)

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

Definition at line 74 of file SparseTensor.cpp.

References unwrap().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGetLvlToDim()

MlirAffineMap mlirSparseTensorEncodingAttrGetLvlToDim ( MlirAttribute  attr)

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

Definition at line 65 of file SparseTensor.cpp.

References unwrap(), and wrap().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGetLvlType()

MlirSparseTensorLevelType mlirSparseTensorEncodingAttrGetLvlType ( MlirAttribute  attr,
intptr_t  lvl 
)

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

Definition at line 74 of file SparseTensor.cpp.

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGetPosWidth()

int mlirSparseTensorEncodingAttrGetPosWidth ( MlirAttribute  attr)

Returns the position bitwidth of the sparse_tensor.encoding attribute.

Definition at line 86 of file SparseTensor.cpp.

References unwrap().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGetStructuredM()

unsigned mlirSparseTensorEncodingAttrGetStructuredM ( MlirSparseTensorLevelType  lvlType)

Definition at line 113 of file SparseTensor.cpp.

References mlir::sparse_tensor::getM().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGetStructuredN()

unsigned mlirSparseTensorEncodingAttrGetStructuredN ( MlirSparseTensorLevelType  lvlType)

Definition at line 108 of file SparseTensor.cpp.

References mlir::sparse_tensor::getN().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingGetLvlRank()

intptr_t mlirSparseTensorEncodingGetLvlRank ( MlirAttribute  attr)

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

Definition at line 69 of file SparseTensor.cpp.

References unwrap().

Referenced by populateDialectSparseTensorSubmodule().

◆ MlirSparseTensorLevelFormat()