Add new JumpForwarding pass - #1060
Conversation
|
Looking at the CI, it seems this PR has a very bad negative impact, especially on safe_stack. |
|
With two successive runs showing bad performance, I guess we shouldn't merge this. In the above version, |
|
Why do the changes affect the RA tests? |
|
It's a very good question. I don't know. The only reason can be that |
6d8ed39 to
4d4841a
Compare
|
Ran PR improvement = (disabled − default) / disabled; positive means the PR default (true) is faster.
Overall it seems the current default option is bad. I would use |
|
Did you only compare the two configurations with each other? Btw. |
|
The history says "you changed, I committed" :D. Yes, I compared only the configurations based on the code of this branch. Can also make comparison with development. What I compared with development was "visually": I printed the IR on a few examples and I agree that it looks a bit better with the jump forwarding. |
I would say once we change the default option, we can merge. |
|
Can you check the larger benchmarks like safe_stack, maybe qspinlock (if you have it), wsq and the more complex cna (in the challenging folder)? Especially safe_stack often showed over 100% overhead (sometimes even like 400%?). |
|
I intentionally skip |
I would consider the regression in |
Well yes, but IIRC the CI failed twice on I also said this in my initial post:
So there was a discrepancy between the performance on PASS and FAIL/UNKNOWN instances. I also think I tested this branch with the IDL encoding since we did not change the default yet IIRC. The SAT encoding might show less variance due to the generally smaller runtimes. |
|
I made 20 runs per branch on
BTW, I do not see |
Hmm, I feel like I did more runs than the history shows. Maybe I did some locally? But I was certainly wrong about the litmus test: as you said, the floats test was failing (which was super surprising). It's interesting that ARM is a lot faster and TSO is a lot slower in your tests. With the old IDL setting where solving times are much larger, I saw differences of over 100%. I remember that my machine usually needed 2-3 minutes for safe_stack but needed like 8-10 minutes on this branch. Anyways, if you are fine with the performance differences, we can merge I guess. |
|
I think we can delete that option completely. BTW: Im working on a PR that will add a CI job to do this performance evaluation in every PR. Maybe it makes sense to wait until that one is merged and let the CI do a final (maybe even larger) performance run. |
|
That's up to you. We can also wait. This PR is totally orthogonal to every other change we do, so it doesn't block or unblock other PRs. |
Added option to BranchEquivalence that forces different control-flow branches into different equivalence classes (mainly for evaluation).
0a17f4b to
fefe1d9
Compare
Performance comparisonLinux x64Memory model: vmm
Memory model: aarch64
Memory model: power
Total
4 benchmark(s) omitted because both averages were below 5 seconds. macOS ARM64Memory model: vmm
Memory model: aarch64
Memory model: power
Total
|
|
Performance remains unchanged overall, thus I think we can merge. |
I added a jump forwarding pass that simplifies some ugly branching code like this:
Oddly, this consistently yielded slower runtimes for
challenging/cna.cunder SC withB=2(UNKNOWN).Looking more into this, I noticed that the simplified code has less equivalence classes according to
BranchEquivalence.This yields stronger merging of
cf-variables in the encoding stage.This seems to be able to have negative impact for UNKNOWN programs, possibly because the solver cannot reason so easily about only the branch that contains the reachable bound event if that branch is merged with others (not sure though).
So I also added an option to
BranchEquivalencethat puts every branch into its own class (which leads to less aggressive merging ofcf-variables). With this option enabled, the jump forwarding seems beneficial again.Interestingly, for the
B=3(PASS) version ofcna.cthe stronger merging enabled by jump forwarding also seems to be beneficial. Maybe this is because the solver has to reason about all branches anyhow (since it is PASS) and so it is better to have them merged.So overall my impression is this:
BranchEquivalence, is good for PASS programsBranchEquivalence) but reducing the total number of branches (the new pass).cna.cand might be different across different benchmarks.