From b9e504411a0e13b0c4014a4ba3beeaa48c786aff Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Thu, 30 Nov 2023 15:47:14 -0800 Subject: [PATCH] Install CIRCT outside of conda (add CI to auto-update) --- .github/workflows/update-circt.yml | 24 +++++++++++++ .gitignore | 1 + .gitmodules | 3 ++ conda-reqs/chipyard.yaml | 2 +- conda-reqs/circt.json | 3 ++ conda-reqs/install-circt | 1 + scripts/build-setup.sh | 58 +++++++++++++++++++----------- 7 files changed, 71 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/update-circt.yml create mode 100644 conda-reqs/circt.json create mode 160000 conda-reqs/install-circt diff --git a/.github/workflows/update-circt.yml b/.github/workflows/update-circt.yml new file mode 100644 index 00000000..3487838f --- /dev/null +++ b/.github/workflows/update-circt.yml @@ -0,0 +1,24 @@ +name: update-circt + +# run weekly +on: push +# schedule: +# - cron: 0 0 * * 1 + +defaults: + run: + shell: bash -leo pipefail {0} + +jobs: + update-circt: + name: update-circt + runs-on: ubuntu-latest + steps: + - name: Update CIRCT + uses: circt/update-circt@v1.0.0 + with: + user: 'bartender' + email: 'firesimchipyard@gmail.com' + pr-reviewers: '' + pr-labels: 'changelog:changed' + circt-config: './conda-reqs/circt.json' diff --git a/.gitignore b/.gitignore index 5dd75bec..78147280 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ tags *~ .bsp/ .conda-env/ +.circt/ .#* first-clone-setup-fast-log .bloop/ diff --git a/.gitmodules b/.gitmodules index 622c5f68..3e12c05a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -139,3 +139,6 @@ [submodule "generators/rocc-acc-utils"] path = generators/rocc-acc-utils url = https://github.com/ucb-bar/rocc-acc-utils +[submodule "conda-reqs/install-circt"] + path = conda-reqs/install-circt + url = https://github.com/circt/install-circt/ diff --git a/conda-reqs/chipyard.yaml b/conda-reqs/chipyard.yaml index 92e0843b..cc63f613 100644 --- a/conda-reqs/chipyard.yaml +++ b/conda-reqs/chipyard.yaml @@ -29,7 +29,7 @@ dependencies: - conda-gcc-specs - binutils - - firtool==1.58.0 # from ucb-bar channel - https://github.com/ucb-bar/firtool-feedstock + # firtool handled outside of conda # misc - autoconf diff --git a/conda-reqs/circt.json b/conda-reqs/circt.json new file mode 100644 index 00000000..1109fac4 --- /dev/null +++ b/conda-reqs/circt.json @@ -0,0 +1,3 @@ +{ + "version": "firtool-1.58.0" +} diff --git a/conda-reqs/install-circt b/conda-reqs/install-circt new file mode 160000 index 00000000..3f8dda6e --- /dev/null +++ b/conda-reqs/install-circt @@ -0,0 +1 @@ +Subproject commit 3f8dda6e1c1965537b5801a43c81c287bac4eae4 diff --git a/scripts/build-setup.sh b/scripts/build-setup.sh index 2c682514..c312c155 100755 --- a/scripts/build-setup.sh +++ b/scripts/build-setup.sh @@ -152,6 +152,44 @@ if run_step "1"; then source $CYDIR/.conda-env/etc/profile.d/conda.sh && conda activate $CYDIR/.conda-env exit_if_last_command_failed + + # Conda Setup + # Provide a sourceable snippet that can be used in subshells that may not have + # inhereted conda functions that would be brought in under a login shell that + # has run conda init (e.g., VSCode, CI) + read -r -d '\0' CONDA_ACTIVATE_PREAMBLE <<'END_CONDA_ACTIVATE' +if ! type conda >& /dev/null; then + echo "::ERROR:: you must have conda in your environment first" + return 1 # don't want to exit here because this file is sourced +fi + +# if we're sourcing this in a sub process that has conda in the PATH but not as a function, init it again +conda activate --help >& /dev/null || source $(conda info --base)/etc/profile.d/conda.sh +\0 +END_CONDA_ACTIVATE + + replace_content env.sh build-setup-conda "# line auto-generated by $0 +$CONDA_ACTIVATE_PREAMBLE +conda activate $CYDIR/.conda-env +source $CYDIR/scripts/fix-open-files.sh" + + # install circt + CIRCT_INSTALL_DIR=$CYDIR/.circt + rm -rf $CIRCT_INSTALL_DIR + $CYDIR/conda-reqs/install-circt/bin/download-release-or-nightly-circt.sh \ + -f circt-full-shared-linux-x64.tar.gz \ + -i $CIRCT_INSTALL_DIR \ + -x $CYDIR/conda-reqs/circt.json \ + -g null + + replace_content env.sh build-setup-circt "# line auto-generated by $0 +if [ -d "${CIRCT_INSTALL_DIR}/bin" ] && [[ ":$PATH:" != *":${CIRCT_INSTALL_DIR}/bin:"* ]]; then + PATH="${PATH:+"$PATH:"}${CIRCT_INSTALL_DIR}/bin" +fi +if [ -d "${CIRCT_INSTALL_DIR}/lib" ] && [[ ":$LD_LIBRARY_PATH:" != *":${CIRCT_INSTALL_DIR}/lib:"* ]]; then + LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+"$LD_LIBRARY_PATH:"}${CIRCT_INSTALL_DIR}/lib" +fi +" fi if [ -z "$FORCE_FLAG" ]; then @@ -250,26 +288,6 @@ if run_step "10"; then exit_if_last_command_failed fi -# Conda Setup -# Provide a sourceable snippet that can be used in subshells that may not have -# inhereted conda functions that would be brought in under a login shell that -# has run conda init (e.g., VSCode, CI) -read -r -d '\0' CONDA_ACTIVATE_PREAMBLE <<'END_CONDA_ACTIVATE' -if ! type conda >& /dev/null; then - echo "::ERROR:: you must have conda in your environment first" - return 1 # don't want to exit here because this file is sourced -fi - -# if we're sourcing this in a sub process that has conda in the PATH but not as a function, init it again -conda activate --help >& /dev/null || source $(conda info --base)/etc/profile.d/conda.sh -\0 -END_CONDA_ACTIVATE - -replace_content env.sh build-setup "# line auto-generated by $0 -$CONDA_ACTIVATE_PREAMBLE -conda activate $CYDIR/.conda-env -source $CYDIR/scripts/fix-open-files.sh" - echo "Setup complete!" } 2>&1 | tee build-setup.log