[Mlir-commits] [mlir] [WIP][mlir][sparse] Setting up sparse_tensor.iterator-related Ops. (PR #85958)

Peiming Liu llvmlistbot at llvm.org
Fri Mar 22 09:34:37 PDT 2024


================
@@ -1418,6 +1420,58 @@ def SparseTensor_ForeachOp : SparseTensor_Op<"foreach",
   let hasVerifier = 1;
 }
 
+//===----------------------------------------------------------------------===//
+// Sparse Tensor Iteration Operations.
+//===----------------------------------------------------------------------===//
+
+def ExtractIterSpaceOp : SparseTensor_Op<"iteration.extract_space",
+    [Pure, DeclareOpInterfaceMethods<InferTypeOpInterface>]> {
+
+  let arguments = (ins AnySparseTensor:$tensor,
+                       Optional<AnySparseIterator>:$parentIter,
----------------
PeimingLiu wrote:

Good question! I think there are multiple different choices for us, and I am not sure which way to pick actually.

In another way, we _potentially_ can use the iterator to index a different tensor as long as the level types match (i.e., the `parentIter` does not know about the tensor, and the tensor should be provided additionally when use the iterator). This might makes the lowering of the operation easier (make also make the program harder to analyze)

The PR is very experimental and we can of course have some discussions on this ;-)


https://github.com/llvm/llvm-project/pull/85958


More information about the Mlir-commits mailing list