Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions srock-bin/README
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -62,16 +62,19 @@ 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.
Naturally, this is much faster the 2nd time following setup_srock.sh

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:
Expand All @@ -82,11 +85,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>
Expand All @@ -98,6 +101,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
Expand Down
59 changes: 40 additions & 19 deletions srock-bin/setup_srock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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 ))
Expand Down
Loading