[Mlir-commits] [mlir] [mlir][sparse] use shared value storage between wrapped iterator and the wrapper. (PR #80046)

Yinying Li llvmlistbot at llvm.org
Tue Jan 30 11:24:17 PST 2024


================
@@ -132,10 +145,33 @@ class SparseIterator {
   };
   virtual void deserialize(ValueRange vs) { llvm_unreachable("unsupported"); };
 
+  //  virtual std::string getFuncNamePostfix() const = 0;
+  //  virtual SmallVector<Value> toFuncArgs() const = 0;
+  //  virtual void linkFuncScope(ValueRange ret) = 0;
+
   //
   // Core functions.
   //
 
+  // Initializes the iterator according to the parent iterator's state.
+  void genInit(OpBuilder &b, Location l, const SparseIterator *p);
+
+  // Forwards the iterator to the next element.
+  ValueRange forward(OpBuilder &b, Location l);
+
+  // Actual Implementation provided by derived class.
+  virtual void genInitImpl(OpBuilder &, Location, const SparseIterator *) = 0;
+  virtual ValueRange forwardImpl(OpBuilder &b, Location l) = 0;
+
+  // Returns a boolean value that equals `!it.end()`
+  virtual Value genNotEnd(OpBuilder &b, Location l) = 0;
+
+  // Dereference the iterator, loads the coordinate at the current position.
----------------
yinying-lisa-li wrote:

dereferences for consistency.

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


More information about the Mlir-commits mailing list