After long complaining(mostly talking about myself here), and discussing various aspects in the Final Chapter of the Standard Dialect, the time has finally arrived. I’ve uploaded D121266 to finally move FuncOp out of the Builtin dialect to the Func dialect. This is likely one of the largest cleanups (aside from the Standard dialect) in recent times, but there has been a lot of recent work upstream to somewhat help simplify the process.
For the actual transition itself, FuncOp will remain in the mlir namespace (via using
directives) for a bit to help reduce immediate API churn. The textual format will also retain support for parsing func
for a bit as well. If you look at the linked patch above, a majority of the API changes are really just sprinkling #include "mlir/Dialect/Func/IR/FuncOps.h"
where necessary; and a good ole find+replace builtin.func
→ func.func
.
For users that need to transition, it would be a great time to ask yourself if you actually need to be using FuncOp
. We have a FunctionOpInterface, and various utility API, that make it very simple to define your own function operation. You can take a look at the changes for PDLInterp and Toy as examples (the toy one may look scary, but a lot of files are duplicated for each chapter). We also recently gained the ability to more easily define passes operating on interfaces, which also means it would be a good time to consider if your FuncOp passes couldn’t be FunctionOpInterface passes or even fully generic passes.
– River