Handle region control flow in remat cost calculation#9201
Merged
Conversation
d365fbe to
88afe54
Compare
88afe54 to
35865c0
Compare
35865c0 to
555b882
Compare
peterbell10
pushed a commit
that referenced
this pull request
Feb 16, 2026
…9245) Replace the current recursive `isOpSingleUse` helper with an iterative traversal that starts from the ops used directly outside a slice and propagates to their operands. This simplifies the code and makes the handling of block arguments explicit. This is an incremental step towards properly handling block arguments (at least for for-loops) in #9201.
ed21d2d to
afc5e74
Compare
91d5f9d to
9a840ac
Compare
9a840ac to
efc5d78
Compare
Determining whether an op is used outside of the slice being rematerialised is currently conservative. For instance, if an op is used by an `scf.yield`, we automatically treat that as a non-slice user, even if the value that the yield flows into is actually part of the slice or completely unused. To address this, trace through region control flow when deciding whether an op is single use.
efc5d78 to
e2c4ef9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Determining whether an op is used outside of the slice being
rematerialised is currently conservative. For instance, if an op is used
by an
scf.yield, we automatically treat that as a non-slice user, evenif the value that the yield flows into is actually part of the slice or
completely unused.
To address this, trace through region control flow when deciding whether
an op is single use.