Skip to content

Commit 1c8ef6c

Browse files
authored
Merge pull request #4113 from oksaumya/fix-yaml-module-dependency
fix: remove PyYAML runtime dependency from Bazel flow scripts
2 parents ae73a7d + 5a16eef commit 1c8ef6c

9 files changed

Lines changed: 1532 additions & 46 deletions

File tree

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# Make Github ignore the designs folder when determining repo language
22
flow/designs/src/* linguist-vendored
3+
flow/scripts/variables.json linguist-generated=true

.github/workflows/github-actions-yaml-test.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,29 @@ jobs:
1515
fetch-depth: 1
1616
sparse-checkout: |
1717
flow/scripts/generate-variables-docs.py
18+
flow/scripts/yaml_to_json.py
19+
flow/scripts/variables.yaml
20+
flow/scripts/variables.json
1821
docs/user/FlowVariables.md
1922
yamlfix.toml
23+
- name: Install dependencies
24+
run: |
25+
python3 -m venv venv
26+
venv/bin/pip install --quiet pyyaml yamlfix==1.19.1
2027
- name: Run generate-variables-docs.py
2128
run: |
22-
python3 flow/scripts/generate-variables-docs.py
29+
venv/bin/python3 flow/scripts/generate-variables-docs.py
2330
- name: Check if FlowVariables.md is up to date
2431
run: |
2532
git diff --exit-code docs/user/FlowVariables.md
26-
- name: Install dependencies
33+
- name: Check variables.json is up to date
2734
run: |
28-
python3 -m venv venv
29-
venv/bin/pip install --quiet yamlfix==1.17.0
35+
venv/bin/python3 flow/scripts/yaml_to_json.py
36+
git diff --exit-code flow/scripts/variables.json
3037
- name: Run yamlfix check
3138
run: |
3239
source venv/bin/activate
3340
yamlfix --version
3441
set -x
3542
yamlfix -c yamlfix.toml flow/scripts/variables.yaml
36-
git diff flow/scripts/variables.yaml
43+
git diff --exit-code flow/scripts/variables.yaml

docs/user/FlowVariables.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ configuration file.
305305
| <a name="SYNTH_OPERATIONS_ARGS"></a>SYNTH_OPERATIONS_ARGS| Extra arguments appended to the Yosys synth command operations list. When set, replaces the default Kogge-Stone adder extra-map.| |
306306
| <a name="SYNTH_OPT_HIER"></a>SYNTH_OPT_HIER| Optimize constants across hierarchical boundaries.| |
307307
| <a name="SYNTH_REPEATABLE_BUILD"></a>SYNTH_REPEATABLE_BUILD| License to prune anything that makes builds less repeatable, typically used with Bazel to ensure that builds are bit-for-bit identical so that caching works optimally. Removes debug information that encodes paths, timestamps, etc.| 0|
308-
| <a name="SYNTH_RETIME_MODULES"></a>SYNTH_RETIME_MODULES| *This is an experimental option and may cause adverse effects.* *No effort has been made to check if the retimed RTL is logically equivalent to the non-retimed RTL.* List of modules to apply automatic retiming to. These modules must not get dissolved and as such they should either be the top module or be included in SYNTH_KEEP_MODULES. The main use case is to quickly identify if performance can be improved by manually retiming the input RTL. Retiming will treat module ports like register endpoints/startpoints. The objective function of retiming isn't informed by SDC, even the clock period is ignored. As such, retiming will optimize for best delay at potentially high register number cost. Automatic retiming can produce suboptimal results as its timing model is crude and it doesn't find the optimal distribution of registers on long pipelines. See OR discussion #8080.| |
308+
| <a name="SYNTH_RETIME_MODULES"></a>SYNTH_RETIME_MODULES| *This is an experimental option and may cause adverse effects.* *No effort has been made to check if the retimed RTL is logically equivalent to the non-retimed RTL.* List of modules to apply automatic retiming to. These modules must not get dissolved and as such they should either be the top module or be included in SYNTH_KEEP_MODULES. The main use case is to quickly identify if performance can be improved by manually retiming the input RTL. Retiming will treat module ports like register endpoints/startpoints. The objective function of retiming isn't informed by SDC, even the clock period is ignored. As such, retiming will optimize for best delay at potentially high register number cost. Automatic retiming can produce suboptimal results as its timing model is crude and it doesn't find the optimal distribution of registers on long pipelines. See OR discussion # 8080.| |
309309
| <a name="SYNTH_SLANG_ARGS"></a>SYNTH_SLANG_ARGS| Additional arguments passed to the slang frontend during synthesis.| |
310310
| <a name="SYNTH_WRAPPED_ADDERS"></a>SYNTH_WRAPPED_ADDERS| Specify the adder modules that can be used for synthesis, separated by commas. The default adder module is determined by the first element of this variable.| |
311311
| <a name="SYNTH_WRAPPED_MULTIPLIERS"></a>SYNTH_WRAPPED_MULTIPLIERS| Specify the multiplier modules that can be used for synthesis, separated by commas. The default multiplier module is determined by the first element of this variable.| |

flow/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ exports_files(
77

88
# files shared between scripts/synth.sh and scripts/flow.sh steps
99
MAKEFILE_SHARED = [
10+
"scripts/variables.json",
1011
"scripts/*.py",
1112
"scripts/*.sh",
1213
"scripts/*.yaml",

flow/scripts/defaults.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env python3
22

3+
import json
34
import os
4-
import yaml
55

66
dir_path = os.path.dirname(os.path.realpath(__file__))
77

8-
yaml_path = os.path.join(dir_path, "variables.yaml")
9-
with open(yaml_path, "r") as file:
10-
data = yaml.safe_load(file)
8+
json_path = os.path.join(dir_path, "variables.json")
9+
with open(json_path, "r") as file:
10+
data = json.load(file)
1111

1212
for key, value in data.items():
1313
if value.get("default", None) is None:

flow/scripts/non_stage_variables.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
#
66
# This script generates a list of variables known
77
# not to be in the current stage.
8+
import json
89
import os
910
import sys
10-
import yaml
1111

1212
dir_path = os.path.dirname(os.path.realpath(__file__))
1313

14-
yaml_path = os.path.join(dir_path, "variables.yaml")
15-
with open(yaml_path, "r") as file:
16-
data = yaml.safe_load(file)
14+
json_path = os.path.join(dir_path, "variables.json")
15+
with open(json_path, "r") as file:
16+
data = json.load(file)
1717

1818
for key, value in data.items():
1919
if "stages" not in value:

0 commit comments

Comments
 (0)