-
Notifications
You must be signed in to change notification settings - Fork 460
pytest based synthesis tests #1257
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
base: main
Are you sure you want to change the base?
Conversation
merge hls4ml main into add-conftest
Add synthesis tests pytest
update add-conftest branch
Add conftest
test/pytest/conftest.py
Outdated
"Vivado": {"csim": False, "synth": True, "export": False}, | ||
"Vitis": {"csim": False, "synth": True, "export": False}, | ||
"Quartus": {"synth": True, "fpgasynth": False}, | ||
"oneAPI": {"build_type": "fpga_emu", "run": False}, |
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.
fpga_emu
is actually just C compilation, so this needs to be changed, though to what I am not sure. The descriptions are given in https://github.com/oneapi-src/oneAPI-samples/tree/release/2025.0/DirectProgramming/C%2B%2BSYCL_FPGA/Tutorials/GettingStarted/fpga_compile#four-compilation-options and they correspond to fpga_emu
, report
, fpga_sim
, and fpga
. I would guess report
unless you want to run cosim, in which case it's fpga_sim
. The first two don't require Quartus, while the last two do.
Can we test this to actually run SYNTHESIS tests? |
yes, but if the env var 'RUN_SYNTHESIS' is not set, the default is False. |
merge remote branch 'upsteam/main'
I generally agree about storing the baselines in a dedicated repo. Is CERN gitlab or regular github preferred? We create the testing containers in gitlab. I don't really have a preference. |
Description
This PR introduces synthesis tests into the
pytest
framework forhls4ml
.The goal of this change is to automate the validation of HLS synthesis reports against predefined baselines to ensure stability and correctness over time, using pytest.
Main Changes
New submodule in
tests/pytests
calledbaselines
, which is a Git submodule pointing to an external repository containing synthesis baselines.backend_tool/version/test_artifacts.json
Baseline management:
New
conftest.py
file to manage shared pytest fixtures:synthesis_config
fixture, which provides:RUN_SYNTHESIS
environment variable).VIVADO_VERSION
, defaulting to2023.1
).model.build(...)
.Synthesis logic centralized in
synthesis_helpers.py
:test_synthesis
.RUN_SYNTHESIS=true
, runs synthesis and compares the report to baseline.Tolerances for report values can be specified using
get_tolerance
.CI integration:
ci-template.yml
updated accordingly).Current test coverage:
test_keras_api.py
includes synthesis tests at the moment.baseline_file_name
to the test,test_synthesis()
.OneAPI backend is currently skipped due to missing synthesis reports support.
Type of change
Tests
Synthesis tests are run conditionally and compared against versioned baselines if
RUN_SYNTHESIS=true
is set in the environment.Checklist
pre-commit
on the files I edited or added.