You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[mlir][transform] Fix and improve "cached names" check
When running with "expensive checks", the transform dialect interpreter
maintains a payload `Operation *` -> `OperationName` cache. This cache
is used to detect invalid API usage such as missing/incorrect handle
consumption/production side effects and/or payload IR modifications that
bypass the rewriter.
There was a bug in the check that can cause issues such as #72931.
(#72986 was just a workaround and did not really fix the underlying
issue.)
- Payload ops mapped to newly produced handles are now added to the
cache. This is in addition to adding/checking all mapped payload ops
at the beginning of each transform op, for extra safety.
- Remove consumed ops (and their children) before applying the transform
op. This used to happen after applying the transform op, which is
incorrect in cases such as: (1) transform op replaces a consumed
payload op with another op, (2) the new op reuses the same memory
pointer and (3) the new op is added to a newly produced handle. In
such a case the previous implementation removed the newly created op
from the cache.
- No assumptions can be made about whether an op should be in the cache
or not. The code previously reported an error when an op was not found
in the cache. E.g., this is problematic in cases such as: (1) the
transform op consumes the handle mapped to a payload op A and (2) the
implementation of the payload op removes/replaces a nested op with A,
which is mapped to another handle. This triggers a listener
notification, which removes the nested op from the cache. However,
because consumed ops (and their children) are removed from the cache
before applying the transform op, the nested op will not be in cache
and making such an assumption would be incorrect.
0 commit comments