[all-commits] [llvm/llvm-project] f9265d: [mlir] Generate Op builders for Python bindings

ftynse via All-commits all-commits at lists.llvm.org
Thu Nov 12 02:29:43 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: f9265de8c634798b2ae8b4bdad7c2f5b7442115e
      https://github.com/llvm/llvm-project/commit/f9265de8c634798b2ae8b4bdad7c2f5b7442115e
  Author: Alex Zinenko <zinenko at google.com>
  Date:   2020-11-12 (Thu, 12 Nov 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
    M mlir/test/Bindings/Python/dialects.py
    M mlir/test/mlir-tblgen/op-python-bindings.td
    M mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp

  Log Message:
  -----------
  [mlir] Generate Op builders for Python bindings

Add an ODS-backed generator of default builders. This currently does not
support operation with attribute arguments, for which the builder is
just ignored. Attribute support will be introduced separately for
builders and accessors.

Default builders are always generated with the same number of result and
operand groups as the ODS specification, i.e. one group per each operand
or result. Optional elements accept None but cannot be omitted. Variadic
groups accept iterable objects and cannot be replaced with a single
object.

For some operations, it is possible to infer the result type given the
traits, but most traits rely on inline pieces of C++ that we cannot
(yet) forward to Python bindings. Since the Ops where the inference is
possible (having the `SameOperandAndResultTypes` trait or
`TypeMatchesWith` without transform field) are a small minority, they
also require the result type to make the builder syntax more consistent.

Reviewed By: stellaraccident

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




More information about the All-commits mailing list