-
Notifications
You must be signed in to change notification settings - Fork 16
feat: add custom emulator build arguments #1282
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
Open
jake-arkinstall
wants to merge
2
commits into
main
Choose a base branch
from
feat/emulator-build-args
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CalMacCQ
reviewed
Oct 2, 2025
|
Branch | feat/emulator-build-args |
Testbed | Linux |
Click to view all benchmark results
Benchmark | hugr_bytes | Benchmark Result bytes x 1e3 (Result Δ%) | Upper Boundary bytes x 1e3 (Limit %) | hugr_nodes | Benchmark Result nodes (Result Δ%) | Upper Boundary nodes (Limit %) |
---|---|---|---|---|---|---|
tests/benchmarks/test_big_array.py::test_big_array_compile | 📈 view plot 🚷 view threshold | 129.06 x 1e3(+0.00%)Baseline: 129.06 x 1e3 | 130.35 x 1e3 (99.01%) | 📈 view plot 🚷 view threshold | 4,873.00(0.00%)Baseline: 4,873.00 | 4,921.73 (99.01%) |
tests/benchmarks/test_ctrl_flow.py::test_many_ctrl_flow_compile | 📈 view plot 🚷 view threshold | 21.99 x 1e3(+0.02%)Baseline: 21.99 x 1e3 | 22.21 x 1e3 (99.03%) | 📈 view plot 🚷 view threshold | 693.00(0.00%)Baseline: 693.00 | 699.93 (99.01%) |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1282 +/- ##
=======================================
Coverage 93.49% 93.49%
=======================================
Files 121 121
Lines 11202 11228 +26
=======================================
+ Hits 10473 10498 +25
- Misses 729 730 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds
builder.with_build_arg(name: str, value: Any)
, which allows for build customisation.Background
Selene builds are managed by the selene_core BuildPlanner. This is a graph comprising:
cost
.It is configured with sensible defaults, but one can add kinds and steps to the default build planner with custom extensions.
Upon providing an input to build(), the artifact kind is determined, and djikstra provides the walk of least total cost from the input kind to a selene executable.
Costs and steps can be customised in the definition of steps. If custom steps are added into the build planner, a common pattern is to enable them (by reducing their
cost
) upon presence of custom build arguments.Concrete Example
The build steps undertaken during a walk of least cost can be inspected by looking at the 'steps' entry in
${build_dir}/selene.yaml
, which for a vanilla run looks like:A HUGR Envelope Bytes can be compiled to .bc or .ll based on a 'build_method' parameter. Passing
build_method='via-llvm-ir'
to selene_sim.build will thus provide human-readable LLVM IR in the build artifacts, which is great for inspection.By doing so, you get these steps instead:
Adding this capability to the guppylang emulator interface
This PR adds the ability to pass custom arguments to selene_sim.build function via the builder method.
Usage looks like:
In
./prefer_text/artifacts
LLVM IR rather than bitcode will be present. This demonstrates a customisation point - boring in itself, but the possibilities with such customisation are quite exciting. One can pass custom args to compilation (e.g. optimisation level, verbosity levels, or choose a different compiler entirely), steer builds to using other machine targets, etc.