[all-commits] [llvm/llvm-project] 853a61: [mlir:OpFormatGen] Add Support for `$_ctxt` in the...

Sean Silva via All-commits all-commits at lists.llvm.org
Mon Jun 14 18:03:42 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 853a614864754cd4b000f03a7ab8fbba103d6177
      https://github.com/llvm/llvm-project/commit/853a614864754cd4b000f03a7ab8fbba103d6177
  Author: Sean Silva <silvasean at google.com>
  Date:   2021-06-14 (Mon, 14 Jun 2021)

  Changed paths:
    M mlir/test/lib/Dialect/Test/TestOps.td
    M mlir/test/mlir-tblgen/op-format.mlir
    M mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
    M mlir/tools/mlir-tblgen/OpFormatGen.cpp

  Log Message:
  -----------
  [mlir:OpFormatGen] Add Support for `$_ctxt` in the transformer.

This is useful for "build tuple" type ops. In my case, in npcomp, I have
an op:

```
// Result type is `!torch.tuple<!torch.tensor, !torch.tensor>`.
torch.prim.TupleConstruct %0, %1 : !torch.tensor, !torch.tensor
```

and the context is required for the `Torch::TupleType::get` call (for
the case of an empty tuple).

The handling of these FmtContext's in the code is pretty ad-hoc -- I didn't
attempt to rationalize it and just made a targeted fix. As someone
unfamiliar with the code I had a hard time seeing how to more broadly fix
the situation.

Differential Revision: https://reviews.llvm.org/D104274




More information about the All-commits mailing list