Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data flow: Prevent quadratic blowup in Stage6Param::localStep #17739

Merged
merged 2 commits into from
Oct 31, 2024

Conversation

hvitved
Copy link
Contributor

@hvitved hvitved commented Oct 11, 2024

No description provided.

@hvitved hvitved force-pushed the dataflow/big-step-quadratic branch from 6fabf09 to e54a030 Compare October 11, 2024 11:45
@hvitved hvitved force-pushed the dataflow/big-step-quadratic branch from e54a030 to 9b37ff4 Compare October 11, 2024 12:08
@hvitved hvitved force-pushed the dataflow/big-step-quadratic branch 5 times, most recently from cda67b3 to 380e563 Compare October 22, 2024 13:21
@github-actions github-actions bot added the Go label Oct 22, 2024
@hvitved hvitved added the no-change-note-required This PR does not need a change note label Oct 23, 2024
@hvitved hvitved force-pushed the dataflow/big-step-quadratic branch from 380e563 to 7a2105b Compare October 23, 2024 08:41
@hvitved hvitved marked this pull request as ready for review October 23, 2024 12:12
@hvitved hvitved requested a review from a team as a code owner October 23, 2024 12:12
@hvitved hvitved requested a review from aschackmull October 23, 2024 12:13
Copy link
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few basic questions below.

DCA looks good for CPP, and fine for Swift (looks like normal wobble). The cpp/non-constant-format performance problem that motivated all this is fixed by the change.

) {
Stage3Param::localFlowBigStep(node1, state1, node2, state2, preservesValue, t, lcc, label) and
PrevStage::revFlow(node1, pragma[only_bind_into](state1), _) and
PrevStage::revFlow(node2, pragma[only_bind_into](state2), _)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the revFlow check that was here lost, or do we preserve it somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not lost, since it's part of localFlowBigStepTc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take your word for it!

Copy link
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 👍

* The big-step releation is based on the `localStep` relation from the
* input module, restricted to nodes that are forwards and backwards
* reachable in this stage.
* The big-step releation is based on the `localStepInput` relation,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* The big-step releation is based on the `localStepInput` relation,
* The big-step relation is based on the `localStepInput` relation,

@@ -2769,6 +2765,33 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
exists(Ap ap |
localFlowStepPlus(node1, state1, node2, preservesValue, t, callContext, label) and
localFlowExit(node2, state1, ap) and
state1 = state2 and
node1 != node2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While the addition here might well preserve semantics relative to main, then I don't think it matches what we want and the semantics prior to the introduction of the big-step recomputation. It's an obscure corner-case, but there might be a sequence of steps around a loop that returns to the origin including a taint step that affects the tracked type. In the first application of big-step TC then such a loop is preserved as a step, but a second application removes it, which seems wrong. So I think we should drop this constraint here.

Suggested change
node1 != node2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the node1 != node2 constraint then also be removed from localFlowStepPlus? Even if a node steps to itself as a taint step, the old type should be compatible with the new type, so I wouldn't expect us to gain much from updating the type.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite possibly. It's certainly corner-case, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#17877 shows the effect of allowing reflexive big steps; I'm not convinced that we want to add it, DCA on this PR also showed no alert changes (the ones for C# are wobble).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let's go with the PR as-is, then.

Copy link
Contributor

@aschackmull aschackmull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of minor comments, otherwise LGTM. I think there's room to simplify the code, but that's not urgent.

@hvitved hvitved merged commit c936468 into github:main Oct 31, 2024
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DataFlow Library Go no-change-note-required This PR does not need a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants