Skip to content

Commit 12ee3a6

Browse files
authored
[mlir][sparse] make high and 2:4 a level format, not a level property (llvm#67206)
After some internal discussion, we decided that these features were best represented as a separate format, and not a property.
1 parent e5026f0 commit 12ee3a6

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,20 +141,24 @@ def SparseTensorEncodingAttr : SparseTensor_Attr<"SparseTensorEncoding",
141141

142142
- **dense** : all entries along this level are stored
143143
- **compressed** : only nonzeros along this level are stored
144+
- **loose_compressed** : as compressed, but allows for free space between regions
144145
- **singleton** : a variant of the compressed format, where coordinates have no siblings
146+
- **block2_4** : the compression uses a 2:4 encoding per 1x4 block
147+
148+
For a compressed level, each position interval is represented in a compact
149+
way with a lowerbound `pos(i)` and an upperbound `pos(i+1) - 1`, which implies
150+
that successive intervals must appear in order without any "holes" in between
151+
them. The loose compressed format relaxes these constraints by representing each
152+
position interval with a lowerbound `lo(i)` and an upperbound `hi(i)`, which
153+
allows intervals to appear in arbitrary order and with elbow room between them.
145154

146-
Different level-formats may have different collections of level-properties.
147155
By default, each level-type has the property of being unique (no duplicate
148-
coordinates at that level), ordered (coordinates appear sorted at that
149-
level), and, for compression, storing each position interval in a compact
150-
way with a lowerbound `pos(i)`" and an upperbound `pos(i+1) - 1`.
151-
The following properties can be added to a level-format to change this
152-
default behavior:
156+
coordinates at that level) and ordered (coordinates appear sorted at that
157+
level). The following properties can be added to a level-format to change
158+
this default behavior:
153159

154160
- **nonunique** : duplicate coordinates may appear at the level
155161
- **nonordered** : coordinates may appear in arbribratry order
156-
- **high** : position interval upperbounds are stored explicitly
157-
- **block2_4** : the compression uses a 2:4 encoding per 1x4 block
158162

159163
In addition to the map, the following two fields are optional:
160164

0 commit comments

Comments
 (0)