[all-commits] [llvm/llvm-project] 74628c: [mlir] Add Python bindings for AffineExpr

ftynse via All-commits all-commits at lists.llvm.org
Mon Jan 11 10:57:37 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 74628c43053b482f35f0f1e6b4eac743fbe425e5
      https://github.com/llvm/llvm-project/commit/74628c43053b482f35f0f1e6b4eac743fbe425e5
  Author: Alex Zinenko <zinenko at google.com>
  Date:   2021-01-11 (Mon, 11 Jan 2021)

  Changed paths:
    M mlir/include/mlir-c/AffineExpr.h
    M mlir/include/mlir-c/Bindings/Python/Interop.h
    M mlir/lib/Bindings/Python/IRModules.cpp
    M mlir/lib/Bindings/Python/IRModules.h
    M mlir/lib/CAPI/IR/AffineExpr.cpp
    A mlir/test/Bindings/Python/ir_affine_expr.py
    M mlir/test/CAPI/ir.c

  Log Message:
  -----------
  [mlir] Add Python bindings for AffineExpr

This adds the Python bindings for AffineExpr and a couple of utility functions
to the C API. AffineExpr is a top-level context-owned object and is modeled
similarly to attributes and types. It is required, e.g., to build layout maps
of the built-in memref type.

Reviewed By: mehdi_amini

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


  Commit: e79bd0b4f25e68130a2ac273d6508ea322028b61
      https://github.com/llvm/llvm-project/commit/e79bd0b4f25e68130a2ac273d6508ea322028b61
  Author: Alex Zinenko <zinenko at google.com>
  Date:   2021-01-11 (Mon, 11 Jan 2021)

  Changed paths:
    M mlir/include/mlir-c/AffineExpr.h
    M mlir/include/mlir-c/AffineMap.h
    M mlir/lib/Bindings/Python/IRModules.cpp
    M mlir/lib/CAPI/IR/AffineMap.cpp
    M mlir/test/Bindings/Python/ir_affine_map.py
    M mlir/test/CAPI/ir.c

  Log Message:
  -----------
  [mlir] More Python bindings for AffineMap

Now that the bindings for AffineExpr have been added, add more bindings for
constructing and inspecting AffineMap that consists of AffineExprs.

Depends On D94225

Reviewed By: mehdi_amini

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


  Commit: 547e3eef14a8e75a867dfcc6b45cd1f0547d4e07
      https://github.com/llvm/llvm-project/commit/547e3eef14a8e75a867dfcc6b45cd1f0547d4e07
  Author: Alex Zinenko <zinenko at google.com>
  Date:   2021-01-11 (Mon, 11 Jan 2021)

  Changed paths:
    M mlir/include/mlir-c/BuiltinTypes.h
    M mlir/lib/Bindings/Python/IRModules.cpp
    M mlir/lib/CAPI/IR/BuiltinTypes.cpp
    M mlir/test/Bindings/Python/ir_types.py

  Log Message:
  -----------
  [mlir] Expose MemRef layout in Python bindings

This wasn't possible before because there was no support for affine expressions
as maps. Now that this support is available, provide the mechanism for
constructing maps with a layout and inspecting it.

Rework the `get` method on MemRefType in Python to avoid needing an explicit
memory space or layout map. Remove the `get_num_maps`, it is too low-level,
using the length of the now-avaiable pseudo-list of layout maps is more
pythonic.

Depends On D94297

Reviewed By: mehdi_amini

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


Compare: https://github.com/llvm/llvm-project/compare/bcec0f27a2c3...547e3eef14a8


More information about the All-commits mailing list