MLIR  17.0.0git
Enumerations | Functions
SparseTensor.h File Reference
#include "mlir-c/AffineMap.h"
#include "mlir-c/IR.h"
#include "mlir/Dialect/SparseTensor/Transforms/Passes.capi.h.inc"
+ Include dependency graph for SparseTensor.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  MlirSparseTensorDimLevelType {
  MLIR_SPARSE_TENSOR_DIM_LEVEL_DENSE = 4 , MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED = 8 , MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NU = 9 , MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NO = 10 ,
  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NU_NO = 11 , MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON = 16 , MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NU = 17 , MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NO = 18 ,
  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NU_NO = 19
}
 Dimension level types (and properties) that define sparse tensors. More...
 

Functions

 MLIR_DECLARE_CAPI_DIALECT_REGISTRATION (SparseTensor, sparse_tensor)
 
MLIR_CAPI_EXPORTED bool mlirAttributeIsASparseTensorEncodingAttr (MlirAttribute attr)
 Checks whether the given attribute is a sparse_tensor.encoding attribute. More...
 
MLIR_CAPI_EXPORTED MlirAttribute mlirSparseTensorEncodingAttrGet (MlirContext ctx, intptr_t lvlRank, enum MlirSparseTensorDimLevelType const *dimLevelTypes, MlirAffineMap dimOrdering, MlirAffineMap higherOrdering, int posWidth, int crdWidth)
 Creates a sparse_tensor.encoding attribute with the given parameters. More...
 
MLIR_CAPI_EXPORTED intptr_t mlirSparseTensorEncodingGetLvlRank (MlirAttribute attr)
 Returns the level-rank of the sparse_tensor.encoding attribute. More...
 
MLIR_CAPI_EXPORTED enum MlirSparseTensorDimLevelType mlirSparseTensorEncodingAttrGetDimLevelType (MlirAttribute attr, intptr_t lvl)
 Returns a specified level-type of the sparse_tensor.encoding attribute. More...
 
MLIR_CAPI_EXPORTED MlirAffineMap mlirSparseTensorEncodingAttrGetDimOrdering (MlirAttribute attr)
 Returns the dimension-ordering of the sparse_tensor.encoding attribute. More...
 
MLIR_CAPI_EXPORTED MlirAffineMap mlirSparseTensorEncodingAttrGetHigherOrdering (MlirAttribute attr)
 Returns the higher-ordering of the sparse_tensor.encoding attribute. More...
 
MLIR_CAPI_EXPORTED int mlirSparseTensorEncodingAttrGetPosWidth (MlirAttribute attr)
 Returns the position bitwidth of the sparse_tensor.encoding attribute. More...
 
MLIR_CAPI_EXPORTED int mlirSparseTensorEncodingAttrGetCrdWidth (MlirAttribute attr)
 Returns the coordinate bitwidth of the sparse_tensor.encoding attribute. More...
 

Enumeration Type Documentation

◆ MlirSparseTensorDimLevelType

Dimension level types (and properties) that define sparse tensors.

See the documentation in SparseTensorAttrDefs.td for their meaning.

These correspond to SparseTensorEncodingAttr::DimLevelType in the C++ API. If updating, keep them in sync and update the static_assert in the impl file.

Enumerator
MLIR_SPARSE_TENSOR_DIM_LEVEL_DENSE 
MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED 
MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NU 
MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NO 
MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NU_NO 
MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON 
MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NU 
MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NO 
MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NU_NO 

Definition at line 28 of file SparseTensor.h.

Function Documentation

◆ MLIR_DECLARE_CAPI_DIALECT_REGISTRATION()

MLIR_DECLARE_CAPI_DIALECT_REGISTRATION ( SparseTensor  ,
sparse_tensor   
)

◆ mlirAttributeIsASparseTensorEncodingAttr()

MLIR_CAPI_EXPORTED bool mlirAttributeIsASparseTensorEncodingAttr ( MlirAttribute  attr)

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

Definition at line 44 of file SparseTensor.cpp.

References unwrap().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGet()

MLIR_CAPI_EXPORTED MlirAttribute mlirSparseTensorEncodingAttrGet ( MlirContext  ctx,
intptr_t  lvlRank,
enum MlirSparseTensorDimLevelType const *  dimLevelTypes,
MlirAffineMap  dimOrdering,
MlirAffineMap  higherOrdering,
int  posWidth,
int  crdWidth 
)

Creates a sparse_tensor.encoding attribute with the given parameters.

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGetCrdWidth()

MLIR_CAPI_EXPORTED int mlirSparseTensorEncodingAttrGetCrdWidth ( MlirAttribute  attr)

Returns the coordinate bitwidth of the sparse_tensor.encoding attribute.

Definition at line 86 of file SparseTensor.cpp.

References unwrap().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGetDimLevelType()

MLIR_CAPI_EXPORTED enum MlirSparseTensorDimLevelType mlirSparseTensorEncodingAttrGetDimLevelType ( MlirAttribute  attr,
intptr_t  lvl 
)

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

Definition at line 77 of file SparseTensor.cpp.

References unwrap().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGetDimOrdering()

MLIR_CAPI_EXPORTED MlirAffineMap mlirSparseTensorEncodingAttrGetDimOrdering ( MlirAttribute  attr)

Returns the dimension-ordering of the sparse_tensor.encoding attribute.

Definition at line 62 of file SparseTensor.cpp.

References unwrap(), and wrap().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGetHigherOrdering()

MLIR_CAPI_EXPORTED MlirAffineMap mlirSparseTensorEncodingAttrGetHigherOrdering ( MlirAttribute  attr)

Returns the higher-ordering of the sparse_tensor.encoding attribute.

Definition at line 67 of file SparseTensor.cpp.

References unwrap(), and wrap().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGetPosWidth()

MLIR_CAPI_EXPORTED int mlirSparseTensorEncodingAttrGetPosWidth ( MlirAttribute  attr)

Returns the position bitwidth of the sparse_tensor.encoding attribute.

Definition at line 82 of file SparseTensor.cpp.

References unwrap().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingGetLvlRank()

MLIR_CAPI_EXPORTED intptr_t mlirSparseTensorEncodingGetLvlRank ( MlirAttribute  attr)

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

Definition at line 72 of file SparseTensor.cpp.

References unwrap().

Referenced by populateDialectSparseTensorSubmodule().