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

[FLANG-classic] rename flang-legacy to flang-classic and llvm-legacy … #1164

Open
wants to merge 1 commit into
base: aomp-dev
Choose a base branch
from
Open
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
7 changes: 4 additions & 3 deletions bin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ each component build script with the name build_\<component name\>.sh .
| extras | aomp-dev | $HOME/git/aomp20.0/aomp-extras | [aomp-extras](https://github.com/ROCm/aomp-extras)
| flang | aomp-dev | $HOME/git/aomp20.0/flang | [flang](https://github.com/ROCm/flang)
| pgmath | aomp-dev | $HOME/git/aomp20.0/flang/runtime/libpgmath | [flang](https://github.com/ROCm/flang)
| flang-legacy | aomp-dev | $HOME/git/aomp20.0/flang/flang-legacy/17.0-4 | [flang](https://github.com/ROCm/flang/flang-legacy/17.0-4/llvm-legacy)
| llvm-classic | aomp-dev | $HOME/git/aomp20.0/flang/flang-classic/17.0-4/llvm-classic | [flang](https://github.com/ROCm/flang/flang-classic/17.0-4/llvm-classic)
| flang-classic | aomp-dev | $HOME/git/aomp20.0/flang/flang-classic/17.0-4 | [flang](https://github.com/ROCm/flang/flang-classic/17.0-4)
| flang_runtime | aomp-dev | $HOME/git/aomp20.0/flang | [flang](https://github.com/ROCm/flang)
|| | |
| roct |Latest ROCm| $HOME/git/aomp20.0/roct-thunk-interfaces | [roct-thunk-interfaces](https://github.com/ROCm/roct-thunk-interface)
Expand Down Expand Up @@ -237,8 +238,8 @@ any fails occur.
./build_comgr.sh install
./build_rocminfo.sh
./build_rocminfo.sh install
./build_flang-legacy.sh
./build_flang-legacy.sh install
./build_flang-classic.sh
./build_flang-classic.sh install
./build_pgmath.sh
./build_pgmath.sh install
./build_flang.sh
Expand Down
12 changes: 6 additions & 6 deletions bin/aomp_common_vars
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fi

AOMP_SKIP_FLANG=${AOMP_SKIP_FLANG:-0}
AOMP_SKIP_FLANG_NEW=${AOMP_SKIP_FLANG_NEW:-0}
AOMP_FLANG_DRIVER=${AOMP_FLANG_DRIVER:-flang-legacy}
AOMP_FLANG_DRIVER=${AOMP_FLANG_DRIVER:-flang-classic}

if [ "$AOMP_SKIP_FLANG" == 1 ] || [ "$AOMP_SKIP_FLANG_NEW" == 1 ] ; then
AOMP_PROJECTS_LIST=${AOMP_PROJECTS_LIST:-"clang;lld;clang-tools-extra"}
Expand Down Expand Up @@ -326,12 +326,12 @@ AOMP_EXTRAS_REPO_NAME=${AOMP_EXTRAS_REPO_NAME:-aomp-extras}
AOMP_FLANG_REPO_NAME=${AOMP_FLANG_REPO_NAME:-flang}

# Last version of rocm (5.5) that supports the legacy driver (command generation)
# The archives are built during flang-legacy.
AOMP_FLANG_LEGACY_REL=${AOMP_FLANG_LEGACY_REL:-${AOMP_REPOS}/${AOMP_FLANG_REPO_NAME}/flang-legacy}
if [ -d $AOMP_FLANG_LEGACY_REL/llvm-legacy ] ; then
AOMP_BUILD_FLANG_LEGACY=1
# The archives are built during flang-classic.
AOMP_FLANG_CLASSIC_REL=${AOMP_FLANG_CLASSIC_REL:-${AOMP_REPOS}/${AOMP_FLANG_REPO_NAME}/flang-classic}
if [ -d $AOMP_FLANG_CLASSIC_REL/llvm-classic ] ; then
AOMP_BUILD_FLANG_CLASSIC=1
else
AOMP_BUILD_FLANG_LEGACY=0
AOMP_BUILD_FLANG_CLASSIC=0
fi

# The AOMP_XXX_REPO_NAME is the directory name following $AOMP_REPOS.
Expand Down
16 changes: 8 additions & 8 deletions bin/build_aomp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ if [ "$AOMP_STANDALONE_BUILD" == 1 ] ; then
if [ "$_hostarch" == "x86_64" ] ; then
# These components build on x86_64, so add them to components list
if [ "$AOMP_SKIP_FLANG" == 0 ] ; then
components="$components llvm-legacy flang-legacy pgmath flang flang_runtime"
components="$components llvm-classic flang-classic pgmath flang flang_runtime"
fi
#components="$components hipfort"
components="$components hipcc hipamd "
Expand All @@ -136,10 +136,10 @@ else
if [ -f "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload/CMakeLists.txt" ]; then
components="$components offload"
fi
if [ "$SANITIZER" == 1 ] && [ -f $AOMP/bin/flang-legacy ] ; then
if [ "$SANITIZER" == 1 ] && [ -f $AOMP/bin/flang-classic ] ; then
components="$components pgmath flang flang_runtime"
else
components="$components llvm-legacy flang-legacy pgmath flang flang_runtime"
components="$components llvm-classic flang-classic pgmath flang flang_runtime"
fi
fi
echo "COMPONENTS:$components"
Expand Down Expand Up @@ -187,7 +187,7 @@ for COMPONENT in $components ; do
echo " ================= DONE INSTALLING COMPONENT $COMPONENT ==================="
done

echo "------ Linking flang-new or flang-legacy to flang -------"
echo "------ Linking flang-new or flang-classic to flang -------"
if [ -L $LLVM_INSTALL_LOC/bin/flang ] ; then
$SUDO rm $LLVM_INSTALL_LOC/bin/flang
fi
Expand All @@ -206,8 +206,8 @@ echo

if [ "$AOMP_STANDALONE_BUILD" -eq 0 ]; then
cd $BUILD_DIR/build
legacy_version=`ls flang-legacy`
legacy_install_manifest=$legacy_version/install_manifest.txt
classic_version=`ls flang-classic`
classic_install_manifest=$classic_version/install_manifest.txt
if [ "$SANITIZER" == 1 ]; then
install_manifest_orig=asan/install_manifest.txt
else
Expand All @@ -219,8 +219,8 @@ if [ "$AOMP_STANDALONE_BUILD" -eq 0 ]; then

for directory in ./*/; do
pushd $directory > /dev/null
if [[ "$directory" =~ "flang-legacy" ]]; then
install_manifest=$legacy_install_manifest
if [[ "$directory" =~ "flang-classic" ]]; then
install_manifest=$classic_install_manifest
else
install_manifest=$install_manifest_orig
fi
Expand Down
56 changes: 28 additions & 28 deletions bin/build_flang-legacy.sh → bin/build_flang-classic.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash
#
# build_flang-legacy.sh: Script to build the legacy flang binary driver
# build_flang-classic.sh: Script to build the flang-classic binary driver
# This driver will never call flang -fc1, it only calls binaries
# clang, flang1, flang2, build elsewhere
# Instead of downloading the ROCm 5.5 llvm package we have to
# compile the 11vm/clang libs from source to support various
# operating systems and spack. This will be the llvm-legacy build step.
# operating systems and spack. This will be the llvm-classic build step.
# These libs/headers are not installed and will picked up from the build
# tree for flang-legacy.
# tree for flang-classic.
#
BUILD_TYPE=${BUILD_TYPE:-Release}

Expand All @@ -17,10 +17,10 @@ thisdir=`dirname $realpath`
. $thisdir/aomp_common_vars
# --- end standard header ----

if [ $AOMP_BUILD_FLANG_LEGACY == 0 ] ; then
if [ $AOMP_BUILD_FLANG_CLASSIC == 0 ] ; then
if [ "$1" != "install" ] ; then
echo "WARNING: ROCM install for $AOMP_FLANG_LEGACY_REL/llvm-legacy not found."
echo " This build will skip build of flang-legacy."
echo "WARNING: ROCM install for $AOMP_FLANG_CLASSIC_REL/llvm-classic not found."
echo " This build will skip build of flang-classic."
echo " The flang will link to the clang driver."
fi
exit
Expand All @@ -45,19 +45,19 @@ else
_cxx_flag=""
fi

# We need a version of ROCM llvm that supports legacy flang
# We need a version of ROCM llvm that supports flang-classic
# via the link from flang to clang. rocm 5.5 would be best.
# This will enable removal of legacy flang driver support
# This will enable removal of flang-classic driver support
# from clang to make way for flang-new.

# Options for llvm-legacy cmake.
# Options for llvm-classic cmake.
TARGETS_TO_BUILD="AMDGPU;X86"

# Do not change the AOMP_LFL_DIR default because it is the subdirectory
# from where we build the flang-legacy driver binary. This is the
# from where we build the flang-classic driver binary. This is the
# Last Frozen LLVM (LFL) for which there is amd-only clang driver support
# for flang. Originally there was no subdirectory for LFL so setting
# AOMP_LFL_DIR to "/" would build flang-legacy with the original
# AOMP_LFL_DIR to "/" would build flang-classic with the original
# ROCm 5.6 sources.
AOMP_LFL_DIR=${AOMP_LFL_DIR:-"17.0-4"}
# comment out above line and uncomment next line for new LFL
Expand Down Expand Up @@ -111,30 +111,30 @@ shopt -s extglob

if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
echo
echo "This is a FRESH START. ERASING any previous builds in $BUILD_DIR/build/flang-legacy/$AOMP_LFL_DIR"
echo "This is a FRESH START. ERASING any previous builds in $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR"
echo "Use ""$0 nocmake"" or ""$0 install"" to avoid FRESH START."
if [ -d "$BUILD_DIR/build/flang-legacy/$AOMP_LFL_DIR" ]; then
if [ -d "$BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR" ]; then
# This needs extglob enabled, as set above.
rm -rf "$BUILD_DIR/build/flang-legacy/$AOMP_LFL_DIR"/!("llvm-legacy")
rm -rf "$BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR"/!("llvm-classic")
else
echo "ERROR: Build llvm-legacy before flang-legacy."
echo "ERROR: Build llvm-classic before flang-classic."
exit 1
fi
else
if [ ! -d $BUILD_DIR/build/flang-legacy/$AOMP_LFL_DIR ] ; then
echo "ERROR: The build directory $BUILD_DIR/build/flang-legacy/$AOMP_LFL_DIR does not exist"
if [ ! -d $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR ] ; then
echo "ERROR: The build directory $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR does not exist"
echo " run $0 without nocmake or install options. "
exit 1
fi
fi

echo
# Cmake flang-legacy.
# Cmake flang-classic.
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
cd $BUILD_DIR/build/flang-legacy/$AOMP_LFL_DIR
cd $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR
echo " -----Running cmake ---- "
echo ${AOMP_CMAKE} $MYCMAKEOPTS $AOMP_REPOS/$AOMP_FLANG_REPO_NAME/flang-legacy/$AOMP_LFL_DIR
${AOMP_CMAKE} $MYCMAKEOPTS $AOMP_REPOS/$AOMP_FLANG_REPO_NAME/flang-legacy/$AOMP_LFL_DIR 2>&1
echo ${AOMP_CMAKE} $MYCMAKEOPTS $AOMP_REPOS/$AOMP_FLANG_REPO_NAME/flang-classic/$AOMP_LFL_DIR
${AOMP_CMAKE} $MYCMAKEOPTS $AOMP_REPOS/$AOMP_FLANG_REPO_NAME/flang-classic/$AOMP_LFL_DIR 2>&1
if [ $? != 0 ] ; then
echo "ERROR cmake failed. Cmake flags"
echo " $MYCMAKEOPTS"
Expand All @@ -148,15 +148,15 @@ fi

echo

# Build flang-legacy.
echo " --- Running $AOMP_NINJA_BIN for $BUILD_DIR/build/flang-legacy/$AOMP_LFL_DIR ---- "
cd $BUILD_DIR/build/flang-legacy/$AOMP_LFL_DIR
# Build flang-classic.
echo " --- Running $AOMP_NINJA_BIN for $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR ---- "
cd $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR
$AOMP_NINJA_BIN -j $AOMP_JOB_THREADS
if [ $? != 0 ] ; then
echo " "
echo "ERROR: $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
echo " cd $BUILD_DIR/build/flang-legacy/$AOMP_LFL_DIR"
echo " cd $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR"
echo " $AOMP_NINJA_BIN"
exit 1
fi
Expand All @@ -168,13 +168,13 @@ if [ "$1" == "install" ] ; then
echo "ERROR make install failed "
exit 1
fi
if [ $AOMP_BUILD_FLANG_LEGACY == 1 ] ; then
echo "------ Linking flang-legacy to flang -------"
if [ $AOMP_BUILD_FLANG_CLASSIC == 1 ] ; then
echo "------ Linking flang-classic to flang -------"
if [ -L $AOMP_INSTALL_DIR/bin/flang ] ; then
$SUDO rm $AOMP_INSTALL_DIR/bin/flang
fi
cd $LLVM_INSTALL_LOC/bin
$SUDO ln -sf flang-legacy flang
$SUDO ln -sf flang-classic flang
fi
echo
echo "SUCCESSFUL INSTALL to $AOMP_INSTALL_DIR"
Expand Down
52 changes: 26 additions & 26 deletions bin/build_llvm-legacy.sh → bin/build_llvm-classic.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash
#
# build_llvm-legacy.sh: Script to build the legacy LLVM used by flang-legacy. binary driver
# build_llvm-classic.sh: Script to build the classic LLVM used by flang-classic. binary driver
# This driver will never call flang -fc1, it only calls binaries
# clang, flang1, flang2, built elsewhere
# Instead of downloading the ROCm 5.5 llvm package we have to
# compile the 11vm/clang libs from source to support various
# operating systems and spack. This will be the llvm-legacy build step.
# operating systems and spack. This will be the llvm-classic build step.
# These libs/headers are not installed and will picked up from the build
# tree for flang-legacy.
# tree for flang-classic.
#
BUILD_TYPE=${BUILD_TYPE:-Release}

Expand All @@ -17,10 +17,10 @@ thisdir=`dirname $realpath`
. $thisdir/aomp_common_vars
# --- end standard header ----

if [ $AOMP_BUILD_FLANG_LEGACY == 0 ] ; then
if [ $AOMP_BUILD_FLANG_CLASSIC == 0 ] ; then
if [ "$1" != "install" ] ; then
echo "WARNING: ROCM install for $AOMP_FLANG_LEGACY_REL/llvm-legacy not found."
echo " This build will skip build of flang-legacy."
echo "WARNING: ROCM install for $AOMP_FLANG_CLASSIC_REL/llvm-classic not found."
echo " This build will skip build of flang-classic."
echo " The flang will link to the clang driver."
fi
exit
Expand All @@ -47,23 +47,23 @@ fi

# Legacy Flang dosen't support building of compiler-rt so it
# utilizes the clang runtime libraries build/install using build_project.sh.
# The LLVM_VERSION_MAJOR of legacy flang driver has to match with the clang
# The LLVM_VERSION_MAJOR of classic flang driver has to match with the clang
# binaries generated from build_project.sh.
LLVM_VERSION_MAJOR=$(${LLVM_INSTALL_LOC}/bin/clang --version | grep -oP '(?<=clang version )[0-9]+')

# We need a version of ROCM llvm that supports legacy flang
# We need a version of ROCM llvm that supports flang-classic
# via the link from flang to clang. rocm 5.5 would be best.
# This will enable removal of legacy flang driver support
# This will enable removal of flang-classic driver support
# from clang to make way for flang-new.

# Options for llvm-legacy cmake.
# Options for llvm-classic cmake.
TARGETS_TO_BUILD="AMDGPU;X86"

# Do not change the AOMP_LFL_DIR default because it is the subdirectory
# from where we build the flang-legacy driver binary. This is the
# from where we build the flang-classic driver binary. This is the
# Last Frozen LLVM (LFL) for which there is amd-only clang driver support
# for flang. Originally there was no subdirectory for LFL so setting
# AOMP_LFL_DIR to "/" would build flang-legacy with the original
# AOMP_LFL_DIR to "/" would build flang-classic with the original
# ROCm 5.6 sources.
AOMP_LFL_DIR=${AOMP_LFL_DIR:-"17.0-4"}
# comment out above line and uncomment next line for new LFL
Expand Down Expand Up @@ -114,25 +114,25 @@ fi

if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
echo
echo "This is a FRESH START. ERASING any previous builds in $BUILD_DIR/build/flang-legacy/$AOMP_LFL_DIR"
echo "This is a FRESH START. ERASING any previous builds in $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR"
echo "Use ""$0 nocmake"" or ""$0 install"" to avoid FRESH START."
rm -rf $BUILD_DIR/build/flang-legacy/$AOMP_LFL_DIR/llvm-legacy
mkdir -p $BUILD_DIR/build/flang-legacy/$AOMP_LFL_DIR
mkdir -p $BUILD_DIR/build/flang-legacy/$AOMP_LFL_DIR/llvm-legacy
rm -rf $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR/llvm-classic
mkdir -p $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR
mkdir -p $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR/llvm-classic
else
if [ ! -d $BUILD_DIR/build/flang-legacy/$AOMP_LFL_DIR ] ; then
echo "ERROR: The build directory $BUILD_DIR/build/flang-legacy/$AOMP_LFL_DIR does not exist"
if [ ! -d $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR ] ; then
echo "ERROR: The build directory $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR does not exist"
echo " run $0 without nocmake or install options. "
exit 1
fi
fi

# Cmake for llvm legacy (ROCm 5.5).
# Cmake for llvm classic (ROCm 5.5).
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
cd $BUILD_DIR/build/flang-legacy/$AOMP_LFL_DIR/llvm-legacy
cd $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR/llvm-classic
echo " -----Running cmake ---- "
echo ${AOMP_CMAKE} $LLVMCMAKEOPTS $AOMP_REPOS/$AOMP_FLANG_REPO_NAME/flang-legacy/$AOMP_LFL_DIR/llvm-legacy/llvm
${AOMP_CMAKE} $LLVMCMAKEOPTS $AOMP_REPOS/$AOMP_FLANG_REPO_NAME/flang-legacy/$AOMP_LFL_DIR/llvm-legacy/llvm 2>&1
echo ${AOMP_CMAKE} $LLVMCMAKEOPTS $AOMP_REPOS/$AOMP_FLANG_REPO_NAME/flang-classic/$AOMP_LFL_DIR/llvm-classic/llvm
${AOMP_CMAKE} $LLVMCMAKEOPTS $AOMP_REPOS/$AOMP_FLANG_REPO_NAME/flang-classic/$AOMP_LFL_DIR/llvm-classic/llvm 2>&1
if [ $? != 0 ] ; then
echo "ERROR cmake failed. Cmake flags"
echo " $LLVMCMAKEOPTS"
Expand All @@ -145,15 +145,15 @@ if [ "$1" = "cmake" ]; then
exit 0
fi

# Build llvm legacy.
echo " --- Running $AOMP_NINJA_BIN for $BUILD_DIR/build/flang-legacy/$AOMP_LFL_DIR/llvm-legacy ---- "
cd $BUILD_DIR/build/flang-legacy/$AOMP_LFL_DIR/llvm-legacy
# Build llvm classic.
echo " --- Running $AOMP_NINJA_BIN for $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR/llvm-classic ---- "
cd $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR/llvm-classic
$AOMP_NINJA_BIN -j $AOMP_JOB_THREADS
if [ $? != 0 ] ; then
echo " "
echo "ERROR: $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
echo " cd $BUILD_DIR/build/flang-legacy/$AOMP_LFL_DIR/llvm-legacy"
echo " cd $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR/llvm-classic"
echo " $AOMP_NINJA_BIN"
exit 1
fi
3 changes: 2 additions & 1 deletion bin/build_project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,11 @@ MYCMAKEOPTS="-DCMAKE_BUILD_TYPE=$BUILD_TYPE
-DLIBOMP_USE_HWLOC=ON -DLIBOMP_HWLOC_INSTALL_DIR=$AOMP_SUPP/hwloc
-DOPENMP_ENABLE_LIBOMPTARGET=1
-DLIBOMP_SHARED_LINKER_FLAGS=-Wl,--disable-new-dtags
-DCLANG_LINK_FLANG_LEGACY=ON
-DLIBOMP_INSTALL_RPATH=$AOMP_ORIGIN_RPATH_LIST
-DLIBOMPTARGET_INSTALL_RPATH=$AOMP_ORIGIN_RPATH_LIST
-DLIBOMPTARGET_NO_SANITIZER_AMDGPU=1"

# -DCLANG_LINK_FLANG_LEGACY=ON

# Enable amdflang, amdclang, amdclang++, amdllvm.
# clang-tools-extra added to LLVM_ENABLE_PROJECTS above.
Expand Down
Loading