Skip to content
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

[RWRoute] Add "--lutPinSwapping" option #895

Merged
merged 140 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from 139 commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
439a23a
RWRoute to not create unused PINFEEDs, nor queue them unless in targe…
eddieh-xlnx Nov 18, 2023
ed64d29
Update TestRWRoute.testSLRCrossingNonTimingDriven
eddieh-xlnx Nov 18, 2023
7b410c5
Tidy
eddieh-xlnx Nov 18, 2023
903dc4b
Oops
eddieh-xlnx Nov 18, 2023
79fe61f
Refactor into RWRoute.isAccessiblePinfeedI()
eddieh-xlnx Nov 19, 2023
fe4ac02
Connections to always be using its (single) sink rnode
eddieh-xlnx Nov 19, 2023
a7e60a8
Cope with devices with no LAGUNA_Is
eddieh-xlnx Nov 19, 2023
e0d8f48
Add comment
eddieh-xlnx Nov 19, 2023
f262495
RWRoute.shouldRoute() to not check first (sink) node for congestion
eddieh-xlnx Nov 20, 2023
c6865c2
RWRoute.ripUp/updateUsersAndPresentCongestionCost() to rip up all
eddieh-xlnx Nov 20, 2023
b1611cd
Unroutable connections to undo ripUp() on sink
eddieh-xlnx Nov 20, 2023
de70dc7
Update comment
eddieh-xlnx Nov 20, 2023
fed9752
Extend TestRouteThruHelper with SLICEM H[16] test
eddieh-xlnx Nov 20, 2023
a64e907
Fix RouteThruHelper.isRouteThruPIPAvailable() for SLICEM.H[1-6]
eddieh-xlnx Nov 20, 2023
3433c82
PartialRouter to use RouteNodeGraph.isExcludedTile()
eddieh-xlnx Nov 20, 2023
79ceeef
Extend TestRouteThruHelper with SLICEM H[16] test
eddieh-xlnx Nov 20, 2023
fb50dc8
Fix RouteThruHelper.isRouteThruPIPAvailable() for SLICEM.H[1-6]
eddieh-xlnx Nov 20, 2023
0cb835e
Merge branch 'routethruhelper_slicem' into rwroute_pinfeed_opt
eddieh-xlnx Nov 20, 2023
5bca326
Undo verbose flag
eddieh-xlnx Nov 20, 2023
c26b57d
Restore original RWRoute.shouldRoute() but with extra assertion
eddieh-xlnx Nov 20, 2023
86b5731
Add comment
eddieh-xlnx Nov 20, 2023
1f09839
RouteNodeInfo to use RouteNodeGraph.lagunaI too
eddieh-xlnx Nov 20, 2023
77cc52a
Undo verbose flag
eddieh-xlnx Nov 20, 2023
be80a59
Fix RouteNodeGraph's lagunaI construction
eddieh-xlnx Nov 20, 2023
2e5fd98
Use null RouteNodeType instead of WIRE for default
eddieh-xlnx Nov 20, 2023
464cc1e
Update PartialRouter too
eddieh-xlnx Nov 20, 2023
7474db9
Remove unused import
eddieh-xlnx Nov 20, 2023
d7a3705
RouteNode.setType() to allow demotion of PINfEED_I
eddieh-xlnx Nov 20, 2023
e2e422a
Tighten assertion
eddieh-xlnx Nov 20, 2023
8ae6996
Extend TestRouteThruHelper with SLICEM H[16] test
eddieh-xlnx Nov 20, 2023
e3fd005
Fix RouteThruHelper.isRouteThruPIPAvailable() for SLICEM.H[1-6]
eddieh-xlnx Nov 20, 2023
a064147
Merge branch 'routethruhelper_slicem' into rwroute_pinfeed_opt
eddieh-xlnx Nov 20, 2023
a9e8bdb
Apply suggestions from code review
eddieh-xlnx Nov 21, 2023
87ddae7
Merge remote-tracking branch 'upstream/master' into rwroute_pinfeed_opt
eddieh-xlnx Nov 21, 2023
3160e9e
Add an assertion that PINFEED_I can never be overused
eddieh-xlnx Nov 21, 2023
dfc7dce
Add RWRoute.isAccessiblePinfeedI() overload with no assertion
eddieh-xlnx Nov 21, 2023
82ead64
Add TestNode.testNodeReachability()
eddieh-xlnx Nov 21, 2023
9d5a3f4
Add and use RWRoute.accessibleWireOnlySameColumnAsTarget
eddieh-xlnx Nov 21, 2023
f970914
Merge remote-tracking branch 'upstream/master' into rwroute_nodeimux_opt
eddieh-xlnx Nov 22, 2023
32616cb
NODE_LOCALs to be acccessible in Laguna columns for cross-SLR connect…
eddieh-xlnx Nov 22, 2023
b945df4
Skip if baseNode is null
eddieh-xlnx Nov 22, 2023
8305b54
Print uphill/downhill
eddieh-xlnx Nov 22, 2023
9d1e3a8
Add reachability test for UltraScale too
eddieh-xlnx Nov 22, 2023
9b5b2bf
Move isAccessiblePinbounce() and make protected
eddieh-xlnx Nov 22, 2023
d58746d
Tweak assertion
eddieh-xlnx Nov 22, 2023
f67c165
Tidy up, add comments
eddieh-xlnx Nov 22, 2023
8b73385
Update copyright year
eddieh-xlnx Nov 22, 2023
1bf882b
Compute RouteNodeGraph.lagunaI more accurately by going uphill from SLL
eddieh-xlnx Nov 22, 2023
46455d5
Update SLR tests
eddieh-xlnx Nov 23, 2023
396bc76
Also restrict NODE_LOCALs to be within one tile of sink too
eddieh-xlnx Nov 23, 2023
898bf3c
Update test
eddieh-xlnx Nov 23, 2023
9669c6f
Add support for multiple alternate sinks
eddieh-xlnx Nov 24, 2023
d051d3f
Fix compilation
eddieh-xlnx Nov 24, 2023
bab9d9c
Extend TestDesignTools.testGetConnectedCells()
eddieh-xlnx Nov 24, 2023
8b5db12
LUT pin swapping enabled with "--lutPinSwapping"
eddieh-xlnx Nov 24, 2023
e99cf41
Fix flag
eddieh-xlnx Nov 24, 2023
677bfb5
Tidy up PinSwap and SATRouter
eddieh-xlnx Nov 24, 2023
de4e518
Initial pin swap working
eddieh-xlnx Nov 24, 2023
202e595
Add testNonTimingDrivenFullRoutingWithLutPinSwapping()
eddieh-xlnx Nov 24, 2023
f9e69db
Add javadoc
eddieh-xlnx Nov 24, 2023
1e31884
Refactor into LUTTools.swapLutPins()
eddieh-xlnx Nov 24, 2023
7d713f5
Add LUTTools.fixPinSwaps()
eddieh-xlnx Nov 24, 2023
a44c304
Add TestLUTTools.testFixPinSwapsWithRWRoute()
eddieh-xlnx Nov 24, 2023
eea05a2
Add System prop rapidwright.rwroute.lutPinSwapping.deferIntraSiteRout…
eddieh-xlnx Nov 24, 2023
e9f3e08
Add standalone TestLUTTools.testFixPinSwaps()
eddieh-xlnx Nov 24, 2023
22deb37
Add LUTTools.swapLutPins() and LUTTools.updateLutPinSwapsFromPIPs()
eddieh-xlnx Nov 24, 2023
f2df95f
Anticipate that no eligible pins to swap were found
eddieh-xlnx Nov 25, 2023
5f58183
Rename to numberOfSwappablePins
eddieh-xlnx Nov 25, 2023
427c03b
LUTTools to take Map<SitePinInst,String> for pinswaps instead
eddieh-xlnx Nov 27, 2023
259594b
LUTTools.swapLutPins() to not unroute intra-site net
eddieh-xlnx Nov 27, 2023
db5ac9d
Add TestSATRouter
eddieh-xlnx Nov 27, 2023
eac8e9b
Add copyright header
eddieh-xlnx Nov 27, 2023
a5a462b
Support and use 60 second timeout for test
eddieh-xlnx Nov 27, 2023
2a64bdc
Fix RWRoute for new pinSwaps type
eddieh-xlnx Nov 27, 2023
2d00c3b
Target nodes to not have occupancy > 1
eddieh-xlnx Nov 27, 2023
7b60fa2
Revert "Support and use 60 second timeout for test"
eddieh-xlnx Nov 27, 2023
e34a610
Add TestSATRouter.testApplyResult()
eddieh-xlnx Nov 28, 2023
da59fad
Add LUTTools.swapLutPins() and LUTTools.updateLutPinSwapsFromPIPs()
eddieh-xlnx Nov 24, 2023
4fefb51
Update copyright year
eddieh-xlnx Nov 24, 2023
2608fbb
Refactor SATRouter.processPinSwaps() to LUTTools.swapSingleLutPins()
eddieh-xlnx Nov 27, 2023
ae28d62
LUTTools to take Map<SitePinInst,String> for pinswaps instead
eddieh-xlnx Nov 27, 2023
68c5fa2
LUTTools.swapLutPins() to not unroute intra-site net
eddieh-xlnx Nov 27, 2023
2601bf8
Connection.setAllTargets() to not set if used by same net
eddieh-xlnx Nov 28, 2023
1b0cafa
Allow NODE_PINBOUNCE
eddieh-xlnx Nov 28, 2023
227049b
Add assertion
eddieh-xlnx Nov 28, 2023
90ea723
Merge remote-tracking branch 'upstream/master' into rwroute_lutpinswap
eddieh-xlnx Nov 28, 2023
ba7464e
Print out unrouted SPIs
eddieh-xlnx Nov 28, 2023
7007302
Reset property
eddieh-xlnx Nov 28, 2023
8f3d754
Merge remote-tracking branch 'upstream/master' into luttools_pinswap
eddieh-xlnx Nov 28, 2023
d07488d
Rename overload to swapMultipleLutPins
eddieh-xlnx Nov 28, 2023
8bc6f49
Remove old file
eddieh-xlnx Nov 28, 2023
6cd9334
Revert "Print out unrouted SPIs"
eddieh-xlnx Nov 28, 2023
b838044
Merge branch 'luttools_pinswap' into rwroute_lutpinswap
eddieh-xlnx Nov 28, 2023
8d86351
Update to new overload
eddieh-xlnx Nov 28, 2023
e9b8748
Refactor/rename/tidy
eddieh-xlnx Nov 28, 2023
d8ccd52
Use LUTTools.MAX_LUT_SIZE constant
eddieh-xlnx Nov 29, 2023
9032ba4
Add support for simulating LUT pin swaps
eddieh-xlnx Nov 29, 2023
41fb2c2
Merge branch 'rwroute_lutpinswap' of github.com:Xilinx/RapidWright in…
eddieh-xlnx Nov 29, 2023
0f1d7bc
Refactor/rename/tidy up
eddieh-xlnx Nov 29, 2023
5442157
Reduce diff with master
eddieh-xlnx Nov 29, 2023
18c9493
Add missing import
eddieh-xlnx Nov 29, 2023
82b6300
Add explanation for new option, tidy
eddieh-xlnx Nov 29, 2023
dc2580f
Add TestPhysNetlistWriter.testSimulateSwappedLutPinsWithRWRoute()
eddieh-xlnx Nov 29, 2023
8c4ad7c
Update test/src/com/xilinx/rapidwright/design/tools/TestLUTTools.java
eddieh-xlnx Nov 29, 2023
f55c98d
Do not pin swap fixed pins
eddieh-xlnx Nov 29, 2023
5d93f41
Fix tests
eddieh-xlnx Nov 29, 2023
6d12869
Rename to swapLutPinsFromPIPs()
eddieh-xlnx Nov 29, 2023
507ebf6
Merge branch 'luttools_pinswap' of github.com:Xilinx/RapidWright into…
eddieh-xlnx Nov 29, 2023
46f877a
Update test
eddieh-xlnx Nov 29, 2023
7a62a3d
Merge branch 'luttools_pinswap' into rwroute_lutpinswap
eddieh-xlnx Nov 29, 2023
f0a480c
Update tests
eddieh-xlnx Nov 29, 2023
c8d3631
Fix javadoc
eddieh-xlnx Nov 29, 2023
5586fb4
Add assertion
eddieh-xlnx Nov 29, 2023
140b470
Fix tests
eddieh-xlnx Nov 29, 2023
aab686b
Handle case where exclusive LUT sinks can be overused
eddieh-xlnx Nov 29, 2023
7593fe6
Revert "Handle case where exclusive LUT sinks can be overused"
eddieh-xlnx Nov 29, 2023
672d444
Add comment
eddieh-xlnx Nov 29, 2023
b432c47
Remove all exclusive sinks that are alternate sinks on other conn-s
eddieh-xlnx Nov 29, 2023
2deb52d
Merge remote-tracking branch 'upstream/master' into rwroute_lutpinswap
eddieh-xlnx Nov 29, 2023
b148875
Revert interchange changes
eddieh-xlnx Nov 29, 2023
2121bb0
Fix/add comments
eddieh-xlnx Nov 29, 2023
d27272b
Fix exclusive sinks for PartialRouter
eddieh-xlnx Nov 29, 2023
b590879
Cleanup
eddieh-xlnx Nov 29, 2023
2931162
Extend assertion
eddieh-xlnx Nov 29, 2023
af9915b
Do not use Cell.isPinFixed() as that doesn't capture LOCK_PIN-s
eddieh-xlnx Nov 29, 2023
c27b554
Update comment
eddieh-xlnx Nov 29, 2023
905fa90
Update test
eddieh-xlnx Nov 29, 2023
cbf879b
Remove irrelevant test
eddieh-xlnx Nov 29, 2023
fcc13fc
Allow alternate sinks that are not PINFEED_Is even if occupied
eddieh-xlnx Nov 30, 2023
1b819a6
Simplify early termination
eddieh-xlnx Nov 30, 2023
5383658
Skip if no rnodes
eddieh-xlnx Nov 30, 2023
c76c929
Always set nodes
eddieh-xlnx Nov 30, 2023
0b776b3
Apply suggestions from code review
eddieh-xlnx Nov 30, 2023
55b96d6
Simplify assignNodesToConnections()
eddieh-xlnx Nov 30, 2023
d286cc4
Merge branch 'rwroute_lutpinswap' of github.com:Xilinx/RapidWright in…
eddieh-xlnx Nov 30, 2023
f2a5c5b
Expand comment/assertion
eddieh-xlnx Nov 30, 2023
03fbe13
Do not update sinkRnode when deferring pin swaps
eddieh-xlnx Nov 30, 2023
ed3a121
Remove verbose
eddieh-xlnx Nov 30, 2023
4e199e7
Invert condition
eddieh-xlnx Nov 30, 2023
16de747
Apply suggestions from code review
eddieh-xlnx Dec 1, 2023
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 src/com/xilinx/rapidwright/design/DesignTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -2000,7 +2000,7 @@ public static boolean stampPlacement(Design design, Module stamp, Map<String,Sit
/**
* Looks in the site instance for BEL pins connected to this site pin.
* @param pin The SitePinInst to examine for connected BEL pins
* param action Perform this action on each conncted BELPin
* @param action Perform this action on each connected BELPin.
*/
private static void foreachConnectedBELPin(SitePinInst pin, Consumer<BELPin> action) {
SiteInst si = pin.getSiteInst();
Expand Down
52 changes: 43 additions & 9 deletions src/com/xilinx/rapidwright/rwroute/Connection.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
package com.xilinx.rapidwright.rwroute;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.xilinx.rapidwright.device.IntentCode;
import com.xilinx.rapidwright.design.Net;
import com.xilinx.rapidwright.design.SitePinInst;
import com.xilinx.rapidwright.device.Node;
Expand All @@ -49,7 +51,7 @@ public class Connection implements Comparable<Connection>{
private RouteNode sourceRnode;
private RouteNode altSourceRnode;
private RouteNode sinkRnode;
private RouteNode altSinkRnode;
private List<RouteNode> altSinkRnodes;
/**
* true to indicate the source and the sink are connected through dedicated resources,
* such as the carry chain connections and connections between cascaded BRAMs.
Expand Down Expand Up @@ -294,13 +296,25 @@ public RouteNode getSinkRnode() {
return sinkRnode;
}

public void setSinkRnode(RouteNode childRnode) {
sinkRnode = childRnode;
public void setSinkRnode(RouteNode sinkRnode) {
this.sinkRnode = sinkRnode;
}

public RouteNode getAltSinkRnode() { return altSinkRnode; }
public List<RouteNode> getAltSinkRnodes() {
return altSinkRnodes == null ? Collections.emptyList() : altSinkRnodes;
}

public void setAltSinkRnode(RouteNode childRnode) { altSinkRnode = childRnode; }
public void addAltSinkRnode(RouteNode sinkRnode) {
if (altSinkRnodes == null) {
altSinkRnodes = new ArrayList<>(1);
} else {
assert(!altSinkRnodes.contains(sinkRnode));
}
assert(sinkRnode.getType() == RouteNodeType.PINFEED_I ||
// Can be a WIRE if node is not exclusive a sink
sinkRnode.getType() == RouteNodeType.WIRE);
altSinkRnodes.add(sinkRnode);
}

public short getXMinBB() {
return xMinBB;
Expand Down Expand Up @@ -467,10 +481,30 @@ public String toString() {
return s.toString();
}

public void setTarget(boolean target) {
sinkRnode.setTarget(target);
if (altSinkRnode != null) {
altSinkRnode.setTarget(target);
public void setAllTargets(boolean target) {
if (sinkRnode.countConnectionsOfUser(netWrapper) == 0 ||
sinkRnode.getNode().getIntentCode() == IntentCode.NODE_PINBOUNCE) {
// Since this connection will have been ripped up, only mark a node
// as a target if it's not already used by this net.
// This prevents -- for the case where the same net needs to be routed
// to the same LUT more than once -- the illegal case of the same
// physical pin servicing more than one logical pin
sinkRnode.setTarget(target);
} else {
assert(altSinkRnodes != null && !altSinkRnodes.isEmpty());
}
if (altSinkRnodes != null) {
for (RouteNode rnode : altSinkRnodes) {
// Same condition as above: only allow this as an alternate sink
// if it's not already in use by the current net to prevent the case
// where the same physical pin services more than one logical pin
if (rnode.countConnectionsOfUser(netWrapper) == 0 ||
// Except if it is not a PINFEED_I
rnode.getType() != RouteNodeType.PINFEED_I) {
assert(rnode.getNode().getIntentCode() != IntentCode.NODE_PINBOUNCE);
rnode.setTarget(target);
}
}
}
}
}
37 changes: 33 additions & 4 deletions src/com/xilinx/rapidwright/rwroute/PartialRouter.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -353,17 +354,19 @@ protected void determineRoutingTargets() {
// (it's possible for another connection to use a bounce node, but now that node is
// needed as a site pin)
for (Connection connection : netWrapper.getConnections()) {
for (RouteNode rnode : Arrays.asList(connection.getSinkRnode(), connection.getAltSinkRnode())) {
Consumer<RouteNode> action = (rnode) -> {
if (rnode == null) {
continue;
return;
}
RouteNode prev = rnode.getPrev();
if (prev == null) {
continue;
return;
}
stashedPrev.put(rnode, prev);
rnode.clearPrev();
}
};
action.accept(connection.getSinkRnode());
connection.getAltSinkRnodes().forEach(action);
clavin-xlnx marked this conversation as resolved.
Show resolved Hide resolved
}

// Create all nodes used by this net and set its previous pointer so that:
Expand Down Expand Up @@ -395,7 +398,20 @@ protected void determineRoutingTargets() {
RouteNode sinkRnode = connection.getSinkRnode();
assert(sourceRnode.getType() == RouteNodeType.PINFEED_O);
assert(sinkRnode.getType() == RouteNodeType.PINFEED_I);

// Even though this connection is not expected to have any routing yet,
// perform a rip up anyway in order to release any exclusive sinks
// ahead of finishRouteConnection()
assert(connection.getRnodes().isEmpty());
connection.getSink().setRouted(false);
ripUp(connection);

finishRouteConnection(connection, sinkRnode);
if (!connection.getSink().isRouted() && connection.getAltSinkRnodes().isEmpty()) {
// Undo what ripUp() did for this connection which has a single exclusive sink
sinkRnode.incrementUser(connection.getNetWrapper());
sinkRnode.updatePresentCongestionCost(presentCongestionFactor);
}
}

// Restore prev to avoid assertions firing
Expand Down Expand Up @@ -631,7 +647,20 @@ protected void unpreserveNet(Net net) {
RouteNode sinkRnode = connection.getSinkRnode();
assert(sourceRnode.getType() == RouteNodeType.PINFEED_O);
assert(sinkRnode.getType() == RouteNodeType.PINFEED_I);

// Even though this connection is not expected to have any routing yet,
// perform a rip up anyway in order to release any exclusive sinks
// ahead of finishRouteConnection()
assert(connection.getRnodes().isEmpty());
connection.getSink().setRouted(false);
ripUp(connection);

finishRouteConnection(connection, sinkRnode);
if (!connection.getSink().isRouted() && connection.getAltSinkRnodes().isEmpty()) {
// Undo what ripUp() did for this connection which has a single exclusive sink
sinkRnode.incrementUser(connection.getNetWrapper());
sinkRnode.updatePresentCongestionCost(presentCongestionFactor);
}
}

netToPins.put(net, net.getSinkPins());
Expand Down
Loading
Loading