Skip to content

Commit 802451d

Browse files
author
Peiming Liu
committed
address comments
1 parent f5a39bb commit 802451d

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,10 +1443,13 @@ def ExtractIterSpaceOp : SparseTensor_Op<"extract_iteration_space",
14431443

14441444
let results = (outs AnySparseIterSpace:$resultSpace);
14451445

1446-
let summary = "Extract an iteration space from a sparse tensor between certain levels";
1446+
let summary = "Extracts an iteration space from a sparse tensor between certain levels";
14471447
let description = [{
14481448
Extracts a `!sparse_tensor.iter_space` from a sparse tensor between
1449-
certian (consecutive) levels.
1449+
certain (consecutive) levels. For sparse levels, it is usually done by
1450+
loading a postion range from the underlying sparse tensor storage.
1451+
E.g., for a compressed level, the iteration space is extracted by
1452+
[pos[i], pos[i+1]) supposing the the parent iterator points at `i`.
14501453

14511454
`tensor`: the input sparse tensor that defines the iteration space.
14521455
`parentIter`: the iterator for the previous level, at which the iteration space
@@ -1455,6 +1458,12 @@ def ExtractIterSpaceOp : SparseTensor_Op<"extract_iteration_space",
14551458
the returned iteration space covers. `hiLvl - loLvl` defines the dimension of the
14561459
iteration space.
14571460

1461+
The type of returned the value is automatically inferred to
1462+
`!sparse_tensor.iter_space<#INPUT_ENCODING, lvls = $loLvl to $hiLvl>`.
1463+
The returned iteration space can then be iterated over by
1464+
`sparse_tensor.iterate` operations to visit every stored element
1465+
(usually nonzeros) in the input sparse tensor.
1466+
14581467
Example:
14591468
```mlir
14601469
// Extracts a 1-D iteration space from a COO tensor at level 1.

mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorTypes.td

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ def SparseTensor_IterSpace : SparseTensor_Type<"IterSpace"> {
8181

8282
let description = [{
8383
A sparse iteration space that represents an abstract N-D (sparse) iteration space
84-
extracted from a sparse tensor.
84+
extracted from a sparse tensor, i.e., a set of (crd_0, crd_1, ..., crd_N) for
85+
every stored element (usually nonzeros) in a sparse tensor between the specified
86+
[$loLvl, $hiLvl) levels.
8587

8688
Examples:
8789

0 commit comments

Comments
 (0)