-
Notifications
You must be signed in to change notification settings - Fork 142
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
Push Pop API #300
Draft
dewert99
wants to merge
21
commits into
egraphs-good:main
Choose a base branch
from
dewert99:semi-persistent
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Push Pop API #300
Conversation
This file contains 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
…and `analysis_pending`
dewert99
force-pushed
the
semi-persistent
branch
from
March 8, 2024 18:51
11544ea
to
2c1c95f
Compare
dewert99
force-pushed
the
semi-persistent
branch
from
March 12, 2024 20:51
e4a8f32
to
da807b0
Compare
# Conflicts: # src/egraph.rs # src/raw/egraph.rs
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.
This is another attempt at #290 that builds on #296.
I first added a
push
/pop
API toRawEGraph
that depends on an additional generic parameter. I ended up with two implementation strategies, and as I wasn't sure which one was better I implemented both, the generic parameter can also be instantiated with()
to disablepush
/pop
statically, orOption
to do it dynamically. Thepush
function forRawEGraph
returns aPushInfo
which needs to be passed intopop
so that the API can compose better with other similar APIs without each one needing its onVec<PushInfo>
.While I was working on this implementation I noticed that I could easily make
memo
append-only by having it nodes to the firstId
that is congruently equivalent instead of the most recent one. My first thought was to convertmemo
into anIndexMap
so it could be reverted by callingpop
until it reached its old size. Unfortunately I noticed this had slightly worse performance than aHashMap
. Instead I implemented my ownDHashMap
using ahashbrown::HashTable
, it has performance characteristics similar to aHashMap
but it stores the insertion order index along with each key/value pair. This allows it to efficiently remove the last element (given it's hash value). It can also iterate in insertion order, but this is more expensive thatIndexMap
and requires allocation.I added⚠️ ) since
push
andpop
toEGraph
and made it controlled dynamically withwith_push_pop_enabled
andwith_push_pop_disabled
(similar to explanations). I currently added a feature to pick between the two implementations I created, although it might make more sense just to pick one. These methods requireN::Data: Default
so I could temporarily have classes without data without making it anOption
orMaybeUninit
. I neededN::Data: Clone
so I could keep a log of copies old versions to revert to duringpop
. Unfortunately I had to make this a bound inAnalysis
(Breaking changeclone
is called inunion
andset_analysis_data
(notpush
orpop
).To test the new API I added a
test-push-pop
feature (similar totest-explanations
) that also adds a hook to callpush
and make a clone of theEGraph
at each iteration. Afterwards it repeatedly callspop
and each times checks if theEGraph
matches its corresponding clone.