MLIR: lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorDescriptor.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

11

16

17using namespace mlir;

19

20

21

22

23

24

26 std::optional lvl) {

27 return lvl ? IntegerAttr::get(IndexType::get(ctx), lvl.value())

28 : IntegerAttr();

29}

30

31

32

33

34static std::optional

38 return std::nullopt;

39

40 unsigned numFields = fields.size();

41 (void)numFields;

43 stt,

47 assert(numFields + fieldIdx == fields.size());

48 fields.push_back(fieldType);

49 return true;

50 });

52}

53

54

55

56

57

61

63

64 return genTuple(builder, loc, tp, inputs);

65}

66

68 addConversion([](Type type) { return type; });

70

71

73}

74

75

76

77

78

81 return StorageSpecifierInitOp::create(

82 builder, loc, StorageSpecifierType::get(stt.getEncoding()));

83}

84

86 StorageSpecifierKind kind,

87 std::optional lvl) {

88 return GetStorageSpecifierOp::create(

89 builder, loc, specifier, kind,

91}

92

95 StorageSpecifierKind kind,

96 std::optional lvl) {

97

99 specifier = SetStorageSpecifierOp::create(

100 builder, loc, specifier, kind,

102}

103

104

105

106

107

110 const Level cooStart = rType.getAoSCOOStart();

111 if (lvl < cooStart)

113

116 size = arith::DivUIOp::create(builder, loc, size, stride);

117 return memref::SubViewOp::create(

122}

static Value materializeTuple(OpBuilder &builder, RankedTensorType tp, ValueRange inputs, Location loc)

Definition SparseTensorDescriptor.cpp:58

static std::optional< LogicalResult > convertSparseTensorType(RankedTensorType rtp, SmallVectorImpl< Type > &fields)

Definition SparseTensorDescriptor.cpp:35

static IntegerAttr optionalLevelAttr(MLIRContext *ctx, std::optional< Level > lvl)

Constructs a nullable LevelAttr from the std::optional.

Definition SparseTensorDescriptor.cpp:25

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()

Definition SparseTensorDescriptor.cpp:67

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 getCrdMemSize(OpBuilder &builder, Location loc, Level lvl) const

Value getMemRefField(SparseTensorFieldKind kind, std::optional< Level > lvl) const

Value getCrdMemRefOrView(OpBuilder &builder, Location loc, Level lvl) const

Definition SparseTensorDescriptor.cpp:108

void setSpecifierField(OpBuilder &builder, Location loc, Value v, StorageSpecifierKind kind, std::optional< Level > lvl)

Definition SparseTensorDescriptor.cpp:93

Value getSpecifierField(OpBuilder &builder, Location loc, StorageSpecifierKind kind, std::optional< Level > lvl)

Definition SparseTensorDescriptor.cpp:85

static Value getInitValue(OpBuilder &builder, Location loc, SparseTensorType stt)

Definition SparseTensorDescriptor.cpp:79

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)>)

Value genTuple(OpBuilder &builder, Location loc, Type tp, ValueRange values)

Packs the given values as a "tuple" value.

unsigned FieldIndex

The type of field indices.

uint64_t Level

The type of level identifiers and level-ranks.

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.

This enum defines all the sparse representations supportable by the SparseTensor dialect.