Skip to content

Commit

Permalink
merge in SteinerTree.cc, SteinerTree.hh
Browse files Browse the repository at this point in the history
  • Loading branch information
andyfox-rushc committed Jan 10, 2024
2 parents 2260324 + 4535a05 commit 90fc00b
Show file tree
Hide file tree
Showing 37 changed files with 17,963 additions and 18,953 deletions.
37 changes: 20 additions & 17 deletions src/gpl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Features:

## Commands

### Global Placement

```
global_placement
[-timing_driven]
Expand Down Expand Up @@ -51,14 +53,7 @@ global_placement
[-force_cpu]
```

```
cluster_flops
[-tray_weight tray_weight]
[-timing_weight timing_weight]
[-max_split_size max_split_size]
```

### Tuning Parameters
#### Options

- `-timing_driven`: Enable timing-driven mode
- `-routability_driven`: Enable routability-driven mode
Expand All @@ -78,24 +73,32 @@ cluster_flops
- `-timing_driven_nets_percentage`: Set the percentage of nets that are reweighted in timing-driven mode. Default value is 10. Allowed values are `[0-100, float]`
- `-verbose_level`: set verbose level for RePlAce. Default value is 1. Allowed values are `[0-5, int]`.
- `-force_cpu`: Force to use the CPU solver even if the GPU is available.
- `tray_weight`: Set the weighting factor for tray cost in flip-flop clustering (recommended to be `[20.0, float]`).
- `timing_weight`: Set the weighting factor for timing-critical paths in flip-flop clusering (recommended to be `[1.0. float]`).
- `max_split_size`: The maximum size of a single pointset after running the pointset decomposition algorithm for runtime improvement in flop clustering (to not run pointset decomposition, set as `-1`).


`-timing_driven` does a virtual `repair_design` to find slacks and
- `-timing_driven` does a virtual `repair_design` to find slacks and
weight nets with low slack. It adjusts the worst slacks (10% by default,
modified with -timing_driven_nets_percentage) using a multiplier (1.9 by
default, modified with `-timing_driven_net_weight_max`). The multiplier
is scaled from the full value for the worst slack, to 1.0 at the
timing_driven_nets_percentage point. Use the `set_wire_rc` command to set
resistance and capacitance of estimated wires used for timing.
- `-pad_left`: Padding applied to each instance's left side in mulitples of the site width.
- `-pad_right`: Padding applied to each instance's right side in mulitples of the site width.

### Cluster Flops

Cluster single bit flops into multi-bit flops.

## Example scripts
```
cluster_flops
[-tray_weight tray_weight]
[-timing_weight timing_weight]
[-max_split_size max_split_size]
```

## Regression tests
#### Options

## Limitations
- `-tray_weight`: Set the weighting factor for tray cost in flip-flop clustering (recommended to be `[20.0, float]`).
- `-timing_weight`: Set the weighting factor for timing-critical paths in flip-flop clusering (recommended to be `[1.0. float]`).
- `-max_split_size`: The maximum size of a single pointset after running the pointset decomposition algorithm for runtime improvement in flop clustering (to not run pointset decomposition, set as `-1`).

## Using the Python interface to gpl

Expand Down
6 changes: 0 additions & 6 deletions src/grt/include/grt/GlobalRouter.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,6 @@ class GlobalRouter : public ant::GlobalRouteSource
int max_routing_layer);
std::vector<std::pair<int, int>> calcLayerPitches(int max_layer);
void initRoutingTracks(int max_routing_layer);
void averageTrackPattern(odb::dbTrackGrid* grid,
bool is_x,
int& track_init,
int& num_tracks,
int& track_step);
void setCapacities(int min_routing_layer, int max_routing_layer);
void initNets(std::vector<Net*>& nets);
bool makeFastrouteNet(Net* net);
Expand Down Expand Up @@ -395,7 +390,6 @@ class GlobalRouter : public ant::GlobalRouteSource
void makeBtermPins(Net* net, odb::dbNet* db_net, const odb::Rect& die_area);
void initClockNets();
bool isClkTerm(odb::dbITerm* iterm, sta::dbNetwork* network);
int trackSpacing();
void initGridAndNets();

utl::Logger* logger_;
Expand Down
81 changes: 7 additions & 74 deletions src/grt/src/GlobalRouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2423,7 +2423,11 @@ odb::Point GlobalRouter::getRectMiddle(const odb::Rect& rect)

void GlobalRouter::initGrid(int max_layer)
{
int track_spacing = trackSpacing();
odb::dbTechLayer* tech_layer = routing_layers_[layer_for_guide_dimension_];
odb::dbTrackGrid* track_grid = block_->findTrackGrid(tech_layer);
int track_spacing, track_init, num_tracks;
tech_layer->getAverageTrackSpacing(
track_grid, track_spacing, track_init, num_tracks);

odb::Rect rect = block_->getDieArea();

Expand Down Expand Up @@ -2455,28 +2459,6 @@ void GlobalRouter::initGrid(int max_layer)
num_layers);
}

// Assumes initRoutingLayers and initRoutingTracks have been called
// to check layers and tracks.
int GlobalRouter::trackSpacing()
{
odb::dbTechLayer* tech_layer = routing_layers_[layer_for_guide_dimension_];
odb::dbTrackGrid* track_grid = block_->findTrackGrid(tech_layer);

if (tech_layer->getDirection() == odb::dbTechLayerDir::HORIZONTAL) {
int track_step_y = -1;
int init_track_y, num_tracks_y;
track_grid->getGridPatternY(0, init_track_y, num_tracks_y, track_step_y);
return track_step_y;
} else if (tech_layer->getDirection() == odb::dbTechLayerDir::VERTICAL) {
int track_step_x = -1;
int init_track_x, num_tracks_x;
track_grid->getGridPatternX(0, init_track_x, num_tracks_x, track_step_x);
return track_step_x;
}
logger_->error(GRT, 82, "Cannot find track spacing.");
return 0;
}

void getViaDims(std::map<int, odb::dbTechVia*> default_vias,
int level,
int& width_up,
Expand Down Expand Up @@ -2602,26 +2584,6 @@ std::vector<std::pair<int, int>> GlobalRouter::calcLayerPitches(int max_layer)
return pitches;
}

// For multiple track patterns we need to compute an average
// track pattern for gcell construction.
void GlobalRouter::averageTrackPattern(odb::dbTrackGrid* grid,
bool is_x,
int& track_init,
int& num_tracks,
int& track_step)
{
std::vector<int> coordinates;
if (is_x) {
grid->getGridX(coordinates);
} else {
grid->getGridY(coordinates);
}
const int span = coordinates.back() - coordinates.front();
track_init = coordinates.front();
track_step = std::ceil((float) span / coordinates.size());
num_tracks = coordinates.size();
}

void GlobalRouter::initRoutingTracks(int max_routing_layer)
{
auto l2vPitches = calcLayerPitches(max_routing_layer);
Expand All @@ -2637,37 +2599,8 @@ void GlobalRouter::initRoutingTracks(int max_routing_layer)
}

int track_step, track_init, num_tracks;
if (tech_layer->getDirection() == odb::dbTechLayerDir::HORIZONTAL) {
if (track_grid->getNumGridPatternsY() == 1) {
track_grid->getGridPatternY(0, track_init, num_tracks, track_step);
} else if (track_grid->getNumGridPatternsY() > 1) {
averageTrackPattern(
track_grid, false, track_init, num_tracks, track_step);
} else {
logger_->error(GRT,
124,
"Horizontal tracks for layer {} not found.",
tech_layer->getName());
return; // error throws
}
} else if (tech_layer->getDirection() == odb::dbTechLayerDir::VERTICAL) {
if (track_grid->getNumGridPatternsX() == 1) {
track_grid->getGridPatternX(0, track_init, num_tracks, track_step);
} else if (track_grid->getNumGridPatternsX() > 1) {
averageTrackPattern(
track_grid, true, track_init, num_tracks, track_step);
} else {
logger_->error(GRT,
147,
"Vertical tracks for layer {} not found.",
tech_layer->getName());
return; // error throws
}
} else {
logger_->error(
GRT, 148, "Layer {} has invalid direction.", tech_layer->getName());
return; // error throws
}
tech_layer->getAverageTrackSpacing(
track_grid, track_step, track_init, num_tracks);

RoutingTracks layer_tracks = RoutingTracks(level,
track_step,
Expand Down
4 changes: 2 additions & 2 deletions src/grt/src/fastroute/include/DataType.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,13 @@ struct TreeEdge

struct StTree
{
int num_nodes = 0;
int num_terminals = 0;
// The nodes (pin and Steiner nodes) in the tree.
std::vector<TreeNode> nodes;
std::vector<TreeEdge> edges;

int num_edges() const { return edges.size(); }
int num_nodes() const { return nodes.size(); }
int num_edges() const { return num_nodes - 1; }
};

struct OrderNetPin
Expand Down
5 changes: 0 additions & 5 deletions src/grt/src/fastroute/include/FastRoute.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,6 @@ class FastRouteCore
const int L,
float& slack_th);
void convertToMazeroute();
int splitEdge(std::vector<TreeEdge>& treeedges,
std::vector<TreeNode>& treenodes,
int n1,
int n2,
int edge_n1n2);
void updateCongestionHistory(const int upType, bool stopDEC, int& max_adj);
int getOverflow2D(int* maxOverflow);
int getOverflow2Dmaze(int* maxOverflow, int* tUsage);
Expand Down
1 change: 1 addition & 0 deletions src/grt/src/fastroute/src/RSMT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ void FastRouteCore::copyStTree(const int ind, const Tree& rsmt)
const int d = rsmt.deg;
const int numnodes = rsmt.branchCount();
const int numedges = numnodes - 1;
sttrees_[ind].num_nodes = numnodes;
sttrees_[ind].num_terminals = d;
sttrees_[ind].nodes.resize(numnodes);
sttrees_[ind].edges.resize(numedges);
Expand Down
Loading

0 comments on commit 90fc00b

Please sign in to comment.