Skip to content

Commit 8203e9a

Browse files
committed
fix compile errors
1 parent 7fb5465 commit 8203e9a

17 files changed

+66
-192
lines changed

vpr/src/base/CheckSetup.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "globals.h"
88
#include "read_xml_arch_file.h"
99

10+
1011
static constexpr int DYMANIC_PORT_RANGE_MIN = 49152;
1112
static constexpr int DYNAMIC_PORT_RANGE_MAX = 65535;
1213

@@ -56,14 +57,16 @@ void CheckSetup(const t_packer_opts& packer_opts,
5657
"A block location file requires that placement is enabled.\n");
5758
}
5859

59-
if (placer_opts.place_algorithm.is_timing_driven() && placer_opts.place_static_move_prob.size() > NUM_PL_MOVE_TYPES) {
60+
if (placer_opts.place_algorithm.is_timing_driven() &&
61+
placer_opts.place_static_move_prob.size() > NUM_PL_MOVE_TYPES) {
6062
VPR_FATAL_ERROR(VPR_ERROR_OTHER,
6163
"The number of provided placer move probabilities (%d) should equal or less than the total number of supported moves (%d).\n",
6264
placer_opts.place_static_move_prob.size(),
6365
NUM_PL_MOVE_TYPES);
6466
}
6567

66-
if (!placer_opts.place_algorithm.is_timing_driven() && placer_opts.place_static_move_prob.size() > NUM_PL_NONTIMING_MOVE_TYPES) {
68+
if (!placer_opts.place_algorithm.is_timing_driven() &&
69+
placer_opts.place_static_move_prob.size() > NUM_PL_NONTIMING_MOVE_TYPES) {
6770
VPR_FATAL_ERROR(VPR_ERROR_OTHER,
6871
"The number of placer non timing move probabilities (%d) should equal to or less than the total number of supported moves (%d).\n",
6972
placer_opts.place_static_move_prob.size(),

vpr/src/base/SetupGrid.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,6 @@ DeviceGrid create_device_grid(const std::string& layout_name,
2727
size_t min_width,
2828
size_t min_height);
2929

30-
DeviceGrid create_device_grid(const std::string& layout_name, const std::vector<t_grid_def>& grid_layouts, size_t min_width, size_t min_height);
31-
32-
/**
33-
* @brief Calculate the device utilization
34-
*
35-
* Calculate the device utilization (i.e. fraction of used grid tiles)
36-
* foor the specified grid and resource requirements
37-
*/
38-
float calculate_device_utilization(const DeviceGrid& grid, const std::map<t_logical_block_type_ptr, size_t>& instance_counts);
39-
4030
/**
4131
* @brief Returns the effective size of the device
4232
* (size of the bounding box of non-empty grid tiles)

vpr/src/base/gen/vpr_constraints_uxsdcxx.h

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ static_assert(alignof(triehash_uu64) == 1, "Unaligned 64-bit access not found.")
132132
enum class atok_t_add_atom {NAME_PATTERN};
133133
constexpr const char *atok_lookup_t_add_atom[] = {"name_pattern"};
134134

135-
136135
enum class atok_t_add_region { LAYER_HIGH,
137136
LAYER_LOW,
138137
SUBTILE,
@@ -575,6 +574,12 @@ inline atok_t_vpr_constraints lex_attr_t_vpr_constraints(const char* in, const s
575574
*/
576575
[[noreturn]] inline void dfa_error(const char* wrong, const int* states, const char* const* lookup, int len, const std::function<void(const char*)>* report_error);
577576

577+
/**
578+
* Internal error function for xs:all validators.
579+
*/
580+
template<std::size_t N>
581+
[[noreturn]] inline void all_error(std::bitset<N> gstate, const char* const* lookup, const std::function<void(const char*)>* report_error);
582+
578583
/**
579584
* Internal error function for attribute validators.
580585
*/
@@ -1052,13 +1057,13 @@ inline void load_vpr_constraints(const pugi::xml_node &root, T &out, Context &co
10521057
for (pugi::xml_node node = root.first_child(); node; node = node.next_sibling()) {
10531058
*offset_debug = node.offset_debug();
10541059
gtok_t_vpr_constraints in = lex_node_t_vpr_constraints(node.name(), report_error);
1055-
next = gstate_t_vpr_constraints[state][(int)in];
1056-
if (next == -1)
1057-
dfa_error(gtok_lookup_t_vpr_constraints[(int)in], gstate_t_vpr_constraints[state], gtok_lookup_t_vpr_constraints, 2, report_error);
1058-
state = next;
1060+
if (gstate[(int)in] == 0)
1061+
gstate[(int)in] = 1;
1062+
else
1063+
noreturn_report(report_error, ("Duplicate element " + std::string(node.name()) + " in <vpr_constraints>.").c_str());
10591064
switch (in) {
10601065
case gtok_t_vpr_constraints::PARTITION_LIST: {
1061-
auto child_context = out.add_vpr_constraints_partition_list(context);
1066+
auto child_context = out.init_vpr_constraints_partition_list(context);
10621067
load_partition_list(node, out, child_context, report_error, offset_debug);
10631068
out.finish_vpr_constraints_partition_list(child_context);
10641069
} break;
@@ -1164,12 +1169,6 @@ inline void write_vpr_constraints(T& in, std::ostream& os, Context& context) {
11641169
os << "</global_route_constraints>\n";
11651170
}
11661171
}
1167-
{
1168-
auto child_context = in.get_vpr_constraints_global_route_constraints(context);
1169-
os << "<global_route_constraints>\n";
1170-
write_global_route_constraints(in, os, child_context);
1171-
os << "</global_route_constraints>\n";
1172-
}
11731172
}
11741173

11751174
inline void dfa_error(const char* wrong, const int* states, const char* const* lookup, int len, const std::function<void(const char*)>* report_error) {
@@ -1185,6 +1184,20 @@ inline void dfa_error(const char* wrong, const int* states, const char* const* l
11851184
noreturn_report(report_error, ("Expected " + expected_or + ", found " + std::string(wrong)).c_str());
11861185
}
11871186

1187+
template<std::size_t N>
1188+
inline void all_error(std::bitset<N> gstate, const char* const* lookup, const std::function<void(const char*)>* report_error) {
1189+
std::vector<std::string> missing;
1190+
for (unsigned int i = 0; i < N; i++) {
1191+
if (gstate[i] == 0) missing.push_back(lookup[i]);
1192+
}
1193+
1194+
std::string missing_and = missing[0];
1195+
for (unsigned int i = 1; i < missing.size(); i++)
1196+
missing_and += std::string(", ") + missing[i];
1197+
1198+
noreturn_report(report_error, ("Didn't find required elements " + missing_and + ".").c_str());
1199+
}
1200+
11881201
template<std::size_t N>
11891202
inline void attr_error(std::bitset<N> astate, const char* const* lookup, const std::function<void(const char*)>* report_error) {
11901203
std::vector<std::string> missing;

vpr/src/base/gen/vpr_constraints_uxsdcxx_interface.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ class VprConstraintsBase {
141141
virtual inline typename ContextTypes::SetGlobalSignalWriteContext add_global_route_constraints_set_global_signal(typename ContextTypes::GlobalRouteConstraintsWriteContext& ctx, enum_route_model_type route_model) = 0;
142142
virtual inline void finish_global_route_constraints_set_global_signal(typename ContextTypes::SetGlobalSignalWriteContext& ctx) = 0;
143143
virtual inline size_t num_global_route_constraints_set_global_signal(typename ContextTypes::GlobalRouteConstraintsReadContext& ctx) = 0;
144+
virtual inline typename ContextTypes::SetGlobalSignalReadContext get_global_route_constraints_set_global_signal(int n, typename ContextTypes::GlobalRouteConstraintsReadContext& ctx) = 0;
145+
146+
/** Generated for complex type "vpr_constraints":
147+
* <xs:complexType xmlns:xs="http://www.w3.org/2001/XMLSchema">
144148
* <xs:all minOccurs="0">
145149
* <xs:element name="partition_list" type="partition_list" />
146150
* <xs:element name="global_route_constraints" type="global_route_constraints" />
@@ -150,8 +154,7 @@ class VprConstraintsBase {
150154
*/
151155
virtual inline const char* get_vpr_constraints_tool_name(typename ContextTypes::VprConstraintsReadContext& ctx) = 0;
152156
virtual inline void set_vpr_constraints_tool_name(const char* tool_name, typename ContextTypes::VprConstraintsWriteContext& ctx) = 0;
153-
virtual inline void preallocate_vpr_constraints_partition_list(typename ContextTypes::VprConstraintsWriteContext& ctx, size_t size) = 0;
154-
virtual inline typename ContextTypes::PartitionListWriteContext add_vpr_constraints_partition_list(typename ContextTypes::VprConstraintsWriteContext& ctx) = 0;
157+
virtual inline typename ContextTypes::PartitionListWriteContext init_vpr_constraints_partition_list(typename ContextTypes::VprConstraintsWriteContext& ctx) = 0;
155158
virtual inline void finish_vpr_constraints_partition_list(typename ContextTypes::PartitionListWriteContext& ctx) = 0;
156159
virtual inline typename ContextTypes::PartitionListReadContext get_vpr_constraints_partition_list(typename ContextTypes::VprConstraintsReadContext& ctx) = 0;
157160
virtual inline bool has_vpr_constraints_partition_list(typename ContextTypes::VprConstraintsReadContext& ctx) = 0;

vpr/src/base/vpr_api.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ void vpr_init_with_options(const t_options* options, t_vpr_setup* vpr_setup, t_a
350350
//Initialize vpr floorplanning and routing constraints
351351
auto& filename_opts = vpr_setup->FileNameOpts;
352352
if (!filename_opts.read_vpr_constraints_file.empty()) {
353-
load_vpr_constraints_files(filename_opts.read_vpr_constraints_file.c_str());
353+
load_vpr_constraints_file(filename_opts.read_vpr_constraints_file.c_str());
354354

355355
// Check if there are route constraints specified, and if the clock modeling setting is explicitly specified
356356
// If both conditions are met, issue a warning that the route constraints will override the clock modeling setting.

vpr/src/base/vpr_constraints.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
#ifndef VPR_CONSTRAINTS_H
22
#define VPR_CONSTRAINTS_H
33

4-
<<<<<<< HEAD
54
#include "user_place_constraints.h"
65
#include "user_route_constraints.h"
7-
=======
8-
#include "vtr_vector.h"
9-
#include "vpr_utils.h"
10-
#include "partition.h"
11-
#include "partition_region.h"
12-
#include "route_constraint.h"
13-
>>>>>>> Route constraint for local clock and reset.
146

157
/**
168
* @brief This file defines the VprConstraints class, which encapsulates user-specified placement and routing constraints

vpr/src/base/vpr_constraints.xsd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@
9797
<xs:all minOccurs="0">
9898
<xs:element name="partition_list" type="partition_list"/>
9999
<xs:element name="global_route_constraints" type="global_route_constraints"/>
100-
</xs:choice>
100+
</xs:all>
101+
101102
<xs:attribute name="tool_name" type="xs:string"/>
102103
</xs:complexType>
103104
</xs:element>

vpr/src/base/vpr_constraints_reader.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ void load_vpr_constraints_file(const char* read_vpr_constraints_name) {
3838
auto& routing_ctx = g_vpr_ctx.mutable_routing();
3939
routing_ctx.constraints = reader.constraints_.route_constraints();
4040

41-
// update vpr constraints for routing
42-
auto& routing_ctx = g_vpr_ctx.mutable_routing();
43-
routing_ctx.constraints = reader.constraints_;
44-
45-
VprConstraints ctx_constraints = floorplanning_ctx.constraints;
41+
const auto& ctx_constraints = floorplanning_ctx.constraints;
4642

4743
if (getEchoEnabled() && isEchoFileEnabled(E_ECHO_VPR_CONSTRAINTS)) {
4844
echo_constraints(getEchoFileName(E_ECHO_VPR_CONSTRAINTS), ctx_constraints);

vpr/src/base/vpr_constraints_writer.cpp

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -26,50 +26,6 @@
2626
*/
2727
static Partition create_partition(const std::string& part_name, const Region& region);
2828

29-
void write_vpr_constraints(t_vpr_setup& vpr_setup) {
30-
auto& filename_opts = vpr_setup.FileNameOpts;
31-
if (!filename_opts.write_vpr_constraints_file.empty()) {
32-
std::string file_name = filename_opts.write_vpr_constraints_file;
33-
if (vtr::check_file_name_extension(file_name.c_str(), ".xml")) {
34-
VprConstraints constraints;
35-
36-
// update constraints with place info
37-
// this is to align to original place/partion constraint behavior
38-
const auto& placer_opts = vpr_setup.PlacerOpts;
39-
int horizontal_partitions = placer_opts.floorplan_num_horizontal_partitions, vertical_partitions = placer_opts.floorplan_num_vertical_partitions;
40-
if (horizontal_partitions != 0 && vertical_partitions != 0) {
41-
setup_vpr_floorplan_constraints_cutpoints(constraints, horizontal_partitions, vertical_partitions);
42-
} else {
43-
setup_vpr_floorplan_constraints_one_loc(constraints, placer_opts.place_constraint_expand, placer_opts.place_constraint_subtile);
44-
}
45-
46-
// update route constraints
47-
for (int i = 0; i < g_vpr_ctx.routing().constraints.get_route_constraint_num(); i++) {
48-
RouteConstraint rc = g_vpr_ctx.routing().constraints.get_route_constraint_by_idx(i);
49-
// note: route constraints with regexpr in input constraint file
50-
// is now replaced with the real net name and will not be written
51-
// into output file
52-
if (rc.is_valid()) {
53-
constraints.add_route_constraint(rc);
54-
}
55-
}
56-
57-
// VprConstraintsSerializer writer(g_vpr_ctx.routing().constraints);
58-
VprConstraintsSerializer writer(constraints);
59-
std::fstream fp;
60-
fp.open(file_name.c_str(), std::fstream::out | std::fstream::trunc);
61-
fp.precision(std::numeric_limits<float>::max_digits10);
62-
void* context;
63-
uxsd::write_vpr_constraints_xml(writer, context, fp);
64-
} else {
65-
VPR_FATAL_ERROR(VPR_ERROR_ROUTE,
66-
"Unknown extension on output %s",
67-
file_name.c_str());
68-
}
69-
}
70-
return;
71-
}
72-
7329
void write_vpr_floorplan_constraints(const char* file_name, int expand, bool subtile, int horizontal_partitions, int vertical_partitions) {
7430
VprConstraints constraints;
7531
if (horizontal_partitions != 0 && vertical_partitions != 0) {
@@ -225,7 +181,7 @@ void setup_vpr_floorplan_constraints_cutpoints(VprConstraints& constraints,
225181
}
226182
}
227183

228-
Region current_reg(xminimum, yminimum, xmaximum, ymaximum, 0, n_layers - 1);
184+
Region current_reg(xminimum, yminimum, xmaximum, ymaximum, 0, n_layers-1);
229185
// This function has not been tested for multi-layer grids. An assertion is used earlier to make sure that the grid has only one layer
230186

231187
auto got = region_atoms.find(current_reg);

vpr/src/base/vpr_constraints_writer.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,6 @@ class VprConstraints;
3535
*/
3636
void write_vpr_constraints(t_vpr_setup& vpr_setup);
3737

38-
/**
39-
* @brief Write out vpr constratins to an XML file based on current placement and
40-
* route constraint settings
41-
*
42-
* @param vpr_setup VPR setup information
43-
*/
44-
void write_vpr_constraints(t_vpr_setup& vpr_setup);
45-
4638
/**
4739
* @brief Write out floorplan constraints to an XML file based on current placement
4840
*

vpr/src/base/vpr_context.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,13 @@ struct DeviceContext : public Context {
238238
*/
239239
RRGraphView rr_graph{rr_graph_builder.rr_nodes(), rr_graph_builder.node_lookup(), rr_graph_builder.rr_node_metadata(), rr_graph_builder.rr_edge_metadata(), rr_indexed_data, rr_rc_data, rr_graph_builder.rr_segments(), rr_graph_builder.rr_switch(), rr_graph_builder.node_in_edge_storage(), rr_graph_builder.node_ptc_storage()};
240240

241+
/* Track ids for each rr_node in the rr_graph.
242+
* This is used by drawer for tileable routing resource graph
243+
*/
244+
std::map<RRNodeId, std::vector<size_t>> rr_node_track_ids;
245+
246+
std::vector<t_arch_switch_inf> arch_switch_inf; // [0..(num_arch_switches-1)]
247+
241248
std::map<int, t_arch_switch_inf> all_sw_inf;
242249

243250
int delayless_switch_idx = OPEN;

vpr/src/route/connection_router.cpp

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,8 @@ void ConnectionRouter<Heap>::timing_driven_add_to_heap(const t_conn_cost_params&
573573
// When RCV is enabled, prune based on the RCV-specific total path cost (see
574574
// in `compute_node_cost_using_rcv` in `evaluate_timing_driven_node_costs`)
575575
// to allow detours to get better QoR.
576-
if ((!rcv_path_manager.is_enabled() && best_back_cost > new_back_cost) || (rcv_path_manager.is_enabled() && best_total_cost > new_total_cost)) {
576+
if ((!rcv_path_manager.is_enabled() && best_back_cost > new_back_cost) ||
577+
(rcv_path_manager.is_enabled() && best_total_cost > new_total_cost)) {
577578
VTR_LOGV_DEBUG(router_debug_, " Expanding to node %d (%s)\n", to_node,
578579
describe_rr_node(device_ctx.rr_graph,
579580
device_ctx.grid,
@@ -789,12 +790,12 @@ void ConnectionRouter<Heap>::evaluate_timing_driven_node_costs(RTExploredNode* t
789790
//Update total cost
790791
float expected_cost = router_lookahead_.get_expected_cost(to->index, target_node, cost_params, to->R_upstream);
791792
VTR_LOGV_DEBUG(router_debug_ && !std::isfinite(expected_cost),
792-
" Lookahead from %s (%s) to %s (%s) is non-finite, expected_cost = %f, to->R_upstream = %f\n",
793-
rr_node_arch_name(to->index, is_flat_).c_str(),
794-
describe_rr_node(device_ctx.rr_graph, device_ctx.grid, device_ctx.rr_indexed_data, to->index, is_flat_).c_str(),
795-
rr_node_arch_name(target_node, is_flat_).c_str(),
796-
describe_rr_node(device_ctx.rr_graph, device_ctx.grid, device_ctx.rr_indexed_data, target_node, is_flat_).c_str(),
797-
expected_cost, to->R_upstream);
793+
" Lookahead from %s (%s) to %s (%s) is non-finite, expected_cost = %f, to->R_upstream = %f\n",
794+
rr_node_arch_name(to->index, is_flat_).c_str(),
795+
describe_rr_node(device_ctx.rr_graph, device_ctx.grid, device_ctx.rr_indexed_data, to->index, is_flat_).c_str(),
796+
rr_node_arch_name(target_node, is_flat_).c_str(),
797+
describe_rr_node(device_ctx.rr_graph, device_ctx.grid, device_ctx.rr_indexed_data, target_node, is_flat_).c_str(),
798+
expected_cost, to->R_upstream);
798799
total_cost += to->backward_path_cost + cost_params.astar_fac * std::max(0.f, expected_cost - cost_params.astar_offset);
799800
}
800801
to->total_cost = total_cost;
@@ -1064,13 +1065,6 @@ static inline void update_router_stats(RouterStats* router_stats,
10641065
VTR_ASSERT(node_type != NUM_RR_TYPES);
10651066

10661067
/* TODO: Eliminate the use of global var here!!! */
1067-
const VibInf* vib;
1068-
if (!g_vpr_ctx.device().arch->vib_infs.empty()) {
1069-
vib = g_vpr_ctx.device().vib_grid.get_vib(rr_graph->node_layer(rr_node_id), rr_graph->node_xlow(rr_node_id), rr_graph->node_ylow(rr_node_id));
1070-
}
1071-
else {
1072-
vib = nullptr;
1073-
}
10741068
if constexpr (VTR_ENABLE_DEBUG_LOGGING_CONST_EXPR) {
10751069
if (is_inter_cluster_node(*rr_graph, rr_node_id)) {
10761070
if (is_push) {

vpr/src/route/overuse_report.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -235,17 +235,8 @@ static void report_overused_ipin_opin(std::ostream& os,
235235
grid_x == rr_graph.node_xhigh(node_id) && grid_y == rr_graph.node_yhigh(node_id),
236236
"Non-track RR node should not span across multiple grid blocks.");
237237

238-
t_physical_tile_type_ptr physical_tile = device_ctx.grid.get_physical_type({grid_x, grid_y, grid_layer});
239-
const VibInf* vib;
240-
if (!device_ctx.arch->vib_infs.empty()) {
241-
vib = device_ctx.vib_grid.get_vib(grid_layer, grid_x, grid_y);
242-
}
243-
else {
244-
vib = nullptr;
245-
}
246-
//const t_vib_inf* vib = device_ctx.vib_grid[grid_layer][grid_x][grid_y];
247238
os << "Pin physical number = " << rr_graph.node_pin_num(node_id) << '\n';
248-
if (is_inter_cluster_node(physical_tile, vib, rr_graph.node_type(node_id), rr_graph.node_ptc_num(node_id))) {
239+
if (is_inter_cluster_node(rr_graph, node_id)) {
249240
os << "On Tile Pin"
250241
<< "\n";
251242
} else {

vpr/src/route/router_lookahead_map.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,6 @@ float MapLookahead::get_expected_cost_flat_router(RRNodeId current_node, RRNodeI
200200
t_physical_tile_type_ptr from_physical_type = device_ctx.grid.get_physical_type({rr_graph.node_xlow(current_node),
201201
rr_graph.node_ylow(current_node),
202202
rr_graph.node_layer(current_node)});
203-
const VibInf* vib;
204-
if (!device_ctx.arch->vib_infs.empty()) {
205-
vib = device_ctx.vib_grid.get_vib(rr_graph.node_layer(current_node), rr_graph.node_xlow(current_node), rr_graph.node_ylow(current_node));
206-
}
207-
else {
208-
vib = nullptr;
209-
}
210-
//const t_vib_inf* vib = device_ctx.vib_grid[rr_graph.node_layer(current_node)][rr_graph.node_xlow(current_node)][rr_graph.node_ylow(current_node)];
211203
int from_node_ptc_num = rr_graph.node_ptc_num(current_node);
212204
t_physical_tile_type_ptr to_physical_type = device_ctx.grid.get_physical_type({rr_graph.node_xlow(target_node),
213205
rr_graph.node_ylow(target_node),

0 commit comments

Comments
 (0)