mrg_build: YoWASP WASM toolchain backend (Docker-free local synth/PnR, #8) - #9
Open
santolucito wants to merge 3 commits into
Open
mrg_build: YoWASP WASM toolchain backend (Docker-free local synth/PnR, #8)#9santolucito wants to merge 3 commits into
santolucito wants to merge 3 commits into
Conversation
The mrg_build half of #8: tools now resolve through one of two backends, picked once per run so a report is never a native/wasm hybrid: - native: yosys/nextpnr-ecp5 on PATH (the image / oss-cad-suite) — preferred - wasm: the yowasp-yosys / yowasp-nextpnr-ecp5 pip wheels, run via wasmtime in a subprocess so cwd/env/output capture match the native tools MRG_TOOLCHAIN_BACKEND=native|wasm forces a backend (parity tests). Missing- toolchain errors now suggest `pip install manhattan-reasoning-gym[local]` first. BuildReport grows a `backend` field so local numbers are attributable. Toolchain tests are parametrized over both backends, each skipping when its backend isn't installed; verified the full synth + pnr flow end-to-end on the wasm backend (mac.v: 1 DSP, fits, deterministic Fmax across runs). The SDK-side fallback order in _local_build.py and the pinned [local] extra land separately. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The wasm-backend variants of the toolchain tests (added in this PR) were self-skipping in CI since only oss-cad-suite (native) was installed -- CI was only ever proving the backend-selection logic and the native path, never that synth/PnR actually work through YoWASP. Installing the wheels lets the parametrized tests run for real on both backends. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
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.
Implements the
mrg_buildhalf of #8: a toolchain-abstraction layer that resolves each tool to either a native binary on$PATH(oss-cad-suite / the sandbox image) or a YoWASP WASM entry point (yowasp-yosys,yowasp-nextpnr-ecp5) — so local synth/PnR reports work in Docker-less environments with nothing but pip wheels.What's in this PR
toolchain.backend()— picksnative(tools on PATH, preferred) orwasm(YoWASP wheels importable) once per run, so a report is never a native/wasm hybrid. Forceable viaMRG_TOOLCHAIN_BACKEND=native|wasmfor parity testing.yowasp_yosys.run_yosys(...)) are invoked in asys.executable -csubprocess, so cwd, env, and output capture behave identically to the native tools. All call sites (synth,pnr,pnr_soc— including the LiteX build-script lines) route through one_cmd()resolver.BuildReport.backend— every report now records which backend produced it (native/wasm; the SDK's Docker path can setdocker), alongside the existingtoolchainversion string (Proposal:[local]extra — Docker-free local synth/PnR via YoWASP #8 acceptance criterion).pip install 'manhattan-reasoning-gym[local]'before oss-cad-suite (Proposal:[local]extra — Docker-free local synth/PnR via YoWASP #8 acceptance criterion).test_toolchain.pyis parametrized over both backends, each skipping independently when its backend isn't installed, plus unit tests for backend selection and the error message. Also fixed a vacuous pass in the determinism test (None == Nonewhen both runs fail).sandbox/.Verified
On this host (macOS, arm64), with
yowasp-yosys==0.66.0.0.post1165andyowasp-nextpnr-ecp5==0.10.0.0.post753:wasmsynth ontests/fixtures/mac.v: ok, exactly 1MULT18X18D, backend/toolchain recorded (Yosys 0.66 / nextpnr-0.10,backend: "wasm").wasmPnR: fits, Fmax 339 MHz,timing_metat 65 MHz, DSP 1/156, deterministic across runs with the same seed.pytest tests/— all wasm-backend and backend-selection tests pass;ruff checkclean.Note: the three
[native]test failures on my host are pre-existing (also fail onmain): the local~/oss-cad-suitebundle is a stale yosys 0.47 that misparses the quotedtee -ofilename, vs the repo's 0.62 pin. The image's native path is unaffected — argv construction for the native backend is byte-identical to before.Out of scope (tracked in #8)
_local_build.py(native → wasm → Docker → error) and the[local]extra inpyproject.tomlwith pinned wheel versions — those live in the SDK repo.pnrwithout LiteX installed.Closes nothing on its own; part of #8.
🤖 Generated with Claude Code