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

Dataflow: Implement call context grouping to improve performance #16456

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

aschackmull
Copy link
Contributor

This replaces our call context representation with a set-based representation of the allowed call edges, thus unifying equivalent call contexts. This unification means that we avoid redundant computation when a callable is reachable with several different, but equivalent call contexts.

In some cases I've observed 3000 equivalent call contexts, which will now be replaced by a single entity, and in that particular case the total tuple count for the stage was cut in half.

Commit-by-commit review encouraged. The first commit introduces the MakeSets primitive, which is then used to collapse local call contexts. Then a sequence of refactoring commits follow. And finally, the "Dataflow: Switch call context to a set representation" commit contains the implementation of and switch to fully set-based call contexts. This commit also does some reshuffling to ensure proper caching in CachedCallContextSensitivity.


import CallContextSensitivity<CallContextSensitivityInput>
import LocalCallContext
}

Check warning

Code scanning / CodeQL

Candidate predicate not marked as `nomagic` Warning

Candidate predicate to
reducedViableImplInCallContext
is not marked as nomagic.
Candidate predicate to
reducedViableImplInCallContext
is not marked as nomagic.
}

private class CallContext = PrunedCallContextSensitivityStage5::Cc;

Check warning

Code scanning / CodeQL

Candidate predicate not marked as `nomagic` Warning

Candidate predicate to
reducedViableImplInReturn
is not marked as nomagic.
Candidate predicate to
reducedViableImplInReturn
is not marked as nomagic.

private module CallSets = MakeSets<CallSetsInput>;

private module CallSetOption = Option<CallSets::ValueSet>;

Check warning

Code scanning / CodeQL

Dead code Warning

This code is never used, and it's not publicly exported.

private module DispatchSets = MakeSets<DispatchSetsInput>;

private module DispatchSetsOption = Option<DispatchSets::ValueSet>;

Check warning

Code scanning / CodeQL

Dead code Warning

This code is never used, and it's not publicly exported.
@aschackmull aschackmull force-pushed the dataflow/callcontext-grouping branch from 178d18c to 985b8f0 Compare May 8, 2024 14:13
@aschackmull aschackmull force-pushed the dataflow/callcontext-grouping branch from 985b8f0 to 0520839 Compare May 14, 2024 13:06
predicate reducedViableImplInReturnCand =
CachedCallContextSensitivity::reducedViableImplInReturn/2;
}
predicate reducedViableImplInCallContextCand =

Check warning

Code scanning / CodeQL

Candidate predicate not marked as `nomagic` Warning

Candidate predicate to
reducedViableImplInCallContext
is not marked as nomagic.
Candidate predicate to
reducedViableImplInCallContext
is not marked as nomagic.

import CallContextSensitivity<CallContextSensitivityInput>
predicate reducedViableImplInReturnCand =

Check warning

Code scanning / CodeQL

Candidate predicate not marked as `nomagic` Warning

Candidate predicate to
reducedViableImplInReturn
is not marked as nomagic.
Candidate predicate to
reducedViableImplInReturn
is not marked as nomagic.
predicate reducedViableImplInReturnCand =
Stage3Param::Level1CallContextInput::reducedViableImplInReturn/2;
}
predicate reducedViableImplInCallContextCand =

Check warning

Code scanning / CodeQL

Candidate predicate not marked as `nomagic` Warning

Candidate predicate to
reducedViableImplInCallContext
is not marked as nomagic.
Candidate predicate to
reducedViableImplInCallContext
is not marked as nomagic.

import CallContextSensitivity<CallContextSensitivityInput>
predicate reducedViableImplInReturnCand = Stage3Param::reducedViableImplInReturn/2;

Check warning

Code scanning / CodeQL

Candidate predicate not marked as `nomagic` Warning

Candidate predicate to
reducedViableImplInReturn
is not marked as nomagic.
Candidate predicate to
reducedViableImplInReturn
is not marked as nomagic.

predicate callContextNone = CachedCallContextSensitivity::ccNone/0;

predicate callContextSomeCall = CachedCallContextSensitivity::ccSomeCall/0;

Check warning

Code scanning / CodeQL

Dead code Warning

This code is never used, and it's not publicly exported.
@aschackmull aschackmull marked this pull request as ready for review May 15, 2024 14:00
@aschackmull aschackmull requested review from a team as code owners May 15, 2024 14:00
@aschackmull aschackmull added the no-change-note-required This PR does not need a change note label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant