18 using namespace sparse_tensor;
26 std::optional<Level> lvl) {
34 static std::optional<LogicalResult>
40 unsigned numFields = fields.size();
47 assert(numFields + fieldIdx == fields.size());
48 fields.push_back(fieldType);
64 return genTuple(builder, loc, tp, inputs);
68 addConversion([](
Type type) {
return type; });
81 return StorageSpecifierInitOp::create(
86 StorageSpecifierKind
kind,
87 std::optional<Level> lvl) {
88 return GetStorageSpecifierOp::create(
89 builder, loc, specifier,
kind,
95 StorageSpecifierKind
kind,
96 std::optional<Level> lvl) {
99 specifier = SetStorageSpecifierOp::create(
100 builder, loc, specifier,
kind,
110 const Level cooStart = rType.getAoSCOOStart();
115 Value size = getCrdMemSize(builder, loc, cooStart);
116 size = arith::DivUIOp::create(builder, loc, size, stride);
117 return memref::SubViewOp::create(
union mlir::linalg::@1242::ArityGroupAndKind::Kind kind
static std::optional< LogicalResult > convertSparseTensorType(RankedTensorType rtp, SmallVectorImpl< Type > &fields)
static Value materializeTuple(OpBuilder &builder, RankedTensorType tp, ValueRange inputs, Location loc)
static IntegerAttr optionalLevelAttr(MLIRContext *ctx, std::optional< Level > lvl)
Constructs a nullable LevelAttr from the std::optional<Level>.
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
MLIRContext is the top-level object for a collection of MLIR operations.
This class helps build Operations.
SparseTensorTypeToBufferConverter()
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
This class provides an abstraction over the different types of ranges over Values.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
Type getType() const
Return the type of this value.
Value getCrdMemRefOrView(OpBuilder &builder, Location loc, Level lvl) const
void setSpecifierField(OpBuilder &builder, Location loc, Value v, StorageSpecifierKind kind, std::optional< Level > lvl)
Value getSpecifierField(OpBuilder &builder, Location loc, StorageSpecifierKind kind, std::optional< Level > lvl)
static Value getInitValue(OpBuilder &builder, Location loc, SparseTensorType stt)
A wrapper around RankedTensorType, which has three goals:
bool hasEncoding() const
Returns true for tensors which have an encoding, and false for those which do not.
SparseTensorEncodingAttr getEncoding() const
Value constantIndex(OpBuilder &builder, Location loc, int64_t i)
Generates a constant of index type.
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.
Value genTuple(OpBuilder &builder, Location loc, Type tp, ValueRange values)
Packs the given values as a "tuple" value.
SparseTensorEncodingAttr getSparseTensorEncoding(Type type)
Convenience method to get a sparse encoding attribute from a type.
SparseTensorFieldKind
===-------------------------------------------------------------------—===// The sparse tensor storag...
Include the generated interface declarations.
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...
This enum defines all the sparse representations supportable by the SparseTensor dialect.