Skip to content

[Place] rename get_initial_move_lim to get_place_inner_loop_num_move #2955

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

Merged
merged 7 commits into from
Apr 8, 2025

Conversation

amin1377
Copy link
Contributor

Updated function name from get_initial_move_lim to get_place_inner_loop_num_move. This clarifies that the number of placement moves within the inner loop is a constant limit, not a variable that changes during annealing.

@amin1377 amin1377 requested a review from soheilshahrouz March 31, 2025 20:51
@github-actions github-actions bot added VPR VPR FPGA Placement & Routing Tool lang-cpp C/C++ code labels Mar 31, 2025
@@ -50,7 +50,7 @@ t_placer_costs& t_placer_costs::operator+=(const NocCostTerms& noc_delta_cost) {
return *this;
}

int get_initial_move_lim(const t_placer_opts& placer_opts, const t_annealing_sched& annealing_sched) {
int get_place_inner_loop_num_move(const t_placer_opts& placer_opts, const t_annealing_sched& annealing_sched) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably renaming it to comp_place_inner_loop_num_move() makes it clear that it actually computes the value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly don't see that much difference between these two names :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it can go either way. For me, "get_..." methods are usually O(1) lookups. Whereas "calc_..." is used to calculate some value and is usually more expensive. It implicitly says that this function is not as cheap to call and care should be taken when putting it in a loop.

I used the same practice here: https://github.com/verilog-to-routing/vtr-verilog-to-routing/blob/85dfc2983cc74150959aca1ff7666c9b7c292fd7/vpr/src/analytical_place/flat_placement_density_manager.cpp

Although this function is cheap and is O(1), there is some complexity in here that implies that it shouldn't be called many times (For example the log message). Up to you honestly how you want to name this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s a good way to decide whether to name a function calc_* or get_*. Thanks, Alex!

I think we shouldn’t print the log message inside the helper function. I’ve removed it from there and instead added the log in the annealer constructor where the function is called.

@amin1377
Copy link
Contributor Author

amin1377 commented Apr 6, 2025

@soheilshahrouz: Thanks for reviewing the PR. Feel free to merge it if you don’t have any further suggestions.

@amin1377 amin1377 merged commit 355e7c1 into master Apr 8, 2025
36 checks passed
@amin1377 amin1377 deleted the move_lim branch April 8, 2025 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang-cpp C/C++ code VPR VPR FPGA Placement & Routing Tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants