[all-commits] [llvm/llvm-project] 3781b7: [mlir][py] Enable building ops with raw inputs

Jacques Pienaar via All-commits all-commits at lists.llvm.org
Wed Dec 21 10:10:44 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3781b7905d8d808e5d4e97d597263f8ac48541b8
      https://github.com/llvm/llvm-project/commit/3781b7905d8d808e5d4e97d597263f8ac48541b8
  Author: Jacques Pienaar <jpienaar at google.com>
  Date:   2022-12-21 (Wed, 21 Dec 2022)

  Changed paths:
    M mlir/docs/Bindings/Python.md
    M mlir/lib/Bindings/Python/Globals.h
    M mlir/lib/Bindings/Python/IRCore.cpp
    M mlir/lib/Bindings/Python/IRModule.cpp
    M mlir/python/mlir/ir.py
    M mlir/test/mlir-tblgen/op-python-bindings.td
    M mlir/test/python/dialects/shape.py
    M mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp

  Log Message:
  -----------
  [mlir][py] Enable building ops with raw inputs

For cases where we can automatically construct the Attribute allow for more
user-friendly input. This is consistent with C++ builder generation as well
choice of which single builder to generate here (most
specialized/user-friendly).

Registration of attribute builders from more pythonic input is all Python side.
The downside is that
  * extra checking to see if user provided a custom builder in op builders,
  * the ODS attribute name is load bearing
upside is that
  * easily change these/register dialect specific ones in downstream projects,
  * adding support/changing to different convenience builders are all along with
    the rest of the convenience functions in Python (and no additional changes
    to tablegen file or recompilation needed);

Allow for both building with Attributes as well as raw inputs. This change
should therefore be backwards compatible as well as allow for avoiding
recreating Attribute where already available.

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




More information about the All-commits mailing list