[Mlir-commits] [mlir] 8e0abf8 - [mlir][sparse] cleanup some pass documentation

Aart Bik llvmlistbot at llvm.org
Tue Dec 6 15:37:48 PST 2022


Author: Aart Bik
Date: 2022-12-06T15:37:39-08:00
New Revision: 8e0abf8d61e2a4339ea017be103a175f5f8b8778

URL: https://github.com/llvm/llvm-project/commit/8e0abf8d61e2a4339ea017be103a175f5f8b8778
DIFF: https://github.com/llvm/llvm-project/commit/8e0abf8d61e2a4339ea017be103a175f5f8b8778.diff

LOG: [mlir][sparse] cleanup some pass documentation

Reviewed By: Peiming

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

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td b/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td
index 3342d2c072caf..4c827c1432056 100644
--- a/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td
@@ -54,8 +54,8 @@ def SparsificationPass : Pass<"sparsification", "ModuleOp"> {
 
     // Multiply a sparse matrix A with a dense vector b into a dense vector x.
     func.func @kernel_matvec(%arga: tensor<?x?xf64, #SparseMatrix>,
-                        %argb: tensor<?xf64>,
-                        %argx: tensor<?xf64>) -> tensor<?xf64> {
+                             %argb: tensor<?xf64>,
+                             %argx: tensor<?xf64>) -> tensor<?xf64> {
       %0 = linalg.generic #matvec
         ins(%arga, %argb: tensor<?x?xf64, #SparseMatrix>, tensor<?xf64>)
         outs(%argx: tensor<?xf64>) {
@@ -142,17 +142,19 @@ def SparseTensorConversionPass : Pass<"sparse-tensor-conversion", "ModuleOp"> {
 
     ```mlir
       Before:
-        %c1 = arith.constant 1 : index
-        %0 = sparse_tensor.pointers %arg0, %c1
-          : tensor<8x8xf32, #sparse_tensor.encoding<{
-              dimLevelType = [ "dense", "compressed" ],
-              pointerBitWidth = 0,
-              indexBitWidth = 0
-            }>> to memref<?xindex>
+        func.func @foo(%arg0: tensor<8x8xf32, #CSR>) -> memref<?xindex> {
+          %0 = sparse_tensor.pointers %arg0 {dimension = 1 : index}
+             : tensor<8x8xf32, #CSR> to memref<?xindex>
+          return %0 : memref<?xindex>
+        }
 
       After:
-        %c1 = arith.constant 1 : index
-        %0 = call @sparsePointers(%arg0, %c1) : (!llvm.ptr<i8>, index) -> memref<?xindex>
+        func.func @foo(%arg0: !llvm.ptr<i8>) -> memref<?xindex> {
+          %c1 = arith.constant 1 : index
+          %0 = call @sparsePointers0(%arg0, %c1)
+             : (!llvm.ptr<i8>, index) -> memref<?xindex>
+          return %0 : memref<?xindex>
+        }
     ```
   }];
   let constructor = "mlir::createSparseTensorConversionPass()";
@@ -186,7 +188,21 @@ def SparseTensorCodegen : Pass<"sparse-tensor-codegen", "ModuleOp"> {
     Example of the conversion:
 
     ```mlir
-    TBD
+      Before:
+        func.func @foo(%arg0: tensor<8x8xf32, #CSR>) -> memref<?xindex> {
+          %0 = sparse_tensor.pointers %arg0 {dimension = 1 : index}
+             : tensor<8x8xf32, #CSR> to memref<?xindex>
+          return %0 : memref<?xindex>
+        }
+
+      After:
+        func.func @foo(%arg0: memref<2xindex>,
+                       %arg1: memref<3xindex>,
+                       %arg2: memref<?xindex>,
+                       %arg3: memref<?xindex>,
+                       %arg4: memref<?xf32>) -> memref<?xindex> {
+          return %arg2 : memref<?xindex>
+        }
     ```
   }];
   let constructor = "mlir::createSparseTensorCodegenPass()";


        


More information about the Mlir-commits mailing list