MLIR
20.0.0git
|
This enum defines all the sparse representations supportable by the SparseTensor dialect. More...
#include "mlir/Dialect/SparseTensor/IR/Enums.h"
Public Member Functions | |
constexpr | LevelType (uint64_t bits) |
Explicit conversion from uint64_t. More... | |
LevelType (LevelFormat f) | |
Constructs a LevelType with the given format using all default properties. More... | |
operator uint64_t () const | |
Converts to uint64_t. More... | |
bool | operator== (const LevelType lhs) const |
bool | operator!= (const LevelType lhs) const |
LevelType | stripStorageIrrelevantProperties () const |
constexpr uint64_t | getN () const |
Get N of NOutOfM level type. More... | |
constexpr uint64_t | getM () const |
Get M of NOutOfM level type. More... | |
constexpr LevelFormat | getLvlFmt () const |
Get the LevelFormat of the LevelType . More... | |
template<LevelFormat... fmt> | |
constexpr bool | isa () const |
Check if the LevelType is in the LevelFormat . More... | |
template<LevelPropNonDefault p> | |
constexpr bool | isa () const |
Check if the LevelType has the properties. More... | |
constexpr bool | hasSparseSemantic () const |
Check if the LevelType is considered to be sparse. More... | |
constexpr bool | hasDenseSemantic () const |
Check if the LevelType is considered to be dense-like. More... | |
constexpr bool | isWithPosLT () const |
Check if the LevelType needs positions array. More... | |
constexpr bool | isWithCrdLT () const |
Check if the LevelType needs coordinates array. More... | |
constexpr unsigned | getNumBuffer () const |
std::string | toMLIRString () const |
Static Public Member Functions | |
static constexpr bool | isValidLvlBits (uint64_t lvlBits) |
Check that the LevelType contains a valid (possibly undefined) value. More... | |
static std::optional< LevelType > | buildLvlType (LevelFormat lf, const std::vector< LevelPropNonDefault > &properties, uint64_t n=0, uint64_t m=0) |
Convert a LevelFormat to its corresponding LevelType with the given properties. More... | |
static std::optional< LevelType > | buildLvlType (LevelFormat lf, bool ordered, bool unique, uint64_t n=0, uint64_t m=0) |
This enum defines all the sparse representations supportable by the SparseTensor dialect.
We use a lightweight encoding to encode the "format" per se (dense, compressed, singleton, loose_compressed, n-out-of-m), the "properties" (ordered, unique) as well as n and m when the format is NOutOfM. The encoding is chosen for performance of the runtime library, and thus may change in future versions; consequently, client code should use the predicate functions defined below, rather than relying on knowledge about the particular binary encoding.
The Undef
"format" is a special value used internally for cases where we need to store an undefined or indeterminate LevelType
. It should not be used externally, since it does not indicate an actual/representable format.
|
inlineexplicitconstexpr |
Explicit conversion from uint64_t.
Definition at line 282 of file Enums.h.
References isValidLvlBits().
Referenced by stripStorageIrrelevantProperties().
|
inline |
Constructs a LevelType with the given format using all default properties.
Definition at line 287 of file Enums.h.
References isValidLvlBits().
|
inlinestatic |
|
inlinestatic |
|
inlineconstexpr |
Get the LevelFormat
of the LevelType
.
Definition at line 320 of file Enums.h.
Referenced by mlir::sparse_tensor::getLevelFormat(), isa(), mlir::sparse_tensor::makeSparseTensorLevel(), and toMLIRString().
|
inlineconstexpr |
Get M of NOutOfM level type.
Definition at line 314 of file Enums.h.
Referenced by mlir::sparse_tensor::getM(), and toMLIRString().
|
inlineconstexpr |
Get N of NOutOfM level type.
Definition at line 308 of file Enums.h.
Referenced by mlir::sparse_tensor::getN(), and toMLIRString().
|
inlineconstexpr |
Definition at line 360 of file Enums.h.
References hasDenseSemantic(), and isWithPosLT().
Referenced by mlir::sparse_tensor::makeSparseTensorLevel().
|
inlineconstexpr |
Check if the LevelType
is considered to be dense-like.
Definition at line 343 of file Enums.h.
Referenced by findAffine(), genIf(), getAllTidLvlsInLatPoints(), getNumBuffer(), and getNumNonTrivialIdxExpOnSparseLvls().
|
inlineconstexpr |
Check if the LevelType
is considered to be sparse.
Definition at line 337 of file Enums.h.
References mlir::sparse_tensor::Compressed, isa(), mlir::sparse_tensor::LooseCompressed, mlir::sparse_tensor::NOutOfM, and mlir::sparse_tensor::Singleton.
Referenced by genIf(), isWithCrdLT(), and shouldTryParallize().
|
inlineconstexpr |
Check if the LevelType
is in the LevelFormat
.
Definition at line 326 of file Enums.h.
References getLvlFmt().
Referenced by hasSparseSemantic(), mlir::sparse_tensor::isBatchLT(), mlir::sparse_tensor::isCompressedLT(), mlir::sparse_tensor::isDenseLT(), mlir::sparse_tensor::isLooseCompressedLT(), mlir::sparse_tensor::isNOutOfMLT(), mlir::sparse_tensor::isOrderedLT(), mlir::sparse_tensor::isSingletonLT(), mlir::sparse_tensor::isUndefLT(), and mlir::sparse_tensor::isUniqueLT().
|
inlineconstexpr |
|
inlinestaticconstexpr |
Check that the LevelType
contains a valid (possibly undefined) value.
Definition at line 241 of file Enums.h.
References mlir::sparse_tensor::Batch, mlir::sparse_tensor::Compressed, mlir::sparse_tensor::Dense, mlir::sparse_tensor::isAnyOfFmt(), mlir::sparse_tensor::LooseCompressed, mlir::sparse_tensor::NOutOfM, mlir::sparse_tensor::Singleton, and mlir::sparse_tensor::Undef.
Referenced by mlir::sparse_tensor::isValidLT(), and LevelType().
|
inlineconstexpr |
Check if the LevelType
needs coordinates array.
Definition at line 354 of file Enums.h.
References hasSparseSemantic().
Referenced by mlir::sparse_tensor::isWithCrdLT(), and mlir::sparse_tensor::makeSparseTensorLevel().
|
inlineconstexpr |
Check if the LevelType
needs positions array.
Definition at line 348 of file Enums.h.
Referenced by getNumBuffer(), mlir::sparse_tensor::isWithPosLT(), and mlir::sparse_tensor::makeSparseTensorLevel().
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
Definition at line 299 of file Enums.h.
References LevelType(), and mlir::sparse_tensor::SoA.
Referenced by getNormalizedEncodingForSpecifier().
|
inline |
Definition at line 364 of file Enums.h.
References getLvlFmt(), getM(), getN(), mlir::sparse_tensor::Nonordered, mlir::sparse_tensor::Nonunique, mlir::sparse_tensor::SoA, mlir::sparse_tensor::toFormatString(), and mlir::sparse_tensor::toPropString().
Referenced by mlir::sparse_tensor::toMLIRString().