[Mlir-commits] [mlir] [mlir][linalg/scf/transform] scalable tiling and fusion for pack/unpack ops (PR #204007)

Andrzej WarzyƄski llvmlistbot at llvm.org
Thu Jun 25 05:00:58 PDT 2026


================
@@ -1199,9 +1252,30 @@ struct PackOpTiling
         // another word, we can only support tiling with consumer if the tile
         // size for the producer is a multiple of the inner tile size for the
         // packed dimensions at this moment.
-        if ((failed(cstTileSize) || !cstInnerSize ||
-             *cstTileSize % *cstInnerSize != 0))
-          return failure();
+
+        // The caller may assert how this packed dimension's loop tile size
+        // relates to the inner tile size via `innerTileAlignments` (see
+        // InnerTileAlignment). It is only consulted when the relationship is
+        // not statically decidable; when both sizes are known constants we
+        // trust the static divisibility check below, so a contradicting hint
+        // cannot fuse into an invalid pack.
----------------
banach-space wrote:

I would actually flip this logic.

As a rule of thumb, when a user specifies an option, it's a hint that "I know better, do as i say" and the compiler should follow. 

If we make this behaviour conditional (e.g. "Its actually possible to derive this info in this _specific case_, so let me ignore the input from the user on this occasion." vs "Oh, in this case I cannot compute the alignment info, so I _will_ use the hint from the user.") then compiler's behaviour becomes harder to reason about. 

My suggestion would be to:
* Prioritise the hint from the user.
* When tile sizes are static, use that to assert that the info from the user is correct.

Similar suggestions for other bits of the code where this is relevant.

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


More information about the Mlir-commits mailing list