Skip to content

Commit b997d1a

Browse files
Merge branch 'master' into fixed_channel_parse_fix
2 parents d978c06 + d4c7aee commit b997d1a

File tree

20 files changed

+82
-66
lines changed

20 files changed

+82
-66
lines changed

libs/libarchfpga/src/logic_types.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,8 @@ struct t_model {
6262
bool never_prune = false; ///< Don't remove from the netlist even if a block of this type has no output ports used and, therefore, unconnected to the rest of the netlist
6363
};
6464

65-
// Tag for the logical model ID
66-
struct logical_model_id_tag;
6765
// A unique ID that represents a logical model in the architecture.
68-
typedef vtr::StrongId<logical_model_id_tag, size_t> LogicalModelId;
66+
typedef vtr::StrongId<struct logical_model_id_tag, size_t> LogicalModelId;
6967

7068
/**
7169
* @brief A storage class containing all of the logical models in an FPGA

libs/librrgraph/src/base/rr_graph_fwd.h

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,9 @@ class t_rr_graph_storage;
1515

1616
class RRGraph;
1717

18-
struct rr_node_id_tag;
19-
struct rr_edge_id_tag;
20-
struct rr_indexed_data_id_tag;
21-
struct rr_switch_id_tag;
22-
struct rr_segment_id_tag;
23-
struct rc_index_tag;
24-
25-
typedef vtr::StrongId<rr_node_id_tag, uint32_t> RRNodeId;
26-
typedef vtr::StrongId<rr_edge_id_tag, uint32_t> RREdgeId;
27-
typedef vtr::StrongId<rr_indexed_data_id_tag, uint32_t> RRIndexedDataId;
28-
typedef vtr::StrongId<rr_switch_id_tag, uint16_t> RRSwitchId;
29-
typedef vtr::StrongId<rr_segment_id_tag, uint16_t> RRSegmentId;
30-
typedef vtr::StrongId<rc_index_tag, uint16_t> NodeRCIndex;
18+
typedef vtr::StrongId<struct rr_node_id_tag, uint32_t> RRNodeId;
19+
typedef vtr::StrongId<struct rr_edge_id_tag, uint32_t> RREdgeId;
20+
typedef vtr::StrongId<struct rr_indexed_data_id_tag, uint32_t> RRIndexedDataId;
21+
typedef vtr::StrongId<struct rr_switch_id_tag, uint16_t> RRSwitchId;
22+
typedef vtr::StrongId<struct rr_segment_id_tag, uint16_t> RRSegmentId;
23+
typedef vtr::StrongId<struct rc_index_tag, uint16_t> NodeRCIndex;

libs/libvtrutil/test/test_vector.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55

66
#include <ostream>
77

8-
struct test_tag;
9-
typedef vtr::StrongId<test_tag> TestId;
8+
typedef vtr::StrongId<struct test_tag> TestId;
109

1110
std::ostream& operator<<(std::ostream& os, const TestId id);
1211

vpr/src/analytical_place/analytical_solver.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ class PreClusterTimingManager;
3939
* This gives a linearized ID for each of the moveable blocks from 0 to the
4040
* number of moveable blocks.
4141
*/
42-
struct ap_row_id_tag {};
43-
typedef vtr::StrongId<ap_row_id_tag, size_t> APRowId;
42+
typedef vtr::StrongId<struct ap_row_id_tag, size_t> APRowId;
4443

4544
/**
4645
* @brief The Analytical Solver base class

vpr/src/analytical_place/flat_placement_bins.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,10 @@
1919
#include "vtr_vector.h"
2020
#include "vtr_vector_map.h"
2121

22-
// The tag for the flat placement bin.
23-
struct flat_placement_bin_tag {};
24-
2522
/**
2623
* @brief A unique ID to a flat placement bin.
2724
*/
28-
typedef vtr::StrongId<flat_placement_bin_tag, size_t> FlatPlacementBinId;
25+
typedef vtr::StrongId<struct flat_placement_bin_tag, size_t> FlatPlacementBinId;
2926

3027
/**
3128
* @brief A container of bins which hold AP blocks and take up space on the FPGA.

vpr/src/analytical_place/full_legalizer.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,7 @@ namespace {
9898
/// This is used for putting the molecules in bins for packing.
9999
// FIXME: Bring this into the device_grid.
100100
// - Maybe this can be called DeviceRootTileId or something.
101-
struct device_tile_id_tag {};
102-
typedef vtr::StrongId<device_tile_id_tag, size_t> DeviceTileId;
101+
typedef vtr::StrongId<struct device_tile_id_tag, size_t> DeviceTileId;
103102

104103
/**
105104
* @brief Helper class to place cluster in the AP context.

vpr/src/analytical_place/global_placer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ static void print_placement_stats(const PartialPlacement& p_placement,
127127
FlatPlacementDensityManager& density_manager,
128128
const PreClusterTimingManager& pre_cluster_timing_manager) {
129129
// Print the placement HPWL
130-
VTR_LOG("\tPlacement HPWL: %f\n", p_placement.get_hpwl(ap_netlist));
130+
VTR_LOG("\tPlacement objective HPWL: %f\n", p_placement.get_hpwl(ap_netlist));
131+
VTR_LOG("\tPlacement estimated wirelength: %u\n", p_placement.estimate_post_placement_wirelength(ap_netlist));
131132

132133
// Print the timing information.
133134
if (pre_cluster_timing_manager.is_valid()) {

vpr/src/analytical_place/model_grouper.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@
1818
// Forward declarations.
1919
class Prepacker;
2020

21-
/// @brief Tag for the ModelGroupId
22-
struct model_group_id_tag;
23-
2421
/// @brief A unique ID of a group of models created by the ModelGrouper class.
25-
typedef vtr::StrongId<model_group_id_tag, size_t> ModelGroupId;
22+
typedef vtr::StrongId<struct model_group_id_tag, size_t> ModelGroupId;
2623

2724
/**
2825
* @brief A manager class for grouping together models that must be legalized

vpr/src/analytical_place/partial_legalizer.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,11 +340,8 @@ class PerPrimitiveDimPrefixSum2D {
340340
vtr::vector<PrimitiveVectorDim, vtr::PrefixSum2D<float>> dim_prefix_sum_;
341341
};
342342

343-
/// @brief Tag for the PrimitiveGroupId
344-
struct primitive_group_id_tag;
345-
346343
/// @brief A unique ID of a group of primitive dims created by the PrimitiveDimGrouper class.
347-
typedef vtr::StrongId<primitive_group_id_tag, size_t> PrimitiveGroupId;
344+
typedef vtr::StrongId<struct primitive_group_id_tag, size_t> PrimitiveGroupId;
348345

349346
/**
350347
* @brief A manager class for grouping together dimensions of the primitive

vpr/src/analytical_place/partial_placement.cpp

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,48 @@ double PartialPlacement::get_hpwl(const APNetlist& netlist) const {
3333
return hpwl;
3434
}
3535

36+
double PartialPlacement::estimate_post_placement_wirelength(const APNetlist& netlist) const {
37+
// Go through each net and calculate the half-perimeter wirelength. Since
38+
// we want to estimate the post-placement wirelength, we do not want the
39+
// flat placement positions of the blocks. Instead we compute the HPWL over
40+
// the tiles that the flat placement is placing the blocks over.
41+
unsigned total_hpwl = 0;
42+
for (APNetId net_id : netlist.nets()) {
43+
// Note: Other wirelength estimates in VTR ignore global nets; however
44+
// it is not known if a net is global or not until packing is
45+
// complete. For now, we just approximate post-placement wirelength
46+
// using the HPWL (in tile space).
47+
// TODO: The reason we do not know what nets are ignored / global is
48+
// because the pin on the tile that the net connects to is what
49+
// decides if a net is global / ignored for place and route. Since
50+
// we have not packed anything yet, we do not know what pin each
51+
// net will go to; however, we can probably get a good idea based
52+
// on some properties of the net and the tile its going to / from.
53+
// Should investigate this to get a better estimate of wirelength.
54+
double min_x = std::numeric_limits<unsigned>::max();
55+
double max_x = std::numeric_limits<unsigned>::lowest();
56+
double min_y = std::numeric_limits<unsigned>::max();
57+
double max_y = std::numeric_limits<unsigned>::lowest();
58+
for (APPinId pin_id : netlist.net_pins(net_id)) {
59+
APBlockId blk_id = netlist.pin_block(pin_id);
60+
min_x = std::min(min_x, block_x_locs[blk_id]);
61+
max_x = std::max(max_x, block_x_locs[blk_id]);
62+
min_y = std::min(min_y, block_y_locs[blk_id]);
63+
max_y = std::max(max_y, block_y_locs[blk_id]);
64+
}
65+
VTR_ASSERT_SAFE(max_x >= min_x && max_y >= min_y);
66+
67+
// Floor the positions to get the x and y coordinates of the tiles each
68+
// block belongs to.
69+
unsigned tile_dx = std::floor(max_x) - std::floor(min_x);
70+
unsigned tile_dy = std::floor(max_y) - std::floor(min_y);
71+
72+
total_hpwl += tile_dx + tile_dy;
73+
}
74+
75+
return total_hpwl;
76+
}
77+
3678
bool PartialPlacement::verify_locs(const APNetlist& netlist,
3779
size_t grid_width,
3880
size_t grid_height) const {

0 commit comments

Comments
 (0)