Skip to content

[mlir][sparse] make high and 2:4 a level format, not a level property #67206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,24 @@ def SparseTensorEncodingAttr : SparseTensor_Attr<"SparseTensorEncoding",

- **dense** : all entries along this level are stored
- **compressed** : only nonzeros along this level are stored
- **loose_compressed** : as compressed, but allows for free space between regions
- **singleton** : a variant of the compressed format, where coordinates have no siblings
- **block2_4** : the compression uses a 2:4 encoding per 1x4 block

For a compressed level, each position interval is represented in a compact
way with a lowerbound `pos(i)` and an upperbound `pos(i+1) - 1`, which implies
that successive intervals must appear in order without any "holes" in between
them. The loose compressed format relaxes these constraints by representing each
position interval with a lowerbound `lo(i)` and an upperbound `hi(i)`, which
allows intervals to appear in arbitrary order and with elbow room between them.

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

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

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

Expand Down