Skip to content

Commit

Permalink
Merge branch 'master' into graphics-view-update
Browse files Browse the repository at this point in the history
  • Loading branch information
alanbu1 authored Sep 6, 2023
2 parents a45b3e4 + 0d8f6de commit 6c796c7
Show file tree
Hide file tree
Showing 41 changed files with 707 additions and 365 deletions.
3 changes: 2 additions & 1 deletion .github/scripts/hostsetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ apt install -y \
default-jdk \
g++-9 \
gcc-9 \
wget
wget \
libtbb-dev

# installing the latest version of cmake
apt install -y apt-transport-https ca-certificates gnupg
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
- name: Execute test script
run: stdbuf -i0 -o0 -e0 ./.github/scripts/run-vtr.sh
env:
VPR_NUM_WORKERS: 4
VTR_TEST: ${{ matrix.test }}
VTR_TEST_OPTIONS: ${{ matrix.options }}
VTR_CMAKE_PARAMS: ${{ matrix.cmake }}
Expand Down
3 changes: 3 additions & 0 deletions dev/pylint_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ def main():
cmd = ["pylint", path, "-s", "n"]
if ignore_list:
cmd.append("--disable=" + ",".join(ignore_list))
# Don't object to single-letter variable names (that's not in PEP8)
# see https://stackoverflow.com/q/21833872
cmd.append("--variable-rgx=[a-z][a-z0-9_]{0,40}$")

# Run pylint and check output
process = subprocess.run(cmd, check=False, stdout=subprocess.PIPE)
Expand Down
4 changes: 2 additions & 2 deletions libs/librrgraph/src/io/rr_graph_reader.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*This function loads in a routing resource graph written in xml format
/* This function loads in a routing resource graph written in xml format
* into vpr when the option --read_rr_graph <file name> is specified.
* When it is not specified the build_rr_graph function is then called.
* This is done using the libpugixml library. This is useful
Expand All @@ -11,7 +11,7 @@
* to ensure it matches. An error will through if any feature does not match.
* Other elements such as edges, nodes, and switches
* are overwritten by the rr graph file if one is specified. If an optional
* identifier such as capacitance is not specified, it is set to 0*/
* identifier such as capacitance is not specified, it is set to 0 */

#include "rr_graph_reader.h"

Expand Down
24 changes: 6 additions & 18 deletions libs/libvtrutil/src/vtr_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <cstdlib>
#include <cerrno> //For errno
#include <cstring>
#include <filesystem>
#include <memory>
#include <sstream>

Expand Down Expand Up @@ -455,28 +456,15 @@ bool file_exists(const char* filename) {
return false;
}

/* Date:July 17th, 2013
* Author: Daniel Chen */
/**
* @brief Checks the file extension of an file to ensure correct file format.
*
* Returns true if format is correct, and false otherwise.
* @note This is probably a fragile check, but at least should
* prevent common problems such as swapping architecture file
* and blif file on the VPR command line.
* Returns true if the extension is correct, and false otherwise.
*/
bool check_file_name_extension(const char* file_name,
const char* file_extension) {
const char* str;
int len_extension;

len_extension = std::strlen(file_extension);
str = std::strstr(file_name, file_extension);
if (str == nullptr || (*(str + len_extension) != '\0')) {
return false;
}

return true;
bool check_file_name_extension(std::string file_name,
std::string file_extension) {
auto ext = std::filesystem::path(file_name).extension();
return ext == file_extension;
}

/**
Expand Down
3 changes: 1 addition & 2 deletions libs/libvtrutil/src/vtr_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ double atod(const std::string& value);
*/
int get_file_line_number_of_last_opened_file();
bool file_exists(const char* filename);
bool check_file_name_extension(const char* file_name,
const char* file_extension);
bool check_file_name_extension(std::string file_name, std::string file_extension);

extern std::string out_file_prefix;

Expand Down
5 changes: 5 additions & 0 deletions vpr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ if(${VTR_ENABLE_CAPNPROTO})
add_definitions("-DVTR_ENABLE_CAPNPROTO")
endif()

if(${VPR_DEBUG_PARTITION_TREE})
message(STATUS "VPR: Partition tree debug logs: enabled")
add_definitions("-DVPR_DEBUG_PARTITION_TREE")
endif()

#Create the library
add_library(libvpr STATIC
${LIB_HEADERS}
Expand Down
1 change: 1 addition & 0 deletions vpr/asan.supp
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
#Suppress known errors from the TBB library
#These are some errors from the library that we can't fix and suspect are spurious
interceptor_via_lib:libtbb.so

1 change: 1 addition & 0 deletions vpr/lsan.supp
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ leak:libfontconfig.so
#Leaks from TBB library, which
#allows VPR to run with parallelism
leak:libtbb.so
leak:pthread_getattr_np
8 changes: 6 additions & 2 deletions vpr/src/base/vpr_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,11 @@ void vpr_init_with_options(const t_options* options, t_vpr_setup* vpr_setup, t_a
#ifdef VPR_USE_TBB
//Using Thread Building Blocks
if (num_workers == 0) {
//Use default concurrency (i.e. maximum conccurency)
//Use default concurrency (i.e. maximum concurrency)
num_workers = tbb::this_task_arena::max_concurrency();
}

VTR_LOG("Using up to %zu parallel worker(s)\n", num_workers);
tbb::global_control c(tbb::global_control::max_allowed_parallelism, num_workers);
#else
//No parallel execution support
if (num_workers != 1) {
Expand All @@ -237,6 +236,7 @@ void vpr_init_with_options(const t_options* options, t_vpr_setup* vpr_setup, t_a
vpr_setup->clock_modeling = options->clock_modeling;
vpr_setup->two_stage_clock_routing = options->two_stage_clock_routing;
vpr_setup->exit_before_pack = options->exit_before_pack;
vpr_setup->num_workers = num_workers;

VTR_LOG("\n");
VTR_LOG("Architecture file: %s\n", options->ArchFile.value().c_str());
Expand Down Expand Up @@ -366,6 +366,10 @@ bool vpr_flow(t_vpr_setup& vpr_setup, t_arch& arch) {
return true;
}

/* Set this here, because tbb::global_control doesn't control anything once it's out of scope
* (contrary to the name). */
tbb::global_control c(tbb::global_control::max_allowed_parallelism, vpr_setup.num_workers);

{ //Pack
bool pack_success = vpr_pack_flow(vpr_setup, arch);

Expand Down
1 change: 1 addition & 0 deletions vpr/src/base/vpr_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1790,6 +1790,7 @@ struct t_vpr_setup {
e_clock_modeling clock_modeling; ///<How clocks should be handled
bool two_stage_clock_routing; ///<How clocks should be routed in the presence of a dedicated clock network
bool exit_before_pack; ///<Exits early before starting packing (useful for collecting statistics without running/loading any stages)
unsigned int num_workers; ///Maximum number of worker threads (determined from an env var or cmdline option)
};

class RouteStatus {
Expand Down
10 changes: 1 addition & 9 deletions vpr/src/route/connection_based_routing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,7 @@ Connection_based_routing_resources::Connection_based_routing_resources(const Net
* reached_rt_sinks will also reserve enough space, but instead of
* indices, it will store the pointers to route tree nodes */

// can have as many targets as sink pins (total number of pins - SOURCE pin)
// supposed to be used as persistent vector growing with push_back and clearing at the start of each net routing iteration
auto max_sink_pins_per_net = std::max(get_max_pins_per_net(net_list_) - 1, 0);
remaining_targets.reserve(max_sink_pins_per_net);
reached_rt_sinks.reserve(max_sink_pins_per_net);

size_t routing_num_nets = net_list_.nets().size();
remaining_targets.resize(routing_num_nets);
reached_rt_sinks.resize(routing_num_nets);
lower_bound_connection_delay.resize(routing_num_nets);
forcible_reroute_connection_flag.resize(routing_num_nets);

Expand Down Expand Up @@ -114,7 +106,7 @@ bool Connection_based_routing_resources::forcibly_reroute_connections(float max_

forcible_reroute_connection_flag[net_id][rr_sink_node] = true;
// note that we don't set forcible_reroute_connection_flag to false when the converse is true
// resetting back to false will be done during tree pruning, after the sink has been legally reached
// resetting back to false will be done during tree pruning, after the sink has been legally reached [!]
any_connection_rerouted = true;

profiling::mark_for_forced_reroute();
Expand Down
30 changes: 0 additions & 30 deletions vpr/src/route/connection_based_routing.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,10 @@
// pruning the route tree of large fanouts. Instead of rerouting to each sink of a congested net,
// reroute only the connections to the ones that did not have a legal connection the previous time
class Connection_based_routing_resources {
/** Holds remaining target pin indices (if this net has a RouteTree from the previous
* iteration, its prune() call will update this) (should be moved into RouteTree) */
vtr::vector<ParentNetId, std::vector<int>> remaining_targets;

/** Holds RRNodeIds of legally reached sinks. Used to build the external rt_node_to_sink
* lookup. (should be moved into RouteTree)*/
vtr::vector<ParentNetId, std::vector<RRNodeId>> reached_rt_sinks;

public:
Connection_based_routing_resources(const Netlist<>& net_list,
const vtr::vector<ParentNetId, std::vector<RRNodeId>>& net_terminals,
bool is_flat);
// adding to the resources when they are reached during pruning
// mark rr sink node as something that still needs to be reached
void toreach_rr_sink(ParentNetId net_id, int rr_sink_node) {
remaining_targets[net_id].push_back(rr_sink_node);
}
// mark rt sink node as something that has been legally reached
void reached_rt_sink(ParentNetId net_id, RRNodeId rt_sink) {
reached_rt_sinks[net_id].push_back(rt_sink);
}

// get a handle on the resources
std::vector<int>& get_remaining_targets(ParentNetId net_id) {
return remaining_targets[net_id];
}
std::vector<RRNodeId>& get_reached_rt_sinks(ParentNetId net_id) {
return reached_rt_sinks[net_id];
}

bool sanity_check_lookup() const;

Expand Down Expand Up @@ -87,11 +62,6 @@ class Connection_based_routing_resources {
//Updates the connection delay lower bound (if less than current best found)
void update_lower_bound_connection_delay(ParentNetId net, int ipin, float delay);

void prepare_routing_for_net(ParentNetId net_id) {
remaining_targets[net_id].clear();
reached_rt_sinks[net_id].clear();
}

// get a handle on the resources
float get_stable_critical_path_delay() const { return last_stable_critical_path_delay; }

Expand Down
Loading

0 comments on commit 6c796c7

Please sign in to comment.