Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion vpr/src/pack/appack_max_dist_th_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void APPackMaxDistThManager::init(const std::vector<std::string>& max_dist_ths,
set_max_distance_thresholds_from_strings(max_dist_ths, logical_block_types);
}

// Set the initilized flag to true.
// Set the initialized flag to true.
is_initialized_ = true;

// Log the max distance thresholds for each logical block type. This is
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/pack/appack_max_dist_th_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class APPackMaxDistThManager {
void set_max_distance_thresholds_from_strings(const std::vector<std::string>& max_dist_ths,
const std::vector<t_logical_block_type>& logical_block_types);

/// @brief A flag which shows if the thesholds have been computed or not.
/// @brief A flag which shows if the thresholds have been computed or not.
bool is_initialized_ = false;

/// @brief The max distance thresholds of all logical blocks in the architecture.
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/pack/atom_pb_bimap.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AtomPBBimap {
///@brief Returns the atom block id associated with pb
AtomBlockId pb_atom(const t_pb* pb) const;

///@brief Conveneince wrapper around atom_pb to access the associated graph node
///@brief Convenience wrapper around atom_pb to access the associated graph node
const t_pb_graph_node* atom_pb_graph_node(const AtomBlockId blk_id) const;

/**
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/pack/cluster_feasibility_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void load_pin_classes_in_pb_graph_head(t_pb_graph_node* pb_graph_node) {
for (i = 0; i < depth; i++) {
input_count = output_count = 0;
// The following function marks pins based on the pin count. This is
// used when traversing the pb heirarchy.
// used when traversing the pb hierarchy.
std::unordered_map<t_pb_graph_pin*, int> pin_marker;
load_pin_class_by_depth(pb_graph_node, i, &input_count, &output_count, pin_marker);
}
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/pack/cluster_feasibility_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* 2) Robustness issue. During packing, we have a limited size queue to store candidates to try to pack. A good filter helps keep that queue filled with candidates likely to pass.
*
* 1st major filter: Pin counting based on pin classes
* Rationale: If the number of a particular gruop of pins supplied by the pb_graph_node in the architecture is insufficient to meet a candidate packing solution's demand for that group of pins, then that
* Rationale: If the number of a particular group of pins supplied by the pb_graph_node in the architecture is insufficient to meet a candidate packing solution's demand for that group of pins, then that
* candidate solution is for sure invalid without any further legalization checks. For example, if a candidate solution requires 2 clock pins but the architecture only has one clock, then that solution
* can't be legal.
*
Expand Down
6 changes: 3 additions & 3 deletions vpr/src/pack/cluster_legalizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ static enum e_block_pack_status check_chain_root_placement_feasibility(const t_p
/*
* @brief Check that the two atom blocks blk_id and sibling_blk_id (which should
* both be memory slices) are feasible, in the sense that they have
* precicely the same net connections (with the exception of nets in data
* precisely the same net connections (with the exception of nets in data
* port classes).
*
* Note that this routine does not check pin feasibility against the cur_pb_type; so
Expand Down Expand Up @@ -368,7 +368,7 @@ static bool primitive_memory_sibling_feasible(const AtomBlockId blk_id, const t_
//We can get the actual net provided the port exists
//
//Note that if the port did not exist, the net is left
//as invalid/disconneced
//as invalid/disconnected
if (blk_port_id) {
blk_net_id = atom_ctx.netlist().port_net(blk_port_id, ipin);
}
Expand Down Expand Up @@ -503,7 +503,7 @@ try_place_atom_block_rec(const t_pb_graph_node* pb_graph_node,
}
const t_pb_type* pb_type = pb_graph_node->pb_type;

/* Any pb_type under an mode, which is disabled for packing, should not be considerd for mapping
/* Any pb_type under an mode, which is disabled for packing, should not be considered for mapping
* Early exit to flag failure
*/
if (true == pb_type->parent_mode->disable_packing) {
Expand Down
8 changes: 4 additions & 4 deletions vpr/src/pack/cluster_legalizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ struct LegalizationCluster {
* 2) FULL
*
* 1) SKIP_INTRA_LB_ROUTE Legalization Strategy Example:
* This strategy will not fully route the interal connections of the clusters
* This strategy will not fully route the internal connections of the clusters
* until when the user specifies. An example of how to use this strategy would
* look something like this. Note, this example is simplified and the result
* of the packings should be checked and handled.
Expand All @@ -166,7 +166,7 @@ struct LegalizationCluster {
* if (!legalizer.check_cluster_legality(new_cluster_id))
* // Destroy the illegal cluster.
* legalizer.destroy_cluster(new_cluster_id);
* // Clean-up the internal bookeeping of the class (required after
* // Clean-up the internal bookkeeping of the class (required after
* // destroying a cluster).
* legalizer.compress();
* // Handle how to try again (maybe use FULL strategy).
Expand Down Expand Up @@ -372,7 +372,7 @@ class ClusterLegalizer {
bool check_cluster_legality(LegalizationClusterId cluster_id);

/*
* @brief Cleans the cluster of unnessary data, reducing the memory footprint.
* @brief Cleans the cluster of unnecessary data, reducing the memory footprint.
*
* After this function is called, no more molecules can be added to the
* cluster. This method will ensure that the cluster has enough information
Expand Down Expand Up @@ -417,7 +417,7 @@ class ClusterLegalizer {
*
* A molecule is compatible with a cluster if there exists a free primitive
* (a primitive that is not currently occupied by other atoms) of the correct
* type to accomodate each type of atom in the molecule.
* type to accommodate each type of atom in the molecule.
*
* This is a quick check to see if a molecule can go in the given cluster.
* "This is a necessary but not sufficient test for a molecule to be able to
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/pack/cluster_placement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ bool get_next_primitive_list(t_intra_cluster_placement_stats* cluster_placement_
* 4. Return NULL if not found
*/

// Intialize variables
// Initialize variables
bool found_best = false;
lowest_cost = std::numeric_limits<float>::max();

Expand Down
49 changes: 24 additions & 25 deletions vpr/src/pack/cluster_router.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ static bool check_edge_for_route_conflicts(std::unordered_map<const t_pb_graph_n
pb_graph_node->illegal_modes.push_back(result.first->second->index);
}

// If the number of illegal modes equals the number of available mode for a specific pb_graph_node it means that no cluster can be generated. This resuts
// If the number of illegal modes equals the number of available mode for a specific pb_graph_node it means that no cluster can be generated. This results
// in a fatal error.
if ((int)pb_graph_node->illegal_modes.size() >= pb_graph_node->pb_type->num_modes) {
VPR_FATAL_ERROR(VPR_ERROR_PACK, "There are no more available modes to be used. Routing Failed!");
Expand Down Expand Up @@ -693,7 +693,7 @@ static void add_pin_to_rt_terminals(t_lb_router_data* router_data, const AtomPin
if (lb_nets[ipos].terminals.empty()) {
/* Add terminals */

//Default assumption is that the source is outside the current cluster (will be overriden later if required)
//Default assumption is that the source is outside the current cluster (will be overridden later if required)
int source_terminal = get_lb_type_rr_graph_ext_source_index(lb_type);
lb_nets[ipos].terminals.push_back(source_terminal);

Expand Down Expand Up @@ -782,10 +782,10 @@ static void add_pin_to_rt_terminals(t_lb_router_data* router_data, const AtomPin
//Sanity checks
int num_extern_sources = 0;
int num_extern_sinks = 0;
for (size_t iterm = 0; iterm < lb_nets[ipos].terminals.size(); ++iterm) {
int inode = lb_nets[ipos].terminals[iterm];
AtomPinId atom_pin = lb_nets[ipos].atom_pins[iterm];
if (iterm == 0) {
for (size_t term_idx = 0; term_idx < lb_nets[ipos].terminals.size(); ++term_idx) {
int inode = lb_nets[ipos].terminals[term_idx];
AtomPinId atom_pin = lb_nets[ipos].atom_pins[term_idx];
if (term_idx == 0) {
//Net driver
VTR_ASSERT_SAFE_MSG(lb_type_graph[inode].type == LB_SOURCE, "Driver must be a source RR node");
VTR_ASSERT_SAFE_MSG(atom_pin, "Driver have an associated atom pin");
Expand Down Expand Up @@ -867,7 +867,7 @@ static void remove_pin_from_rt_terminals(t_lb_router_data* router_data, const At

/* Remove sink from list of terminals */
int pin_index = pb_graph_pin->pin_count_in_cluster;
unsigned int iterm;
size_t term_idx;

VTR_ASSERT(lb_type_graph[pin_index].num_modes == 1);
VTR_ASSERT(lb_type_graph[pin_index].num_fanout[0] == 1);
Expand All @@ -877,8 +877,8 @@ static void remove_pin_from_rt_terminals(t_lb_router_data* router_data, const At
int target_index = -1;
//Search for the sink
found = false;
for (iterm = 0; iterm < lb_nets[ipos].terminals.size(); iterm++) {
if (lb_nets[ipos].terminals[iterm] == sink_index) {
for (term_idx = 0; term_idx < lb_nets[ipos].terminals.size(); term_idx++) {
if (lb_nets[ipos].terminals[term_idx] == sink_index) {
target_index = sink_index;
found = true;
break;
Expand All @@ -887,23 +887,22 @@ static void remove_pin_from_rt_terminals(t_lb_router_data* router_data, const At
if (!found) {
//Search for the pin
found = false;
for (iterm = 0; iterm < lb_nets[ipos].terminals.size(); iterm++) {
if (lb_nets[ipos].terminals[iterm] == pin_index) {
for (term_idx = 0; term_idx < lb_nets[ipos].terminals.size(); term_idx++) {
if (lb_nets[ipos].terminals[term_idx] == pin_index) {
target_index = pin_index;
found = true;
break;
}
}
}
VTR_ASSERT(found == true);
VTR_ASSERT(lb_nets[ipos].terminals[iterm] == target_index);
VTR_ASSERT(iterm > 0);
VTR_ASSERT(lb_nets[ipos].terminals[term_idx] == target_index);

/* Drop terminal from list */
lb_nets[ipos].terminals[iterm] = lb_nets[ipos].terminals.back();
lb_nets[ipos].terminals[term_idx] = lb_nets[ipos].terminals.back();
lb_nets[ipos].terminals.pop_back();

lb_nets[ipos].atom_pins[iterm] = lb_nets[ipos].atom_pins.back();
lb_nets[ipos].atom_pins[term_idx] = lb_nets[ipos].atom_pins.back();
lb_nets[ipos].atom_pins.pop_back();

if (lb_nets[ipos].terminals.size() == 1 && lb_nets[ipos].terminals[0] != get_lb_type_rr_graph_ext_source_index(lb_type)) {
Expand Down Expand Up @@ -946,23 +945,23 @@ static void fix_duplicate_equivalent_pins(t_lb_router_data* router_data, const A
std::vector<t_intra_lb_net>& lb_nets = *router_data->intra_lb_nets;

for (size_t ilb_net = 0; ilb_net < lb_nets.size(); ++ilb_net) {
//Collect all the sink terminals indicies which target a particular node
//Collect all the sink terminals indices which target a particular node
std::map<int, std::vector<int>> duplicate_terminals;
for (size_t iterm = 1; iterm < lb_nets[ilb_net].terminals.size(); ++iterm) {
int node = lb_nets[ilb_net].terminals[iterm];
for (size_t term_idx = 1; term_idx < lb_nets[ilb_net].terminals.size(); ++term_idx) {
int node = lb_nets[ilb_net].terminals[term_idx];

duplicate_terminals[node].push_back(iterm);
duplicate_terminals[node].push_back(term_idx);
}

for (auto kv : duplicate_terminals) {
if (kv.second.size() < 2) continue; //Only process duplicates

//Remap all the duplicate terminals so they target the pin instead of the sink
for (size_t idup_term = 0; idup_term < kv.second.size(); ++idup_term) {
int iterm = kv.second[idup_term]; //The index in terminals which is duplicated
int term_idx = kv.second[idup_term]; //The index in terminals which is duplicated

VTR_ASSERT(lb_nets[ilb_net].atom_pins.size() == lb_nets[ilb_net].terminals.size());
AtomPinId atom_pin = lb_nets[ilb_net].atom_pins[iterm];
AtomPinId atom_pin = lb_nets[ilb_net].atom_pins[term_idx];
VTR_ASSERT(atom_pin);

const t_pb_graph_pin* pb_graph_pin = find_pb_graph_pin(atom_ctx.netlist(), atom_to_pb, atom_pin);
Expand All @@ -984,10 +983,10 @@ static void fix_duplicate_equivalent_pins(t_lb_router_data* router_data, const A
VTR_ASSERT(lb_type_graph[pin_index].num_fanout[0] == 1);
int sink_index = lb_type_graph[pin_index].outedges[0][0].node_index;
VTR_ASSERT(lb_type_graph[sink_index].type == LB_SINK);
VTR_ASSERT_MSG(sink_index == lb_nets[ilb_net].terminals[iterm], "Remapped pin must be connected to original sink");
VTR_ASSERT_MSG(sink_index == lb_nets[ilb_net].terminals[term_idx], "Remapped pin must be connected to original sink");

//Change the target
lb_nets[ilb_net].terminals[iterm] = pin_index;
lb_nets[ilb_net].terminals[term_idx] = pin_index;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entire function is actually terrifying the way it uses and reuses term_idx. Can you please put a note somewhere to refactor it in a later PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually already have this on my radar. This will be part of future packer cleanups.

This reuse of the variable is not too bad, I tried to resolve it but its a bit more involved for this PR. Its just searching for a terminal index which matches some attribute.

}
}
}
Expand Down Expand Up @@ -1370,8 +1369,8 @@ static void save_and_reset_lb_route(t_lb_router_data* router_data) {
*/
saved_lb_nets[inet].atom_net_id = lb_nets[inet].atom_net_id;
saved_lb_nets[inet].terminals.resize(lb_nets[inet].terminals.size());
for (int iterm = 0; iterm < (int)lb_nets[inet].terminals.size(); iterm++) {
saved_lb_nets[inet].terminals[iterm] = lb_nets[inet].terminals[iterm];
for (int term_idx = 0; term_idx < (int)lb_nets[inet].terminals.size(); term_idx++) {
saved_lb_nets[inet].terminals[term_idx] = lb_nets[inet].terminals[term_idx];
}
saved_lb_nets[inet].rt_tree = lb_nets[inet].rt_tree;
lb_nets[inet].rt_tree = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/pack/greedy_candidate_selector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ void GreedyCandidateSelector::update_cluster_gain_stats_candidate_success(
// TODO: If this threshold lookup gets expensive, move outside.
int high_fanout_net_threshold = high_fanout_thresholds_.get_threshold(cluster_legalizer.get_cluster_type(cluster_id)->name);

// Mark and update the gain stats for each block in the succesfully
// Mark and update the gain stats for each block in the successfully
// clustered molecule.
// Makes calls to update cluster stats such as the gain map for atoms, used
// pins, and clock structures, in order to reflect the new content of the
Expand Down
6 changes: 3 additions & 3 deletions vpr/src/pack/greedy_candidate_selector.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ struct ClusterGainStats {
/// @brief Indicator for the initial search for feasible blocks.
bool initial_search_for_feasible_blocks;

/// @brief Limit for the number of candiate proposed at each stage.
/// @brief Limit for the number of candidates proposed at each stage.
unsigned candidates_propose_limit;

/// @brief Counter for the number of candiate proposed at each stage.
/// @brief Counter for the number of candidates proposed at each stage.
unsigned num_candidates_proposed;

/// @brief Check if the current stage candidates proposed limit is reached.
Expand Down Expand Up @@ -232,7 +232,7 @@ class GreedyCandidateSelector {
* @param is_global
* The set of global nets in the Atom Netlist. These will be
* routed on special dedicated networks, and hence are less
* relavent to locality / attraction.
* relevant to locality / attraction.
* @param net_output_feeds_driving_block_input
* The set of nets whose output feeds the block that drives
* itself. This may cause double-counting in the gain
Expand Down
6 changes: 3 additions & 3 deletions vpr/src/pack/greedy_clusterer.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class GreedyClusterer {
* @param is_global
* The set of global nets in the Atom Netlist. These will be
* routed on special dedicated networks, and hence are less
* relavent to locality / attraction.
* relevant to locality / attraction.
* @param pre_cluster_timing_manager
* Timing manager class which holds the timing information of
* the primitive netlist. Used by the seed selector to select
Expand Down Expand Up @@ -151,7 +151,7 @@ class GreedyClusterer {
*
* If the strategy is set to SKIP_INTRA_LB_ROUTE, the cluster will grow
* without performing intra-lb route every time a molecule is added to the
* cluster. It will perfrom intra-lb route at the end, after all molecules
* cluster. It will perform intra-lb route at the end, after all molecules
* have been added. If this final intra-lb route fails, the cluster will be
* destroyed and an invalid cluster ID will be returned.
*
Expand Down Expand Up @@ -180,7 +180,7 @@ class GreedyClusterer {
* to balance logical block type utilization.
*
* If the device is to be auto-sized, this method will try to grow the
* device grid if it find thats more clusters of specific logical block
* device grid if it finds that more clusters of specific logical block
* types have been created than the device can support.
*/
LegalizationClusterId start_new_cluster(PackMoleculeId seed_mol_id,
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/pack/lb_type_rr_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Common acryonyms:
* rr - routing resource
* lb - logic block
* pb - phsyical block (the top level physical block is the logic block, a leaf physical block is a primitive)
* pb - physical block (the top level physical block is the logic block, a leaf physical block is a primitive)
*
* Author: Jason Luu
* Date: July 22, 2013
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/pack/output_clustering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ static void clustering_xml_block(pugi::xml_node& parent_node, t_logical_block_ty
port_node.text().set(vtr::join(pins.begin(), pins.end(), " ").c_str());

//The cluster router may have rotated equivalent pins (e.g. LUT inputs),
//record the resulting rotation here so it can be unambigously mapped
//record the resulting rotation here so it can be unambiguously mapped
//back to the atom netlist
if (pb_type->ports[i].equivalent != PortEquivalence::NONE && pb_type->parent_mode != nullptr && pb_type->is_primitive()) {
//This is a primitive with equivalent inputs
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/pack/pack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace {
enum class e_packer_state {
/// @brief Default packer state.
DEFAULT,
/// @brief Succcess state for the packer. The packing looks feasible to
/// @brief Success state for the packer. The packing looks feasible to
/// fit on the device (does not exceed number of blocks of each
/// type in the grid) and meets floorplanning constraints.
SUCCESS,
Expand Down
6 changes: 3 additions & 3 deletions vpr/src/pack/pack_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct t_lb_type_rr_node_edge {
struct t_lb_type_rr_node {
short capacity; /* Number of nets that can simultaneously use this node */
int num_modes;
short* num_fanout; /* [0..num_modes - 1] Mode dependant fanout */
short* num_fanout; /* [0..num_modes - 1] Mode dependent fanout */
enum e_lb_rr_type type; /* Type of logic cluster_ctx.blocks resource node */

t_lb_type_rr_node_edge** outedges; /* [0..num_modes - 1][0..num_fanout-1] index and cost of out edges */
Expand Down Expand Up @@ -169,10 +169,10 @@ class compare_expansion_node {

/* Stores explored nodes by router */
struct t_explored_node_tb {
int prev_index; /* Prevous node that drives this one */
int prev_index; /* Previous node that drives this one */
int explored_id; /* ID used to determine if this node has been explored */
int inet; /* net index of route tree */
int enqueue_id; /* ID used ot determine if this node has been pushed on exploration priority queue */
int enqueue_id; /* ID used to determine if this node has been pushed on exploration priority queue */
float enqueue_cost; /* cost of node pused on exploration priority queue */

t_explored_node_tb() {
Expand Down
Loading