MLIR 22.0.0git
SparseTensor.h File Reference
#include "mlir-c/AffineMap.h"
#include "mlir-c/IR.h"
#include "mlir/Dialect/SparseTensor/Transforms/Passes.capi.h.inc"

Go to the source code of this file.

Typedefs

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

Enumerations

enum  MlirSparseTensorLevelFormat {
  MLIR_SPARSE_TENSOR_LEVEL_DENSE = 0x000000010000 , MLIR_SPARSE_TENSOR_LEVEL_BATCH = 0x000000020000 , MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED = 0x000000040000 , MLIR_SPARSE_TENSOR_LEVEL_SINGLETON = 0x000000080000 ,
  MLIR_SPARSE_TENSOR_LEVEL_LOOSE_COMPRESSED = 0x000000100000 , MLIR_SPARSE_TENSOR_LEVEL_N_OUT_OF_M = 0x000000200000
}
enum  MlirSparseTensorLevelPropertyNondefault { MLIR_SPARSE_PROPERTY_NON_UNIQUE = 0x0001 , MLIR_SPARSE_PROPERTY_NON_ORDERED = 0x0002 , MLIR_SPARSE_PROPERTY_SOA = 0x0004 }

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.
MLIR_CAPI_EXPORTED 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.
MLIR_CAPI_EXPORTED intptr_t mlirSparseTensorEncodingGetLvlRank (MlirAttribute attr)
 Returns the level-rank of the sparse_tensor.encoding attribute.
MLIR_CAPI_EXPORTED MlirSparseTensorLevelType mlirSparseTensorEncodingAttrGetLvlType (MlirAttribute attr, intptr_t lvl)
 Returns a specified level-type of the sparse_tensor.encoding attribute.
MLIR_CAPI_EXPORTED enum MlirSparseTensorLevelFormat mlirSparseTensorEncodingAttrGetLvlFmt (MlirAttribute attr, intptr_t lvl)
 Returns a specified level-format of the sparse_tensor.encoding attribute.
MLIR_CAPI_EXPORTED MlirAffineMap mlirSparseTensorEncodingAttrGetDimToLvl (MlirAttribute attr)
 Returns the dimension-to-level mapping of the sparse_tensor.encoding attribute.
MLIR_CAPI_EXPORTED MlirAffineMap mlirSparseTensorEncodingAttrGetLvlToDim (MlirAttribute attr)
 Returns the level-to-dimension mapping of the sparse_tensor.encoding attribute.
MLIR_CAPI_EXPORTED int mlirSparseTensorEncodingAttrGetPosWidth (MlirAttribute attr)
 Returns the position bitwidth of the sparse_tensor.encoding attribute.
MLIR_CAPI_EXPORTED int mlirSparseTensorEncodingAttrGetCrdWidth (MlirAttribute attr)
 Returns the coordinate bitwidth of the sparse_tensor.encoding attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirSparseTensorEncodingAttrGetExplicitVal (MlirAttribute attr)
 Returns the explicit value of the sparse_tensor.encoding attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirSparseTensorEncodingAttrGetImplicitVal (MlirAttribute attr)
 Returns the implicit value of the sparse_tensor.encoding attribute.
MLIR_CAPI_EXPORTED unsigned mlirSparseTensorEncodingAttrGetStructuredN (MlirSparseTensorLevelType lvlType)
MLIR_CAPI_EXPORTED unsigned mlirSparseTensorEncodingAttrGetStructuredM (MlirSparseTensorLevelType lvlType)
MLIR_CAPI_EXPORTED MlirSparseTensorLevelType mlirSparseTensorEncodingAttrBuildLvlType (enum MlirSparseTensorLevelFormat lvlFmt, const enum MlirSparseTensorLevelPropertyNondefault *properties, unsigned propSize, unsigned n, unsigned m)

Typedef Documentation

◆ MlirSparseTensorLevelType

typedef uint64_t MlirSparseTensorLevelType

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

See the documentation in SparseTensorAttrDefs.td for their meaning.

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

Definition at line 28 of file SparseTensor.h.

Enumeration Type Documentation

◆ MlirSparseTensorLevelFormat

Enumerator
MLIR_SPARSE_TENSOR_LEVEL_DENSE 
MLIR_SPARSE_TENSOR_LEVEL_BATCH 
MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED 
MLIR_SPARSE_TENSOR_LEVEL_SINGLETON 
MLIR_SPARSE_TENSOR_LEVEL_LOOSE_COMPRESSED 
MLIR_SPARSE_TENSOR_LEVEL_N_OUT_OF_M 

Definition at line 30 of file SparseTensor.h.

◆ MlirSparseTensorLevelPropertyNondefault

Enumerator
MLIR_SPARSE_PROPERTY_NON_UNIQUE 
MLIR_SPARSE_PROPERTY_NON_ORDERED 
MLIR_SPARSE_PROPERTY_SOA 

Definition at line 39 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 45 of file SparseTensor.cpp.

References unwrap().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrBuildLvlType()

MLIR_CAPI_EXPORTED MlirSparseTensorLevelType mlirSparseTensorEncodingAttrBuildLvlType ( enum MlirSparseTensorLevelFormat lvlFmt,
const enum MlirSparseTensorLevelPropertyNondefault * properties,
unsigned propSize,
unsigned n,
unsigned m )

◆ mlirSparseTensorEncodingAttrGet()

MLIR_CAPI_EXPORTED 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 unwrap(), and wrap().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGetCrdWidth()

MLIR_CAPI_EXPORTED int mlirSparseTensorEncodingAttrGetCrdWidth ( MlirAttribute attr)

Returns the coordinate bitwidth of the sparse_tensor.encoding attribute.

Definition at line 94 of file SparseTensor.cpp.

References unwrap().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGetDimToLvl()

MLIR_CAPI_EXPORTED 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().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGetExplicitVal()

MLIR_CAPI_EXPORTED 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().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGetImplicitVal()

MLIR_CAPI_EXPORTED 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().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGetLvlFmt()

MLIR_CAPI_EXPORTED enum MlirSparseTensorLevelFormat mlirSparseTensorEncodingAttrGetLvlFmt ( MlirAttribute attr,
intptr_t lvl )

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

Definition at line 84 of file SparseTensor.cpp.

References mlir::sparse_tensor::LevelType::getLvlFmt(), and mlirSparseTensorEncodingAttrGetLvlType().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGetLvlToDim()

MLIR_CAPI_EXPORTED 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().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGetLvlType()

MLIR_CAPI_EXPORTED 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.

References unwrap().

Referenced by mlirSparseTensorEncodingAttrGetLvlFmt(), and populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGetPosWidth()

MLIR_CAPI_EXPORTED int mlirSparseTensorEncodingAttrGetPosWidth ( MlirAttribute attr)

Returns the position bitwidth of the sparse_tensor.encoding attribute.

Definition at line 90 of file SparseTensor.cpp.

References unwrap().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGetStructuredM()

MLIR_CAPI_EXPORTED unsigned mlirSparseTensorEncodingAttrGetStructuredM ( MlirSparseTensorLevelType lvlType)

Definition at line 126 of file SparseTensor.cpp.

References mlir::sparse_tensor::getM().

Referenced by populateDialectSparseTensorSubmodule().

◆ mlirSparseTensorEncodingAttrGetStructuredN()

MLIR_CAPI_EXPORTED unsigned mlirSparseTensorEncodingAttrGetStructuredN ( MlirSparseTensorLevelType lvlType)

Definition at line 121 of file SparseTensor.cpp.

References mlir::sparse_tensor::getN().

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 73 of file SparseTensor.cpp.

References unwrap().

Referenced by populateDialectSparseTensorSubmodule().