Hi everyone, I have been experimenting a bit with the TestPDLByteCodePass and wanted to apply PDL patterns to multiple mlir files. Is there a way to link or combine multiple mlir files?
Otherwise, I would need to always inject the @patterns into the mlir file for pattern matching. Ideally I would have an mlir file with the @patterns module and one with @ir.
To my understanding this functionality is not present in MLIR yet. But other projects have implemented a similar mechanism to supply/parse a second MLIR file based on an optional path.
The TestPDLByteCodePass, as its name clearly indicates, is a test pass. It is intended to test the infrastructure itself. Clients must not use it beyond writing tests or debugging. It does not restrict what clients can do with the infrastructure.
If you take even a cursory look at the implementation of said pass, you will see that the PDL pattern module can be trivially constructed from an IR module (llvm-project/TestPDLByteCode.cpp at main · llvm/llvm-project · GitHub) regardless of the provenance of the latter. It is then equally simple to just open a second file and parse a module from there.