Skip to content

Commit

Permalink
Merge pull request verilog-to-routing#2564 from verilog-to-routing/ad…
Browse files Browse the repository at this point in the history
…d_or_tools

NoC SAT Routing
  • Loading branch information
vaughnbetz committed Jun 10, 2024
2 parents 62fa97e + 2ed4497 commit 744ef2d
Show file tree
Hide file tree
Showing 50 changed files with 1,480 additions and 283 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ option(VPR_USE_SERVER "Specify whether vpr enables the server mode" ON)
#VPR option --enable_analytic_placer is also required for Analytic Placement
option(VPR_ANALYTIC_PLACE "Enable analytic placement in VPR." ON)
option(VPR_ENABLE_INTERCHANGE "Enable FPGA interchange." ON)
option(VPR_ENABLE_NOC_SAT_ROUTING "Enable NoC SAT routing." OFF)

option(WITH_BLIFEXPLORER "Enable build with blifexplorer" OFF)

Expand Down Expand Up @@ -220,12 +221,12 @@ endforeach()
set(FLEX_BISON_WARN_SUPPRESS_FLAGS "")
set(FLEX_BISON_WARN_SUPPRESS_FLAGS_TO_CHECK
"-Wno-redundant-decls" #Flex/bison generate code with redundant declarations
"-Wno-switch-default" #Flex/bison generate switch statments w/o default cases
"-Wno-switch-default" #Flex/bison generate switch statements w/o default cases
"-Wno-unused-parameter" #Flex produces functions with unused params in re-entrant mode
"-Wno-missing-declarations" #Flex misses some declarations in re-entrant mode
"-Wimplicit-fallthrough=0" #Bison produces some cases with explicit
"-Wno-sign-compare" #Flex generates code which performs some signed/unsigned comparison
"-Wno-null-dereference" #Bison produces some cases with potenetial null derefs
"-Wno-null-dereference" #Bison produces some cases with potential null derefs
)
foreach(flag ${FLEX_BISON_WARN_SUPPRESS_FLAGS_TO_CHECK})
CHECK_CXX_COMPILER_FLAG(${flag} CXX_COMPILER_SUPPORTS_${flag})
Expand Down
2 changes: 1 addition & 1 deletion libs/EXTERNAL/libargparse/src/argparse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ namespace argparse {
//Sets the hlep text
Argument& help(std::string help_str);

//Sets the defuault value
//Sets the default value
Argument& default_value(const std::string& default_val);
Argument& default_value(const std::vector<std::string>& default_val);
Argument& default_value(const std::initializer_list<std::string>& default_val);
Expand Down
8 changes: 5 additions & 3 deletions libs/libvtrutil/src/vtr_time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "vtr_log.h"
#include "vtr_rusage.h"

#include <utility>

namespace vtr {

int f_timer_depth = 0;
Expand Down Expand Up @@ -30,7 +32,7 @@ float Timer::delta_max_rss_mib() const {

///@brief Constructor
ScopedActionTimer::ScopedActionTimer(std::string action_str)
: action_(action_str)
: action_(std::move(action_str))
, depth_(f_timer_depth++) {
}

Expand Down Expand Up @@ -69,7 +71,7 @@ int ScopedActionTimer::depth() const {

///@brief Constructor
ScopedFinishTimer::ScopedFinishTimer(std::string action_str)
: ScopedActionTimer(action_str) {
: ScopedActionTimer(std::move(action_str)) {
}

///@brief Destructor
Expand All @@ -83,7 +85,7 @@ ScopedFinishTimer::~ScopedFinishTimer() {

///@brief Constructor
ScopedStartFinishTimer::ScopedStartFinishTimer(std::string action_str)
: ScopedActionTimer(action_str) {
: ScopedActionTimer(std::move(action_str)) {
vtr::printf_info("%s%s\n", pad().c_str(), action().c_str());
}

Expand Down
6 changes: 3 additions & 3 deletions libs/libvtrutil/src/vtr_time.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Timer {
///@brief Scoped time class which prints the time elapsed for the specifid action
class ScopedActionTimer : public Timer {
public:
ScopedActionTimer(const std::string action);
ScopedActionTimer(std::string action);
~ScopedActionTimer();

void quiet(bool value);
Expand Down Expand Up @@ -71,7 +71,7 @@ class ScopedActionTimer : public Timer {
*/
class ScopedFinishTimer : public ScopedActionTimer {
public:
ScopedFinishTimer(const std::string action);
ScopedFinishTimer(std::string action);
~ScopedFinishTimer();
};

Expand All @@ -91,7 +91,7 @@ class ScopedFinishTimer : public ScopedActionTimer {
*/
class ScopedStartFinishTimer : public ScopedActionTimer {
public:
ScopedStartFinishTimer(const std::string action);
ScopedStartFinishTimer(std::string action);
~ScopedStartFinishTimer();
};
} // namespace vtr
Expand Down
18 changes: 16 additions & 2 deletions vpr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,20 @@ if(${VPR_ANALYTIC_PLACE})
endif(TARGET Eigen3::Eigen)
endif()

if (${VPR_ENABLE_NOC_SAT_ROUTING})
message(STATUS "VPR NoC SAT Routing: Requested")
find_package(ortools CONFIG REQUIRED)
if (TARGET ortools::ortools)
message(STATUS "VPR NoC SAT Routing dependency (or-tools): Found")
message(STATUS "VPR NoC SAT Routing: Enabled")
target_link_libraries(libvpr ortools::ortools)
target_compile_definitions(libvpr PUBLIC -DENABLE_NOC_SAT_ROUTING)
else ()
message(STATUS "VPR NoC SAT Routing dependency (or-tools): Not Found (You may need to set CMAKE_PREFIX_PATH in order for CMake to find your OR-Tools installation)")
message(STATUS "VPR NoC SAT Routing: Disabled")
endif (TARGET ortools::ortools)
endif ()

set_target_properties(libvpr PROPERTIES PREFIX "") #Avoid extra 'lib' prefix

#Specify link-time dependencies
Expand Down Expand Up @@ -161,7 +175,7 @@ add_executable(vpr ${EXEC_SOURCES})
target_link_libraries(vpr libvpr)


#Supress IPO link warnings if IPO is enabled
#Suppress IPO link warnings if IPO is enabled
get_target_property(VPR_USES_IPO vpr INTERPROCEDURAL_OPTIMIZATION)
if (VPR_USES_IPO)
set_property(TARGET vpr APPEND PROPERTY LINK_FLAGS ${IPO_LINK_WARN_SUPRESS_FLAGS})
Expand Down Expand Up @@ -292,7 +306,7 @@ target_link_libraries(test_vpr
Catch2::Catch2WithMain
libvpr)

#Supress IPO link warnings if IPO is enabled
#Suppress IPO link warnings if IPO is enabled
get_target_property(TEST_VPR_USES_IPO vpr INTERPROCEDURAL_OPTIMIZATION)
if (TEST_VPR_USES_IPO)
set_property(TARGET test_vpr APPEND PROPERTY LINK_FLAGS ${IPO_LINK_WARN_SUPRESS_FLAGS})
Expand Down
13 changes: 12 additions & 1 deletion vpr/src/base/SetupVPR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -744,9 +744,20 @@ static void SetupNocOpts(const t_options& Options, t_noc_opts* NocOpts) {
NocOpts->noc_latency_constraints_weighting = Options.noc_latency_constraints_weighting;
NocOpts->noc_latency_weighting = Options.noc_latency_weighting;
NocOpts->noc_congestion_weighting = Options.noc_congestion_weighting;
NocOpts->noc_swap_percentage = Options.noc_swap_percentage;
NocOpts->noc_centroid_weight = Options.noc_centroid_weight;
NocOpts->noc_swap_percentage = Options.noc_swap_percentage;
NocOpts->noc_sat_routing_bandwidth_resolution = Options.noc_sat_routing_bandwidth_resolution;
NocOpts->noc_sat_routing_latency_overrun_weighting = Options.noc_sat_routing_latency_overrun_weighting_factor;
NocOpts->noc_sat_routing_congestion_weighting = Options.noc_sat_routing_congestion_weighting_factor;
if (Options.noc_sat_routing_num_workers.provenance() == argparse::Provenance::SPECIFIED) {
NocOpts->noc_sat_routing_num_workers = Options.noc_sat_routing_num_workers;
} else {
NocOpts->noc_sat_routing_num_workers = (int)Options.num_workers;
}
NocOpts->noc_sat_routing_log_search_progress = Options.noc_sat_routing_log_search_progress;
NocOpts->noc_placement_file_name = Options.noc_placement_file_name;


}

static void SetupServerOpts(const t_options& Options, t_server_opts* ServerOpts) {
Expand Down
4 changes: 4 additions & 0 deletions vpr/src/base/ShowSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,10 @@ static void ShowNocOpts(const t_noc_opts& NocOpts) {
VTR_LOG("NocOpts.noc_latency_weighting: %f\n", NocOpts.noc_latency_weighting);
VTR_LOG("NocOpts.noc_congestion_weighting: %f\n", NocOpts.noc_congestion_weighting);
VTR_LOG("NocOpts.noc_swap_percentage: %d%%\n", NocOpts.noc_swap_percentage);
VTR_LOG("NocOpts.noc_sat_routing_bandwidth_resolution: %d\n", NocOpts.noc_sat_routing_bandwidth_resolution);
VTR_LOG("NocOpts.noc_sat_routing_latency_overrun_weighting: %d\n", NocOpts.noc_sat_routing_latency_overrun_weighting);
VTR_LOG("NocOpts.noc_sat_routing_congestion_weighting: %d\n", NocOpts.noc_sat_routing_congestion_weighting);
VTR_LOG("NocOpts.noc_sat_routing_num_workers: %d\n", NocOpts.noc_sat_routing_num_workers);
VTR_LOG("NocOpts.noc_routing_algorithm: %s\n", NocOpts.noc_placement_file_name.c_str());
VTR_LOG("\n");
}
13 changes: 5 additions & 8 deletions vpr/src/base/echo_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ void setEchoEnabled(bool echo_enabled) {
}

void setAllEchoFileEnabled(bool value) {
int i;
for (i = 0; i < (int)E_ECHO_END_TOKEN; i++) {
for (int i = 0; i < (int)E_ECHO_END_TOKEN; i++) {
echoFileEnabled[i] = value;
}
}
Expand Down Expand Up @@ -67,7 +66,7 @@ void alloc_and_load_echo_file_info() {
echoFileNames = new char*[(int)E_ECHO_END_TOKEN];
for (auto i = 0; i < (int)E_ECHO_END_TOKEN; i++) {
echoFileEnabled[i] = false;
echoFileNames[i] = NULL;
echoFileNames[i] = nullptr;
}

setAllEchoFileEnabled(getEchoEnabled());
Expand Down Expand Up @@ -136,9 +135,8 @@ void alloc_and_load_echo_file_info() {
}

void free_echo_file_info() {
int i;
if (echoFileEnabled != nullptr) {
for (i = 0; i < (int)E_ECHO_END_TOKEN; i++) {
for (int i = 0; i < (int)E_ECHO_END_TOKEN; i++) {
if (echoFileNames[i] != nullptr) {
delete[] echoFileNames[i];
}
Expand All @@ -165,7 +163,7 @@ char* getOutputFileName(enum e_output_files ename) {
return outputFileNames[(int)ename];
}

void alloc_and_load_output_file_names(const std::string default_name) {
void alloc_and_load_output_file_names(const std::string& default_name) {
std::string name;

if (outputFileNames == nullptr) {
Expand All @@ -185,9 +183,8 @@ void alloc_and_load_output_file_names(const std::string default_name) {
}

void free_output_file_names() {
int i;
if (outputFileNames != nullptr) {
for (i = 0; i < (int)E_FILE_END_TOKEN; i++) {
for (int i = 0; i < (int)E_FILE_END_TOKEN; i++) {
if (outputFileNames[i] != nullptr) {
delete[] outputFileNames[i];
outputFileNames[i] = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/base/echo_files.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void free_echo_file_info();

void setOutputFileName(enum e_output_files ename, const char* name, const char* default_name);
char* getOutputFileName(enum e_output_files ename);
void alloc_and_load_output_file_names(const std::string default_name);
void alloc_and_load_output_file_names(const std::string& default_name);
void free_output_file_names();

#endif
8 changes: 4 additions & 4 deletions vpr/src/base/place_and_route.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ int binary_search_place_and_route(const Netlist<>& placement_net_list,
t_det_routing_arch* det_routing_arch,
std::vector<t_segment_inf>& segment_inf,
NetPinsMatrix<float>& net_delay,
std::shared_ptr<SetupHoldTimingInfo> timing_info,
std::shared_ptr<RoutingDelayCalculator> delay_calc,
const std::shared_ptr<SetupHoldTimingInfo>& timing_info,
const std::shared_ptr<RoutingDelayCalculator>& delay_calc,
bool is_flat) {
vtr::vector<ParentNetId, vtr::optional<RouteTree>> best_routing; /* Saves the best routing found so far. */
int current, low, high, final;
Expand Down Expand Up @@ -101,7 +101,7 @@ int binary_search_place_and_route(const Netlist<>& placement_net_list,
graph_directionality = (det_routing_arch->directionality == BI_DIRECTIONAL ? GRAPH_BIDIR : GRAPH_UNIDIR);
}

VTR_ASSERT(net_delay.size());
VTR_ASSERT(!net_delay.empty());

if (det_routing_arch->directionality == BI_DIRECTIONAL)
udsd_multiplier = 1;
Expand Down Expand Up @@ -298,7 +298,7 @@ int binary_search_place_and_route(const Netlist<>& placement_net_list,
current = current + current % udsd_multiplier;
}

/* The binary search above occassionally does not find the minimum *
/* The binary search above occasionally does not find the minimum *
* routeable channel width. Sometimes a circuit that will not route *
* in 19 channels will route in 18, due to router flukiness. If *
* verify_binary_search is set, the code below will ensure that FPGAs *
Expand Down
4 changes: 2 additions & 2 deletions vpr/src/base/place_and_route.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ int binary_search_place_and_route(const Netlist<>& placement_net_list,
t_det_routing_arch* det_routing_arch,
std::vector<t_segment_inf>& segment_inf,
NetPinsMatrix<float>& net_delay,
std::shared_ptr<SetupHoldTimingInfo> timing_info,
std::shared_ptr<RoutingDelayCalculator> delay_calc,
const std::shared_ptr<SetupHoldTimingInfo>& timing_info,
const std::shared_ptr<RoutingDelayCalculator>& delay_calc,
bool is_flat);

t_chan_width init_chan(int cfactor,
Expand Down
Loading

0 comments on commit 744ef2d

Please sign in to comment.