-
Notifications
You must be signed in to change notification settings - Fork 427
[Place] Estimating Starting T Using Equilibrium T #3271
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
[Place] Estimating Starting T Using Equilibrium T #3271
Conversation
I found that the way that the annealer estimates the initial temperature to be too high when the initial placement is of very good quality (for example, after AP). Added a new way of estimating the starting temperature by setting it to an estimation of the equilibrium temperature. The equilibrium temperature is the temperature at which the change in cost after an annealing iteration would be 0. The old way (of using the variance of the change in cost) is still the default; however, this new method can be turned on in the command-line.
…ibrium-init-t-est
Results on Titan (titan quick qor). Baseline is using the original cost variance approach (current default), the other is using my new equilibrium option (only one command-line change):
Overall, it looks like these changes improved place time by over 15% and improved CPD by 1%, at the expense of 1% wirelength! That's a very good tradeoff in my opinion! I predict AP would only be better! Raw results: Looking at direct_rf: We can see that this new equilibrium approach is achieving its goal of not setting the temperature too high. @vaughnbetz What do you think? I think we should not make this default yet; but this at least demonstrates the value of this approach. |
Definitely looks promising! |
@soheilshahrouz was curious if the gains we are seeing is just due to this new estimator always scaling down the initial temperature; so we could get the same results by just scaling down the initial temperature. To counter that point, I got the initial temperatures for each circuit for each estimator:
We can see that although, on average, the temperature was reduced by 4x, the ratio for most circuits is not near the average, with some circuits being 10x reduced, and some being 2x reduced. This demonstrates that this new approach is adapting based on the circuit's initial placement. One big bonus of this new flow is that it does not have any magic scaling factors, which will make it more automatic (so we do not need to keep readjusting it using new scaling factors). |
For @AmirhosseinPoolad , I ran VTR Master to see if there is any run time degredation due to this approach:
It looks like machine load hides the results some. But if we compare the change in pack time to the change in place time, we see that the run time does not increase by a noticeable amount due to this change. |
vtr_flow/tasks/regression_tests/vtr_reg_strong/strong_place_init_t_est/config/config.txt
Show resolved
Hide resolved
vpr/src/place/annealer.cpp
Outdated
accepted_swaps.reserve(move_lim); | ||
rejected_swaps.reserve(move_lim); | ||
for (int i = 0; i < move_lim; i++) { | ||
bool manual_move_enabled = 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.
I'd delete this. No need to enable manual moves during initial temperature calculations -- this is intended to let people directly control the annealer, but just doing that in the main annealer is enough.
There should be code like this at the start of the main annealer -- if it is there, there isn't any need to duplicate it here. If it isn't there, I think we should move this there anyway.
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 agree, this should not be here assuming that the entire purpose of this method is to estimate the starting temperature.
Looking at the code, however, I do not believe that the manual move feature is working at all. It appears to only ever turn on in the initial temperature estimation. I do not believe that this should be resolved in this PR, but I can raise an issue if you would like?
In the meantime, I will remove this from the equilibrium estimator (which I have added), but I will leave it the default flow for now so we do not regress the feature further.
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.
Ill raise an issue to look into this!
@AlexandreSinger: For the results you reported on Titan and VTR benchmarks, are you using the default placement flow with just the equilibrium approach for init temp, or is this with AP? Also, if the results are for AP, when you say “place time,” are you referring to the total placement time or just the detailed placement (i.e., SA) portion? Thanks! |
@AlexandreSinger: Just to write down what we discussed earlier. It would also be interesting to try a random initial placement (i.e., use dense placement for all blocks instead of doing centroid and then falling back on dense place) and check the initial temperature reported for both the default and equilibrium approaches. Ideally, with your approach, the temperature should follow this order: random > centriod > AP |
@AlexandreSinger: Also, since this PR makes equilibrium the default init temp estimator, I’d suggest running the Koios benchmark as well. It’s become almost standard to run all three (VTR, Titan, Koios) to ensure there are no regressions. |
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.
Thanks, Alex!
That was a typo... The default is variance in the code. I just messed up the docs. Thanks for pointing that out! |
All results presented on this PR are on default VTR (No AP). |
@vaughnbetz FYI, I have read Prof. Rose's paper on equilibrium dynamics over the weekend and I have found that my work is a special case of the process that they proposed. In this work, I have independently achieved a special case of their approach where the P[ΔC] (used in their integration) is estimated using relative frequency. Instead of approaching this using theoretical probability though, my approach arrives at the same solution through reasoning about a trial anneal iteration. Its quite interesting actually! @amin1377 FYI |
@vaughnbetz I have updated the PR with your comments. Let me know if you have any further comments. Once we merge this in, I want to experiment more with accepting the swaps or not during the estimation. |
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.
LGTM
@vaughnbetz I will present these results at the VTR meeting today, but I ran the original temperature estimator (variance) and my proposed equilibrium estimator on a set of placements across the Titan Benchmark Suite:
And got the final results:
I wanted to post these here to keep organized. As you can see, across all of these placements, the ratio of the cost before and after first iteration is MUCH closer to 1.00 and the variance is much tighter. This results in an initial temperature that is more than 4x lower than default with little to no loss in WL or CPD. I wrote a script to collect these results automatically, so I am starting to use it to explore variations on my equilibrium approach. Will discuss in the VTR meeting. @amin1377 FYI |
I found that the way that the annealer estimates the initial temperature to be too high when the initial placement is of very good quality (for example, after AP).
Added a new way of estimating the starting temperature by setting it to an estimation of the equilibrium temperature. The equilibrium temperature is the temperature at which the change in cost after an annealing iteration would be 0.
The old way (of using the variance of the change in cost) is still the default; however, this new method can be turned on in the command-line.