-
Notifications
You must be signed in to change notification settings - Fork 180
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
[WIP] Vizier integration #1160
base: main
Are you sure you want to change the base?
[WIP] Vizier integration #1160
Conversation
Internal-tag: [#46586] Signed-off-by: Robert Winkler's avatarRobert Winkler <rwinkler@antmicro.com>
The library contains XLSChannel, XLSChannelDriver and XLSChannelMonitor classes. * XLSChannel - provides a mechanism for wrapping all signals related to XLS channels into one object. * XLSChannelDriver - may be used to send data to XLS channel * XLSChannelMonitor - may be used to monitor transaction taking place in XLS Channel Internal-tag: [#46586] Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
…ation This commit adds a simple DSLX module that sends back the information received on the input channel. The example contains tests written in DSLX to verify the IR, as well as tests that use Cocotb framework to validate behavior of the generated Verilog sources. Internal-tag: [#46586] Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
- `jsonschema` is used for validating in data provided for the dashboard generation script in for of a dedicated Dashboard JSON is valid - `mdutils` is used to generate markdown from the obtained Dashboard JSON data - `mkdocs`, `mkdocs-material` are used to generate HTML website out of the markdown files generated previously from Dashboard JSON Internal-tag: #[46111] Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
- `dashboard.py` is the main script responsible for generating the dashboard. It uses the rest of the scripts as utilities. - `run_and_parse.py` contains functions for running tests and parsing their output to a Dashboard JSON format - `validate_dashboard_json.py` contains function for validating if the provided JSON is in the Dashboard JSON format - `json_to_markdown.py` converts the Dashboard JSON to a markdown document - `mkdocs_creator.py` converts the markdown to HTML using mkdocs Internal-tag: #[46111] Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
This commit adds three parsers that can be used by the user to extract the data for creating a dashboard: - `cocotb_results_xml_parser.py` can extract the information about successful and failed cocotb tests using result.xml saved by the test - `dslx_test_parser.py` can be used to extract the information about successful and failed DSLX tests using the log from the test - `generic_parser.py` can be used to get the Dashboard JSON data dumped directly to the log within special delimiters. To dump data in this format, one can use a dedicated function contained in `utils.py` Internal-tag: #[46111] Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
Internal-tag: #[46111] Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
Internal-tag: #[46111] Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
The test check correctness of the encoding and measures both delay and performance of the core Internal-tag: #[46111] Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
The dashboard contains results of DSLX and cocotb tests as well as delay and performance measurements obtained in the cocotb test. Internal-tag: #[46111] Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
Add rules for implementing physical design for rle_enc module for SKY130 process technology. Internal-tag: [#46111] Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
Internal Tag: [#47739] Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
Internal-tag: [#47739] Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
Bump lock file for python dependencies. This change is required after rebase between XLS with python_rules v0.8 and v0.25. Internal-tag: [#46111] Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
Replace git URL with link to direct archive This is workaround for possible bug in bazel python_rules which causes faulty builds of python extension modules built from C/C++ sources. Internal-tag: [#46111] Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
This is a temporary change required to pass environment variables to place_and_route roule defined in bazel_rules_hdl. This commit will be removed and replaced with bumping bazel_rules_hdl dependency once necessary changes will be merged in bazel_rules_hdl upstream repository. Internal-tag: [#49957] Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
google-vizier python module requires `kw_only` parameter of `dataclass` which was introduced in python 3.10 Internal-tag: [#50339] Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
Newer version passes by default argument `--allow-unsafe` to pip-compile. It is required for correct installation of python modules which depend on modules like: * setuptools * pip-tools Internal-tag: [#50339] Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
Internal-tag: [#49957] Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
Allows passing environment variables to codegen through bazel `--action-env` argument. Internal-tag: [#49957] Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
Internal-tag: [#50339] Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
… optimization Internal-tag: [#49957] Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
Internal-tag: [#50339] Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
…constraint This is a workaround for excluding generic parameter optimization rules generated with generate_compression_block_parameter_optimization() from builds and tests executed with a wildcard expressions like e.g. in CI: bazel test //xls/... Internal-tag: [#50339] Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
65fb1da
to
e620ba8
Compare
Some initial feedback
It would be nice to also have design based parameters, you can parameters DSLX based design by generating a dslx from from a textproto file using xls/xls/tools/proto_to_dslx_main.cc Line 61 in 60a8f20
I think it would easier to decouple the flow from bazel (currently it does
Another alternative is to rely on the python bindings for yosys and openroad and drive the tools directly as library rather than launching them as commands with a tcl script. @QuantamHD and @grotival are also interested into a finding a more sustainable to do without an hard dependencies on shelling out to bazel, so it'd be good to get their perspective as well.
do you currently extract throughput data from simulation data using realistic payload? if not, it @grebe could provide an example he put together for https://github.com/google/xls/tree/main/xls/examples/protobuf |
@proppy parameterization through DSLX files generated with My biggest concern is to figure out a solution that would not require reimplementing flows that are already defined in bazel rules. This is because I want to prevent a situation where there is a need to maintain 2 separate flows that perform the same task. For example, in synthesis rule we gather the files required for the synthesis, construct args and environment variables and only after that the rule calls the synthesis tool. Your idea with python bindings for yosys and openroad is also very interesting and I will surely investigate more on that but I believe that apart from the bindings for the tools we should also have a way of generating the preparation steps before those tools are called based on the implementation of bazel rules.
No, current example simulates RLE encoder with some trivial payload which does not represent realistic data |
While I agree it would be best to have maintain only one flow, I think that's orthogonal to what we are trying to achieve here (the Vizier driven parameter exploration). I think we should tackle that as a separate effort.
Another way to look at this, is that if we come with a good way to tackle the flow preparation outside of bazel (in C++, Python) we might be able to integrate it as a tool back into the bazel rules and drop a bunch of non-reusable skylark logic. |
what do you think of moving this (along side #1137) in separate repo similar to https://github.com/antmicro/xls-cosimulation-demonstrator ? |
Depends on #1137
This PR integrates Vizier Black-Box Optimization tool with XLS workspace.
It allows running parameter optimization tasks on designs written in DSLX.
The optimization task relies on:
The optimization engine explores the parameter search space in iterative fashion composing
suggestions
of parameter values which are then used inevaluation function
to obtainperformance metrics
. The evaluation function evaluates the sets of parameter values in the process of implementing and testing DSLX designs.The implementation consists of 3 components:
vizier_runner.py
- python script utilizing vizier library, which is responsible for:generate_compression_block_parameter_optimization()
)vizier_optimize
- top-level bazel rule used for startingvizier_runner
generate_compression_block_parameter_optimization()
- helper bazel macro which purpose is to instantiate a set of generic bazel rules necessary for usingsuggestions
for implementing and testing DSLX design in order to get performance metrics. Generic rules instantiated by this macro are used in theevaluation function
or serve as the entry point for starting the optimization task (vizier_optimize
rule). Parameter values from the suggestions are passed to those rules by environment variables and bazel argument--action_env
.This PR purpose is to showcase possible way of adding support for parameter optimization and handling of the
suggestions
in theevaluation function
. For the purpose of the showcase, the parameters and performance metrics available for the optimization tasks are limited to:Additionally, PR provides an example which showcases the usage of integration components. The example is based on rle_enc module. It optimizes
delay
andthroughput
metrics based on singlepipeline_stages
parameter. The example can be launched with:This PR requires a number of additional changes which include:
ctx.configuration.default_shell_env
to bazel action incodegen
rule in order to facilitate passing environment variables through bazel into scripts or binaries lying under called bazel rules.ctx.configuration.default_shell_env
to bazel action inplace_and_route
rule inbazel_rules_hdl
(temporarily use forked bazel_rules_hdl repository)kw_only
parameter ofdataclass
which was introduced in python 3.10rules_python
to version 0.26.0 to allow correct installation of modules which depend on modules likesetuptools
@proppy please take a look
Please note that since this work is based on #1137, it has commits from that PR in commit list and the changes from those are visible in
Files changed
. The commits relevant to this PR are top 8 commits, starting from [TEMP] use forked bazel_rules_hdl