MLIR
20.0.0git
|
#include "mlir/Dialect/SparseTensor/IR/Enums.h"
#include "mlir/ExecutionEngine/CRunnerUtils.h"
#include "mlir/ExecutionEngine/Float16bits.h"
#include <cinttypes>
#include <complex>
#include <vector>
Go to the source code of this file.
Macros | |
#define | DECL_SPARSEVALUES(VNAME, V) |
Tensor-storage method to obtain direct access to the values array. More... | |
#define | DECL_SPARSEPOSITIONS(PNAME, P) |
Tensor-storage method to obtain direct access to the positions array for the given level. More... | |
#define | DECL_SPARSECOORDINATES(CNAME, C) |
Tensor-storage method to obtain direct access to the coordinates array for the given level. More... | |
#define | DECL_SPARSECOORDINATES(CNAME, C) |
Tensor-storage method to obtain direct access to the coordinates array for the given level. More... | |
#define | DECL_LEXINSERT(VNAME, V) |
Tensor-storage method to insert elements in lexicographical level-coordinate order. More... | |
#define | DECL_EXPINSERT(VNAME, V) |
Tensor-storage method to insert using expansion. More... | |
#define | DECL_READTOBUFFERS(VNAME, V, CNAME, C) |
Reads the sparse tensor, stores the coordinates and values to the given memrefs of a COO in AoS format. More... | |
#define | DECL_OUTNEXT(VNAME, V) |
Outputs an element for the sparse tensor. More... | |
Functions | |
MLIR_CRUNNERUTILS_EXPORT void * | _mlir_ciface_newSparseTensor (StridedMemRefType< index_type, 1 > *dimSizesRef, StridedMemRefType< index_type, 1 > *lvlSizesRef, StridedMemRefType< LevelType, 1 > *lvlTypesRef, StridedMemRefType< index_type, 1 > *dim2lvlRef, StridedMemRefType< index_type, 1 > *lvl2dimRef, OverheadType posTp, OverheadType crdTp, PrimaryType valTp, Action action, void *ptr) |
This is the "swiss army knife" method for materializing sparse tensors into the computation. More... | |
MLIR_CRUNNERUTILS_EXPORT void * | _mlir_ciface_createCheckedSparseTensorReader (char *filename, StridedMemRefType< index_type, 1 > *dimShapeRef, PrimaryType valTp) |
Constructs a new SparseTensorReader object, opens the file, reads the header, and validates that the actual contents of the file match the expected dimShapeRef and valTp . More... | |
MLIR_CRUNNERUTILS_EXPORT void | _mlir_ciface_getSparseTensorReaderDimSizes (StridedMemRefType< index_type, 1 > *out, void *p) |
SparseTensorReader method to obtain direct access to the dimension-sizes array. More... | |
MLIR_CRUNNERUTILS_EXPORT void | _mlir_ciface_outSparseTensorWriterMetaData (void *p, index_type dimRank, index_type nse, StridedMemRefType< index_type, 1 > *dimSizesRef) |
Outputs the sparse tensor dim-rank, nse, and dim-shape. More... | |
MLIR_CRUNNERUTILS_EXPORT index_type | sparseLvlSize (void *tensor, index_type l) |
Tensor-storage method to get the size of the given level. More... | |
MLIR_CRUNNERUTILS_EXPORT index_type | sparseDimSize (void *tensor, index_type d) |
Tensor-storage method to get the size of the given dimension. More... | |
MLIR_CRUNNERUTILS_EXPORT void | endLexInsert (void *tensor) |
Tensor-storage method to finalize lexicographic insertions. More... | |
MLIR_CRUNNERUTILS_EXPORT void | delSparseTensor (void *tensor) |
Releases the memory for the tensor-storage object. More... | |
MLIR_CRUNNERUTILS_EXPORT char * | getTensorFilename (index_type id) |
Helper function to read a sparse tensor filename from the environment, defined with the naming convention ${TENSOR0}, ${TENSOR1}, etc. More... | |
MLIR_CRUNNERUTILS_EXPORT index_type | getSparseTensorReaderNSE (void *p) |
Returns the number of stored elements for the sparse tensor being read. More... | |
MLIR_CRUNNERUTILS_EXPORT void | delSparseTensorReader (void *p) |
Releases the SparseTensorReader and closes the associated file. More... | |
MLIR_CRUNNERUTILS_EXPORT void * | createSparseTensorWriter (char *filename) |
Creates a SparseTensorWriter for outputting a sparse tensor to a file with the given file name. More... | |
MLIR_CRUNNERUTILS_EXPORT void | delSparseTensorWriter (void *p) |
Finalizes the outputing of a sparse tensor to a file and releases the SparseTensorWriter. More... | |
#define DECL_EXPINSERT | ( | VNAME, | |
V | |||
) |
Tensor-storage method to insert using expansion.
Definition at line 98 of file SparseTensorRuntime.h.
#define DECL_LEXINSERT | ( | VNAME, | |
V | |||
) |
Tensor-storage method to insert elements in lexicographical level-coordinate order.
Definition at line 90 of file SparseTensorRuntime.h.
#define DECL_OUTNEXT | ( | VNAME, | |
V | |||
) |
Outputs an element for the sparse tensor.
Definition at line 136 of file SparseTensorRuntime.h.
#define DECL_READTOBUFFERS | ( | VNAME, | |
V, | |||
CNAME, | |||
C | |||
) |
Reads the sparse tensor, stores the coordinates and values to the given memrefs of a COO in AoS format.
Returns a boolean to indicate whether the COO elements are sorted.
Definition at line 121 of file SparseTensorRuntime.h.
#define DECL_SPARSECOORDINATES | ( | CNAME, | |
C | |||
) |
Tensor-storage method to obtain direct access to the coordinates array for the given level.
Tensor-storage method to obtain direct access to the coordinates array buffer for the given level (provides an AoS view into the library).
Definition at line 82 of file SparseTensorRuntime.h.
#define DECL_SPARSECOORDINATES | ( | CNAME, | |
C | |||
) |
Tensor-storage method to obtain direct access to the coordinates array for the given level.
Tensor-storage method to obtain direct access to the coordinates array buffer for the given level (provides an AoS view into the library).
Definition at line 82 of file SparseTensorRuntime.h.
#define DECL_SPARSEPOSITIONS | ( | PNAME, | |
P | |||
) |
Tensor-storage method to obtain direct access to the positions array for the given level.
Definition at line 66 of file SparseTensorRuntime.h.
#define DECL_SPARSEVALUES | ( | VNAME, | |
V | |||
) |
Tensor-storage method to obtain direct access to the values array.
Definition at line 58 of file SparseTensorRuntime.h.
MLIR_CRUNNERUTILS_EXPORT void* _mlir_ciface_createCheckedSparseTensorReader | ( | char * | filename, |
StridedMemRefType< index_type, 1 > * | dimShapeRef, | ||
PrimaryType | valTp | ||
) |
Constructs a new SparseTensorReader object, opens the file, reads the header, and validates that the actual contents of the file match the expected dimShapeRef
and valTp
.
MLIR_CRUNNERUTILS_EXPORT void _mlir_ciface_getSparseTensorReaderDimSizes | ( | StridedMemRefType< index_type, 1 > * | out, |
void * | p | ||
) |
SparseTensorReader method to obtain direct access to the dimension-sizes array.
MLIR_CRUNNERUTILS_EXPORT void* _mlir_ciface_newSparseTensor | ( | StridedMemRefType< index_type, 1 > * | dimSizesRef, |
StridedMemRefType< index_type, 1 > * | lvlSizesRef, | ||
StridedMemRefType< LevelType, 1 > * | lvlTypesRef, | ||
StridedMemRefType< index_type, 1 > * | dim2lvlRef, | ||
StridedMemRefType< index_type, 1 > * | lvl2dimRef, | ||
OverheadType | posTp, | ||
OverheadType | crdTp, | ||
PrimaryType | valTp, | ||
Action | action, | ||
void * | ptr | ||
) |
This is the "swiss army knife" method for materializing sparse tensors into the computation.
The types of the ptr
argument and the result depend on the action, as explained in the following table, where "STS" means a sparse-tensor-storage object.
kEmpty - STS, empty kFromReader reader STS, input from reader kPack buffers STS, from level buffers kSortCOOInPlace STS STS, sorted in place
MLIR_CRUNNERUTILS_EXPORT void _mlir_ciface_outSparseTensorWriterMetaData | ( | void * | p, |
index_type | dimRank, | ||
index_type | nse, | ||
StridedMemRefType< index_type, 1 > * | dimSizesRef | ||
) |
Outputs the sparse tensor dim-rank, nse, and dim-shape.
MLIR_CRUNNERUTILS_EXPORT void* createSparseTensorWriter | ( | char * | filename | ) |
Creates a SparseTensorWriter for outputting a sparse tensor to a file with the given file name.
When the file name is empty, std::cout is used. Only the extended FROSTT format is supported currently.
MLIR_CRUNNERUTILS_EXPORT void delSparseTensor | ( | void * | tensor | ) |
Releases the memory for the tensor-storage object.
MLIR_CRUNNERUTILS_EXPORT void delSparseTensorReader | ( | void * | p | ) |
Releases the SparseTensorReader and closes the associated file.
MLIR_CRUNNERUTILS_EXPORT void delSparseTensorWriter | ( | void * | p | ) |
Finalizes the outputing of a sparse tensor to a file and releases the SparseTensorWriter.
MLIR_CRUNNERUTILS_EXPORT void endLexInsert | ( | void * | tensor | ) |
Tensor-storage method to finalize lexicographic insertions.
MLIR_CRUNNERUTILS_EXPORT index_type getSparseTensorReaderNSE | ( | void * | p | ) |
Returns the number of stored elements for the sparse tensor being read.
MLIR_CRUNNERUTILS_EXPORT char* getTensorFilename | ( | index_type | id | ) |
Helper function to read a sparse tensor filename from the environment, defined with the naming convention ${TENSOR0}, ${TENSOR1}, etc.
MLIR_CRUNNERUTILS_EXPORT index_type sparseDimSize | ( | void * | tensor, |
index_type | d | ||
) |
Tensor-storage method to get the size of the given dimension.
MLIR_CRUNNERUTILS_EXPORT index_type sparseLvlSize | ( | void * | tensor, |
index_type | l | ||
) |
Tensor-storage method to get the size of the given level.