[Mlir-commits] [mlir] [mlir][linalg] Implement bufferization for UnPackOp. (PR #182837)

Han-Chung Wang llvmlistbot at llvm.org
Mon Feb 23 04:39:57 PST 2026


================
@@ -231,6 +231,44 @@ struct PackOpInterface
     return success();
   }
 };
+
+struct UnPackOpInterface
+    : public DstBufferizableOpInterfaceExternalModel<UnPackOpInterface,
+                                                     linalg::UnPackOp> {
+  bool bufferizesToMemoryRead(Operation *op, OpOperand &opOperand,
+                              const AnalysisState &state) const {
+    auto unPackOp = cast<linalg::UnPackOp>(op);
+    return !unPackOp.isDpsInit(&opOperand);
+  }
+
+  LogicalResult bufferize(Operation *op, RewriterBase &rewriter,
+                          const BufferizationOptions &options,
+                          BufferizationState &state) const {
+    auto unPackOp = cast<linalg::UnPackOp>(op);
+    assert(!unPackOp.hasPureBufferSemantics() && "expected op with tensors");
----------------
hanhanW wrote:

By above, I meant the pack op.

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


More information about the Mlir-commits mailing list