[Mlir-commits] [mlir] [MLIR][CAPI][Python] Add support for querying memory effect instances (PR #213459)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sat Aug 1 21:27:22 PDT 2026


================
@@ -546,21 +565,22 @@ static void populateDialectTransformSubmodule(nb::module_ &m) {
   PyPatternDescriptorOpInterface::bind(m);
 
   m.def("only_reads_handle", onlyReadsHandle,
-        "Mark operands as only reading handles.", nb::arg("operands"),
-        nb::arg("effects"));
+        "Returns effects marking operands as only reading handles.",
----------------
PragmaTwice wrote:

ahh it is a signature change. previously `effects` is a mutable input argument, and these functions will append new effects into `effects` list (`MemoryEffectInstancesList`), e.g.
```python
    @staticmethod
    def get_effects(op: ir.Operation, effects):
        transform.only_reads_handle(op.op_operands, effects)
        transform.produces_handle(op.results, effects)
        transform.only_reads_payload(effects)
```

now it will return a new Python-native `list` and we can use `+` to concat lists and return.

```python
    def get_effects(op: ir.Operation):
        return (
            transform.only_reads_handle(op.op_operands)
            + transform.produces_handle(op.results)
            + transform.only_reads_payload()
        )
```

@adam-smnk I think maybe lighthouse is using these APIs. Are you good with this change?

https://github.com/llvm/llvm-project/pull/213459


More information about the Mlir-commits mailing list