Skip to content

Remove per-layer bounding box - #3785

Merged
vaughnbetz merged 21 commits into
masterfrom
remove_per_layer_bb
Sep 2, 2026
Merged

Remove per-layer bounding box#3785
vaughnbetz merged 21 commits into
masterfrom
remove_per_layer_bb

Conversation

@soheilshahrouz

Copy link
Copy Markdown
Contributor

This PR removes per-layer bounding boxes that are used to estimated wirelength in NetCostHandler.

@github-actions github-actions Bot added VPR VPR FPGA Placement & Routing Tool docs Documentation lang-cpp C/C++ code labels Aug 27, 2026
@soheilshahrouz

Copy link
Copy Markdown
Contributor Author

In SB-based architectures, the per-layer bounding box method increaes CPD, WL, placement time, and route time.
I'll collect some results for full-OPIN 3D connectivity.

@soheilshahrouz

Copy link
Copy Markdown
Contributor Author

per_layer_bb / 3D OPIN-based connectivity

Metric Ratio
CPD 1.015
Wirelength 1.001
Place time 1.124
Route time 0.985

Comment thread vpr/src/base/netlist.h
Comment on lines +706 to +710
///@brief Returns a view over the nets that are not ignored.
auto non_ignored_nets() const {
return nets() | std::views::filter([this](NetId net_id) { return !net_is_ignored(net_id); });
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm 90% sure this is the reason behind the performance regression. the views library, in particular views::filter has terrible performance compared to raw loops. No fundamental reason other than that current compilers are just not good enough yet and they emit awful assembly.

https://lemire.me/blog/2025/10/05/stdranges-may-not-deliver-the-performance-that-you-expect/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

non_ignored_nets() is only called in periodic paths where the cost is computed from scratch, not in a per-swap hot loop. The article's benchmarks uses chained views with lazy evaluation. Here, we have a single filter.

Comment on lines +1086 to +1089
return static_cast<int>(std::ranges::count_if(clb_nlist.non_ignored_nets(), [this](ClusterNetId net_id) {
const t_bb& bb = bb_coords_[net_id];
return bb.layer_min != bb.layer_max;
}));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would also be wary if this one, with the same reasoning as above.

@soheilshahrouz

Copy link
Copy Markdown
Contributor Author

SA placement time, titan_other with 3 seeds

The runtime gain can attribted to the removal of std::function.

Circuit Baseline (s) Branch (s) Ratio
CHERI 155.80 152.68 0.980
CH_DFSIN 100.95 98.71 0.978
EKF-SLAM_Jacobians 179.07 173.76 0.970
JPEG 81.19 77.25 0.952
MCML 93.39 90.73 0.971
MMM 62.65 60.64 0.968
Reed_Solomon 41.01 39.76 0.970
SURF_desc 133.19 130.25 0.978
carpat 96.87 93.83 0.969
fir_cascade 186.29 183.76 0.986
jacobi 131.09 127.52 0.973
leon2 21.50 21.86 1.017
leon3mp 58.31 56.79 0.974
murax 1.07 1.03 0.969
picosoc 12.72 12.77 1.004
radar20 13.42 12.91 0.962
random 107.19 103.43 0.965
smithwaterman 122.82 119.28 0.971
stap_steering 67.80 65.52 0.966
sudoku_check 22.05 21.16 0.959
ucsb_152_tap_fir 13.49 13.01 0.964
uoft_raytracer 90.57 87.69 0.968
wb_conmax 24.13 22.80 0.945
Geomean 0.972

@soheilshahrouz

Copy link
Copy Markdown
Contributor Author

SA placement time, titan_quick_qor, 3 seeds

circuit master avg branch avg ratio
directrf 6855.46 6657.72 0.971
bitcoin_miner 6073.97 5989.95 0.986
LU230 2762.89 2747.97 0.995
sparcT1_chip2 3651.65 3605.00 0.987
LU_Network 3399.52 3395.43 0.999
gsm_switch 1596.54 1578.93 0.989
mes_noc 2892.04 2877.54 0.995
denoise 1723.85 1675.32 0.972
sparcT2_core 1375.61 1327.34 0.965
cholesky_bdti 554.09 545.42 0.984
minres 572.99 559.54 0.977
stap_qrd 993.17 960.28 0.967
openCV 517.94 508.42 0.982
dart 482.79 481.28 0.997
bitonic_mesh 809.35 797.68 0.986
segmentation 661.97 639.66 0.966
SLAM_spheric 327.33 313.99 0.959
des90 370.26 364.08 0.983
cholesky_mc 198.39 187.09 0.943
stereo_vision 102.64 98.49 0.960
sparcT1_core 198.57 187.20 0.943
neuron 104.16 97.26 0.934
geomean 0.974

@github-actions github-actions Bot added lang-make CMake/Make code blifexplorer labels Aug 30, 2026
@soheilshahrouz

Copy link
Copy Markdown
Contributor Author

@vaughnbetz When you have a moment, could you take a look at this?

@amin1377 amin1377 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, Soheil! I just had a bunch of small comments.

One question: I don’t think per-layer bounding boxes were widely used, but if you think people outside our group may rely on them, it might be worth keeping --place_bounding_box_mode. If it’s set to per_layer, we could just warn the user that the option is deprecated.

Comment thread vtr_flow/tasks/regression_tests/vtr_reg_nightly_test7/task_list.txt Outdated
Comment thread vpr/src/base/vpr_types.h Outdated
Comment thread vpr/src/place/net_cost_handler.cpp
@soheilshahrouz

Copy link
Copy Markdown
Contributor Author

it might be worth keeping --place_bounding_box_mode. If it’s set to per_layer, we could just warn the user that the option is deprecated.

I think this can be very confusing. I don't understand why we should keep the command line option if the code is removed.

@amin1377 I applied your comments. If you don't have further comments, I think this PR can be merged.

@vaughnbetz vaughnbetz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This simplifies the code quite a lot. It looks good to me, and the speedup is nice!

@vaughnbetz
vaughnbetz merged commit debd87c into master Sep 2, 2026
40 checks passed
@vaughnbetz
vaughnbetz deleted the remove_per_layer_bb branch September 2, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blifexplorer docs Documentation lang-cpp C/C++ code lang-make CMake/Make code libvtrutil VPR VPR FPGA Placement & Routing Tool

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants