[Mlir-commits] [mlir] [mlir][transform] Do not maintain mappings for dead handles (PR #73558)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Mon Nov 27 11:57:52 PST 2023


https://github.com/ftynse commented:

I suppose the desired behavior is the tracking rewriter not failing to update the mapping. Can we construct a test to exercise this?

This behavior also has a spooky action-at-a-distance flavor. Specifically, we could have the following situation:

```
%tracked = transform.match ... in %func
transform.apply_patterns in %func
```
This works because `%tracked` is dead and tracking can simply ignore it. However, adding
```
transform.print %tracked
```
after the pattern application makes _the pattern application_ fail. Even though the pattern application was not changed, and the added op does not have effects on the payload IR. Moving the print before the application "fixes" it.

I have a recollection of a similar behavior existing in some earlier version of the interpreter and then being removed to avoid this kind of situation. Have you considered any alternatives? For example, having more aggressive scoping via nested `transform.sequence` so that values go out of scope, or having an explicit "transform.consume" that does nothing but indicates the end of the handle's lifetime?

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


More information about the Mlir-commits mailing list