[all-commits] [llvm/llvm-project] 681eac: [MLIR][transform][python] add sugared python abstr...

martin-luecke via All-commits all-commits at lists.llvm.org
Fri Dec 15 04:04:56 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 681eacc1b670fd7137d8677fef6fc76c6e37dca9
      https://github.com/llvm/llvm-project/commit/681eacc1b670fd7137d8677fef6fc76c6e37dca9
  Author: martin-luecke <martin.luecke at ed.ac.uk>
  Date:   2023-12-15 (Fri, 15 Dec 2023)

  Changed paths:
    M mlir/include/mlir-c/Dialect/Transform.h
    M mlir/include/mlir/Bindings/Python/PybindAdaptors.h
    M mlir/lib/Bindings/Python/DialectTransform.cpp
    M mlir/lib/CAPI/Dialect/Transform.cpp
    M mlir/python/CMakeLists.txt
    A mlir/python/mlir/extras/dialects/transform/__init__.py
    A mlir/test/python/dialects/transform_extras.py

  Log Message:
  -----------
  [MLIR][transform][python] add sugared python abstractions for transform dialect (#75073)

This adds Python abstractions for the different handle types of the
transform dialect

The abstractions allow for straightforward chaining of transforms by
calling their member functions.
As an initial PR for this infrastructure, only a single transform is
included: `transform.structured.match`.
With a future `tile` transform abstraction an example of the usage is: 
```Python
def script(module: OpHandle):
    module.match_ops(MatchInterfaceEnum.TilingInterface).tile(tile_sizes=[32,32])
```
to generate the following IR:
```mlir
%0 = transform.structured.match interface{TilingInterface} in %arg0
%tiled_op, %loops = transform.structured.tile_using_for %0 [32, 32]
```

These abstractions are intended to enhance the usability and flexibility
of the transform dialect by providing an accessible interface that
allows for easy assembly of complex transformation chains.




More information about the All-commits mailing list