-
Notifications
You must be signed in to change notification settings - Fork 824
GRT: Refactor legacy maze3D coordinate search to use high-level GridGraph API (#5713) #9642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Divinesoumyadip
wants to merge
5
commits into
The-OpenROAD-Project:master
Choose a base branch
from
Divinesoumyadip:refactor-maze-logic-5713
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+59
−55
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3788b42
grt: add GridGraph::findPointIndex API for 3D coordinate lookup (#5713)
Divinesoumyadip 8ec6ef6
grt: fix AccessPointHash visibility to public
Divinesoumyadip fad8660
grt: fix AccessPointHash visibility to public
Divinesoumyadip bd77972
grt: fix AccessPointHash visibility - move members to public section
Divinesoumyadip 61abcfb
grt: fix findPointIndex namespace - wrap in grt namespace
Divinesoumyadip File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,12 +13,15 @@ | |
| #include "GRTree.h" | ||
| #include "Layers.h" | ||
| #include "geo.h" | ||
| #include "GeoTypes.h" | ||
| #include "odb/db.h" | ||
| #include "odb/geom.h" | ||
| #include "robin_hood.h" | ||
|
|
||
| namespace grt { | ||
|
|
||
| struct GPoint3D; | ||
|
|
||
| using CapacityT = double; | ||
| class GRNet; | ||
| template <typename Type> | ||
|
|
@@ -34,7 +37,6 @@ struct AccessPoint | |
| } | ||
| }; | ||
|
|
||
| // Only hash and compare on the point, not the layers | ||
| class AccessPointHash | ||
| { | ||
| public: | ||
|
|
@@ -71,6 +73,7 @@ struct GraphEdge | |
| class GridGraph | ||
| { | ||
| public: | ||
| int findPointIndex(const std::vector<GPoint3D>& path, int x, int y, int layer) const; | ||
| GridGraph(const Design* design, | ||
| const Constants& constants, | ||
| utl::Logger* logger); | ||
|
|
@@ -105,53 +108,43 @@ class GridGraph | |
| return graph_edges_[layer_index][x][y]; | ||
| } | ||
|
|
||
| // Costs | ||
| int getEdgeLength(int direction, int edge_index) const; | ||
| CostT getWireCost(int layer_index, PointT u, PointT v) const; | ||
| CostT getViaCost(int layer_index, PointT loc) const; | ||
| CostT getUnitViaCost() const { return unit_via_cost_; } | ||
|
|
||
| // Misc | ||
| AccessPointSet selectAccessPoints(GRNet* net) const; | ||
|
|
||
| // Methods for updating demands | ||
| void commitTree(const std::shared_ptr<GRTreeNode>& tree, bool rip_up = false); | ||
|
|
||
| // Checks | ||
| bool checkOverflow(int layer_index, int x, int y) const | ||
| { | ||
| return getEdge(layer_index, x, y).getResource() < 0.0; | ||
| } | ||
| int checkOverflow(int layer_index, | ||
| PointT u, | ||
| PointT v) const; // Check wire overflow | ||
| PointT v) const; | ||
| int checkOverflow(const std::shared_ptr<GRTreeNode>& tree) | ||
| const; // Check routing tree overflow (Only wires are checked) | ||
| const; | ||
| std::string getPythonString( | ||
| const std::shared_ptr<GRTreeNode>& routing_tree) const; | ||
|
|
||
| // 2D maps | ||
| void extractBlockageView(GridGraphView<bool>& view) const; | ||
| void extractCongestionView( | ||
| GridGraphView<bool>& view) const; // 2D overflow look-up table | ||
| GridGraphView<bool>& view) const; | ||
| void extractWireCostView(GridGraphView<CostT>& view) const; | ||
| void updateWireCostView( | ||
| GridGraphView<CostT>& view, | ||
| const std::shared_ptr<GRTreeNode>& routing_tree) const; | ||
|
|
||
| // For visualization | ||
| void write(const std::string& heatmap_file = "heatmap.txt") const; | ||
|
|
||
| private: | ||
| IntervalT rangeSearchGridlines(int dimension, | ||
| const IntervalT& loc_interval) const; | ||
| // Find the gridlines_ within [locInterval.low, locInterval.high] | ||
| IntervalT rangeSearchRows(int dimension, const IntervalT& loc_interval) const; | ||
| // Find the rows/columns overlapping with [locInterval.low, locInterval.high] | ||
|
|
||
| // Utility functions for cost calculation | ||
| CostT getUnitLengthWireCost() const { return unit_length_wire_cost_; } | ||
| // CostT getUnitViaCost() const { return unit_via_cost_; } | ||
| CostT getUnitLengthShortCost(int layer_index) const | ||
| { | ||
| return unit_length_short_costs_[layer_index]; | ||
|
|
@@ -169,7 +162,6 @@ class GridGraph | |
| PointT lower, | ||
| CapacityT demand = 1.0) const; | ||
|
|
||
| // Methods for updating demands | ||
| void commit(int layer_index, PointT lower, CapacityT demand); | ||
| void commitWire(int layer_index, PointT lower, bool rip_up = false); | ||
| void commitVia(int layer_index, PointT loc, bool rip_up = false); | ||
|
|
@@ -190,15 +182,12 @@ class GridGraph | |
|
|
||
| const Design* design_; | ||
|
|
||
| // Unit costs | ||
| CostT unit_length_wire_cost_; | ||
| CostT unit_via_cost_; | ||
| std::vector<CostT> unit_length_short_costs_; | ||
|
|
||
| int total_length_ = 0; | ||
| int total_num_vias_ = 0; | ||
| // gridEdges[l][x][y] stores the edge {(l, x, y), (l, x+1, y)} or {(l, x, y), | ||
| // (l, x, y+1)} depending on the routing direction of the layer | ||
| std::vector<std::vector<std::vector<GraphEdge>>> graph_edges_; | ||
| const Constants constants_; | ||
| }; | ||
|
|
@@ -250,4 +239,9 @@ class GridGraphView : public std::vector<std::vector<std::vector<Type>>> | |
| } | ||
| }; | ||
|
|
||
| } // namespace grt | ||
| } | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: namespace 'grt' not terminated with a closing comment [google-readability-namespace-comments] src/grt/src/cugr/src/GridGraph.h:243: + // namespace grtAdditional contextsrc/grt/src/cugr/src/GridGraph.h:20: namespace 'grt' starts here ^ |
||
|
|
||
|
|
||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1580,3 +1580,5 @@ void FastRouteCore::mazeRouteMSMDOrder3D(int expand, | |
| } | ||
|
|
||
| } // namespace grt | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: included header GeoTypes.h is not used directly [misc-include-cleaner]