[all-commits] [llvm/llvm-project] 712346: [MLIR][Python] Add the ability to signal pass fail...

Twice via All-commits all-commits at lists.llvm.org
Tue Sep 9 08:06:02 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7123463ef98bd478ff068dc94bfeee1b13c551c3
      https://github.com/llvm/llvm-project/commit/7123463ef98bd478ff068dc94bfeee1b13c551c3
  Author: Twice <twice at apache.org>
  Date:   2025-09-09 (Tue, 09 Sep 2025)

  Changed paths:
    M mlir/lib/Bindings/Python/Pass.cpp
    M mlir/test/python/python_pass.py

  Log Message:
  -----------
  [MLIR][Python] Add the ability to signal pass failures in python-defined passes (#157613)

This is a follow-up PR for #156000.

In this PR we add the ability to signal pass failures
(`signal_pass_failure()`) in python-defined passes.

To achieve this, we expose `MlirExternalPass` via `nb::class_` with a
method `signal_pass_failure()`, and the callable passed to `pm.add(..)`
now accepts two arguments (`op: MlirOperation, pass_:
MlirExternalPass`).

For example:
```python
def custom_pass_that_fails(op, pass_):
    if some_condition:
        pass_.signal_pass_failure()
    # do something
```



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list