[flang-commits] [PATCH] D134285: [flang][RFC] Adding higher level FIR ops to ease expression lowering
Mehdi AMINI via Phabricator via flang-commits
flang-commits at lists.llvm.org
Wed Sep 21 06:09:36 PDT 2022
mehdi_amini added inline comments.
================
Comment at: flang/docs/HighLevelFIR.md:960
+
+It has not been decided if these new operations should be added to FIR or if
+this should be an independent dialect.
----------------
jeanPerier wrote:
> tschuett wrote:
> > Isn't this point about the expressiveness of MLIR? What are the engineering costs of adding a FIRX dialect for the higher ops?
> >
> > What would be the benefit of having a separate dialect?
> The benefit of having a separate dialect is to strongly split the high level ops that require information about Fortran variables to be retrievable in the IR (via the fir.def/fir.ref) and the current operations that are lower level and do not require such information.
> After the translation pass of variable related operation, this dialect would be illegal.
>
> There is a precedent in FIR with the fir::cg dialect ops (https://github.com/llvm/llvm-project/blob/main/flang/include/flang/Optimizer/CodeGen/CGOps.td) that helps simplifying the addressing and emboxing operation before codegen.
>
> I think the engineering cost are mostly about having different td files, headers and .cpp for these new ops and types, but also to register the dialect in the passes that will work with it. That last point may be a bit more annoying (it does not matter with the fir::cg dialect because codegen is the only pass meant to be run with this dialect).
>
> I do not have a strong opinion here.
> to register the dialect in the passes that will work with it.
To be clear: registration is only ever needed in a pass that produces entities from a dialect (ops, attributes, types) when this dialect isn't in the input already. So a pass lowering from a high-level dialect to a lower-level dialect only defines the lower-level dialects to be registered, no need to do anything for the high-level dialect.
Similarly passes that transform within the same dialect don't need to declare anything at all.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134285/new/
https://reviews.llvm.org/D134285
More information about the flang-commits
mailing list