Skip to content
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

NetCostHandler class #2676

Merged
merged 43 commits into from
Sep 24, 2024
Merged

NetCostHandler class #2676

merged 43 commits into from
Sep 24, 2024

Conversation

soheilshahrouz
Copy link
Contributor

@soheilshahrouz soheilshahrouz commented Aug 5, 2024

This PR refactors net_cost_handler.cpp/.h files. A new class called NetCostHandler is added. All static variables in net_cost_handler.cpp are now member variables of NetCostHandler. Removing file-scoped variables is another step towards running multiple annealers at the same time.

@github-actions github-actions bot added VPR VPR FPGA Placement & Routing Tool lang-cpp C/C++ code libvtrutil external_libs labels Aug 5, 2024
@vaughnbetz
Copy link
Contributor

Re-launching CI.

@vaughnbetz
Copy link
Contributor

vtr_nightly_test5 failures all appear to be in 3D architectures with placement constraints (one big partition, left / right, and up/down partitions).
2024-08-16T02:27:57.3174001Z �[32;1m02:27:57�[0m | 3d_full_OPIN_inter_die_stratixiv_arch.timing/neuron_stratixiv_arch_timing Error: Executable vpr failed
2024-08-16T02:27:57.3182578Z �[32;1m02:27:57�[0m | full command: /usr/bin/env time -v /root/vtr-verilog-to-routing/vtr-verilog-to-routing/vpr/vpr 3d_full_OPIN_inter_die_stratixiv_arch.timing.xml neuron_stratixiv_arch_timing --circuit_file neuron_stratixiv_arch_timing.pre-vpr.blif --route_chan_width 300 --max_router_iterations 400 --router_lookahead map --initial_pres_fac 1.0 --router_profiler_astar_fac 1.5 --seed 3 --device neuron3d --sdc_file neuron_stratixiv_arch_timing.sdc --read_vpr_constraints one_big_partition.xml
2024-08-16T02:27:57.3187067Z �[32;1m02:27:57�[0m | returncode : 134
2024-08-16T02:27:57.3190615Z �[32;1m02:27:57�[0m | log file : /root/vtr-verilog-to-routing/vtr-verilog-to-routing/vtr_flow/tasks/regression_tests/vtr_reg_nightly_test5/vpr_tight_floorplan_3d/run001/3d_full_OPIN_inter_die_stratixiv_arch.timing.xml/neuron_stratixiv_arch_timing.blif/common_-sdc_file_sdc_samples_neuron_stratixiv_arch_timing_sdc_-read_vpr_constraints_tasks_regression_tests_vtr_reg_nightly_test5_vpr_tight_floorplan_3d_one_big_partition_xml/vpr.out
2024-08-16T02:27:57.3194301Z �[32;1m02:27:57�[0m | failed: Executable vpr failed (took 466.67 seconds, overall memory peak 2.82 GiB consumed by vpr run)

The return code is SIGABRT, which likely means a seg fault.

Copy link
Contributor

@AlexandreSinger AlexandreSinger left a comment

Choose a reason for hiding this comment

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

Hi @soheilshahrouz , I really appreciate these kind of code refactorings! I think VTR can really improve with more classes like this!

I have left a few comments; however, I recognize that a lot of this code is not yours and you are just moving it from one place to another. So, feel free to ignore the comments if you think they are not necessary for what you are doing.

vpr/src/base/vpr_types.h Outdated Show resolved Hide resolved
vpr/src/place/move_generator.cpp Outdated Show resolved Hide resolved
vpr/src/place/move_generator.cpp Show resolved Hide resolved
vpr/src/place/net_cost_handler.cpp Show resolved Hide resolved
vpr/src/place/net_cost_handler.h Outdated Show resolved Hide resolved
vpr/src/place/net_cost_handler.h Outdated Show resolved Hide resolved
vpr/src/place/net_cost_handler.h Outdated Show resolved Hide resolved
@soheilshahrouz
Copy link
Contributor Author

vtr_reg_nightly_test3/vtr_reg_qor_chain_large

VTR Large pack-time place time place WL place cpd place_mem
vtr-master 59.4 70.41168848 235102.554 20.72379515 678.4687356
vtr-pr 59.7 70.23339596 235102.554 20.72379515 675.5519583
1.00 0.997467856 1 1 0.995700941

@soheilshahrouz
Copy link
Contributor Author

soheilshahrouz commented Sep 10, 2024

vtr_reg_nightly_test2/titan_quick_qor

titan_quick_qor pack-time place time place WL place cpd place_mem
titan-master 616.2897924 1259.088278 2495045.479 17.23294049 5334.326215
titan-pr 617.727757 1270.405134 2495045.479 17.23294049 5334.333385
ratop 1.00233326 1.008988135 1 1 1.000001344

Copy link
Contributor

@vaughnbetz vaughnbetz left a comment

Choose a reason for hiding this comment

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

Minor changes requested and some TODOs. Biggest one is 3D / cube_bb -- we seem to be missing the 3rd dimension computation. @amin1377 : is the layer part of cube_bb merged in?

vpr/src/base/blk_loc_registry.h Outdated Show resolved Hide resolved
vpr/src/base/blk_loc_registry.h Outdated Show resolved Hide resolved
vpr/src/place/move_generator.cpp Show resolved Hide resolved
vpr/src/place/move_generator.cpp Show resolved Hide resolved
vpr/src/place/net_cost_handler.h Show resolved Hide resolved
* will never be used.
*/
vtr::NdMatrix<float, 2> chanx_place_cost_fac_; // [0...device_ctx.grid.width()-2]
vtr::NdMatrix<float, 2> chany_place_cost_fac_; // [0...device_ctx.grid.height()-2]
Copy link
Contributor

Choose a reason for hiding this comment

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

TODO: make these line up with the edge of the grid so we get rid of some if statements (probably width-1 or width instead of width-2).
Also, we should have a 3rd dimension normalization somewhere using the same technique and it seems that variable should also go here.

vpr/src/place/net_cost_handler.h Outdated Show resolved Hide resolved
vpr/src/place/net_cost_handler.h Show resolved Hide resolved
vpr/src/place/net_cost_handler.cpp Show resolved Hide resolved

return (ncost);
return ncost;
Copy link
Contributor

Choose a reason for hiding this comment

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

We should have a 3rd term:
ncost += (layer_max-layer_min+1) * chanz_place_cost_fac

Big TODO!

@vaughnbetz
Copy link
Contributor

QoR looks good -- good to merge.

@soheilshahrouz soheilshahrouz changed the title Remove static and global varibales from net cost computation NetCostHandler class Sep 16, 2024
@AlexandreSinger
Copy link
Contributor

@soheilshahrouz @vaughnbetz The failed CI test is the one that I fixed in my most recent PR. I think this can just be merged.

@soheilshahrouz
Copy link
Contributor Author

@vaughnbetz I applied your comments and replaced get_net_bb_cost_() and get_non_updatable_bb_() methods with functors initialized in the constructor. All CI tests passed and the PR is ready to be merged.

@vaughnbetz vaughnbetz merged commit 159c2c4 into master Sep 24, 2024
53 checks passed
@vaughnbetz vaughnbetz deleted the temp_net_cost_ref branch September 24, 2024 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external_libs lang-cpp C/C++ code libvtrutil VPR VPR FPGA Placement & Routing Tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants