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

Conversation

aartbik
Copy link
Contributor

@aartbik aartbik commented Sep 22, 2023

After some internal discussion, we decided that these features were best represented as a separate format, and not a property.

After some internal discussion, we decided that these features were
best represented as a separate format, and not a property.
@llvmbot llvmbot added mlir:sparse Sparse compiler in MLIR mlir labels Sep 22, 2023
@llvmbot
Copy link
Member

llvmbot commented Sep 22, 2023

@llvm/pr-subscribers-mlir-sparse

@llvm/pr-subscribers-mlir

Changes

After some internal discussion, we decided that these features were best represented as a separate format, and not a property.


Full diff: https://github.com/llvm/llvm-project/pull/67206.diff

1 Files Affected:

  • (modified) mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td (+12-8)
diff --git a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td
index 6a8e66335fbc697..b1e6a1927299828 100644
--- a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td
+++ b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td
@@ -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 constrainst 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:
 

@aartbik aartbik merged commit 12ee3a6 into llvm:main Sep 22, 2023
@aartbik aartbik deleted the bick branch September 22, 2023 23:52
Guzhu-AMD pushed a commit to GPUOpen-Drivers/llvm-project that referenced this pull request Sep 28, 2023
Local branch amd-gfx b62921c Merged main:11b9ec5f240e into amd-gfx:121ddb486b15
Remote branch main 12ee3a6 [mlir][sparse] make high and 2:4 a level format, not a level property (llvm#67206)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mlir:sparse Sparse compiler in MLIR mlir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants