Linalg-strategy-tile-and-fuse-pass need tile-sizes

I want to use linalg-strategy-tile-and-fuse-pass for a linalg.generic op, but it did not change the mlir it.

mlir-opt ./fusion.mlir --linalg-strategy-tile-and-fuse-pass=“anchor-func=filter”

The debug output shows that this pass matched the generic op but failed because expect #tile sizes >= #loops

this link shows there was a tile-sizes option for a similar pass --linalg-tile-and-fuse-tensor-ops but now it seems removed, and I also cannot find tile-sizes option.

Is there any way to solve it?

The linalg-strategy-tile-and-fuse-pass is used internally by CodeGenStragey and there is indeed no command line option to set the tile sizes (AFAIK). If you use the pass programmatically the tile sizes can be set.

The easiest way to do tile and fuse is currently the CodeGenStrategy test pass:
-test-linalg-codegen-strategy="anchor-op=linalg.generic fuse tile-sizes=5,4,7"

I took the example from the following test:

CodeGenStrategy is actually quite complex and does multiple things at once. It is thus not easy to use and most likely will be replaced by something better in the near future. However, currently it is probably the way to go if you want to experiment with Linalg transformations.

Thanks a lot for your reply! This really solves my problem.

BTW, there are now three ways to use multiple passes (AFAIK):

  1. chain many passes like --pass-one --pass-two
  2. use --pass-pipeline
  3. use CodeGenStrategy

Are there any documents to explain the usage of CodeGenStrategy? It seems that every pass with the name of *-codegen-strategy-* can use it, right? Or, it is only for testing?

CodegenStrategy is an experimental tool to run a sequence of passes on a specific function / operation. AFAIK there is no documentation except for the code due to its experimental nature and I think it will soon be replaced by other solutions (for example, [RFC] Interfaces and dialects for precise IR transformation control - #5 by nicolasvasilache). If possible, I would avoid deep diving and just use it to bridge the gap until other solutions replace it.

ok~ thanks again