Skip to content
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

Cherry pick into integrated_dev: [tools] Use bazel-provided Python for fusesoc subprocesses #24756

Open
wants to merge 1 commit into
base: integrated_dev
Choose a base branch
from

Conversation

qmn
Copy link

@qmn qmn commented Oct 9, 2024

I've been noticing that builds involving FuseSoC were being done twice: in Verilator simulations, I found my RTL verilated twice, and in Vivado bitstream builds, I found that Vivado was going through the entire process twice.

Doing some digging, I found bazelbuild/rules_python#675, which calls the entry point of anything in py_binary twice. This was version 0.9 of rules_python, which incidentally is the version pinned by lowRISC/rules_python: https://github.com/lowRISC/rules_python/blob/07c3f8547abbd5b97839a48af226a0fbcfaa5e7c/python/pip_install/extract_wheels/lib/bazel.py#L38-L49

I initially tried bumping the version of rules_python, but found this interacted badly with other deps. I found #19162 which sidesteps rules_python's py_binary entirely with its own explicit FuseSoC wrapper script. Incidentally, after this PR got merged in the master branch, CW310 Earl Grey bitstream build times dropped from 123 minutes before this PR got merged (76713f7) to 61 mintues afterwards (91befd8).

This PR simply cherry picks e38937c to integrated_dev with a trivial merge conflict fixup.

Add a py_binary shim that modifies the PATH environment variable to hold
the bazel-provided Python interpreter directory first, so /usr/bin/env
will point to it for the shebang method of running Python scripts. Add
the entire set of packages from ot_python_deps as deps for that shim, so
they're available to any generator fusesoc might call.

Signed-off-by: Alexander Williams <[email protected]>
(cherry picked from commit e38937c)
@qmn qmn requested a review from cfrantz as a code owner October 9, 2024 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants