[Mlir-commits] [mlir] [mlir][Linalg] implement bufferization for `linalg.pack` (PR #177982)

Adam Siemieniuk llvmlistbot at llvm.org
Mon Jan 26 08:22:14 PST 2026


================
@@ -191,6 +191,47 @@ struct SoftmaxOpInterface
     return success();
   }
 };
+
+struct PackOpInterface
+    : public DstBufferizableOpInterfaceExternalModel<PackOpInterface,
+                                                     linalg::PackOp> {
+  bool bufferizesToMemoryRead(Operation *op, OpOperand &opOperand,
+                              const AnalysisState &state) const {
+    auto packOp = cast<linalg::PackOp>(op);
+    return !packOp.isDpsInit(&opOperand);
----------------
adam-smnk wrote:

In destination passing style `init` refers to `outs`.
I think this check is correct for `bufferizesToMemoryWrite` i.e., it indicates that pack's `dest` is being written to.

Read should be indicated for pack's `source`. You can probably use `isDpsInput` for that.



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


More information about the Mlir-commits mailing list