Skip to content

Commit a2e91dc

Browse files
authored
Merge pull request #2526 from w0lek/ipa_it2_clean
Interactive Path Analysis Feature Integration
2 parents 8f20622 + 2b74463 commit a2e91dc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+2912
-5
lines changed

.github/workflows/test.yml

+5
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,11 @@ jobs:
197197
params: '-DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DVPR_USE_EZGL=off',
198198
suite: 'vtr_reg_basic'
199199
},
200+
{
201+
name: 'Basic with NO_SERVER',
202+
params: '-DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DVPR_USE_EZGL=on -DVPR_USE_SERVER=off',
203+
suite: 'vtr_reg_basic'
204+
},
200205
{
201206
name: 'Basic with CAPNPROTO disabled',
202207
params: '-DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DVTR_ENABLE_CAPNPROTO=off',

.gitmodules

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
[submodule "libs/EXTERNAL/libcatch2"]
22
path = libs/EXTERNAL/libcatch2
33
url = https://github.com/catchorg/Catch2.git
4+
[submodule "libs/EXTERNAL/sockpp"]
5+
path = libs/EXTERNAL/sockpp
6+
#url = git@github.com:fpagliughi/sockpp.git
7+
url = git@github.com:w0lek/sockpp.git # fork where in branch v1.0.0_no_complication_warnings there are compilation warnings fixes for upstream tag v1.0.0 of sockpp

CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ set(VPR_USE_EZGL "auto" CACHE STRING "Specify whether vpr uses the graphics libr
3939
set_property(CACHE VPR_USE_EZGL PROPERTY STRINGS auto off on)
4040
option(VTR_ENABLE_CAPNPROTO "Enable capnproto binary serialization support in VPR." ON)
4141

42+
#Allow the user to decide whether to compile the server module
43+
option(VPR_USE_SERVER "Specify whether vpr enables the server mode" ON)
44+
4245
#Allow the user to enable/disable VPR analytic placement
4346
#VPR option --enable_analytic_placer is also required for Analytic Placement
4447
option(VPR_ANALYTIC_PLACE "Enable analytic placement in VPR." ON)

libs/EXTERNAL/CMakeLists.txt

+17
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ add_subdirectory(libtatum)
1111
add_subdirectory(libcatch2)
1212
#add_subdirectory(parmys)
1313

14+
#VPR_USE_SERVER is initialized in the root CMakeLists
15+
#compile sockpp only if server mode is enabled
16+
if (VPR_USE_SERVER)
17+
set(SOCKPP_BUILD_SHARED OFF CACHE BOOL "Override default value" FORCE)
18+
set(SOCKPP_BUILD_STATIC ON CACHE BOOL "Override default value" FORCE)
19+
add_subdirectory(sockpp)
20+
endif()
21+
1422
#VPR_USE_EZGL is initialized in the root CMakeLists.
1523
#compile libezgl only if the user asks for or has its dependencies installed.
1624
if (VPR_USE_EZGL STREQUAL "on")
@@ -132,3 +140,12 @@ target_include_directories(Catch2
132140
$<INSTALL_INTERFACE:include>
133141
)
134142

143+
# Some sockpp headers generate warnings, so treat them as system headers to suppress warnings
144+
if (VPR_USE_SERVER)
145+
target_include_directories(sockpp-static
146+
SYSTEM
147+
PUBLIC
148+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/sockpp/include>
149+
$<INSTALL_INTERFACE:include>
150+
)
151+
endif()

libs/EXTERNAL/libtatum/libtatum/tatum/TimingReporter.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ void TimingReporter::report_timing_setup(std::ostream& os,
9999
report_timing(os, paths);
100100
}
101101

102+
void TimingReporter::report_timing_setup(std::vector<tatum::TimingPath>& paths,
103+
std::ostream& os,
104+
const SetupTimingAnalyzer& setup_analyzer,
105+
size_t npaths) const {
106+
paths = path_collector_.collect_worst_setup_timing_paths(timing_graph_, setup_analyzer, npaths);
107+
108+
report_timing(os, paths);
109+
}
110+
102111
void TimingReporter::report_timing_hold(std::string filename,
103112
const HoldTimingAnalyzer& hold_analyzer,
104113
size_t npaths) const {
@@ -114,6 +123,15 @@ void TimingReporter::report_timing_hold(std::ostream& os,
114123
report_timing(os, paths);
115124
}
116125

126+
void TimingReporter::report_timing_hold(std::vector<tatum::TimingPath>& paths,
127+
std::ostream& os,
128+
const HoldTimingAnalyzer& hold_analyzer,
129+
size_t npaths) const {
130+
paths = path_collector_.collect_worst_hold_timing_paths(timing_graph_, hold_analyzer, npaths);
131+
132+
report_timing(os, paths);
133+
}
134+
117135
void TimingReporter::report_skew_setup(std::string filename,
118136
const SetupTimingAnalyzer& setup_analyzer,
119137
size_t nworst) const {

libs/EXTERNAL/libtatum/libtatum/tatum/TimingReporter.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ class TimingReporter {
6464
public:
6565
void report_timing_setup(std::string filename, const tatum::SetupTimingAnalyzer& setup_analyzer, size_t npaths=REPORT_TIMING_DEFAULT_NPATHS) const;
6666
void report_timing_setup(std::ostream& os, const tatum::SetupTimingAnalyzer& setup_analyzer, size_t npaths=REPORT_TIMING_DEFAULT_NPATHS) const;
67+
void report_timing_setup(std::vector<tatum::TimingPath>& paths, std::ostream& os, const tatum::SetupTimingAnalyzer& setup_analyzer, size_t npaths=REPORT_TIMING_DEFAULT_NPATHS) const;
6768

6869
void report_timing_hold(std::string filename, const tatum::HoldTimingAnalyzer& hold_analyzer, size_t npaths=REPORT_TIMING_DEFAULT_NPATHS) const;
6970
void report_timing_hold(std::ostream& os, const tatum::HoldTimingAnalyzer& hold_analyzer, size_t npaths=REPORT_TIMING_DEFAULT_NPATHS) const;
71+
void report_timing_hold(std::vector<tatum::TimingPath>& paths, std::ostream& os, const tatum::HoldTimingAnalyzer& hold_analyzer, size_t npaths=REPORT_TIMING_DEFAULT_NPATHS) const;
7072

7173
void report_skew_setup(std::string filename, const tatum::SetupTimingAnalyzer& setup_analyzer, size_t nworst=REPORT_TIMING_DEFAULT_NPATHS) const;
7274
void report_skew_setup(std::ostream& os, const tatum::SetupTimingAnalyzer& setup_analyzer, size_t nworst=REPORT_TIMING_DEFAULT_NPATHS) const;

libs/EXTERNAL/sockpp

Submodule sockpp added at 5388c4b

vpr/CMakeLists.txt

+27-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,25 @@ else()
3232
message(STATUS "EZGL: graphics disabled")
3333
endif()
3434

35+
36+
#Handle server setup
37+
set(SERVER_DEFINES "")
38+
39+
set(SERVER_DISABILED_REASON "")
40+
if (VPR_USE_SERVER)
41+
if (VPR_USE_EZGL STREQUAL "off")
42+
set(SERVER_DISABILED_REASON ", due to EZGL being disabled")
43+
set(VPR_USE_SERVER OFF)
44+
endif()
45+
endif()
46+
47+
if (VPR_USE_SERVER)
48+
message(STATUS "Server mode is enabled")
49+
else()
50+
list(APPEND SERVER_DEFINES "-DNO_SERVER")
51+
message(STATUS "Server mode is disabled${SERVER_DISABILED_REASON}")
52+
endif()
53+
3554
#
3655
# Build Configuration
3756
#
@@ -87,6 +106,13 @@ target_link_libraries(libvpr
87106
librrgraph
88107
)
89108

109+
if(VPR_USE_SERVER)
110+
target_link_libraries(libvpr
111+
sockpp-static
112+
-lz
113+
)
114+
endif()
115+
90116
#link graphics library only when graphics set to on
91117
if (VPR_USE_EZGL STREQUAL "on")
92118
target_link_libraries(libvpr
@@ -123,7 +149,7 @@ if (VPR_USE_EZGL STREQUAL "on")
123149

124150
endif()
125151

126-
target_compile_definitions(libvpr PUBLIC ${GRAPHICS_DEFINES})
152+
target_compile_definitions(libvpr PUBLIC ${GRAPHICS_DEFINES} ${SERVER_DEFINES})
127153

128154
if(${VTR_ENABLE_CAPNPROTO})
129155
target_link_libraries(libvpr libvtrcapnproto)

vpr/src/base/CheckSetup.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
void CheckSetup(const t_packer_opts& PackerOpts,
1111
const t_placer_opts& PlacerOpts,
1212
const t_router_opts& RouterOpts,
13+
const t_server_opts& ServerOpts,
1314
const t_det_routing_arch& RoutingArch,
1415
const std::vector<t_segment_inf>& Segments,
1516
const t_timing_inf Timing,
@@ -105,4 +106,12 @@ void CheckSetup(const t_packer_opts& PackerOpts,
105106
"Place channel width must be even for unidirectional.\n");
106107
}
107108
}
109+
110+
if (ServerOpts.is_server_mode_enabled) {
111+
if (ServerOpts.port_num < DYMANIC_PORT_RANGE_MIN || ServerOpts.port_num > DYNAMIC_PORT_RANGE_MAX) {
112+
VPR_FATAL_ERROR(VPR_ERROR_OTHER,
113+
"Specified server port number `--port %d` is out of range [%d-%d]. Please specify a port number within that range.\n",
114+
ServerOpts.port_num, DYMANIC_PORT_RANGE_MIN, DYNAMIC_PORT_RANGE_MAX);
115+
}
116+
}
108117
}

vpr/src/base/CheckSetup.h

+4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
#define CHECKSETUP_H
33
#include "vpr_types.h"
44

5+
const int DYMANIC_PORT_RANGE_MIN = 49152;
6+
const int DYNAMIC_PORT_RANGE_MAX = 65535;
7+
58
void CheckSetup(const t_packer_opts& PackerOpts,
69
const t_placer_opts& PlacerOpts,
710
const t_router_opts& RouterOpts,
11+
const t_server_opts& ServerOpts,
812
const t_det_routing_arch& RoutingArch,
913
const std::vector<t_segment_inf>& Segments,
1014
const t_timing_inf Timing,

vpr/src/base/SetupVPR.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ static void SetupAnnealSched(const t_options& Options,
3838
static void SetupRouterOpts(const t_options& Options, t_router_opts* RouterOpts);
3939
static void SetupNocOpts(const t_options& Options,
4040
t_noc_opts* NocOpts);
41+
static void SetupServerOpts(const t_options& Options,
42+
t_server_opts* ServerOpts);
4143
static void SetupRoutingArch(const t_arch& Arch, t_det_routing_arch* RoutingArch);
4244
static void SetupTiming(const t_options& Options, const bool TimingEnabled, t_timing_inf* Timing);
4345
static void SetupSwitches(const t_arch& Arch,
@@ -99,6 +101,7 @@ void SetupVPR(const t_options* Options,
99101
t_router_opts* RouterOpts,
100102
t_analysis_opts* AnalysisOpts,
101103
t_noc_opts* NocOpts,
104+
t_server_opts* ServerOpts,
102105
t_det_routing_arch* RoutingArch,
103106
std::vector<t_lb_type_rr_node>** PackerRRGraphs,
104107
std::vector<t_segment_inf>& Segments,
@@ -144,6 +147,7 @@ void SetupVPR(const t_options* Options,
144147
SetupAnalysisOpts(*Options, *AnalysisOpts);
145148
SetupPowerOpts(*Options, PowerOpts, Arch);
146149
SetupNocOpts(*Options, NocOpts);
150+
SetupServerOpts(*Options, ServerOpts);
147151

148152
if (readArchFile == true) {
149153
vtr::ScopedStartFinishTimer t("Loading Architecture Description");
@@ -743,6 +747,11 @@ static void SetupNocOpts(const t_options& Options, t_noc_opts* NocOpts) {
743747
NocOpts->noc_placement_file_name = Options.noc_placement_file_name;
744748
}
745749

750+
static void SetupServerOpts(const t_options& Options, t_server_opts* ServerOpts) {
751+
ServerOpts->is_server_mode_enabled = Options.is_server_mode_enabled;
752+
ServerOpts->port_num = Options.server_port_num;
753+
}
754+
746755
static void find_ipin_cblock_switch_index(const t_arch& Arch, int& wire_to_arch_ipin_switch, int& wire_to_arch_ipin_switch_between_dice) {
747756
for (auto cb_switch_name_index = 0; cb_switch_name_index < (int)Arch.ipin_cblock_switch_name.size(); cb_switch_name_index++) {
748757
int ipin_cblock_switch_index = UNDEFINED;

vpr/src/base/SetupVPR.h

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ void SetupVPR(const t_options* Options,
2020
t_router_opts* RouterOpts,
2121
t_analysis_opts* AnalysisOpts,
2222
t_noc_opts* NocOpts,
23+
t_server_opts* ServerOpts,
2324
t_det_routing_arch* RoutingArch,
2425
std::vector<t_lb_type_rr_node>** PackerRRGraphs,
2526
std::vector<t_segment_inf>& Segments,

vpr/src/base/read_options.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -2874,6 +2874,21 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
28742874
.default_value("vpr_noc_placement_output.txt")
28752875
.show_in(argparse::ShowIn::HELP_ONLY);
28762876

2877+
#ifndef NO_SERVER
2878+
auto& server_grp = parser.add_argument_group("server options");
2879+
2880+
server_grp.add_argument<bool, ParseOnOff>(args.is_server_mode_enabled, "--server")
2881+
.help("Run in server mode."
2882+
"Accept client application connection and respond to requests." )
2883+
.action(argparse::Action::STORE_TRUE)
2884+
.default_value("off");
2885+
2886+
server_grp.add_argument<int>(args.server_port_num, "--port")
2887+
.help("Server port number.")
2888+
.default_value("60555")
2889+
.show_in(argparse::ShowIn::HELP_ONLY);
2890+
#endif /* NO_SERVER */
2891+
28772892
return parser;
28782893
}
28792894

vpr/src/base/read_options.h

+4
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ struct t_options {
7575
argparse::ArgValue<bool> allow_dangling_combinational_nodes;
7676
argparse::ArgValue<bool> terminate_if_timing_fails;
7777

78+
/* Server options */
79+
argparse::ArgValue<bool> is_server_mode_enabled;
80+
argparse::ArgValue<int> server_port_num;
81+
7882
/* Atom netlist options */
7983
argparse::ArgValue<bool> absorb_buffer_luts;
8084
argparse::ArgValue<e_const_gen_inference> const_gen_inference;

vpr/src/base/vpr_api.cpp

+35-1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@
102102
# include <tbb/global_control.h>
103103
#endif
104104

105+
#ifndef NO_SERVER
106+
#include "gateio.h"
107+
#include "serverupdate.h"
108+
#endif /* NO_SERVER */
109+
105110
/* Local subroutines */
106111
static void free_complex_block_types();
107112

@@ -291,6 +296,7 @@ void vpr_init_with_options(const t_options* options, t_vpr_setup* vpr_setup, t_a
291296
&vpr_setup->RouterOpts,
292297
&vpr_setup->AnalysisOpts,
293298
&vpr_setup->NocOpts,
299+
&vpr_setup->ServerOpts,
294300
&vpr_setup->RoutingArch,
295301
&vpr_setup->PackerRRGraph,
296302
vpr_setup->Segments,
@@ -309,6 +315,7 @@ void vpr_init_with_options(const t_options* options, t_vpr_setup* vpr_setup, t_a
309315
CheckSetup(vpr_setup->PackerOpts,
310316
vpr_setup->PlacerOpts,
311317
vpr_setup->RouterOpts,
318+
vpr_setup->ServerOpts,
312319
vpr_setup->RoutingArch, vpr_setup->Segments, vpr_setup->Timing, arch->Chans);
313320

314321
/* flush any messages to user still in stdout that hasn't gotten displayed */
@@ -387,6 +394,9 @@ bool vpr_flow(t_vpr_setup& vpr_setup, t_arch& arch) {
387394

388395
// TODO: Placer still assumes that cluster net list is used - graphics can not work with flat routing yet
389396
vpr_init_graphics(vpr_setup, arch, false);
397+
398+
vpr_init_server(vpr_setup);
399+
390400
{ //Place
391401
const auto& placement_net_list = (const Netlist<>&)g_vpr_ctx.clustering().clb_nlist;
392402
bool place_success = vpr_place_flow(placement_net_list, vpr_setup, arch);
@@ -806,6 +816,12 @@ RouteStatus vpr_route_flow(const Netlist<>& net_list,
806816
auto& atom_ctx = g_vpr_ctx.atom();
807817
routing_delay_calc = std::make_shared<RoutingDelayCalculator>(atom_ctx.nlist, atom_ctx.lookup, net_delay, is_flat);
808818
timing_info = make_setup_hold_timing_info(routing_delay_calc, router_opts.timing_update_type);
819+
#ifndef NO_SERVER
820+
if (g_vpr_ctx.server().gateIO().is_running()) {
821+
g_vpr_ctx.mutable_server().set_timing_info(timing_info);
822+
g_vpr_ctx.mutable_server().set_routing_delay_calc(routing_delay_calc);
823+
}
824+
#endif /* NO_SERVER */
809825
} else {
810826
/* No delay calculator (segfault if the code calls into it) and wirelength driven routing */
811827
timing_info = make_constant_timing_info(0);
@@ -1049,6 +1065,21 @@ void vpr_init_graphics(const t_vpr_setup& vpr_setup, const t_arch& arch, bool is
10491065
alloc_draw_structs(&arch);
10501066
}
10511067

1068+
void vpr_init_server(const t_vpr_setup& vpr_setup) {
1069+
#ifndef NO_SERVER
1070+
if (vpr_setup.ServerOpts.is_server_mode_enabled) {
1071+
/* Set up a server and its callback to be triggered at 100ms intervals by the timer's timeout event. */
1072+
server::GateIO& gate_io = g_vpr_ctx.mutable_server().mutable_gateIO();
1073+
if (!gate_io.is_running()) {
1074+
gate_io.start(vpr_setup.ServerOpts.port_num);
1075+
g_timeout_add(/*interval_ms*/ 100, server::update, &application);
1076+
}
1077+
}
1078+
#else
1079+
(void)(vpr_setup);
1080+
#endif /* NO_SERVER */
1081+
}
1082+
10521083
void vpr_close_graphics(const t_vpr_setup& /*vpr_setup*/) {
10531084
/* Close down X Display */
10541085
free_draw_structs();
@@ -1256,6 +1287,7 @@ void vpr_setup_vpr(t_options* Options,
12561287
t_router_opts* RouterOpts,
12571288
t_analysis_opts* AnalysisOpts,
12581289
t_noc_opts* NocOpts,
1290+
t_server_opts* ServerOpts,
12591291
t_det_routing_arch* RoutingArch,
12601292
std::vector<t_lb_type_rr_node>** PackerRRGraph,
12611293
std::vector<t_segment_inf>& Segments,
@@ -1280,6 +1312,7 @@ void vpr_setup_vpr(t_options* Options,
12801312
RouterOpts,
12811313
AnalysisOpts,
12821314
NocOpts,
1315+
ServerOpts,
12831316
RoutingArch,
12841317
PackerRRGraph,
12851318
Segments,
@@ -1300,11 +1333,12 @@ void vpr_check_arch(const t_arch& Arch) {
13001333
void vpr_check_setup(const t_packer_opts& PackerOpts,
13011334
const t_placer_opts& PlacerOpts,
13021335
const t_router_opts& RouterOpts,
1336+
const t_server_opts& ServerOpts,
13031337
const t_det_routing_arch& RoutingArch,
13041338
const std::vector<t_segment_inf>& Segments,
13051339
const t_timing_inf& Timing,
13061340
const t_chan_width_dist& Chans) {
1307-
CheckSetup(PackerOpts, PlacerOpts, RouterOpts, RoutingArch,
1341+
CheckSetup(PackerOpts, PlacerOpts, RouterOpts, ServerOpts, RoutingArch,
13081342
Segments, Timing, Chans);
13091343
}
13101344

vpr/src/base/vpr_api.h

+4
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ void vpr_create_device_grid(const t_vpr_setup& vpr_setup, const t_arch& Arch);
139139
void vpr_create_rr_graph(t_vpr_setup& vpr_setup, const t_arch& arch, int chan_width, bool is_flat);
140140

141141
void vpr_init_graphics(const t_vpr_setup& vpr_setup, const t_arch& arch, bool is_flat);
142+
void vpr_init_server(const t_vpr_setup& vpr_setup);
143+
142144
void vpr_close_graphics(const t_vpr_setup& vpr_setup);
143145

144146
void vpr_setup_clock_networks(t_vpr_setup& vpr_setup, const t_arch& Arch);
@@ -177,6 +179,7 @@ void vpr_setup_vpr(t_options* Options,
177179
t_router_opts* RouterOpts,
178180
t_analysis_opts* AnalysisOpts,
179181
t_noc_opts* NocOpts,
182+
t_server_opts* ServerOpts,
180183
t_det_routing_arch* RoutingArch,
181184
std::vector<t_lb_type_rr_node>** PackerRRGraph,
182185
std::vector<t_segment_inf>& Segments,
@@ -195,6 +198,7 @@ void vpr_check_arch(const t_arch& Arch);
195198
void vpr_check_setup(const t_packer_opts& PackerOpts,
196199
const t_placer_opts& PlacerOpts,
197200
const t_router_opts& RouterOpts,
201+
const t_server_opts& ServerOpts,
198202
const t_det_routing_arch& RoutingArch,
199203
const std::vector<t_segment_inf>& Segments,
200204
const t_timing_inf& Timing,

0 commit comments

Comments
 (0)