From 98b4f286bfba87f1a5018768e3cf8886e70609fc Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Mon, 8 Jan 2024 14:31:13 -0800 Subject: [PATCH 1/8] [RapidWright] Update to latest master Signed-off-by: Eddie Hung --- RapidWright | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RapidWright b/RapidWright index 683e572..16f7696 160000 --- a/RapidWright +++ b/RapidWright @@ -1 +1 @@ -Subproject commit 683e5723b4e9c7e1d98aa3cb1e05e3216f8ca081 +Subproject commit 16f76969124bbabba918f83eb666e80c09c8f057 From ea812e7ef8e0f95ba79482e75452f2a79fab2252 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Mon, 8 Jan 2024 14:31:44 -0800 Subject: [PATCH 2/8] Temporarily use staging BENCHMARKS_URL Signed-off-by: Eddie Hung --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9443177..f304d43 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ BENCHMARKS ?= boom_med_pb \ ispd16_example2 -BENCHMARKS_URL = https://github.com/Xilinx/fpga24_routing_contest/releases/latest/download/benchmarks.tar.gz +BENCHMARKS_URL = https://github.com/eddieh-xlnx/fpga24_routing_contest/releases/download/benchmarks/benchmarks.tar.gz # Inherit proxy settings from the host if they exist HTTPHOST=$(firstword $(subst :, ,$(subst http:,,$(subst /,,$(HTTP_PROXY))))) From 58f698a04294aa475c952c0a89d6afa21077a972 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Thu, 4 Jan 2024 11:05:12 -0800 Subject: [PATCH 3/8] CheckPhysNetlist to now check for non-PIP differences Signed-off-by: Eddie Hung --- Makefile | 2 +- .../CheckPhysNetlist.java | 32 +++++++++++++------ 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index f304d43..3392483 100644 --- a/Makefile +++ b/Makefile @@ -90,7 +90,7 @@ fpga-interchange-schema/interchange/capnp/java.capnp: # Gradle is used to invoke the CheckPhysNetlist class' main method with arguments # $^ (%.netlist and %_rwroute.phys), and display/redirect all output to $@.log (%_rwroute.check.log). # The exit code of Gradle determines if 'PASS' or 'FAIL' is written to $@ (%_rwroute.check) -%_$(ROUTER).check: %.netlist %_$(ROUTER).phys | compile-java +%_$(ROUTER).check: %.netlist %_$(ROUTER).phys %_unrouted.phys | compile-java if ./gradlew -DjvmArgs="-Xms6g -Xmx6g" -Dmain=com.xilinx.fpga24_routing_contest.CheckPhysNetlist :run --args='$^' $(call log_and_or_display,$@.log); then \ echo "PASS" > $@; \ else \ diff --git a/src/com/xilinx/fpga24_routing_contest/CheckPhysNetlist.java b/src/com/xilinx/fpga24_routing_contest/CheckPhysNetlist.java index 1394f34..e3347ff 100644 --- a/src/com/xilinx/fpga24_routing_contest/CheckPhysNetlist.java +++ b/src/com/xilinx/fpga24_routing_contest/CheckPhysNetlist.java @@ -10,6 +10,7 @@ package com.xilinx.fpga24_routing_contest; import com.xilinx.rapidwright.design.Design; +import com.xilinx.rapidwright.design.compare.DesignComparator; import com.xilinx.rapidwright.design.tools.LUTTools; import com.xilinx.rapidwright.edif.EDIFNetlist; import com.xilinx.rapidwright.edif.EDIFTools; @@ -43,8 +44,8 @@ public class CheckPhysNetlist { public static void main(String[] args) throws IOException, InterruptedException { - if (args.length != 2) { - System.err.println("USAGE: "); + if (args.length != 3) { + System.err.println("USAGE: "); return; } @@ -54,15 +55,26 @@ public static void main(String[] args) throws IOException, InterruptedException PhysNetlistReader.VALIDATE_MACROS_PLACED_FULLY = false; PhysNetlistReader.CHECK_MACROS_CONSISTENT = false; + // Read the routed and unrouted Physical Netlists + Design routedDesign = PhysNetlistReader.readPhysNetlist(args[1]); + Design unroutedDesign = PhysNetlistReader.readPhysNetlist(args[2]); + + DesignComparator dc = new DesignComparator(); + dc.setComparePIPs(false); + int numDiffs = dc.compareDesigns(unroutedDesign, routedDesign); + unroutedDesign = null; + if (numDiffs == 0) { + System.out.println("INFO: No non-PIP differences found between routed and unrouted netlists"); + } else { + System.err.println("ERROR: Detected " + numDiffs + " non-PIP differences between " + args[1] + " and " + args[2]); + } + // Read the Logical Netlist EDIFNetlist netlist = LogNetlistReader.readLogNetlist(args[0]); - // Read the Physical Netlist - Design design = PhysNetlistReader.readPhysNetlist(args[1]); - // Combine Physical Netlist with Logical - design.setNetlist(netlist); - design.setName(netlist.getName()); + routedDesign.setNetlist(netlist); + routedDesign.setName(netlist.getName()); // Add encrypted EDIF cells to the design if found Path ednDirectory = Paths.get(args[0] + ".edn"); @@ -75,11 +87,11 @@ public static void main(String[] args) throws IOException, InterruptedException } // Examine the design routing and perform any necessary LUT pin swaps - LUTTools.swapLutPinsFromPIPs(design); + LUTTools.swapLutPinsFromPIPs(routedDesign); // Write design to Vivado Design Checkpoint (DCP) Path outputDcp = Paths.get(FileTools.removeFileExtension(args[1]) + ".dcp"); - design.writeCheckpoint(outputDcp); + routedDesign.writeCheckpoint(outputDcp); // Call Vivado's `report_route_status` command on this DCP ReportRouteStatusResult rrs = null; @@ -147,7 +159,7 @@ public static void main(String[] args) throws IOException, InterruptedException } // Exit code 0 only if Vivado reported that it was fully routed - System.exit(rrs.logicalNets > 0 && rrs.isFullyRouted() ? 0 : 1); + System.exit(numDiffs == 0 && rrs.logicalNets > 0 && rrs.isFullyRouted() ? 0 : 1); } } From d4f06620cca4e90a934747b36af7e0711bd5ba0f Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Thu, 4 Jan 2024 11:07:25 -0800 Subject: [PATCH 4/8] Update GitHub Actions to check for no non-PIP diffs Signed-off-by: Eddie Hung --- .github/workflows/make.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index ab8df96..878f01b 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -81,6 +81,8 @@ jobs: # Allow CheckPhysNetlist to fail if no remote access to Vivado grep -H PASS *.check || ${{ secrets.REPORT_ROUTE_STATUS_URL == '' }} grep -H -e "# of nets with routing errors[. :]\+0" *.check.log || ${{ secrets.REPORT_ROUTE_STATUS_URL == '' }} + # But CheckPhysNetlist must have no non-PIP differences + grep "INFO: No non-PIP differences found between routed and unrouted netlists" *.check.log && exit 1 # Check no multiple sources, no stubs grep "UserWarning: Found [0-9]\+ sources" *.wirelength && exit 1 grep "UserWarning: Found [0-9]\+ stubs" *.wirelength && exit 1 @@ -90,8 +92,10 @@ jobs: if: matrix.router == 'nxroute-poc' run: | grep -H FAIL *.check - # Allow following grep to fail if no URL + # Only expect report_route_status output if URL given grep -H -e "# of nets with routing errors[. :]\+[1-9]" -e "# of unrouted nets[. :]\+[1-9]" *.check.log || ${{ secrets.REPORT_ROUTE_STATUS_URL == '' }} + # But CheckPhysNetlist must have no non-PIP differences + grep "INFO: No non-PIP differences found between routed and unrouted netlists" *.check.log && exit 1 # Check no multiple sources, but expect stubs grep "UserWarning: Found [0-9]\+ sources" *.wirelength && exit 1 grep "UserWarning: Found [0-9]\+ stubs" *.wirelength || ${{ matrix.benchmark == 'koios_dla_like_large' }} From 7b6a414ae1716e7e63a02587d5120565cc2b19de Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Thu, 4 Jan 2024 11:15:06 -0800 Subject: [PATCH 5/8] Check for presence of no diffs found Signed-off-by: Eddie Hung --- .github/workflows/make.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index 878f01b..c410a54 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -82,7 +82,7 @@ jobs: grep -H PASS *.check || ${{ secrets.REPORT_ROUTE_STATUS_URL == '' }} grep -H -e "# of nets with routing errors[. :]\+0" *.check.log || ${{ secrets.REPORT_ROUTE_STATUS_URL == '' }} # But CheckPhysNetlist must have no non-PIP differences - grep "INFO: No non-PIP differences found between routed and unrouted netlists" *.check.log && exit 1 + grep "INFO: No non-PIP differences found between routed and unrouted netlists" *.check.log # Check no multiple sources, no stubs grep "UserWarning: Found [0-9]\+ sources" *.wirelength && exit 1 grep "UserWarning: Found [0-9]\+ stubs" *.wirelength && exit 1 @@ -95,7 +95,7 @@ jobs: # Only expect report_route_status output if URL given grep -H -e "# of nets with routing errors[. :]\+[1-9]" -e "# of unrouted nets[. :]\+[1-9]" *.check.log || ${{ secrets.REPORT_ROUTE_STATUS_URL == '' }} # But CheckPhysNetlist must have no non-PIP differences - grep "INFO: No non-PIP differences found between routed and unrouted netlists" *.check.log && exit 1 + grep "INFO: No non-PIP differences found between routed and unrouted netlists" *.check.log # Check no multiple sources, but expect stubs grep "UserWarning: Found [0-9]\+ sources" *.wirelength && exit 1 grep "UserWarning: Found [0-9]\+ stubs" *.wirelength || ${{ matrix.benchmark == 'koios_dla_like_large' }} From f8ea912f048bca2ca9b5da530d623cf8b3064e06 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Thu, 4 Jan 2024 11:45:06 -0800 Subject: [PATCH 6/8] Skip CheckPhysNetlist's DesignComparator for koios as out of memory Signed-off-by: Eddie Hung --- .github/workflows/make.yml | 9 ++++---- Makefile | 2 +- .../CheckPhysNetlist.java | 21 +++++++++++-------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index c410a54..52b46bb 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -67,8 +67,9 @@ jobs: - env: REPORT_ROUTE_STATUS_URL: ${{ secrets.REPORT_ROUTE_STATUS_URL }} REPORT_ROUTE_STATUS_AUTH: ${{ secrets.REPORT_ROUTE_STATUS_AUTH }} - # For certain benchmarks, wirelength_analyzer requires more memory than that available in GitHub Actions + # For certain benchmarks, wirelength_analyzer/CheckPhysNetlist requires more memory than that available in GitHub Actions WIRELENGTH_ANALYZER_MOCK_RESULT: ${{ matrix.benchmark == 'koios_dla_like_large' }} + CHECK_PHYS_NETLIST_DIFF_MOCK_RESULT: ${{ matrix.benchmark == 'koios_dla_like_large' }} RWROUTE_FORCE_LUT_PIN_SWAP: ${{ matrix.router == 'rwroute' && matrix.lutpinswap }} run: | make ROUTER="${{ matrix.router }}" BENCHMARKS="${{ matrix.benchmark }}" VERBOSE=1 @@ -94,9 +95,9 @@ jobs: grep -H FAIL *.check # Only expect report_route_status output if URL given grep -H -e "# of nets with routing errors[. :]\+[1-9]" -e "# of unrouted nets[. :]\+[1-9]" *.check.log || ${{ secrets.REPORT_ROUTE_STATUS_URL == '' }} - # But CheckPhysNetlist must have no non-PIP differences - grep "INFO: No non-PIP differences found between routed and unrouted netlists" *.check.log - # Check no multiple sources, but expect stubs + # But CheckPhysNetlist must have no non-PIP differences (except koios because out-of-memory) + grep "INFO: No non-PIP differences found between routed and unrouted netlists" *.check.log || ${{ matrix.benchmark == 'koios_dla_like_large' }} + # Check no multiple sources, but expect stubs (except koios because out-of-memory) grep "UserWarning: Found [0-9]\+ sources" *.wirelength && exit 1 grep "UserWarning: Found [0-9]\+ stubs" *.wirelength || ${{ matrix.benchmark == 'koios_dla_like_large' }} # Allow wirelength computation to fail since nxroute may not have routed anything or wirelength_analyzer was not run diff --git a/Makefile b/Makefile index 3392483..01c58b5 100644 --- a/Makefile +++ b/Makefile @@ -99,7 +99,7 @@ fpga-interchange-schema/interchange/capnp/java.capnp: %_$(ROUTER).wirelength: %_$(ROUTER).phys | setup-wirelength_analyzer if [[ "$(WIRELENGTH_ANALYZER_MOCK_RESULT)" == "true" ]]; then \ - echo "::warning file=$@::wirelength_analyzer not run because WIRELENGTH_ANALYZER_MOCK_RESULT is set"; \ + echo "::warning file=$<::wirelength_analyzer not run because WIRELENGTH_ANALYZER_MOCK_RESULT is set"; \ echo "Wirelength: inf" > $@; \ else \ python3 wirelength_analyzer/wa.py $< $(call log_and_or_display,$@); \ diff --git a/src/com/xilinx/fpga24_routing_contest/CheckPhysNetlist.java b/src/com/xilinx/fpga24_routing_contest/CheckPhysNetlist.java index e3347ff..f37c990 100644 --- a/src/com/xilinx/fpga24_routing_contest/CheckPhysNetlist.java +++ b/src/com/xilinx/fpga24_routing_contest/CheckPhysNetlist.java @@ -57,16 +57,19 @@ public static void main(String[] args) throws IOException, InterruptedException // Read the routed and unrouted Physical Netlists Design routedDesign = PhysNetlistReader.readPhysNetlist(args[1]); - Design unroutedDesign = PhysNetlistReader.readPhysNetlist(args[2]); - - DesignComparator dc = new DesignComparator(); - dc.setComparePIPs(false); - int numDiffs = dc.compareDesigns(unroutedDesign, routedDesign); - unroutedDesign = null; - if (numDiffs == 0) { - System.out.println("INFO: No non-PIP differences found between routed and unrouted netlists"); + if (System.getenv("CHECK_PHYS_NETLIST_DIFF_MOCK_RESULT").equals("true")) { + System.out.println("::warning file=" + args[1] + "::CheckPhysNetlist's DesignComparator not run because CHECK_PHYS_NETLIST_DIFF_MOCK_RESULT is set"); } else { - System.err.println("ERROR: Detected " + numDiffs + " non-PIP differences between " + args[1] + " and " + args[2]); + Design unroutedDesign = PhysNetlistReader.readPhysNetlist(args[2]); + + DesignComparator dc = new DesignComparator(); + dc.setComparePIPs(false); + int numDiffs = dc.compareDesigns(unroutedDesign, routedDesign); + if (numDiffs == 0) { + System.out.println("INFO: No non-PIP differences found between routed and unrouted netlists"); + } else { + System.err.println("ERROR: Detected " + numDiffs + " non-PIP differences between " + args[1] + " and " + args[2]); + } } // Read the Logical Netlist From cc1a68f954212286ce1498b281d95884c3c6cdd3 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Thu, 4 Jan 2024 11:48:50 -0800 Subject: [PATCH 7/8] Move numDiffs out Signed-off-by: Eddie Hung --- .../fpga24_routing_contest/CheckPhysNetlist.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/com/xilinx/fpga24_routing_contest/CheckPhysNetlist.java b/src/com/xilinx/fpga24_routing_contest/CheckPhysNetlist.java index f37c990..5b1fced 100644 --- a/src/com/xilinx/fpga24_routing_contest/CheckPhysNetlist.java +++ b/src/com/xilinx/fpga24_routing_contest/CheckPhysNetlist.java @@ -57,6 +57,7 @@ public static void main(String[] args) throws IOException, InterruptedException // Read the routed and unrouted Physical Netlists Design routedDesign = PhysNetlistReader.readPhysNetlist(args[1]); + int numDiffs = 0; if (System.getenv("CHECK_PHYS_NETLIST_DIFF_MOCK_RESULT").equals("true")) { System.out.println("::warning file=" + args[1] + "::CheckPhysNetlist's DesignComparator not run because CHECK_PHYS_NETLIST_DIFF_MOCK_RESULT is set"); } else { @@ -64,12 +65,12 @@ public static void main(String[] args) throws IOException, InterruptedException DesignComparator dc = new DesignComparator(); dc.setComparePIPs(false); - int numDiffs = dc.compareDesigns(unroutedDesign, routedDesign); - if (numDiffs == 0) { - System.out.println("INFO: No non-PIP differences found between routed and unrouted netlists"); - } else { - System.err.println("ERROR: Detected " + numDiffs + " non-PIP differences between " + args[1] + " and " + args[2]); - } + numDiffs = dc.compareDesigns(unroutedDesign, routedDesign); + } + if (numDiffs == 0) { + System.out.println("INFO: No non-PIP differences found between routed and unrouted netlists"); + } else { + System.err.println("ERROR: Detected " + numDiffs + " non-PIP differences between " + args[1] + " and " + args[2]); } // Read the Logical Netlist From 5419629cea635cbb3adb8e903e03cbd8a9cfcb6f Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Mon, 8 Jan 2024 09:58:56 -0800 Subject: [PATCH 8/8] Compare PIPs on static/clock nets only Signed-off-by: Eddie Hung --- .github/workflows/make.yml | 8 ++++---- .../xilinx/fpga24_routing_contest/CheckPhysNetlist.java | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index 52b46bb..7a960ec 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -82,8 +82,8 @@ jobs: # Allow CheckPhysNetlist to fail if no remote access to Vivado grep -H PASS *.check || ${{ secrets.REPORT_ROUTE_STATUS_URL == '' }} grep -H -e "# of nets with routing errors[. :]\+0" *.check.log || ${{ secrets.REPORT_ROUTE_STATUS_URL == '' }} - # But CheckPhysNetlist must have no non-PIP differences - grep "INFO: No non-PIP differences found between routed and unrouted netlists" *.check.log + # But CheckPhysNetlist must have no differences + grep "INFO: No differences found between routed and unrouted netlists" *.check.log # Check no multiple sources, no stubs grep "UserWarning: Found [0-9]\+ sources" *.wirelength && exit 1 grep "UserWarning: Found [0-9]\+ stubs" *.wirelength && exit 1 @@ -95,8 +95,8 @@ jobs: grep -H FAIL *.check # Only expect report_route_status output if URL given grep -H -e "# of nets with routing errors[. :]\+[1-9]" -e "# of unrouted nets[. :]\+[1-9]" *.check.log || ${{ secrets.REPORT_ROUTE_STATUS_URL == '' }} - # But CheckPhysNetlist must have no non-PIP differences (except koios because out-of-memory) - grep "INFO: No non-PIP differences found between routed and unrouted netlists" *.check.log || ${{ matrix.benchmark == 'koios_dla_like_large' }} + # But CheckPhysNetlist must have no differences (except koios because out-of-memory) + grep "INFO: No differences found between routed and unrouted netlists" *.check.log || ${{ matrix.benchmark == 'koios_dla_like_large' }} # Check no multiple sources, but expect stubs (except koios because out-of-memory) grep "UserWarning: Found [0-9]\+ sources" *.wirelength && exit 1 grep "UserWarning: Found [0-9]\+ stubs" *.wirelength || ${{ matrix.benchmark == 'koios_dla_like_large' }} diff --git a/src/com/xilinx/fpga24_routing_contest/CheckPhysNetlist.java b/src/com/xilinx/fpga24_routing_contest/CheckPhysNetlist.java index 5b1fced..efa72f4 100644 --- a/src/com/xilinx/fpga24_routing_contest/CheckPhysNetlist.java +++ b/src/com/xilinx/fpga24_routing_contest/CheckPhysNetlist.java @@ -64,13 +64,14 @@ public static void main(String[] args) throws IOException, InterruptedException Design unroutedDesign = PhysNetlistReader.readPhysNetlist(args[2]); DesignComparator dc = new DesignComparator(); - dc.setComparePIPs(false); + // Only compare PIPs on static and clock nets + dc.setComparePIPs((net) -> net.isStaticNet() || net.isClockNet()); numDiffs = dc.compareDesigns(unroutedDesign, routedDesign); } if (numDiffs == 0) { - System.out.println("INFO: No non-PIP differences found between routed and unrouted netlists"); + System.out.println("INFO: No differences found between routed and unrouted netlists"); } else { - System.err.println("ERROR: Detected " + numDiffs + " non-PIP differences between " + args[1] + " and " + args[2]); + System.err.println("ERROR: Detected " + numDiffs + " differences between " + args[1] + " and " + args[2]); } // Read the Logical Netlist