Skip to content

Commit 7b87c11

Browse files
authored
Merge pull request #1504 from verilog-to-routing/initial_analytic_placer
Add Analytic Placer to VPR with new option, test, and dependency
2 parents 869501d + 757f990 commit 7b87c11

File tree

19 files changed

+2919
-65
lines changed

19 files changed

+2919
-65
lines changed

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@ option(VTR_ENABLE_PROFILING "Enable performance profiler (gprof)" OFF)
3232
option(VTR_ENABLE_COVERAGE "Enable code coverage tracking (gcov)" OFF)
3333
option(VTR_ENABLE_DEBUG_LOGGING "Enable debug logging" OFF)
3434

35-
#Allow the user to decide weather to compile the graphics library
35+
#Allow the user to decide whether to compile the graphics library
3636
set(VPR_USE_EZGL "auto" CACHE STRING "Specify whether vpr uses the graphics library")
3737
set_property(CACHE VPR_USE_EZGL PROPERTY STRINGS auto off on)
3838
option(VTR_ENABLE_CAPNPROTO "Enable capnproto binary serialization support in VPR." ON)
3939

40+
#Allow the user to enable/disable VPR analytic placement
41+
#VPR option --enable_analytic_placer is also required for Analytic Placement
42+
option(VPR_ANALYTIC_PLACE "Enable analytic placement in VPR." ON)
43+
4044
option(WITH_BLIFEXPLORER "Enable build with blifexplorer" OFF)
4145

4246
option(WITH_ABC "Enable building abc" ON)

libs/libvtrutil/src/vtr_geometry.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ class Rect {
110110
//Returns true if the point is coincident with the rectangle (including the top-right edges)
111111
bool coincident(Point<T> point) const;
112112

113+
//Returns true if other is contained within the rectangle (including all edges)
114+
bool contains(const Rect<T>& other) const;
115+
113116
//Returns true if no points are contained in the rectangle
114117
// rect.empty() => not exists p. rect.contains(p)
115118
// This also implies either the width or height is 0.

libs/libvtrutil/src/vtr_geometry.tpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,13 @@ bool Rect<T>::coincident(Point<T> point) const {
151151
&& point.y() >= ymin() && point.y() <= ymax();
152152
}
153153

154+
template<class T>
155+
bool Rect<T>::contains(const Rect<T>& other) const {
156+
//Including all edges
157+
return other.xmin() >= xmin() && other.xmax() <= xmax()
158+
&& other.ymin() >= ymin() && other.ymax() <= ymax();
159+
}
160+
154161
template<class T>
155162
bool Rect<T>::empty() const {
156163
return xmax() <= xmin() || ymax() <= ymin();

vpr/CMakeLists.txt

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,25 @@ add_library(libvpr STATIC
5151
${LIB_SOURCES}
5252
)
5353

54+
5455
target_include_directories(libvpr PUBLIC ${LIB_INCLUDE_DIRS})
56+
57+
#VPR_ANALYTIC_PLACE is inisitalized in the root CMakeLists
58+
#Check Eigen dependency
59+
if(${VPR_ANALYTIC_PLACE})
60+
message(STATUS "VPR Analytic Placement: Requested")
61+
find_package(Eigen3 3.3 NO_MODULE)
62+
if (TARGET Eigen3::Eigen)
63+
message(STATUS "VPR Analytic Placement dependency (Eigen3): Found")
64+
message(STATUS "VPR Analytic Placement: Enabled")
65+
target_link_libraries (libvpr Eigen3::Eigen)
66+
target_compile_definitions(libvpr PUBLIC -DENABLE_ANALYTIC_PLACE)
67+
else ()
68+
message(STATUS "VPR Analytic Placement dependency (Eigen3): Not Found (Download manually with sudo apt install libeigen3-dev, and rebuild)")
69+
message(STATUS "VPR Analytic Placement: Disabled")
70+
endif(TARGET Eigen3::Eigen)
71+
endif()
72+
5573
set_target_properties(libvpr PROPERTIES PREFIX "") #Avoid extra 'lib' prefix
5674

5775
#Specify link-time dependancies
@@ -62,7 +80,8 @@ target_link_libraries(libvpr
6280
libblifparse
6381
libtatum
6482
libargparse
65-
libpugixml)
83+
libpugixml
84+
)
6685

6786
#link graphics library only when graphics set to on
6887
if (VPR_USE_EZGL STREQUAL "on")

vpr/src/base/SetupVPR.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,7 @@ static void SetupPlacerOpts(const t_options& Options, t_placer_opts* PlacerOpts)
574574

575575
PlacerOpts->effort_scaling = Options.place_effort_scaling;
576576
PlacerOpts->timing_update_type = Options.timing_update_type;
577+
PlacerOpts->enable_analytic_placer = Options.enable_analytic_placer;
577578
}
578579

579580
static void SetupAnalysisOpts(const t_options& Options, t_analysis_opts& analysis_opts) {

vpr/src/base/read_options.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,6 +1739,13 @@ argparse::ArgumentParser create_arg_parser(std::string prog_name, t_options& arg
17391739
.default_value("0")
17401740
.show_in(argparse::ShowIn::HELP_ONLY);
17411741

1742+
place_grp.add_argument(args.enable_analytic_placer, "--enable_analytic_placer")
1743+
.help(
1744+
"Enables the analytic placer. "
1745+
"Once analytic placement is done, the result is passed through the quench phase of the annealing placer for local improvement")
1746+
.default_value("false")
1747+
.show_in(argparse::ShowIn::HELP_ONLY);
1748+
17421749
auto& place_timing_grp = parser.add_argument_group("timing-driven placement options");
17431750

17441751
place_timing_grp.add_argument(args.PlaceTimingTradeoff, "--timing_tradeoff")

vpr/src/base/read_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ struct t_options {
112112
argparse::ArgValue<int> placement_saves_per_temperature;
113113
argparse::ArgValue<e_place_effort_scaling> place_effort_scaling;
114114
argparse::ArgValue<e_place_delta_delay_algorithm> place_delta_delay_matrix_calculation_method;
115+
argparse::ArgValue<bool> enable_analytic_placer;
115116

116117
/* Timing-driven placement options only */
117118
argparse::ArgValue<float> PlaceTimingTradeoff;

vpr/src/base/vpr_types.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,14 @@ struct t_placer_opts {
10351035
std::string allowed_tiles_for_delay_model;
10361036

10371037
e_place_delta_delay_algorithm place_delta_delay_matrix_calculation_method;
1038+
1039+
/*
1040+
* @brief enables the analytic placer.
1041+
*
1042+
* Once analytic placement is done, the result is passed through the quench phase
1043+
* of the annealing placer for local improvement
1044+
*/
1045+
bool enable_analytic_placer;
10381046
};
10391047

10401048
/* All the parameters controlling the router's operation are in this *

0 commit comments

Comments
 (0)