Repository navigation
[Fix][Relax] Preserve impure calls with unused tuple outputs - #20816
Conversation
7cf1c8b to
eb6d479
Compare
|
@tlopex, would you have time to review this follow-up to RemoveUnusedOutputs? When all tuple fields of an impure callee are unused, the current rewrite drops the call and its side effects. This change preserves the callee signature only in that case; pure and partially used cases retain the existing pruning. I've rebased onto current main and rerun the pass, DCE and canonicalization suites (64 passed, one existing xfail). The added VM cases check exact print counts and returned values before/after the pass. Fresh CI results are pending. Thank you. |
eb6d479 to
80dd7f1
Compare
tlopex
left a comment
There was a problem hiding this comment.
Could we simplify the tests and rebase onto main?
80dd7f1 to
ffed390
Compare
|
Thanks for the review, @tlopex. Rebased onto current main ( The impure regression still fails without the fix. With the fix, the pass/DCE/canonicalization suites report 60 passed and one existing xfail. File-scoped pre-commit checks also pass. Fresh CI results are pending. |
|
actually I don't think we need to add extra tests for this. Could you just preserve the fix? |
ffed390 to
001855c
Compare
|
Done, @tlopex. Removed all added tests and rebased onto current main. The PR now contains one commit changing only The existing pass/DCE/canonicalization suites report 58 passed and one existing xfail. The side-effect reproducer also passes locally. Fresh CI results are pending. Thanks for the guidance. |
When every tuple output of an impure private function is unused,
RemoveUnusedOutputsdrops the call and its side effects. A callee containingR.print, for example, no longer prints after the pass.Skip output pruning only for an impure callee whose output-usage mask is entirely false. Preserve its call and return signature. Pure callees and impure callees with partially used outputs keep the existing pruning behavior.
Fixes #20592.
Validation against main
a0ffe06def, Python 3.11 and source-built pinned TIRx/FFI dependencies:test_transform_remove_unused_outputs.py,test_transform_dead_code_elimination.py, andtest_transform_canonicalize_bindings.py: 58 passed, 1 existing xfailed.Prepared with OpenAI Codex assistance. The build and validation above were executed locally. Fresh CI results for this revision are pending.