-
Notifications
You must be signed in to change notification settings - Fork 277
Use the sharing map for the renaming level maps #4505
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
Use the sharing map for the renaming level maps #4505
Conversation
@smowton, @romainbrenguier Would you be able to try this out on your benchmarks too? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments (including one blocking one) below; I've started performance experiments, will report on their results later on today.
src/goto-symex/auto_objects.cpp
Outdated
if( | ||
state.get_level2().current_names.find(ssa_expr.get_identifier()) == | ||
state.get_level2().current_names.end()) | ||
if(!state.get_level2().current_names.has_key(ssa_expr.get_identifier())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting looks messed up? (edit: just a GitHub artifact)
src/goto-symex/goto_state.cpp
Outdated
{ | ||
std::pair<ssa_exprt, unsigned> copy = r_opt->get(); | ||
copy.second = n; | ||
level2.current_names.replace(l1_identifier, copy); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::move(copy)
@@ -776,16 +776,20 @@ ssa_exprt goto_symex_statet::add_object( | |||
const irep_idt l0_name = ssa.get_identifier(); | |||
const std::size_t l1_index = index_generator(l0_name); | |||
|
|||
// save old L1 name, if any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I appreciate that this comment has been removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put back in
{ | ||
level2.current_names.erase(it); | ||
level2.current_names.erase(l1_identifier); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this method should either be removed or else be used from drop_l1_name
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other version is now using erase_if_exists()
as suggested by @smowton
src/util/ssa_expr.h
Outdated
@@ -16,6 +16,8 @@ Author: Daniel Kroening, [email protected] | |||
class ssa_exprt:public symbol_exprt | |||
{ | |||
public: | |||
ssa_exprt() : symbol_exprt("", typet()) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pretty much a show stopper: why is this needed? Presumably a side effect of how objects are created in a sharing map, but can the sharing map please be fixed instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll take a look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was meaning to fix this once we have decided whether to merge this PR. Currently the sharing map creates a dummy object (using the default constructor of the stored value type) when for a delta_view_itemt
the key is only in one of the maps. We can probably use an optionalt
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#4612 is merged.
The results for my recent favourite ReachSafety-ECA are: 160 points scored with this patch, 156 points without this patch. Symex steps per second increase from 2978.24 to 2991.21. So that's overall an improvement, albeit not a groundbreaking one. |
@danpoe @romainbrenguier Could you rerun your benchmarking now that field-sensitivity is merged? It's possible that the maps now actually get larger, and thus such changes may be more impactful. |
src/goto-symex/goto_symex_state.h
Outdated
} | ||
|
||
/// Drops an L1 name from the local L2 map | ||
void drop_l1_name(const irep_idt &l1_identifier) | ||
{ | ||
level2.current_names.erase(l1_identifier); | ||
if(level2.current_names.has_key(l1_identifier)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now have erase_if_exists
auto it = current_names.begin(); | ||
for(const auto &pair : other) | ||
current_namest::delta_viewt delta_view; | ||
other.get_delta_view(current_names, delta_view, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delta_view
overestimates the keys that may differ, right? If so couldn't the replace
below replace for no good reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested this with a long-running Webgoat analysis -- found before the changes it took ~200s, afterwards ~160s.
Here are some results for the runtime of symex only, with Overall with sharing it's 3% faster. Btw, I've also compared old symex vs. field sensitive symex and overall field-sensitive symex was 6.3X faster on the benchmarks. |
9edc38c
to
ba5b977
Compare
Now that field-sensitivity is in this makes even more of a difference, mostly in skipping the large number of new keys in the renaming map via a sparse |
@smowton Would you be able to re-run the benchmarks on the Webgoat analysis now that field-sensitivity has been merged? |
Thanks everyone for the benchmarking and comments. So in summary on @romainbrenguier's benchmarks it's about 4% slower, on @smowton's benchmark it's about twice as fast, and on my benchmarks it's about 3% faster. So I'd be inclined to merge it once comments have been addressed and CI passes. |
ba5b977
to
f37b254
Compare
CI failure is caused by the rebase, as |
f37b254
to
c608c50
Compare
c608c50
to
60dbcd9
Compare
Use the sharing map for the renaming level maps
current_names
insymex_renaming_levelt
. The code in this PR has a few issues which I'll fix once we've decided whether to merge it.