From 6c6749ce72fa3225dd3514a4d78187aa706fce7c Mon Sep 17 00:00:00 2001 From: Yinying Li <107574043+yinying-lisa-li@users.noreply.github.com> Date: Wed, 18 Oct 2023 16:15:45 -0400 Subject: [PATCH] [mlir][sparse] Update examples in Ops.td (#69499) Example: dimLevelType = [ "compressed", "compressed" ] to map = (d0, d1) -> (d0 : compressed, d1 : compressed) --- .../Dialect/SparseTensor/IR/SparseTensorOps.td | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td index 3d1807094797ec..c446b84c5d3410 100644 --- a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td +++ b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td @@ -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, + d1 : #sparse_tensor) -> + (d0 : dense, d1 : compressed) }> %0 = sparse_tensor.storage_specifier.init : !sparse_tensor.storage_specifier<#CSR> @@ -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 @@ -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