Skip to content

Commit 749e4f7

Browse files
authored
Merge branch 'master' into cleanup_grid_usage
2 parents bcda068 + c654d16 commit 749e4f7

File tree

9 files changed

+238
-62
lines changed

9 files changed

+238
-62
lines changed

.github/workflows/test.yml

Lines changed: 89 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
run: ./dev/${{ matrix.script }}
100100

101101

102-
UniTests:
102+
UnitTests:
103103
name: 'U: C++ Unit Tests'
104104
runs-on: ubuntu-24.04
105105
steps:
@@ -125,6 +125,92 @@ jobs:
125125
run: ./.github/scripts/unittest.sh
126126

127127

128+
# This test builds different variations of VTR (with different CMake Params)
129+
# and ensures that they can run the basic regression tests. This also ensures
130+
# that these build variations are warning clean.
131+
BuildVariations:
132+
runs-on: ubuntu-24.04
133+
name: 'B: Build Variations'
134+
env:
135+
# For the CI, we want all build variations to be warning clean.
136+
# NOTE: Need to turn IPO off due to false warnings being produced.
137+
COMMON_CMAKE_PARAMS: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_IPO_BUILD=off'
138+
steps:
139+
140+
- uses: actions/setup-python@v5
141+
with:
142+
python-version: 3.12.3
143+
144+
- uses: actions/checkout@v4
145+
with:
146+
submodules: 'true'
147+
148+
- name: 'Get number of CPU cores'
149+
uses: SimenB/github-actions-cpu-cores@v2
150+
id: cpu-cores
151+
152+
- name: 'Install dependencies'
153+
run: ./.github/scripts/install_dependencies.sh
154+
155+
- name: 'ccache'
156+
uses: hendrikmuhs/[email protected]
157+
158+
- name: 'Test with VTR_ASSERT_LEVEL 4'
159+
if: success() || failure()
160+
env:
161+
CMAKE_PARAMS: "${{ env.COMMON_CMAKE_PARAMS }} -DVTR_ASSERT_LEVEL=4"
162+
NUM_PROC: ${{ steps.cpu-cores.outputs.count }}
163+
run: |
164+
rm -f build/CMakeCache.txt
165+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
166+
make -j${{ steps.cpu-cores.outputs.count}}
167+
./run_reg_test.py vtr_reg_basic -show_failures -j${{ steps.cpu-cores.outputs.count}}
168+
169+
- name: 'Test with NO_GRAPHICS'
170+
if: success() || failure()
171+
env:
172+
CMAKE_PARAMS: "${{ env.COMMON_CMAKE_PARAMS }} -DVPR_USE_EZGL=off"
173+
NUM_PROC: ${{ steps.cpu-cores.outputs.count }}
174+
run: |
175+
rm -f build/CMakeCache.txt
176+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
177+
make -j${{ steps.cpu-cores.outputs.count}}
178+
./run_reg_test.py vtr_reg_basic -show_failures -j${{ steps.cpu-cores.outputs.count}}
179+
180+
- name: 'Test with NO_SERVER'
181+
if: success() || failure()
182+
env:
183+
CMAKE_PARAMS: "${{ env.COMMON_CMAKE_PARAMS }} -DVPR_USE_SERVER=off"
184+
NUM_PROC: ${{ steps.cpu-cores.outputs.count }}
185+
run: |
186+
rm -f build/CMakeCache.txt
187+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
188+
make -j${{ steps.cpu-cores.outputs.count}}
189+
./run_reg_test.py vtr_reg_basic -show_failures -j${{ steps.cpu-cores.outputs.count}}
190+
191+
- name: 'Test with CAPNPROTO disabled'
192+
if: success() || failure()
193+
env:
194+
CMAKE_PARAMS: "${{ env.COMMON_CMAKE_PARAMS }} -DVTR_ENABLE_CAPNPROTO=off"
195+
NUM_PROC: ${{ steps.cpu-cores.outputs.count }}
196+
run: |
197+
rm -f build/CMakeCache.txt
198+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
199+
make -j${{ steps.cpu-cores.outputs.count}}
200+
./run_reg_test.py vtr_reg_basic -show_failures -j${{ steps.cpu-cores.outputs.count}}
201+
202+
- name: 'Test with serial VPR_EXECUTION_ENGINE'
203+
if: success() || failure()
204+
env:
205+
CMAKE_PARAMS: "${{ env.COMMON_CMAKE_PARAMS }} -DVPR_EXECUTION_ENGINE=serial -DTATUM_EXECUTION_ENGINE=serial"
206+
NUM_PROC: ${{ steps.cpu-cores.outputs.count }}
207+
run: |
208+
rm -f build/CMakeCache.txt
209+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
210+
make -j${{ steps.cpu-cores.outputs.count}}
211+
./run_reg_test.py vtr_reg_basic -show_failures -j${{ steps.cpu-cores.outputs.count}}
212+
213+
128214
Regression:
129215
runs-on: ubuntu-24.04
130216
strategy:
@@ -137,42 +223,12 @@ jobs:
137223
suite: 'vtr_reg_basic',
138224
extra_pkgs: ""
139225
},
140-
{
141-
name: 'Basic with highest assertion level',
142-
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_IPO_BUILD=off -DVTR_ASSERT_LEVEL=4 -DWITH_BLIFEXPLORER=on',
143-
suite: 'vtr_reg_basic',
144-
extra_pkgs: ""
145-
},
146226
{
147227
name: 'Basic_odin',
148228
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_IPO_BUILD=off -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DWITH_PARMYS=OFF -DWITH_ODIN=on',
149229
suite: 'vtr_reg_basic_odin',
150230
extra_pkgs: ""
151231
},
152-
{
153-
name: 'Basic with NO_GRAPHICS',
154-
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_IPO_BUILD=off -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DVPR_USE_EZGL=off',
155-
suite: 'vtr_reg_basic',
156-
extra_pkgs: ""
157-
},
158-
{
159-
name: 'Basic with NO_SERVER',
160-
params: '-DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DVPR_USE_EZGL=on -DVPR_USE_SERVER=off',
161-
suite: 'vtr_reg_basic',
162-
extra_pkgs: ""
163-
},
164-
{
165-
name: 'Basic with CAPNPROTO disabled',
166-
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_IPO_BUILD=off -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DVTR_ENABLE_CAPNPROTO=off',
167-
suite: 'vtr_reg_basic',
168-
extra_pkgs: ""
169-
},
170-
{
171-
name: 'Basic with serial VPR_EXECUTION_ENGINE',
172-
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_IPO_BUILD=off -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DVPR_EXECUTION_ENGINE=serial -DTATUM_EXECUTION_ENGINE=serial',
173-
suite: 'vtr_reg_basic',
174-
extra_pkgs: ""
175-
},
176232
{
177233
name: 'Basic with VTR_ENABLE_DEBUG_LOGGING',
178234
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_IPO_BUILD=off -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DVTR_ENABLE_DEBUG_LOGGING=on',
@@ -484,7 +540,8 @@ jobs:
484540
needs:
485541
- Build
486542
- Format
487-
- UniTests
543+
- UnitTests
544+
- BuildVariations
488545
- Regression
489546
- Sanitized
490547
- Parmys

vpr/src/base/vpr_api.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,8 @@ bool vpr_flow(t_vpr_setup& vpr_setup, t_arch& arch) {
466466
}
467467

468468
// TODO: Placer still assumes that cluster net list is used - graphics can not work with flat routing yet
469-
vpr_init_graphics(vpr_setup, arch, false);
469+
bool is_flat = vpr_setup.RouterOpts.flat_routing;
470+
vpr_init_graphics(vpr_setup, arch, is_flat);
470471

471472
vpr_init_server(vpr_setup);
472473

@@ -510,7 +511,6 @@ bool vpr_flow(t_vpr_setup& vpr_setup, t_arch& arch) {
510511
block_locs);
511512
}
512513

513-
bool is_flat = vpr_setup.RouterOpts.flat_routing;
514514
const Netlist<>& router_net_list = is_flat ? (const Netlist<>&)g_vpr_ctx.atom().netlist() : (const Netlist<>&)g_vpr_ctx.clustering().clb_nlist;
515515
if (is_flat) {
516516
VTR_LOG_WARN("Disabling port equivalence in the architecture since flat routing is enabled.\n");

vpr/src/draw/draw.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ void alloc_draw_structs(const t_arch* arch) {
489489
t_draw_state* draw_state = get_draw_state_vars();
490490
auto& device_ctx = g_vpr_ctx.device();
491491
auto& cluster_ctx = g_vpr_ctx.clustering();
492+
const AtomContext& atom_ctx = g_vpr_ctx.atom();
492493

493494
/* Allocate the structures needed to draw the placement and routing-> Set *
494495
* up the default colors for blocks and nets. */
@@ -498,7 +499,12 @@ void alloc_draw_structs(const t_arch* arch) {
498499
/* For sub-block drawings inside clbs */
499500
draw_internal_alloc_blk();
500501

501-
draw_state->net_color.resize(cluster_ctx.clb_nlist.nets().size());
502+
if (draw_state->is_flat) {
503+
draw_state->net_color.resize(atom_ctx.netlist().nets().size());
504+
} else {
505+
draw_state->net_color.resize(cluster_ctx.clb_nlist.nets().size());
506+
}
507+
502508
draw_state->block_color_.resize(cluster_ctx.clb_nlist.blocks().size());
503509
draw_state->use_default_block_color_.resize(
504510
cluster_ctx.clb_nlist.blocks().size());

vpr/src/draw/draw_basic.cpp

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ void drawroute(enum e_draw_net_type draw_net_type, ezgl::renderer* g) {
537537
/* Next free track in each channel segment if routing is GLOBAL */
538538

539539
auto& cluster_ctx = g_vpr_ctx.clustering();
540+
const AtomContext& atom_ctx = g_vpr_ctx.atom();
540541

541542
t_draw_state* draw_state = get_draw_state_vars();
542543

@@ -546,14 +547,23 @@ void drawroute(enum e_draw_net_type draw_net_type, ezgl::renderer* g) {
546547
g->set_color(ezgl::BLACK, ezgl::BLACK.alpha * NET_ALPHA);
547548

548549
/* Now draw each net, one by one. */
550+
if (draw_state->is_flat) {
551+
for (AtomNetId net_id : atom_ctx.netlist().nets()) {
552+
if (draw_net_type == HIGHLIGHTED
553+
&& draw_state->net_color[net_id] == ezgl::BLACK)
554+
continue;
555+
556+
draw_routed_net((ParentNetId&)net_id, g);
557+
} /* End for (each net) */
558+
} else {
559+
for (ClusterNetId net_id : cluster_ctx.clb_nlist.nets()) {
560+
if (draw_net_type == HIGHLIGHTED
561+
&& draw_state->net_color[net_id] == ezgl::BLACK)
562+
continue;
549563

550-
for (auto net_id : cluster_ctx.clb_nlist.nets()) {
551-
if (draw_net_type == HIGHLIGHTED
552-
&& draw_state->net_color[net_id] == ezgl::BLACK)
553-
continue;
554-
555-
draw_routed_net((ParentNetId&)net_id, g);
556-
} /* End for (each net) */
564+
draw_routed_net((ParentNetId&)net_id, g);
565+
} /* End for (each net) */
566+
}
557567
}
558568

559569
void draw_routed_net(ParentNetId net_id, ezgl::renderer* g) {

vpr/src/draw/draw_searchbar.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ void deselect_all() {
231231

232232
t_draw_state* draw_state = get_draw_state_vars();
233233
const auto& cluster_ctx = g_vpr_ctx.clustering();
234+
const AtomContext& atom_ctx = g_vpr_ctx.atom();
234235
const auto& device_ctx = g_vpr_ctx.device();
235236

236237
/* Create some colour highlighting */
@@ -239,8 +240,13 @@ void deselect_all() {
239240
draw_reset_blk_color(blk_id);
240241
}
241242

242-
for (auto net_id : cluster_ctx.clb_nlist.nets())
243-
draw_state->net_color[net_id] = ezgl::BLACK;
243+
if (draw_state->is_flat) {
244+
for (auto net_id : atom_ctx.netlist().nets())
245+
draw_state->net_color[net_id] = ezgl::BLACK;
246+
} else {
247+
for (auto net_id : cluster_ctx.clb_nlist.nets())
248+
draw_state->net_color[net_id] = ezgl::BLACK;
249+
}
244250

245251
for (RRNodeId inode : device_ctx.rr_graph.nodes()) {
246252
draw_state->draw_rr_node[inode].color = DEFAULT_RR_NODE_COLOR;

vpr/src/draw/draw_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ struct t_draw_state {
234234
char default_message[vtr::bufsize];
235235

236236
///@brief color in which each net should be drawn. [0..cluster_ctx.clb_nlist.nets().size()-1]
237-
vtr::vector<ClusterNetId, ezgl::color> net_color;
237+
vtr::vector<ParentNetId, ezgl::color> net_color;
238238

239239
/**
240240
* @brief stores the state information of each routing resource.

vpr/src/draw/search_bar.cpp

Lines changed: 62 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "vtr_log.h"
2222

2323
#include "vpr_utils.h"
24+
#include "route_utils.h"
2425

2526
#include "globals.h"
2627
#include "draw.h"
@@ -30,6 +31,7 @@
3031
#include "intra_logic_block.h"
3132
#include "atom_netlist.h"
3233
#include "search_bar.h"
34+
#include "old_traceback.h"
3335
#include "physical_types.h"
3436
#include "place_macro.h"
3537

@@ -59,6 +61,8 @@ void search_and_highlight(GtkWidget* /*widget*/, ezgl::application* app) {
5961
// reset
6062
deselect_all();
6163

64+
t_draw_state* draw_state = get_draw_state_vars();
65+
6266
if (search_type == "RR Node ID") {
6367
int rr_node_id = -1;
6468
ss >> rr_node_id;
@@ -122,32 +126,73 @@ void search_and_highlight(GtkWidget* /*widget*/, ezgl::application* app) {
122126
else if (search_type == "Net ID") {
123127
int net_id = -1;
124128
ss >> net_id;
125-
126-
// valid net id check
127-
if (!cluster_ctx.clb_nlist.valid_net_id(ClusterNetId(net_id))) {
128-
warning_dialog_box("Invalid Net ID");
129-
app->refresh_drawing();
130-
return;
129+
if (draw_state->is_flat) {
130+
AtomNetId atom_net_id = AtomNetId(net_id);
131+
if (!atom_ctx.netlist().valid_net_id(atom_net_id)) {
132+
warning_dialog_box("Invalid Net ID");
133+
app->refresh_drawing();
134+
return;
135+
}
136+
if (!is_net_routed(atom_net_id)) {
137+
warning_dialog_box("Net is unrouted");
138+
app->refresh_drawing();
139+
return;
140+
}
141+
if (is_net_fully_absorbed(atom_net_id)) {
142+
warning_dialog_box("Net is fully absorbed");
143+
app->refresh_drawing();
144+
return;
145+
}
146+
highlight_nets((ClusterNetId)net_id);
147+
} else {
148+
// valid net id check
149+
if (!cluster_ctx.clb_nlist.valid_net_id(ClusterNetId(net_id))) {
150+
warning_dialog_box("Invalid Net ID");
151+
app->refresh_drawing();
152+
return;
153+
}
154+
highlight_nets((ClusterNetId)net_id);
131155
}
132-
133-
highlight_nets((ClusterNetId)net_id);
134156
}
135157

136158
else if (search_type == "Net Name") {
137159
//in this case, all nets (clb and non-clb) are contained in the atom netlist
138160
//So we only need to search this one
139161
std::string net_name;
140162
ss >> net_name;
141-
AtomNetId atom_net_id = atom_ctx.netlist().find_net(net_name);
142163

143-
if (atom_net_id == AtomNetId::INVALID()) {
144-
warning_dialog_box("Invalid Net Name");
145-
return; //name not exist
146-
}
147-
148-
const auto clb_nets = atom_ctx.lookup().clb_nets(atom_net_id);
149-
for (auto clb_net_id : clb_nets.value()) {
150-
highlight_nets(clb_net_id);
164+
if (draw_state->is_flat) {
165+
AtomNetId atom_net_id = atom_ctx.netlist().find_net(net_name);
166+
if (atom_net_id == AtomNetId::INVALID()) {
167+
warning_dialog_box("Invalid Net Name");
168+
app->refresh_drawing();
169+
return;
170+
}
171+
if (!is_net_routed(atom_net_id)) {
172+
warning_dialog_box("Net is unrouted");
173+
app->refresh_drawing();
174+
return;
175+
}
176+
if (is_net_fully_absorbed(atom_net_id)) {
177+
warning_dialog_box("Net is fully absorbed");
178+
app->refresh_drawing();
179+
return;
180+
}
181+
highlight_nets(convert_to_cluster_net_id(atom_net_id));
182+
} else {
183+
AtomNetId atom_net_id = atom_ctx.netlist().find_net(net_name);
184+
185+
if (atom_net_id == AtomNetId::INVALID()) {
186+
warning_dialog_box("Invalid Net Name");
187+
app->refresh_drawing();
188+
return;
189+
}
190+
auto clb_net_ids_opt = atom_ctx.lookup().clb_nets(atom_net_id);
191+
if (clb_net_ids_opt.has_value()) {
192+
for (auto clb_net_id : clb_net_ids_opt.value()) {
193+
highlight_nets(clb_net_id);
194+
}
195+
}
151196
}
152197
}
153198

0 commit comments

Comments
 (0)