Skip to content

Commit

Permalink
[mlir][sparse] Update examples in Ops.td (llvm#69499)
Browse files Browse the repository at this point in the history
Example:

dimLevelType = [ "compressed", "compressed" ] to
map = (d0, d1) -> (d0 : compressed, d1 : compressed)
  • Loading branch information
yinying-lisa-li authored Oct 18, 2023
1 parent 81d651e commit 6c6749c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,13 @@ def SparseTensor_StorageSpecifierInitOp : SparseTensor_Op<"storage_specifier.ini
Example:

```mlir
#CSR = #sparse_tensor.encoding<{ dimLevelType = [ "dense", "compressed" ]}>
#CSR = #sparse_tensor.encoding<{
map = (i, j) -> (i : dense, j : compressed)
}>
#CSR_SLICE = #sparse_tensor.encoding<{
dimLevelType = [ "dense", "compressed" ],
slice = [ (1, 4, 1), (1, 4, 2) ]
map = (d0 : #sparse_tensor<slice(1, 4, 1)>,
d1 : #sparse_tensor<slice(1, 4, 2)>) ->
(d0 : dense, d1 : compressed)
}>

%0 = sparse_tensor.storage_specifier.init : !sparse_tensor.storage_specifier<#CSR>
Expand Down Expand Up @@ -1260,8 +1263,7 @@ def SparseTensor_ForeachOp : SparseTensor_Op<"foreach",
For example:
```mlir
#COL_MAJOR = #sparse_tensor.encoding<{
dimLevelType = [ "compressed", "compressed" ],
dimOrdering = affine_map<(i,j) -> (j,i)>
map = (d0, d1) -> (d1 : compressed, d0 : compressed)
}>

// foreach on a column-major sparse tensor
Expand All @@ -1271,7 +1273,7 @@ def SparseTensor_ForeachOp : SparseTensor_Op<"foreach",
}

#ROW_MAJOR = #sparse_tensor.encoding<{
dimLevelType = [ "compressed", "compressed" ],
map = (d0, d1) -> (d0 : compressed, d1 : compressed)
}>

// foreach on a row-major sparse tensor
Expand Down

0 comments on commit 6c6749c

Please sign in to comment.