MLIR
20.0.0git
|
Abstract base class for SparseTensorStorage<P,C,V>
.
More...
#include "mlir/ExecutionEngine/SparseTensor/Storage.h"
Public Member Functions | |
SparseTensorStorageBase (uint64_t dimRank, const uint64_t *dimSizes, uint64_t lvlRank, const uint64_t *lvlSizes, const LevelType *lvlTypes, const uint64_t *dim2lvl, const uint64_t *lvl2dim) | |
Constructs a new sparse-tensor storage object with the given encoding. More... | |
virtual | ~SparseTensorStorageBase ()=default |
uint64_t | getDimRank () const |
Gets the number of tensor-dimensions. More... | |
uint64_t | getLvlRank () const |
Gets the number of storage-levels. More... | |
const std::vector< uint64_t > & | getDimSizes () const |
Gets the tensor-dimension sizes array. More... | |
uint64_t | getDimSize (uint64_t d) const |
Safely looks up the size of the given tensor-dimension. More... | |
const std::vector< uint64_t > & | getLvlSizes () const |
Gets the storage-level sizes array. More... | |
uint64_t | getLvlSize (uint64_t l) const |
Safely looks up the size of the given storage-level. More... | |
const std::vector< LevelType > & | getLvlTypes () const |
Gets the level-types array. More... | |
LevelType | getLvlType (uint64_t l) const |
Safely looks up the type of the given level. More... | |
bool | isDenseLvl (uint64_t l) const |
Safely checks if the level uses dense storage. More... | |
bool | isCompressedLvl (uint64_t l) const |
Safely checks if the level uses compressed storage. More... | |
bool | isLooseCompressedLvl (uint64_t l) const |
Safely checks if the level uses loose compressed storage. More... | |
bool | isSingletonLvl (uint64_t l) const |
Safely checks if the level uses singleton storage. More... | |
bool | isNOutOfMLvl (uint64_t l) const |
Safely checks if the level uses n out of m storage. More... | |
bool | isOrderedLvl (uint64_t l) const |
Safely checks if the level is ordered. More... | |
bool | isUniqueLvl (uint64_t l) const |
Safely checks if the level is unique. More... | |
virtual void | endLexInsert ()=0 |
Finalizes lexicographic insertions. More... | |
Protected Member Functions | |
SparseTensorStorageBase (const SparseTensorStorageBase &)=default | |
SparseTensorStorageBase & | operator= (const SparseTensorStorageBase &)=delete |
Protected Attributes | |
const MapRef | map |
const bool | allDense |
Abstract base class for SparseTensorStorage<P,C,V>
.
This class takes responsibility for all the <P,C,V>
-independent aspects of the tensor (e.g., sizes, sparsity, mapping). In addition, we use function overloading to implement "partial" method specialization, which the C-API relies on to catch type errors arising from our use of opaque pointers.
Because this class forms a bridge between the denotational semantics of "tensors" and the operational semantics of how we store and compute with them, it also distinguishes between two different coordinate spaces (and their associated rank, sizes, etc). Denotationally, we have the dimensions of the tensor represented by this object. Operationally, we have the levels of the storage representation itself.
The size of an axis is the cardinality of possible coordinate values along that axis (regardless of which coordinates have stored element values). As such, each size must be non-zero since if any axis has size-zero then the whole tensor would have trivial storage (since there are no possible coordinates). Thus we use the plural term sizes for a collection of non-zero cardinalities, and use this term whenever referring to run-time cardinalities. Whereas we use the term shape for a collection of compile-time cardinalities, where zero is used to indicate cardinalities which are dynamic (i.e., unknown/unspecified at compile-time). At run-time, these dynamic cardinalities will be inferred from or checked against sizes otherwise specified. Thus, dynamic cardinalities always have an "immutable but unknown" value; so the term "dynamic" should not be taken to indicate run-time mutability.
|
protecteddefault |
SparseTensorStorageBase::SparseTensorStorageBase | ( | uint64_t | dimRank, |
const uint64_t * | dimSizes, | ||
uint64_t | lvlRank, | ||
const uint64_t * | lvlSizes, | ||
const LevelType * | lvlTypes, | ||
const uint64_t * | dim2lvl, | ||
const uint64_t * | lvl2dim | ||
) |
Constructs a new sparse-tensor storage object with the given encoding.
Definition at line 27 of file Storage.cpp.
References isCompressedLvl(), isDenseLvl(), isLooseCompressedLvl(), isNOutOfMLvl(), and isSingletonLvl().
|
virtualdefault |
|
pure virtual |
Finalizes lexicographic insertions.
Implemented in mlir::sparse_tensor::SparseTensorStorage< P, C, V >.
|
inline |
Gets the number of tensor-dimensions.
Definition at line 77 of file Storage.h.
Referenced by getDimSize().
|
inline |
Safely looks up the size of the given tensor-dimension.
Definition at line 86 of file Storage.h.
References getDimRank().
|
inline |
|
inline |
Gets the number of storage-levels.
Definition at line 80 of file Storage.h.
Referenced by mlir::sparse_tensor::SparseTensorStorage< P, C, V >::expInsert(), mlir::sparse_tensor::SparseTensorStorage< P, C, V >::getCoordinates(), mlir::sparse_tensor::SparseTensorStorage< P, C, V >::getCoordinatesBuffer(), getLvlSize(), getLvlType(), mlir::sparse_tensor::SparseTensorStorage< P, C, V >::getPositions(), mlir::sparse_tensor::SparseTensorStorage< P, C, V >::lexInsert(), and mlir::sparse_tensor::SparseTensorStorage< P, C, V >::sortInPlace().
|
inline |
Safely looks up the size of the given storage-level.
Definition at line 95 of file Storage.h.
References getLvlRank().
Referenced by mlir::sparse_tensor::SparseTensorStorage< P, C, V >::lexInsert().
|
inline |
|
inline |
Safely looks up the type of the given level.
Definition at line 104 of file Storage.h.
References getLvlRank().
Referenced by isCompressedLvl(), isDenseLvl(), isLooseCompressedLvl(), isNOutOfMLvl(), isOrderedLvl(), isSingletonLvl(), and isUniqueLvl().
|
inline |
|
inline |
Safely checks if the level uses compressed storage.
Definition at line 113 of file Storage.h.
References getLvlType(), and mlir::sparse_tensor::isCompressedLT().
Referenced by mlir::sparse_tensor::SparseTensorStorage< P, C, V >::SparseTensorStorage(), and SparseTensorStorageBase().
|
inline |
Safely checks if the level uses dense storage.
Definition at line 110 of file Storage.h.
References getLvlType(), and mlir::sparse_tensor::isDenseLT().
Referenced by mlir::sparse_tensor::SparseTensorStorage< P, C, V >::SparseTensorStorage(), and SparseTensorStorageBase().
|
inline |
Safely checks if the level uses loose compressed storage.
Definition at line 118 of file Storage.h.
References getLvlType(), and mlir::sparse_tensor::isLooseCompressedLT().
Referenced by mlir::sparse_tensor::SparseTensorStorage< P, C, V >::SparseTensorStorage(), and SparseTensorStorageBase().
|
inline |
Safely checks if the level uses n out of m storage.
Definition at line 126 of file Storage.h.
References getLvlType(), and mlir::sparse_tensor::isNOutOfMLT().
Referenced by mlir::sparse_tensor::SparseTensorStorage< P, C, V >::SparseTensorStorage(), and SparseTensorStorageBase().
|
inline |
Safely checks if the level is ordered.
Definition at line 129 of file Storage.h.
References getLvlType(), and mlir::sparse_tensor::isOrderedLT().
|
inline |
Safely checks if the level uses singleton storage.
Definition at line 123 of file Storage.h.
References getLvlType(), and mlir::sparse_tensor::isSingletonLT().
Referenced by mlir::sparse_tensor::SparseTensorStorage< P, C, V >::SparseTensorStorage(), and SparseTensorStorageBase().
|
inline |
Safely checks if the level is unique.
Definition at line 132 of file Storage.h.
References getLvlType(), and mlir::sparse_tensor::isUniqueLT().
Referenced by mlir::sparse_tensor::SparseTensorStorage< P, C, V >::SparseTensorStorage().
|
protecteddelete |
|
protected |
|
protected |