From 3ba792c45ba3f580158868403483520a7fe3ee80 Mon Sep 17 00:00:00 2001 From: gregrodgers Date: Wed, 15 Apr 2026 08:28:24 -0500 Subject: [PATCH 1/3] [SROCK] fix minor typo in README --- srock-bin/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srock-bin/README b/srock-bin/README index 0755059d8..307b4f305 100644 --- a/srock-bin/README +++ b/srock-bin/README @@ -18,7 +18,7 @@ A: Run these commands: nohup ./setup_srock.sh & # setup takes awhile (10-20 mins) so using nohup is nice mv nohup.out nohup.out.setup - nohup ./post_setup_srock_build.sh & + nohup ./build_srock.sh & Q: How is this different than aomp? A: Aomp used a set of bash scripts that performed the cmake, make, and make install From f2e371ca8247956cec05f3116f226ea6670758b3 Mon Sep 17 00:00:00 2001 From: Julian Brown Date: Tue, 17 Mar 2026 12:53:46 -0500 Subject: [PATCH 2/3] [srock] Update srock-bin/README about incremental builds Document process for performing incremental builds of LLVM, noting the need to adjust the AOMP environment variable if doing so. --- srock-bin/README | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/srock-bin/README b/srock-bin/README index 307b4f305..cf0352c21 100644 --- a/srock-bin/README +++ b/srock-bin/README @@ -71,7 +71,8 @@ A: YES. This is useful if you have made development changes to any repository. Q: Is there a more incremental and faster way to rebuild the compiler? A: YES. One of the reasons build_srock.sh can be slow is that compiler changes - force a rebuild of rocgdb. To aovid this use ninja install, see step 8 and 9 below. + force a rebuild of rocgdb. To avoid this use ninja therock-dist from the + component build directory, see step 8 and 9 below. Q: What is the compiler development flow with srock? A: @@ -82,11 +83,11 @@ A: 5 cd $SROCK_REPOS/TheRock/compiler/amd-llvm 6 < make desired changes > 7 < Try incremental compile and install> -8 cd $SROCK_REPOS/TheRock/build/compiler/amd-llvm/build -9 ninja install +8 cd $SROCK_REPOS/TheRock/build/compiler/amd-llvm/build +9 ninja therock-dist 10 < if build fails, go to step 4> 11 < test your srock compiler. e.g.> -12 export AOMP=$HOME/rocm/srock +12 export AOMP=$SROCK_REPOS/TheRock/build/dist/rocm 13 cd $SROCK_REPOS/aomp/test/smoke 14 ./check_smoke.sh 15 < if fail, go to step 4> @@ -98,6 +99,11 @@ A: 21 git diff >$HOME/my.patch 22 < Apply my.patch to either trunk or downstream amd-staging branch > +Pay special attention to step 12: after an incremental rebuild, you should +set the AOMP environment variable to the build/dist/rocm directory in +TheRock's build tree, NOT to $HOME/rocm/srock as you may do after a full +"build_srock.sh" build. + Q: Why not just change the submodule file to point compiler repos to amd-staging branch? A: TheRock has frequent changes including submodule updates. The setup_srock.sh script correctly reintegrates these changes and then refixes the llvm-project and From 4d8762cf2e3dcbae8a1815b761fa4062e5724e3b Mon Sep 17 00:00:00 2001 From: Julian Brown Date: Mon, 16 Mar 2026 14:57:09 -0500 Subject: [PATCH 3/3] Add 'restart' option for setup_srock.sh As a convenience, this patch adds a "restart" option to setup_srock.sh in order to wipe out the build directory and reconfigure existing sources, without checking everything out from scratch again. This seems to work fine in light testing, but it may not do as expected in more complex scenarios. --- srock-bin/README | 6 ++-- srock-bin/setup_srock.sh | 59 +++++++++++++++++++++++++++------------- 2 files changed, 44 insertions(+), 21 deletions(-) diff --git a/srock-bin/README b/srock-bin/README index cf0352c21..9f60a1ecc 100644 --- a/srock-bin/README +++ b/srock-bin/README @@ -62,8 +62,10 @@ Link to install dir $HOME/rocm/aomp $HOME/ro Install env var $AOMP_INSTALL_DIR $SROCK_INSTALL_DIR Q: Can one rerun setup_srock.sh ? -A: NO. If you want to start from scratch, completely remove SROCK_THEROCK_DIR - which by default is /work/$USER/git/srock-repos/TheRock +A: YES, with the 'restart' option. If you want to start from scratch, including + re-fetching all sources, completely remove SROCK_THEROCK_DIR which by default + is /work/$USER/git/srock-repos/TheRock. To reconfigure with existing + downloaded sources instead, use "setup_srock.sh restart". Q: Can one rerun build_srock.sh ? A: YES. This is useful if you have made development changes to any repository. diff --git a/srock-bin/setup_srock.sh b/srock-bin/setup_srock.sh index ac4bcc53d..835d859f1 100755 --- a/srock-bin/setup_srock.sh +++ b/srock-bin/setup_srock.sh @@ -14,9 +14,14 @@ thisdir=$(dirname "$realpath") # --- end standard header ---- # -if [ -d "$SROCK_THEROCK_DIR" ] ; then +# Accept a single command as an argument. Only "restart" is accepted so far. +ARG=$1 + +if [ -d "$SROCK_THEROCK_DIR" ] && [ "$ARG" != "restart" ]; then echo " ERROR: $0 requires that $SROCK_THEROCK_DIR NOT exist" echo " Delete or move that directory to run $0" + echo " Alternatively, try '$0 restart' to reconfigure with" + echo " existing sources." exit 1 fi @@ -42,35 +47,51 @@ echo "===== Sourcing prebuild_srock.sh" . "$thisdir/prebuild_srock.sh" echo "===== DONE Sourcing prebuild_srock.sh" -cd "$SROCK_REPOS" || exit -echo -echo "===== git clone https://github.com/ROCm/TheRock.git -b $SROCK_THEROCK_BRANCH TheRock" -git clone https://github.com/ROCm/TheRock.git -b "$SROCK_THEROCK_BRANCH" TheRock -if [ -f TheRock/version.json ] ; then - _quoted=$(cat TheRock/version.json | grep rocm-version | cut -d: -f2) - _rocm_version=${_quoted//\"/} - echo " ROCm components version : $_rocm_version" - echo " SROCK_VERSION_STRING : $SROCK_VERSION_STRING (Compiler dev version)" +if [ "$ARG" != "restart" ]; then + cd "$SROCK_REPOS" || exit + echo + echo "===== git clone https://github.com/ROCm/TheRock.git -b $SROCK_THEROCK_BRANCH TheRock" + git clone https://github.com/ROCm/TheRock.git -b "$SROCK_THEROCK_BRANCH" TheRock + if [ -f TheRock/version.json ] ; then + _quoted=$(cat TheRock/version.json | grep rocm-version | cut -d: -f2) + _rocm_version=${_quoted//\"/} + echo " ROCm components version : $_rocm_version" + echo " SROCK_VERSION_STRING : $SROCK_VERSION_STRING (Compiler dev version)" + fi fi cd "$SROCK_THEROCK_DIR" || exit -if [ ! -d "$SROCK_THEROCK_DIR/.venv/bin" ] ; then +if [ -d "$SROCK_THEROCK_DIR/.venv/bin" ] ; then + echo + echo "===== Activating virtual environment =====" + cd "$SROCK_THEROCK_DIR" || exit + echo "source .venv/bin/activate" + source ".venv/bin/activate" +else echo echo "===== Building virtual environment in .venv and updating PATH =====" cd "$SROCK_THEROCK_DIR" || exit echo "python3 -m venv .venv && source .venv/bin/activate" # shellcheck disable=1091 python3 -m venv .venv && source ".venv/bin/activate" - echo "pip install -r requirements.txt" - pip install -r requirements.txt fi +echo "pip install -r requirements.txt" +pip install -r requirements.txt export PATH=$SROCK_THEROCK_DIR/.venv/bin:$PATH -echo -echo "===== Running python ./build_tools/fetch_sources.py =====" -python ./build_tools/fetch_sources.py -echo "===== Done running python ./build_tools/fetch_sources.py" +if [ "$ARG" != "restart" ]; then + echo + echo "===== Running python ./build_tools/fetch_sources.py =====" + python ./build_tools/fetch_sources.py + echo "===== Done running python ./build_tools/fetch_sources.py" +fi + +if [ "$ARG" = "restart" ]; then + echo "==== Removing build dir for restart =====" + echo "rm -rf $SROCK_THEROCK_DIR/build" + rm -rf "$SROCK_THEROCK_DIR/build" +fi echo "cd $SROCK_THEROCK_DIR" cd "$SROCK_THEROCK_DIR" || exit @@ -81,7 +102,7 @@ echo "===== Running build_tools/setup_ccache.py" eval "$(python3 ./build_tools/setup_ccache.py)" # Make updates to compiler submodules unless this is native TheRock build -if [ "$SROCK_COMPILER_BRANCH" != "develop" ] ; then +if [ "$SROCK_COMPILER_BRANCH" != "develop" ] && [ "$ARG" != "restart" ]; then # FIXME: Before wiping out current amd-staging changes, # to save current changes in the patches directory. # Otherwise, this is not a real development environment" @@ -147,13 +168,13 @@ if [ "$SROCK_COMPILER_BRANCH" != "develop" ] ; then fi echo " --- end compiler submodule updates for $SROCK_COMPILER_BRANCH" +fi cd "$SROCK_THEROCK_DIR" || exit echo echo "===== cmake CMD: $SROCK_CMAKE ${_cmake_args[*]}" $SROCK_CMAKE "${_cmake_args[@]}" _rc=$? && [ "$_rc" != 0 ] && cd "$_curdir" && exit "$_rc" -fi _setup_secs=$(date +%s) _secs_to_setup=$(( _setup_secs - _start_secs ))