Skip to content

Commit

Permalink
Update OpenROAD + Handle Breaking Changes (#1949)
Browse files Browse the repository at this point in the history
+ update utils.py `fetch_submodules_from_tarballs` to handle relative submodule url
~ `openroad_app` -> `0a6d0fd`
~ add extractor for operating conditions  

Co-authored-by: Donn <[email protected]>
  • Loading branch information
kareefardi and donn authored Sep 5, 2023
1 parent 5fb033c commit d03ecd9
Show file tree
Hide file tree
Showing 14 changed files with 91 additions and 14 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/openlane_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ jobs:
- name: Set up environment variables
uses: ./.github/actions/set_env_variables

- name: Set up GITHUB_TOKEN
run: |
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
- name: Get Volare Build/Push Dependencies
run: |
# Magic Build Dependencies
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ mount:

.PHONY: pdk
pdk: venv/created
PYTHONPATH= ./venv/bin/$(PYTHON_BIN) -m pip install --upgrade --no-cache-dir volare>=0.12.3
PYTHONPATH= ./venv/bin/$(PYTHON_BIN) -m pip install --upgrade --no-cache-dir 'volare>=0.12.3'
./venv/bin/volare enable --pdk $(PDK_FAMILY)

.PHONY: survey
Expand All @@ -147,7 +147,7 @@ start-build-env: venv/created
bash -c "bash --rcfile <(cat ~/.bashrc ./venv/bin/activate)"

venv: venv/created
venv/created: ./requirements.txt ./requirements_dev.txt ./requirements_lint.txt ./dependencies/python/precompile_time.txt ./dependencies/python/run_time.txt
venv/created: ./requirements.txt ./requirements_dev.txt ./requirements_lint.txt ./dependencies/python/precompile_time.txt
rm -rf ./venv
$(PYTHON_BIN) -m venv ./venv
PYTHONPATH= ./venv/bin/$(PYTHON_BIN) -m pip install --upgrade --no-cache-dir pip
Expand Down
3 changes: 1 addition & 2 deletions dependencies/python/compile_time.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
cmake
pyinstaller
cmake
4 changes: 2 additions & 2 deletions dependencies/python/run_time.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
click>=8.0.0,<9
pyyaml>=6,<7
install>=1.3.5,<2
XlsxWriter>=3.0.2,<4
XlsxWriter>=3.0.2,<4
git+https://github.com/efabless/[email protected]
2 changes: 1 addition & 1 deletion dependencies/tool_metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
in_install: false
- name: openroad_app
repo: https://github.com/The-OpenROAD-Project/OpenROAD
commit: 0cfb9a45bfb256c9af1a0500d4c97da0f145f54f
commit: 0a6d0fd469bc674417036342994520ee2e0a2727
in_install: false
- name: git
repo: https://github.com/git/git
Expand Down
2 changes: 1 addition & 1 deletion dependencies/verify_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def verify_versions(
manifest_names_by_SOURCES_name = {
"open_pdks": "open_pdks",
"skywater": "sky130",
"magic": "magic",
}
pdk_manifest_names = set(manifest_names_by_SOURCES_name.values())

Expand Down Expand Up @@ -131,6 +130,7 @@ def verify_versions(
)

for name, commit in tool_versions:
print(name, commit)
manifest_commit = manifest_dict[name]["commit"]

if commit != manifest_commit:
Expand Down
3 changes: 2 additions & 1 deletion docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pull-build-base:
$(PYTHON_BIN) ./utils.py pull-if-doesnt-exist --repository $(TOOL_REPOSITORY) --os $(OS_NAME) --architecture $(BUILD_ARCH) build-base
@echo "-----------"

# Used by pull-if-doesnt-exist
build-run-base: ./run_base/Dockerfile
cat ../dependencies/python/run_time.txt > ./run_base/pip_dependencies.txt
cat ../dependencies/centos-7/precompile_time.txt > ./run_base/yum_repos.txt
Expand All @@ -61,7 +62,7 @@ pull-run-base:
@echo "-----------"

# Tool Images
$(TOOL_BUILD_TARGETS): build-% : ./%/Dockerfile pull-build-base
$(TOOL_BUILD_TARGETS): build-% : ./%/Dockerfile pull-build-base pull-run-base
mkdir -p logs
cp ./utils.py $*
$(BUILD_COMMAND)\
Expand Down
1 change: 1 addition & 0 deletions docker/run_base/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/Dockerfile
1 change: 1 addition & 0 deletions docker/run_base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ RUN git config --global user.email "openlane.user@localhost"
## Wheel Build Dependencies
RUN python3 -m pip install --no-cache-dir --upgrade pip
COPY ./pip_dependencies.txt /pip_dependencies.txt
RUN yum install -y swig3 gcc gcc-c++ python3-devel
RUN python3 -m pip install --no-cache-dir -r /pip_dependencies.txt
5 changes: 4 additions & 1 deletion docker/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
SUPPORTED_OPERATING_SYSTEMS = {"centos-7"}


def test_manifest_exists(repository, tag) -> str:
def test_manifest_exists(repository, tag) -> bool:
url = f"https://registry.hub.docker.com/v2/repositories/{repository}/tags/{tag}"
req = urllib.request.Request(url, headers={"Accept": "application/json"})
status = None
Expand Down Expand Up @@ -303,6 +303,9 @@ def fetch_submodules_from_tarballs(filter, repository, commit):

for name, submodule in submodules_by_name.items():
submodule["commit"] = shas_by_path.get(submodule["path"])
if submodule["url"].startswith(tuple(["./", "../"])):
submodule["url"] = urllib.parse.urljoin(repository, submodule["url"])

if submodule["url"].endswith(".git"):
submodule["url"] = submodule["url"][:-4]

Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
-r ./dependencies/python/precompile_time.txt
-r ./dependencies/python/run_time.txt
click>=8.0.0,<9
pyyaml>=6,<7
20 changes: 18 additions & 2 deletions scripts/openroad/common/io.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ proc print_units {args} {
proc read_libs {args} {
sta::parse_key_args "read_libs" args \
keys {-typical -slowest -fastest}\
flags {-no_extra}
flags {-no_extra -set_operating_conditions}

if { ![info exists keys(-typical)] } {
puts "read_libs -typical is required"
Expand All @@ -134,6 +134,13 @@ proc read_libs {args} {
foreach lib $corner($corner_name) {
puts "read_liberty -corner $corner_name $lib"
read_liberty -corner $corner_name $lib
if { [info exists flags(-set_operating_conditions)] } {
set lib_info [fetch_library_info $lib]
set lib_name [lindex $lib_info 0]
set operating_conditions [lindex $lib_info 1]
puts "\[INFO] Setting operating conditions to '$operating_conditions'…"
set_operating_conditions -library $lib_name $operating_conditions
}
}
if { ![info exists flags(-no_extra)] } {
if { [info exists ::env(EXTRA_LIBS) ] } {
Expand All @@ -151,7 +158,7 @@ proc read_libs {args} {
proc read {args} {
sta::parse_key_args "read" args \
keys {-lib_fastest -lib_typical -lib_slowest} \
flags {-no_spefs}
flags {-no_spefs -set_lib_operating_conditions}

if { [info exists ::env(IO_READ_DEF)] && $::env(IO_READ_DEF) } {
if { [ catch {read_lef $::env(MERGED_LEF)} errmsg ]} {
Expand Down Expand Up @@ -184,6 +191,9 @@ proc read {args} {
if { [info exists keys(-lib_slowest)] } {
lappend read_libs_args -slowest "$keys(-lib_slowest)"
}
if { [info exists flags(-set_lib_operating_conditions)] } {
lappend read_libs_args -set_operating_conditions
}

read_libs {*}$read_libs_args

Expand Down Expand Up @@ -319,3 +329,9 @@ proc read_spefs {} {
}
}
}

proc fetch_library_info {lib} {
set extraction [exec python3 $::env(SCRIPTS_DIR)/utils/get_default_operating_conditions.py $lib]
set result [split $extraction ":"]
return $result
}
2 changes: 1 addition & 1 deletion scripts/openroad/irdrop.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
source $::env(SCRIPTS_DIR)/openroad/common/io.tcl
read
read -set_lib_operating_conditions
read_spef $::env(CURRENT_SPEF)

source $::env(SCRIPTS_DIR)/openroad/common/set_rc.tcl
Expand Down
51 changes: 51 additions & 0 deletions scripts/utils/get_default_operating_conditions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env python3
# Copyright 2023 Efabless Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys

import click
from libparse import LibertyParser


@click.command()
@click.argument("liberty", type=click.Path(dir_okay=False, exists=True))
def get_default_operating_conditions(liberty):
library = LibertyParser(open(liberty))
ast = library.ast

default_operating_conditions_id = None
operating_conditions_raw = {}
for child in ast.children:
if child.id == "default_operating_conditions":
default_operating_conditions_id = child.value
if child.id == "operating_conditions":
operating_conditions_raw[child.args[0]] = child

if default_operating_conditions_id is None:
if len(operating_conditions_raw) > 1:
print(
"No default operating condition defined, and the liberty file has multiple operating conditions.",
file=sys.stderr,
)
exit(-1)
elif len(operating_conditions_raw) < 1:
print("Liberty file has no operating conditions.", file=sys.stderr)
exit(-1)
default_operating_conditions_id = list(operating_conditions_raw.keys())[0]

print(f"{ast.args[0]}:{default_operating_conditions_id}", end="")


if __name__ == "__main__":
get_default_operating_conditions()

0 comments on commit d03ecd9

Please sign in to comment.