goblint / analyzer

Static analysis framework for C
https://goblint.in.tum.de
MIT License
175 stars 75 forks source link

Restarting of Access globals as a baseline for the incremental solver #703

Closed michael-schwarz closed 2 years ago

michael-schwarz commented 2 years ago

@stilscher discussed this with Helmut yesterday, and at some point I also joined the discussion.

The issue we currently face is that we try to sell the non-restarting of access globals as a contribution (c.f. read-only globals). However, already in the basic setting without the incremental post-solver we are smart about these accesses in that we only really collect them during postsolving, which already is part of the insight we want to sell.

So for comparison, we were thinking about implementing a more naive approach:

If we implement this, this gives us a natural testbed for selective restarting and also shows that just the Seidl, Vogler, Erhard incrementality is not enough, as it (without our insight) requires restarting of access globals, which is not something they do in their paper.

I think this sort of restarting ought to be easy to implement, as we already collect the dependencies during the access analysis anyway. I think to showcase the difference, it would even suffice to reset because that's what is needed conceptually and then still simply collect in the verification phase, as we iterate over the entire system anyway when the incremental post-solver is off.

WDYT @sim642 @vesalvojdani ?


And perhaps a stupid side question: In the setting without the incremental post-solver, do we actually reset the access globals to bot, or are we truly just accumulating race warnings without it?

sim642 commented 2 years ago

However, already in the basic setting without the incremental post-solver we are smart about these accesses in that we only really collect them during postsolving, which already is part of the insight we want to sell.

The crucial difference is that there was no incremental postsolving before, so all the accesses had to be regenerated each time.

the Seidl, Vogler, Erhard incrementality is not enough, as it (without our insight) requires restarting of access globals, which is not something they do in their paper.

Prior to incremental postsolving, there were even no unknowns for accesses, but it was all done ad-hoc. So effectively they used to be all restarted (the incrementally loaded run started with no accesses) and all recalculated (by the non-incremental postsolver). So if I understand the idea correctly, it's exactly what they did, but it was all implicit because the access tables were a global OCaml data structure that simply wasn't marshaled.

Or am I misunderstanding something?

And perhaps a stupid side question: In the setting without the incremental post-solver, do we actually reset the access globals to bot, or are we truly just accumulating race warnings without it?

Just like I described above, at the time of the previous paper, the non-incremental postsolver implicitly reset all of them to empty sets. Now with non-incremental postsolver, we also reset all of them to empty sets (by not reusing any of rho_write). So AFAIK accesses have never been accumulated like how the global values and protecting sets have.

sim642 commented 2 years ago

Decision at GobCon was to write a story about it, implement it (which hopefully should be very simple) and then decide.

michael-schwarz commented 2 years ago

fixed and merged back.

sim642 commented 2 years ago

We used this for the smtprc story in hopes to get minimal restarting of not write-only unknowns, but just globals. Somehow this wasn't any faster than full restarting.

After the deadline I also tried to go through the smtprc story using fuel 1 to achieve minimal restarting (available on smtprc-fuel branch). In https://github.com/goblint/analyzer/pull/721#discussion_r864635389 it seemed like the two should be equivalent. Surprisingly, this isn't the case! As you can see below, fuel 1 restarts a lot fewer unknowns (while still having sufficient restarting for the story). Also the two incremental analyses are then a couple of seconds faster than reported in the paper.

In https://github.com/goblint/analyzer/pull/721#issue-1225110391 you also say:

What is very curious is that I have been completely unable to construct an example where the incremental.restart.sided.destab-with-sides would make any sort of difference.

So it really seems like there's some problem with that option, not doing what is intended and degrading to full restarting. On smtprc it seems to do all the same restarts as full restarting, just in a different order.

smtprc story

With this (#721)

Using "destab-with-sides": false

Restarts after patch 1

``` change_info = { unchanged = 1238; changed = 1; added = 0; removed = 0 } Completely changed function: start_scan Destabilizing changed functions and primary old nodes ... Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:o Restarting to bot varinfo:(alloc@sid:1822) Restarting to bot varinfo:swap_rule Restarting to bot varinfo:rules Restarting to bot varinfo:(alloc@sid:947) Restarting to bot varinfo:(alloc@sid:907) Restarting to bot FlagConfiguredTID: varinfo * node option:main Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2135) Restarting to bot varinfo:(alloc@sid:2135) Restarting to bot varinfo:(alloc@sid:3782) Restarting to bot varinfo:(alloc@sid:3970) Restarting to bot varinfo:(alloc@sid:3856) Restarting to bot varinfo:(alloc@sid:2135) Restarting to bot varinfo:(alloc@sid:3658) Restarting to bot varinfo:(alloc@sid:827) Restarting to bot varinfo:(alloc@sid:3651) Restarting to bot varinfo:s_malloc Restarting to bot varinfo:swap_macro Restarting to bot varinfo:hosts Restarting to bot varinfo:f Restarting to bot varinfo:(alloc@sid:785) Restarting to bot varinfo:(alloc@sid:820) Restarting to bot varinfo:(alloc@sid:782) Restarting to bot varinfo:(alloc@sid:958) Restarting to bot varinfo:o Restarting to bot FlagConfiguredTID: varinfo * node option:thread_start Restarting to bot varinfo:stderr Restarting to bot varinfo:stdout Restarting to bot varinfo:error Restarting to bot varinfo:connect_non_blocking Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:907) Restarting to bot varinfo:rules Restarting to bot varinfo:(alloc@sid:907) Restarting to bot varinfo:(alloc@sid:947) Restarting to bot varinfo:(alloc@sid:950) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:950) Restarting to bot varinfo:(alloc@sid:950) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3782) Restarting to bot varinfo:(alloc@sid:3782) Restarting to bot varinfo:(alloc@sid:2159) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2159) Restarting to bot varinfo:read_timeo Restarting to bot varinfo:convert_rule Restarting to bot varinfo:write_smtp Restarting to bot varinfo:read_smtp Restarting to bot varinfo:(alloc@sid:958) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:958) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3856) Restarting to bot varinfo:(alloc@sid:3856) Restarting to bot varinfo:(alloc@sid:966) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:966) Restarting to bot varinfo:(alloc@sid:966) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3970) Restarting to bot varinfo:(alloc@sid:3970) Restarting to bot varinfo:debug Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:f Restarting to bot varinfo:o Restarting to bot varinfo:f Restarting to bot varinfo:(alloc@sid:1590) Restarting to bot varinfo:(alloc@sid:1647) Restarting to bot varinfo:(alloc@sid:3406) Restarting to bot varinfo:(alloc@sid:3544) Restarting to bot varinfo:(alloc@sid:1501) Restarting to bot varinfo:(alloc@sid:1606) Restarting to bot varinfo:(alloc@sid:3416) Restarting to bot varinfo:(alloc@sid:1635) Restarting to bot varinfo:(alloc@sid:3520) Restarting to bot varinfo:(alloc@sid:3564) Restarting to bot varinfo:(alloc@sid:1623) Restarting to bot varinfo:(alloc@sid:2253) Restarting to bot varinfo:(alloc@sid:2245) Restarting to bot varinfo:(alloc@sid:3458) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1576) Restarting to bot varinfo:(alloc@sid:1576) Restarting to bot varinfo:(alloc@sid:3531) Restarting to bot varinfo:(alloc@sid:3434) Restarting to bot varinfo:(alloc@sid:1561) Restarting to bot varinfo:(alloc@sid:1576) Restarting to bot varinfo:(alloc@sid:3531) Restarting to bot varinfo:(alloc@sid:3434) Restarting to bot varinfo:(alloc@sid:1561) Restarting to bot varinfo:(alloc@sid:3478) Restarting to bot varinfo:(alloc@sid:3499) Restarting to bot varinfo:(alloc@sid:3468) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3531) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3434) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1561) Restarting to bot varinfo:parse_mbox Restarting to bot varinfo:parse_maildir Restarting to bot varinfo:(alloc@sid:3544) Restarting to bot varinfo:(alloc@sid:1623) Restarting to bot varinfo:display_html Restarting to bot varinfo:display_machine Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:827) Restarting to bot varinfo:hosts Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:785) Restarting to bot varinfo:(alloc@sid:785) Restarting to bot varinfo:(alloc@sid:782) Restarting to bot varinfo:(alloc@sid:820) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:782) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:820) Restarting to bot varinfo:(alloc@sid:827) Restarting to bot varinfo:(alloc@sid:1396) Restarting to bot varinfo:(alloc@sid:1074) Restarting to bot varinfo:(alloc@sid:1157) Restarting to bot varinfo:(alloc@sid:1121) Restarting to bot varinfo:(alloc@sid:2233) Restarting to bot varinfo:(alloc@sid:1115) Restarting to bot varinfo:(alloc@sid:1038) Restarting to bot varinfo:(alloc@sid:1064) Restarting to bot varinfo:(alloc@sid:1147) Restarting to bot varinfo:(alloc@sid:1032) Restarting to bot varinfo:smtp_open Restarting to bot varinfo:smtp_open Restarting to bot varinfo:print_link Restarting to bot varinfo:(alloc@sid:3054) Restarting to bot varinfo:print_check Restarting to bot varinfo:print_errord_check Restarting to bot varinfo:print_quit Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2968) Restarting to bot varinfo:(alloc@sid:2999) Restarting to bot varinfo:(alloc@sid:2968) Restarting to bot varinfo:(alloc@sid:2968) Restarting to bot varinfo:escape_html_chars Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2999) Restarting to bot varinfo:(alloc@sid:2999) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1396) Restarting to bot varinfo:(alloc@sid:1396) Restarting to bot varinfo:(alloc@sid:1157) Restarting to bot varinfo:(alloc@sid:1121) Restarting to bot varinfo:(alloc@sid:1115) Restarting to bot varinfo:(alloc@sid:1147) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1074) Restarting to bot varinfo:(alloc@sid:1074) Restarting to bot varinfo:(alloc@sid:1038) Restarting to bot varinfo:(alloc@sid:1064) Restarting to bot varinfo:(alloc@sid:1032) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1038) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1064) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1032) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1157) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1121) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1115) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1147) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3416) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1635) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2245) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1501) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3564) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2253) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2194) Restarting to bot varinfo:(alloc@sid:2194) Restarting to bot varinfo:(alloc@sid:3054) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3054) Restarting to bot varinfo:passed Restarting to bot varinfo:errord Restarting to bot varinfo:(alloc@sid:3082) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3082) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1874) Restarting to bot varinfo:(alloc@sid:1874) Restarting to bot varinfo:(alloc@sid:1874) Restarting to bot varinfo:thread_start Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2026) Restarting to bot varinfo:(alloc@sid:2285) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2285) Restarting to bot varinfo:(alloc@sid:2285) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:failed_file Restarting to bot varinfo:failed_file Restarting to bot varinfo:failed_file Restarting to bot varinfo:(alloc@sid:2309) Restarting to bot varinfo:(alloc@sid:2317) Restarting to bot varinfo:(alloc@sid:2309) Restarting to bot varinfo:(alloc@sid:2317) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2309) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2317) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:4411) Restarting to bot varinfo:(alloc@sid:4411) Restarting to bot varinfo:(alloc@sid:4411) Restarting to bot varinfo:s_zmalloc Restarting to bot varinfo:quit_smtp Restarting to bot varinfo:(alloc@sid:3651) Restarting to bot varinfo:(alloc@sid:3658) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3658) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:4363) Restarting to bot varinfo:(alloc@sid:4363) Restarting to bot varinfo:(alloc@sid:4363) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:4224) Restarting to bot varinfo:(alloc@sid:4224) Restarting to bot varinfo:(alloc@sid:4224) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2233) Restarting to bot varinfo:(alloc@sid:2745) Restarting to bot varinfo:(alloc@sid:2882) Restarting to bot varinfo:return_data Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3710) Restarting to bot varinfo:(alloc@sid:3710) Restarting to bot varinfo:(alloc@sid:3710) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:4120) Restarting to bot varinfo:(alloc@sid:4120) Restarting to bot varinfo:(alloc@sid:4120) ```

Restarts after patch 2

``` change_info = { unchanged = 1238; changed = 1; added = 0; removed = 0 } Completely changed function: parse_args Destabilizing changed functions and primary old nodes ... Restarting to bot varinfo:o Restarting to bot varinfo:f Restarting to bot varinfo:(alloc@sid:3478) Restarting to bot varinfo:(alloc@sid:1576) Restarting to bot varinfo:(alloc@sid:1590) Restarting to bot varinfo:(alloc@sid:1647) Restarting to bot varinfo:(alloc@sid:3406) Restarting to bot varinfo:(alloc@sid:3544) Restarting to bot varinfo:(alloc@sid:3499) Restarting to bot varinfo:(alloc@sid:1501) Restarting to bot varinfo:(alloc@sid:1606) Restarting to bot varinfo:(alloc@sid:3531) Restarting to bot varinfo:(alloc@sid:3434) Restarting to bot varinfo:(alloc@sid:3416) Restarting to bot varinfo:(alloc@sid:3468) Restarting to bot varinfo:(alloc@sid:1635) Restarting to bot varinfo:(alloc@sid:3520) Restarting to bot varinfo:(alloc@sid:3564) Restarting to bot varinfo:(alloc@sid:1623) Restarting to bot varinfo:(alloc@sid:1561) Restarting to bot varinfo:(alloc@sid:2253) Restarting to bot varinfo:(alloc@sid:2245) Restarting to bot varinfo:(alloc@sid:3458) Restarting to bot FlagConfiguredTID: varinfo * node option:main Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:o Restarting to bot varinfo:o Restarting to bot varinfo:hosts Restarting to bot varinfo:(alloc@sid:785) Restarting to bot varinfo:(alloc@sid:820) Restarting to bot varinfo:(alloc@sid:782) Restarting to bot FlagConfiguredTID: varinfo * node option:thread_start Restarting to bot varinfo:stderr Restarting to bot varinfo:stdout Restarting to bot varinfo:error Restarting to bot varinfo:connect_non_blocking Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:907) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2135) Restarting to bot varinfo:(alloc@sid:2135) Restarting to bot varinfo:(alloc@sid:3782) Restarting to bot varinfo:(alloc@sid:3856) Restarting to bot varinfo:(alloc@sid:3970) Restarting to bot varinfo:(alloc@sid:2135) Restarting to bot varinfo:(alloc@sid:3658) Restarting to bot varinfo:(alloc@sid:827) Restarting to bot varinfo:(alloc@sid:3651) Restarting to bot varinfo:s_malloc Restarting to bot varinfo:swap_macro Restarting to bot varinfo:(alloc@sid:958) Restarting to bot varinfo:swap_rule Restarting to bot varinfo:rules Restarting to bot varinfo:(alloc@sid:947) Restarting to bot varinfo:(alloc@sid:907) Restarting to bot varinfo:rules Restarting to bot varinfo:(alloc@sid:907) Restarting to bot varinfo:(alloc@sid:947) Restarting to bot varinfo:(alloc@sid:950) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:950) Restarting to bot varinfo:(alloc@sid:950) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3782) Restarting to bot varinfo:(alloc@sid:3782) Restarting to bot varinfo:f Restarting to bot varinfo:(alloc@sid:2159) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2159) Restarting to bot varinfo:read_timeo Restarting to bot varinfo:convert_rule Restarting to bot varinfo:write_smtp Restarting to bot varinfo:read_smtp Restarting to bot varinfo:(alloc@sid:958) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:958) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3856) Restarting to bot varinfo:(alloc@sid:3856) Restarting to bot varinfo:(alloc@sid:966) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:966) Restarting to bot varinfo:(alloc@sid:966) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3970) Restarting to bot varinfo:(alloc@sid:3970) Restarting to bot varinfo:debug Restarting to bot varinfo:(alloc@sid:1396) Restarting to bot varinfo:(alloc@sid:1157) Restarting to bot varinfo:(alloc@sid:1121) Restarting to bot varinfo:(alloc@sid:1115) Restarting to bot varinfo:(alloc@sid:1147) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1074) Restarting to bot varinfo:(alloc@sid:1074) Restarting to bot varinfo:(alloc@sid:1038) Restarting to bot varinfo:(alloc@sid:1064) Restarting to bot varinfo:(alloc@sid:1032) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1038) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1064) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1032) Restarting to bot varinfo:(alloc@sid:1396) Restarting to bot varinfo:(alloc@sid:1074) Restarting to bot varinfo:(alloc@sid:1157) Restarting to bot varinfo:(alloc@sid:1121) Restarting to bot varinfo:(alloc@sid:2233) Restarting to bot varinfo:(alloc@sid:1115) Restarting to bot varinfo:(alloc@sid:1038) Restarting to bot varinfo:(alloc@sid:1064) Restarting to bot varinfo:(alloc@sid:1147) Restarting to bot varinfo:(alloc@sid:1032) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:782) Restarting to bot varinfo:hosts Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:785) Restarting to bot varinfo:(alloc@sid:785) Restarting to bot varinfo:(alloc@sid:782) Restarting to bot varinfo:(alloc@sid:820) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:820) Restarting to bot varinfo:(alloc@sid:827) Restarting to bot varinfo:smtp_open Restarting to bot varinfo:smtp_open Restarting to bot varinfo:print_link Restarting to bot varinfo:(alloc@sid:3054) Restarting to bot varinfo:print_check Restarting to bot varinfo:print_errord_check Restarting to bot varinfo:print_quit Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2968) Restarting to bot varinfo:(alloc@sid:2999) Restarting to bot varinfo:(alloc@sid:2968) Restarting to bot varinfo:(alloc@sid:2968) Restarting to bot varinfo:escape_html_chars Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2999) Restarting to bot varinfo:(alloc@sid:2999) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1396) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1157) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1121) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1115) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1147) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1576) Restarting to bot varinfo:(alloc@sid:1576) Restarting to bot varinfo:(alloc@sid:3531) Restarting to bot varinfo:(alloc@sid:3434) Restarting to bot varinfo:(alloc@sid:1561) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3531) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3434) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1561) Restarting to bot varinfo:(alloc@sid:4570) Restarting to bot varinfo:(alloc@sid:4570) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2026) Restarting to bot varinfo:(alloc@sid:3544) Restarting to bot varinfo:(alloc@sid:1623) Restarting to bot varinfo:(alloc@sid:2285) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2285) Restarting to bot varinfo:(alloc@sid:2285) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:failed_file Restarting to bot varinfo:failed_file Restarting to bot varinfo:failed_file Restarting to bot varinfo:(alloc@sid:2309) Restarting to bot varinfo:(alloc@sid:2317) Restarting to bot varinfo:(alloc@sid:2309) Restarting to bot varinfo:(alloc@sid:2317) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2309) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2317) Restarting to bot varinfo:passed Restarting to bot varinfo:errord Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2194) Restarting to bot varinfo:(alloc@sid:2194) Restarting to bot varinfo:(alloc@sid:3054) Restarting to bot varinfo:(alloc@sid:3082) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:4411) Restarting to bot varinfo:(alloc@sid:4411) Restarting to bot varinfo:(alloc@sid:4411) Restarting to bot varinfo:s_zmalloc Restarting to bot varinfo:quit_smtp Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3416) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3564) Restarting to bot varinfo:(alloc@sid:3651) Restarting to bot varinfo:(alloc@sid:3658) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3658) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:4363) Restarting to bot varinfo:(alloc@sid:4363) Restarting to bot varinfo:(alloc@sid:4363) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:4224) Restarting to bot varinfo:(alloc@sid:4224) Restarting to bot varinfo:(alloc@sid:4224) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2233) Restarting to bot varinfo:(alloc@sid:2882) Restarting to bot varinfo:(alloc@sid:2745) Restarting to bot varinfo:return_data Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3710) Restarting to bot varinfo:(alloc@sid:3710) Restarting to bot varinfo:(alloc@sid:3710) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:4120) Restarting to bot varinfo:(alloc@sid:4120) Restarting to bot varinfo:(alloc@sid:4120) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:4570) Restarting to bot varinfo:thread_start Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:f Restarting to bot varinfo:parse_mbox Restarting to bot varinfo:parse_maildir Restarting to bot varinfo:display_html Restarting to bot varinfo:display_machine Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:827) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1635) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2245) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1501) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2253) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3054) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3082) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3478) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1590) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1647) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3406) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3544) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3499) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1606) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3468) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3520) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1623) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3458) ```

With fuel (#629)

Using "fuel": 1

Restarts after patch 1

``` change_info = { unchanged = 1238; changed = 1; added = 0; removed = 0 } Completely changed function: start_scan Destabilizing changed functions and primary old nodes ... Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:o Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1874) ```

Restarts after patch 2

``` change_info = { unchanged = 1238; changed = 1; added = 0; removed = 0 } Completely changed function: parse_args Destabilizing changed functions and primary old nodes ... Restarting to bot varinfo:o Restarting to bot varinfo:f Restarting to bot varinfo:(alloc@sid:3478) Restarting to bot varinfo:(alloc@sid:1576) Restarting to bot varinfo:(alloc@sid:1590) Restarting to bot varinfo:(alloc@sid:1647) Restarting to bot varinfo:(alloc@sid:3406) Restarting to bot varinfo:(alloc@sid:3544) Restarting to bot varinfo:(alloc@sid:3499) Restarting to bot varinfo:(alloc@sid:1501) Restarting to bot varinfo:(alloc@sid:1606) Restarting to bot varinfo:(alloc@sid:3531) Restarting to bot varinfo:(alloc@sid:3434) Restarting to bot varinfo:(alloc@sid:3416) Restarting to bot varinfo:(alloc@sid:3468) Restarting to bot varinfo:(alloc@sid:1635) Restarting to bot varinfo:(alloc@sid:3520) Restarting to bot varinfo:(alloc@sid:3564) Restarting to bot varinfo:(alloc@sid:1623) Restarting to bot varinfo:(alloc@sid:1561) Restarting to bot varinfo:(alloc@sid:2253) Restarting to bot varinfo:(alloc@sid:2245) Restarting to bot varinfo:(alloc@sid:3458) Restarting to bot FlagConfiguredTID: varinfo * node option:main Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:o Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:f Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3478) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1576) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1590) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1647) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3406) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3544) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3499) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1501) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1606) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3531) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3434) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3416) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3468) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1635) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3520) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3564) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1623) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1561) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2253) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2245) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3458) ```

cc: @vesalvojdani

michael-schwarz commented 2 years ago

Strange! I can't really look into it today, but will hopefully do so soon

sim642 commented 2 years ago

I looked into it and here's the problem. The added restart_destab_with_sides only controls what kind of destabilization continues via side_dep, because that's where the restarting is done. But even if according to the option, the side_dep (the writes to the global) are destabilized normally, the infl (the reads from the global) below are still destabilized with side. This defeats the whole point, because many crucial side effects also read the value at the same node (or nearby). It explains why the option had absolutely no effect when you tried it as well.

Hence one would want to copy the same check to infl as well, but that becomes too strict since all local destabilization via infl should not degrade from side to normal after one step. Therefore a hack like the following is needed:

diff --git a/src/solvers/td3.ml b/src/solvers/td3.ml
index 02a45c47c..3d829a25e 100644
--- a/src/solvers/td3.ml
+++ b/src/solvers/td3.ml
@@ -592,9 +592,12 @@ module WP =
               (not restart_only_globals || Node.equal (S.Var.node x) (Function Cil.dummyFunDec)) && (not (S.Var.is_write_only x))
           in

+          let restarted = ref false in
+
           if not (VS.is_empty w) && should_restart then (
             (* restart side-effected var *)
             restart_leaf x;
+            restarted := true;

             (* add side_dep to front to prevent them from being aborted *)
             destabilize_front ~front:true x w;
@@ -621,7 +624,10 @@ module WP =
               if tracing then trace "sol2" "stable remove %a\n" S.Var.pretty_trace y;
               HM.remove stable y;
               HM.remove superstable y;
-              destabilize_with_side ~side_fuel ~front:false y
+              if not !restarted || restart_destab_with_sides then
+                destabilize_with_side ~side_fuel ~front:false y
+              else
+                destabilize_normal ~front:false y
             ) w;

           (* destabilize side infl *)

smtprc with this patch

Restarts after patch 1

``` change_info = { unchanged = 1238; changed = 1; added = 0; removed = 0 } Completely changed function: start_scan Destabilizing changed functions and primary old nodes ... Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:o Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1874) Restarting to bot varinfo:(alloc@sid:1874) Restarting to bot varinfo:o Restarting to bot FlagConfiguredTID: varinfo * node option:main ```

Restarts after patch 2

``` change_info = { unchanged = 1238; changed = 1; added = 0; removed = 0 } Completely changed function: parse_args Destabilizing changed functions and primary old nodes ... Restarting to bot varinfo:o Restarting to bot varinfo:f Restarting to bot varinfo:(alloc@sid:3478) Restarting to bot varinfo:(alloc@sid:1576) Restarting to bot varinfo:(alloc@sid:1590) Restarting to bot varinfo:(alloc@sid:1647) Restarting to bot varinfo:(alloc@sid:3406) Restarting to bot varinfo:(alloc@sid:3544) Restarting to bot varinfo:(alloc@sid:3499) Restarting to bot varinfo:(alloc@sid:1501) Restarting to bot varinfo:(alloc@sid:1606) Restarting to bot varinfo:(alloc@sid:3531) Restarting to bot varinfo:(alloc@sid:3434) Restarting to bot varinfo:(alloc@sid:3416) Restarting to bot varinfo:(alloc@sid:3468) Restarting to bot varinfo:(alloc@sid:1635) Restarting to bot varinfo:(alloc@sid:3520) Restarting to bot varinfo:(alloc@sid:3564) Restarting to bot varinfo:(alloc@sid:1623) Restarting to bot varinfo:(alloc@sid:1561) Restarting to bot varinfo:(alloc@sid:2253) Restarting to bot varinfo:(alloc@sid:2245) Restarting to bot varinfo:(alloc@sid:3458) Restarting to bot FlagConfiguredTID: varinfo * node option:main Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:o Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:f Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3478) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1576) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1590) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1647) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3406) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3544) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3499) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1501) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1606) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3531) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3434) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3416) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3468) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1635) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3520) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3564) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1623) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:1561) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2253) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:2245) Restarting to bot either varinfo or FlagConfiguredTID: varinfo * node option:(alloc@sid:3458) ```

The restarts now are much more reasonable and closer to the fuel 1 ones, although surprisingly still not exactly the same. Instead of two restarts of fuel 1 for patch 1 of smtprc, this makes five restarts, including main.


Seems to me like #629 is still better at limiting this by only needing a single check at side_infl (going from local to global) instead of multiple checks at side_dep and infl (going from global to local).

michael-schwarz commented 2 years ago

@stilscher @jerhard Did we use this for any of the evaluations in the paper and is this still needed in light of #629?

sim642 commented 2 years ago

From one of the latest interactive discussions on Slack, this could be achieved using:

Thus the broken incremental.restart.sided.destab-with-sides can be stripped from #391.