13 #ifndef MLIR_DIALECT_SPARSETENSOR_IR_SPARSETENSORSTORAGELAYOUT_H_
14 #define MLIR_DIALECT_SPARSETENSOR_IR_SPARSETENSORSTORAGELAYOUT_H_
20 namespace sparse_tensor {
92 PosMemRef =
static_cast<uint32_t
>(StorageSpecifierKind::PosMemSize),
93 CrdMemRef =
static_cast<uint32_t
>(StorageSpecifierKind::CrdMemSize),
94 ValMemRef =
static_cast<uint32_t
>(StorageSpecifierKind::ValMemSize)
99 return static_cast<StorageSpecifierKind
>(kind);
103 assert(kind != StorageSpecifierKind::LvlSize);
137 std::optional<Level> lvl)
const {
148 std::pair<FieldIndex, unsigned>
150 std::optional<Level> lvl)
const;
153 const SparseTensorEncodingAttr enc;
169 SparseTensorEncodingAttr enc,
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
A wrapper around RankedTensorType, which has three goals:
Provides methods to access fields of a sparse tensor with the given encoding.
unsigned getNumDataFields() const
Gets the total number of data fields (coordinate arrays, position arrays, and a value array) for the ...
unsigned getNumFields() const
Gets the total number of fields for the given sparse tensor encoding.
StorageLayout(SparseTensorEncodingAttr enc)
FieldIndex getMemRefFieldIndex(SparseTensorFieldKind kind, std::optional< Level > lvl) const
Gets the field index for required field.
void foreachField(llvm::function_ref< bool(FieldIndex, SparseTensorFieldKind, Level, LevelType)>) const
For each field that will be allocated for the given sparse tensor encoding, calls the callback with t...
StorageLayout(const SparseTensorType &stt)
std::pair< FieldIndex, unsigned > getFieldIndexAndStride(SparseTensorFieldKind kind, std::optional< Level > lvl) const
void foreachFieldAndTypeInSparseTensor(SparseTensorType, llvm::function_ref< bool(Type, FieldIndex, SparseTensorFieldKind, Level, LevelType)>)
unsigned FieldIndex
The type of field indices.
uint64_t Level
The type of level identifiers and level-ranks.
SparseTensorFieldKind toFieldKind(StorageSpecifierKind kind)
unsigned getNumDataFieldsFromEncoding(SparseTensorEncodingAttr enc)
unsigned getNumFieldsFromEncoding(SparseTensorEncodingAttr enc)
SparseTensorFieldKind
===-------------------------------------------------------------------—===// The sparse tensor storag...
StorageSpecifierKind toSpecifierKind(SparseTensorFieldKind kind)
void foreachFieldInSparseTensor(SparseTensorEncodingAttr enc, llvm::function_ref< bool(FieldIndex, SparseTensorFieldKind, Level, LevelType)> callback)
Include the generated interface declarations.
This enum defines all the sparse representations supportable by the SparseTensor dialect.