-
Notifications
You must be signed in to change notification settings - Fork 292
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
[Autotuner] - Tunable variables check #2452
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of good stuff, some things to be addressed, break into several PRs, one for each concern(which will simplify reviews allow PRs to flow into master more smoothly)
docs/user/FlowVariables.md
Outdated
@@ -100,6 +100,7 @@ configuration file. | |||
| <a name="GPL_TIMING_DRIVEN"></a>GPL_TIMING_DRIVEN| Specifies whether the placer should use timing driven placement.| | | |||
| <a name="GUI_TIMING"></a>GUI_TIMING| Load timing information when opening GUI. For large designs, this can be quite time consuming. Useful to disable when investigating non-timing aspects like floorplan, placement, routing, etc.| | | |||
| <a name="HOLD_SLACK_MARGIN"></a>HOLD_SLACK_MARGIN| Specifies a time margin for the slack when fixing hold violations. This option allows you to overfix.| | | |||
| <a name="IO_CONSTRAINTS"></a>IO_CONSTRAINTS| File path to the IO constraints .tcl file.| | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose not updating FlowVariables.md in pull requests that modify generate-variables-docs.py because it is likely to cause conflicts with other PRs in flight.
# information about the variables from variables.yaml. | ||
""" | ||
This script injects an autogenerated section in FlowVariables.md with | ||
information about the variables from variables.yaml. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
break out update to generate-variables-docs.py to separate PR, it has nothing to do with AutoTuner.
] | ||
def load_yaml(yaml_path: str) -> dict: | ||
if not os.path.exists(yaml_path): | ||
raise FileNotFoundError(f"File {yaml_path} not found") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting: why are you checking here instead of letting open() propagate this exception? What is the difference?
Seems like this code should be removed, or at least it is very surprising and I have never seen it.
If there is a reason to keep it, it deserves a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I usually try to write this to catch the exact exception triggering the open() error. Makes the code slightly verbose but easier to debug. 99% of the time open(... , "r") do fail with FileNotFoundError, but there might be other exceptions out there.
Also yaml.safe_load()
might fail too (e.g. invalid yaml)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better to leave file not found to open(), it is what all other python code i have seen does: minimize surprises and questions in the code.
there is no evidence of specific unique circumstances here.
8848846
to
37c7d9c
Compare
c1dc0b4
to
08a132b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some comments during my ambling walk around ORFS...
variables.add(variable.strip().upper()) | ||
# Read from variables.yaml and get variables with tunable = 1 | ||
os.chdir(vars_path) | ||
with open("variables.yaml") as file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't use os.chdir(), use full paths instead.
Signed-off-by: Jack Luar <[email protected]>
Signed-off-by: Jack Luar <[email protected]>
Signed-off-by: Jack Luar <[email protected]>
Signed-off-by: Jack Luar <[email protected]>
Signed-off-by: Jack Luar <[email protected]>
Signed-off-by: Jack Luar <[email protected]>
9953874
to
d93180d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits
# if key not in flow_variables: | ||
# print(f"[ERROR TUN-0017] Variable {key} is not tunable.") | ||
# sys.exit(1) | ||
if flow_variables.get(key, 0) == 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a set and "key in flow_variables", easier to read
Signed-off-by: Jack Luar <[email protected]>
PR Goals
Fixes Autotuner: Make flow variable detection more robust #2401
In future PRS