[PATCH] D76903: Add a flag on the context to protect against creation of operations in unregistered dialects

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 1 22:50:51 PDT 2020


mehdi_amini added a comment.

In D76903#1954252 <https://reviews.llvm.org/D76903#1954252>, @bondhugula wrote:

> In D76903#1954105 <https://reviews.llvm.org/D76903#1954105>, @mehdi_amini wrote:
>
> > In D76903#1954082 <https://reviews.llvm.org/D76903#1954082>, @bondhugula wrote:
> >
> > > In D76903#1948918 <https://reviews.llvm.org/D76903#1948918>, @mehdi_amini wrote:
> > >
> > > > (I don't even know why we allow such operation name in the first place to be honest, other than saving a few chars when writing tests there isn't much interest)
> > >
> > >
> > > One advantage has been in writing test cases where you need an op with a side-effect so that it just doesn't become dead code (when canonicalization is being run as part of the pass/utility you are testing). These unknown ops provided the easiest/shortest IR for it - we would have otherwise had to think of another side-effecting op (like creating a memref type and a load/store on it). Any other quick shortcut replacements?
> >
> >
> > Using a name with a dot?
> >  `foo.myop` instead of ˋmyop` should give the same effect I expect.
>
>
> You mean 'foo' is a registered dialect? Won't you still still get an error if 'myop' isn't registered and we disallow all unregistered ops. Or you were suggesting something else?


Some context got lost I guess, you were answering to "(I don't even know why we allow such operation name in the first place to be honest, other than saving a few chars when writing tests there isn't much interest)" which referred to ops that don't contain any dot in the name.

>> mlir-opt is really a testing tool, I expect any « real » compiler built with MLIR to always register their dialects.
> 
> Even for testing, I meant if one wanted to run:
>  `.... | mlir-opt  ... | <another-mlir-based-tool> ...`
> 
> If mlir-opt errors out on unregistered dialect operations, one can't test a mix of mlir registered dialect ops and other ops mid-way in the pipeline there.

Right, but that's why the command line flag is provided.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76903/new/

https://reviews.llvm.org/D76903





More information about the llvm-commits mailing list