This repository has been archived by the owner on Aug 20, 2024. It is now read-only.
Prevent extra re-lowerings via "actual targets" #1802
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.
Add a member to DependencyManager that returns the "actual targets" of
what this DependencyManager solves. This exposes an API to query not
just the targets, but the actual state that results from running the
transform. The actual targets are a superset of the targets that can
prevent unnecessary re-lowering.
Consider the situation of a dependency manager that has one transform
target, foo, and no current state. The flattened transform order that
results pulls in hundreds of other transforms that foo requires.
However, from the perspective of a user looking at the dependency
manager, it's "effect" is only running foo.
This matters when using a DependencyManager to solve a sub-problem. If
the sub-problem is too narrow, e.g., one transform foo, then the
hundreds of other transforms that may be run will be repeatedly run
over and over again because there's no API to query the effect of
solving a (targets, currentState) tuple.
This commit includes a small test that shows this issue.
This commit also removes a spurious addition of ResolveKinds before
ExpandWhensAndCheck.
For the provided test, the old order, without this PR is:
The new order, with this PR is:
The unnecessary re-lowering of
A
is removed.This is related to the comment in #1784 (comment).
Note: doing this highlighted two lingering issues of using anonymous transforms in tests. Those are fixed in the first commit of this PR.
Contributor Checklist
Type of Improvement
API Impact
None.
Backend Code Generation Impact
None.
Desired Merge Strategy
Release Notes
Reviewer Checklist (only modified by reviewer)
Please Merge
?