Skip to content

Commit 0610fff

Browse files
Merge branch 'master' into feature-ci-test-num-proc-upgrade
2 parents 7c15e06 + 3b74db5 commit 0610fff

23 files changed

+669
-37
lines changed

.github/workflows/test.yml

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -162,57 +162,68 @@ jobs:
162162
{
163163
name: 'Basic',
164164
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on',
165-
suite: 'vtr_reg_basic'
165+
suite: 'vtr_reg_basic',
166+
extra_pkgs: ""
166167
},
167168
{
168169
name: 'Basic with highest assertion level',
169170
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_ASSERT_LEVEL=4 -DWITH_BLIFEXPLORER=on',
170-
suite: 'vtr_reg_basic'
171+
suite: 'vtr_reg_basic',
172+
extra_pkgs: ""
171173
},
172174
{
173175
name: 'Basic_odin',
174176
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DWITH_PARMYS=OFF -DWITH_ODIN=on',
175-
suite: 'vtr_reg_basic_odin'
177+
suite: 'vtr_reg_basic_odin',
178+
extra_pkgs: ""
176179
},
177180
{
178181
name: 'Basic with NO_GRAPHICS',
179182
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DVPR_USE_EZGL=off',
180-
suite: 'vtr_reg_basic'
183+
suite: 'vtr_reg_basic',
184+
extra_pkgs: ""
181185
},
182186
{
183187
name: 'Basic with NO_SERVER',
184188
params: '-DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DVPR_USE_EZGL=on -DVPR_USE_SERVER=off',
185-
suite: 'vtr_reg_basic'
189+
suite: 'vtr_reg_basic',
190+
extra_pkgs: ""
186191
},
187192
{
188193
name: 'Basic with CAPNPROTO disabled',
189194
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DVTR_ENABLE_CAPNPROTO=off',
190-
suite: 'vtr_reg_basic'
195+
suite: 'vtr_reg_basic',
196+
extra_pkgs: ""
191197
},
192198
{
193199
name: 'Basic with VTR_ENABLE_DEBUG_LOGGING',
194200
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DVTR_ENABLE_DEBUG_LOGGING=on',
195-
suite: 'vtr_reg_basic'
201+
suite: 'vtr_reg_basic',
202+
extra_pkgs: ""
196203
},
197204
{
198205
name: 'Basic_odin with VTR_ENABLE_DEBUG_LOGGING',
199206
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DVTR_ENABLE_DEBUG_LOGGING=on -DWITH_PARMYS=OFF -DWITH_ODIN=on',
200-
suite: 'vtr_reg_basic_odin'
207+
suite: 'vtr_reg_basic_odin',
208+
extra_pkgs: ""
201209
},
202210
{
203211
name: 'Strong',
204212
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on',
205-
suite: 'vtr_reg_strong'
213+
suite: 'vtr_reg_strong',
214+
extra_pkgs: "libeigen3-dev"
206215
},
207216
{
208217
name: 'Strong_odin',
209218
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DWITH_PARMYS=OFF -DWITH_ODIN=on',
210-
suite: 'vtr_reg_strong_odin'
219+
suite: 'vtr_reg_strong_odin',
220+
extra_pkgs: ""
211221
},
212222
{
213223
name: 'Valgrind Memory',
214224
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DWITH_ODIN=on',
215-
suite: 'vtr_reg_valgrind_small'
225+
suite: 'vtr_reg_valgrind_small',
226+
extra_pkgs: ""
216227
}
217228
]
218229
name: 'R: ${{ matrix.name }}'
@@ -221,6 +232,7 @@ jobs:
221232
- uses: actions/setup-python@v5
222233
with:
223234
python-version: 3.10.10
235+
224236
- uses: actions/checkout@v4
225237
with:
226238
submodules: 'true'
@@ -232,6 +244,10 @@ jobs:
232244
- name: Install dependencies
233245
run: ./.github/scripts/install_dependencies.sh
234246

247+
- name: Install external libraries
248+
run: sudo apt install -y ${{ matrix.extra_pkgs }}
249+
if: ${{ matrix.extra_pkgs }}
250+
235251
- uses: hendrikmuhs/[email protected]
236252

237253
- name: Test

vpr/CMakeLists.txt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,27 @@ add_library(libvpr STATIC
7676

7777
target_include_directories(libvpr PUBLIC ${LIB_INCLUDE_DIRS})
7878

79+
80+
# Find if Eigen is installed. Eigen is used within the Analytical Solver of the
81+
# Analytical Placement flow. If Eigen is not installed, certain solvers cannot
82+
# be used.
83+
find_package(Eigen3 3.3 NO_MODULE)
84+
if (TARGET Eigen3::Eigen)
85+
target_link_libraries (libvpr Eigen3::Eigen)
86+
target_compile_definitions(libvpr PUBLIC -DEIGEN_INSTALLED)
87+
message(STATUS "Eigen3: Found")
88+
else ()
89+
message(STATUS "Eigen3: Not Found. Some features may be disabled.")
90+
endif (TARGET Eigen3::Eigen)
91+
7992
#VPR_ANALYTIC_PLACE is initialized in the root CMakeLists
80-
#Check Eigen dependency
93+
# NOTE: This is the cluster-level Analytical Placement which existed before the
94+
# flat Analytical Placement flow.
8195
if(${VPR_ANALYTIC_PLACE})
8296
message(STATUS "VPR Analytic Placement: Requested")
83-
find_package(Eigen3 3.3 NO_MODULE)
8497
if (TARGET Eigen3::Eigen)
8598
message(STATUS "VPR Analytic Placement dependency (Eigen3): Found")
8699
message(STATUS "VPR Analytic Placement: Enabled")
87-
target_link_libraries (libvpr Eigen3::Eigen)
88100
target_compile_definitions(libvpr PUBLIC -DENABLE_ANALYTIC_PLACE)
89101
else ()
90102
message(STATUS "VPR Analytic Placement dependency (Eigen3): Not Found (Download manually with sudo apt install libeigen3-dev, and rebuild)")

vpr/src/analytical_place/analytical_placement_flow.cpp

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
*/
77

88
#include "analytical_placement_flow.h"
9+
#include <memory>
10+
#include "analytical_solver.h"
911
#include "ap_netlist.h"
1012
#include "atom_netlist.h"
1113
#include "full_legalizer.h"
@@ -19,6 +21,40 @@
1921
#include "vtr_assert.h"
2022
#include "vtr_time.h"
2123

24+
/**
25+
* @brief A helper method to log statistics on the APNetlist.
26+
*/
27+
static void print_ap_netlist_stats(const APNetlist& netlist) {
28+
// Get the number of moveable and fixed blocks
29+
size_t num_moveable_blocks = 0;
30+
size_t num_fixed_blocks = 0;
31+
for (APBlockId blk_id : netlist.blocks()) {
32+
if (netlist.block_mobility(blk_id) == APBlockMobility::MOVEABLE)
33+
num_moveable_blocks++;
34+
else
35+
num_fixed_blocks++;
36+
}
37+
// Get the fanout information of nets
38+
size_t highest_fanout = 0;
39+
float average_fanout = 0.f;
40+
for (APNetId net_id : netlist.nets()) {
41+
size_t net_fanout = netlist.net_pins(net_id).size();
42+
if (net_fanout > highest_fanout)
43+
highest_fanout = net_fanout;
44+
average_fanout += static_cast<float>(net_fanout);
45+
}
46+
average_fanout /= static_cast<float>(netlist.nets().size());
47+
// Print the statistics
48+
VTR_LOG("Analytical Placement Netlist Statistics:\n");
49+
VTR_LOG("\tBlocks: %zu\n", netlist.blocks().size());
50+
VTR_LOG("\t\tMoveable Blocks: %zu\n", num_moveable_blocks);
51+
VTR_LOG("\t\tFixed Blocks: %zu\n", num_fixed_blocks);
52+
VTR_LOG("\tNets: %zu\n", netlist.nets().size());
53+
VTR_LOG("\t\tAverage Fanout: %.2f\n", average_fanout);
54+
VTR_LOG("\t\tHighest Fanout: %zu\n", highest_fanout);
55+
VTR_LOG("\tPins: %zu\n", netlist.pins().size());
56+
}
57+
2258
void run_analytical_placement_flow(t_vpr_setup& vpr_setup) {
2359
(void)vpr_setup;
2460
// Start an overall timer for the Analytical Placement flow.
@@ -38,22 +74,19 @@ void run_analytical_placement_flow(t_vpr_setup& vpr_setup) {
3874
APNetlist ap_netlist = gen_ap_netlist_from_atoms(atom_nlist,
3975
prepacker,
4076
constraints);
77+
print_ap_netlist_stats(ap_netlist);
4178

4279
// Run the Global Placer
43-
// For now, just put all the moveable blocks at the center of the device
44-
// grid. This will be replaced later. This is just for testing.
80+
// For now, just runs the solver.
4581
PartialPlacement p_placement(ap_netlist);
82+
std::unique_ptr<AnalyticalSolver> solver = make_analytical_solver(e_analytical_solver::QP_HYBRID,
83+
ap_netlist);
84+
solver->solve(0, p_placement);
85+
86+
// Verify that the partial placement is valid before running the full
87+
// legalizer.
4688
const size_t device_width = device_ctx.grid.width();
4789
const size_t device_height = device_ctx.grid.height();
48-
double device_center_x = static_cast<double>(device_width) / 2.0;
49-
double device_center_y = static_cast<double>(device_height) / 2.0;
50-
for (APBlockId ap_blk_id : ap_netlist.blocks()) {
51-
if (ap_netlist.block_mobility(ap_blk_id) != APBlockMobility::MOVEABLE)
52-
continue;
53-
// If the APBlock is moveable, put it on the center for the device.
54-
p_placement.block_x_locs[ap_blk_id] = device_center_x;
55-
p_placement.block_y_locs[ap_blk_id] = device_center_y;
56-
}
5790
VTR_ASSERT(p_placement.verify(ap_netlist,
5891
device_width,
5992
device_height,

0 commit comments

Comments
 (0)