The-OpenROAD-Project / OpenLane

OpenLane is an automated RTL to GDSII flow based on several components including OpenROAD, Yosys, Magic, Netgen and custom methodology scripts for design exploration and optimization.
https://openlane.readthedocs.io/
Apache License 2.0
1.3k stars 369 forks source link

synth_explore: NoneType object is not subscriptable #1619

Closed xobs closed 1 year ago

xobs commented 1 year ago

Description

Running -synth_explore using the docker image (2023.01.03) can result in a TypeError: 'NoneType' object is not subscriptable error. The analyze.py file fails when trying to analyze: 0-synthesis.log.gz

Expected Behavior

-synth_explore should succeed without throwing an exception

Environment report

WARNING: issue-survey appears to be running inside the OpenLane
container.

This makes it difficult to rule out issues with your
environment.

Unless instructed specifically to do so, please run this command
outside the OpenLane container.
---

Kernel: Linux v5.15.79.1-microsoft-standard-WSL2
Distribution: centos 7
Python: v3.6.8 (OK)
OpenLane Git Version: e570a6a5b428eddb19f8efe4f9d18d79f1050940
pip: INSTALLED
python-venv: INSTALLED
---
PDK Version Verification Status: MISMATCH
The version of open_pdks used in building the PDK does not match the version OpenLane was tested on (installed: 0059588eebfc704681dc2368bd1d33d96281d10f, tested: 3f9bdbd857564726b731760dc2c817e84ca7d8ac)
This may introduce some issues. You may want to re-install the PDK by invoking `make pdk`.
---
Git Log (Last 3 Commits)

e570a6a 2023-01-02T15:10:43+02:00 `run_designs` fixes (#1597) - Mohamed Gaber -  (grafted, HEAD, tag: 2023.01.03)
---
Git Remotes

origin  https://github.com/The-OpenROAD-Project/OpenLane (fetch)
origin  https://github.com/The-OpenROAD-Project/OpenLane (push)

Reproduction material

I've run this from inside caravel-minimax/openlane/:

docker run -it -v $(realpath /si/work/caravel-minimax/..):$(realpath /si/work/caravel-minimax/..) -v /si/work/dependencies/pdks:/si/work/dependencies/pdks -v /si/work/dependencies/caravel:/si/work/dependencies/caravel -v /si/work/dependencies/openlane_src:/openlane -v /si/work/dependencies/mgmt_core_wrapper:/si/work/dependencies/mgmt_core_wrapper -e PDK_ROOT=/si/work/dependencies/pdks -e PDK=gf180mcuC -e MISMATCHES_OK=1 -e CARAVEL_ROOT=/si/work/dependencies/caravel -e OPENLANE_RUN_TAG=23_01_13_18_45 -e MCW_ROOT=/si/work/dependencies/mgmt_core_wrapper -u 1000:1000         efabless/openlane:2023.01.03 sh -c "flow.tcl -design $(realpath ./minimax_rf) -save_path $(realpath ..) -save -tag some-tag -overwrite -ignore_mismatches -synth_explore"

Relevant log output

(minimax) user@Ondo:/si/work/caravel-minimax/openlane$ docker run -it -v $(realpath /si/work/caravel-minimax/..):$(realpath /si/work/caravel-minimax/..) -v /si/work/dependencies/pdks:/si/work/dependencies/pdks -v /si/work/dependencies/caravel:/si/work/dependencies/caravel -v /si/work/dependencies/openlane_src:/openlane -v /si/work/dependencies/mgmt_core_wrapper:/si/work/dependencies/mgmt_core_wrapper -e PDK_ROOT=/si/work/dependencies/pdks -e PDK=gf180mcuC -e MISMATCHES_OK=1 -e CARAVEL_ROOT=/si/work/dependencies/caravel -e OPENLANE_RUN_TAG=23_01_13_18_45 -e MCW_ROOT=/si/work/dependencies/mgmt_core_wrapper -u 1000:1000         efabless/openlane:2023.01.03 sh -c "flow.tcl -design $(realpath ./minimax_rf) -save_path $(realpath ..) -save -tag some-tag -overwrite -ignore_mismatches -synth_explore"
OpenLane e570a6a5b428eddb19f8efe4f9d18d79f1050940
All rights reserved. (c) 2020-2022 Efabless Corporation and contributors.
Available under the Apache License, version 2.0. See the LICENSE file for more details.

[WARNING]: OpenLane may not function properly: The version of open_pdks used in building the PDK does not match the version OpenLane was tested on (installed: 0059588eebfc704681dc2368bd1d33d96281d10f, tested: 3f9bdbd857564726b731760dc2c817e84ca7d8ac)
This may introduce some issues. You may want to re-install the PDK by invoking `make pdk`.
[INFO]: Using configuration in '../si/work/caravel-minimax/openlane/minimax_rf/config.json'...
[INFO]: PDK Root: /si/work/dependencies/pdks
[INFO]: Process Design Kit: gf180mcuC
[INFO]: Standard Cell Library: gf180mcu_fd_sc_mcu7t5v0
[INFO]: Optimization Standard Cell Library: gf180mcu_fd_sc_mcu7t5v0
[INFO]: Run Directory: /si/work/caravel-minimax/openlane/minimax_rf/runs/some-tag
[INFO]: Removing existing /si/work/caravel-minimax/openlane/minimax_rf/runs/some-tag...
[INFO]: Preparing LEF files for the nom corner...
[INFO]: Running Synthesis Exploration...
[INFO]: This is a Synthesis Exploration and so no need to remove the defparam lines.
[INFO]: Generating exploration report...
[ERROR]: during executing: "python3 /openlane/scripts/synth_exp/analyze.py --output /si/work/caravel-minimax/openlane/minimax_rf/runs/some-tag/reports/synthesis/0-exploration_analysis.html /si/work/caravel-minimax/openlane/minimax_rf/runs/some-tag/logs/synthesis/0-synthesis.log"
[ERROR]: Exit code: 1
[ERROR]: Last 10 lines:
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/openlane/scripts/synth_exp/analyze.py", line 68, in cli
    delay = float(delay_m[1])
TypeError: 'NoneType' object is not subscriptable

[INFO]: Saving current set of views in '../si/work/caravel-minimax/openlane/minimax_rf/runs/some-tag/results/final'...
[INFO]: Generating final set of reports...
[INFO]: Created manufacturability report at '../si/work/caravel-minimax/openlane/minimax_rf/runs/some-tag/reports/manufacturability.rpt'.
[INFO]: Created metrics report at '../si/work/caravel-minimax/openlane/minimax_rf/runs/some-tag/reports/metrics.csv'.
[INFO]: Saving runtime environment...
[ERROR]: Flow failed.
(minimax) user@Ondo:/si/work/caravel-minimax/openlane$
xobs commented 1 year ago

This appears to be caused by the following line:

ABC: WireLoad = "none"  Gates =   6377 (  3.4 %)   Cap = 19.2 ff (  0.0 %)   Area =    81852.42 (100.0 %)   Delay =113197.96 ps  ( 23.2 %)

This patch appears to solve the issue:

diff --git a/scripts/synth_exp/analyze.py b/scripts/synth_exp/analyze.py
index daf4124..c26928c 100644
--- a/scripts/synth_exp/analyze.py
+++ b/scripts/synth_exp/analyze.py
@@ -49,9 +49,9 @@ def cli(output, input_file):
     best_gates = ""

     strat_rx = re.compile(r"USING STRATEGY ([A-Z]+\s+\d+)")
-    delay_rx = re.compile(r"Delay\s+\=\s+(\S+)")
-    area_rx = re.compile(r"Area\s+\=\s+(\S+)")
-    gates_rx = re.compile(r"Gates\s+\=\s+(\S+)")
+    delay_rx = re.compile(r"Delay\s+\=\s*(\S+)")
+    area_rx = re.compile(r"Area\s+\=\s*(\S+)")
+    gates_rx = re.compile(r"Gates\s+\=\s*(\S+)")

     data = []