[Mlir-commits] [mlir] 3fc9294 - [mlir][sparse] add example to attribute doc

Aart Bik llvmlistbot at llvm.org
Tue Aug 3 18:41:56 PDT 2021


Author: Aart Bik
Date: 2021-08-03T18:41:49-07:00
New Revision: 3fc92948734ab606e3afa68bc2c083fd3d48102a

URL: https://github.com/llvm/llvm-project/commit/3fc92948734ab606e3afa68bc2c083fd3d48102a
DIFF: https://github.com/llvm/llvm-project/commit/3fc92948734ab606e3afa68bc2c083fd3d48102a.diff

LOG: [mlir][sparse] add example to attribute doc

Also makes style consistent with the "surrounding"
text that appears on one webpage in MLIR doc

Reviewed By: grosul1

Differential Revision: https://reviews.llvm.org/D107418

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td
index 5c71fb43bfa3..5668bdc2ef3e 100644
--- a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td
+++ b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td
@@ -23,12 +23,28 @@ def SparseTensorEncodingAttr : SparseTensor_Attr<"SparseTensorEncoding",
   let mnemonic = "encoding";
 
   let description = [{
-    An attribute to encode "TACO"-style information (see tensor-compiler.org)
-    on sparsity properties of tensors. The encoding is eventually used by a
-    `sparse compiler` pass to generate sparse code fully automatically
-    for all tensor expressions that involve tensors with a sparse encoding.
-    Compiler passes that run before this sparse compiler pass need to be
+    An attribute to encode TACO-style information on sparsity properties
+    of tensors. The encoding is eventually used by a **sparse compiler**
+    pass to generate sparse code fully automatically for all tensor
+    expressions that involve tensors with a sparse encoding. Compiler
+    passes that run before this sparse compiler pass need to be
     aware of the semantics of tensor types with such an encoding.
+
+    Example:
+
+    ```mlir
+
+    #DCSC = #sparse_tensor.encoding<{
+      dimLevelType = [ "compressed", "compressed" ],
+      dimOrdering = affine_map<(i,j) -> (j,i)>,
+      pointerBitWidth = 32,
+      indexBitWidth = 8
+    }>
+
+
+    ... tensor<8x8xf64, #DCSR> ...
+
+    ```
   }];
 
   // Data in sparse tensor encoding.


        


More information about the Mlir-commits mailing list