From 9c0956016d70e19303dd047f969fc38ef83e2909 Mon Sep 17 00:00:00 2001 From: Lynd Stringer Date: Thu, 17 Sep 2026 23:49:57 -0500 Subject: [PATCH 01/23] Fix for launch_latency. --- test/smoke-limbo/launch_latency/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/smoke-limbo/launch_latency/Makefile b/test/smoke-limbo/launch_latency/Makefile index 0fe4ada40f..b383d51d3b 100644 --- a/test/smoke-limbo/launch_latency/Makefile +++ b/test/smoke-limbo/launch_latency/Makefile @@ -9,7 +9,7 @@ CLANG ?= clang OMP_BIN = $(AOMP)/bin/$(CLANG) CC = $(OMP_BIN) $(VERBOSE) RUNENV = ulimit -s unlimited; -RUNCMD = $(AOMPHIP)/bin/rocprofv3 --output-format csv --kernel-trace --stats -- ./$(TESTNAME) && python3 printLatency.py +RUNCMD = $(AOMPHIP)/bin/rocprofv3 --output-format csv --kernel-trace --stats -- ./$(TESTNAME) 2>/dev/null && python3 printLatency.py #-ccc-print-phases #"-\#\#\#" From 2b6b810ffd707109feba2069a0cbdbe30b0f71e1 Mon Sep 17 00:00:00 2001 From: Lynd Stringer Date: Mon, 21 Sep 2026 10:35:08 -0500 Subject: [PATCH 02/23] Added a log file to rocprofv3. --- test/smoke-limbo/launch_latency/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/smoke-limbo/launch_latency/Makefile b/test/smoke-limbo/launch_latency/Makefile index b383d51d3b..2277bb1c27 100644 --- a/test/smoke-limbo/launch_latency/Makefile +++ b/test/smoke-limbo/launch_latency/Makefile @@ -9,7 +9,7 @@ CLANG ?= clang OMP_BIN = $(AOMP)/bin/$(CLANG) CC = $(OMP_BIN) $(VERBOSE) RUNENV = ulimit -s unlimited; -RUNCMD = $(AOMPHIP)/bin/rocprofv3 --output-format csv --kernel-trace --stats -- ./$(TESTNAME) 2>/dev/null && python3 printLatency.py +RUNCMD = $(AOMPHIP)/bin/rocprofv3 --output-format csv --kernel-trace --stats -- ./$(TESTNAME) 2> ./rocprofv3.log && python3 printLatency.py #-ccc-print-phases #"-\#\#\#" From 49781782e3feac22df75d243571624232a3428fa Mon Sep 17 00:00:00 2001 From: estewart08 Date: Mon, 21 Sep 2026 10:41:33 -0500 Subject: [PATCH 03/23] [build] - Add build of rocm_sysdeps (#2545) * [build] - Add build of rocm_sysdeps TheRock builds and ships some dependencies. Currently AOMP is only doing this for libdrm/libdrm_amdgpu. This PR adds build_rocm_sysdeps.sh, which builds right after prereq in the component list. * [rocm_sysdeps] - Fix shellcheck issues * [build] - move rocsmilib and hwloc build to rocm_sysdeps - rocmsmilib is dependent on libdrm and hwloc is dependent on rocmsmilib. These are now invoked at the end of build_rocm_sysdeps.sh after libdrm is built from source. - Updated rocmsmilib version to 10.0 - Pass CMAKE_PREFIX_PATH=$ROCM_SYSDEPS_PATH to rocmsmilib * [build] - Update PREFIX_PATH in build_rocr.sh to include rocm_sysdeps * [build] - Update rocprofiler-sdk, rocm_smi_lib, amdsmi scripts with libdrm support Two patches are needed for rocprofiler-sdk and rocm-smi to properly detect the libdrm shipped with AOMP. These issues are not seen in TheRock because they use 'include_directories(/path/to/libdrm/include)'. --- bin/aomp_common_vars | 8 +- bin/build_amdsmi.sh | 5 +- bin/build_rocm_smi_lib.sh | 5 +- bin/build_rocm_sysdeps.sh | 149 ++++++++++++++++++ bin/build_rocprofiler-sdk.sh | 5 +- bin/build_rocr.sh | 6 +- bin/build_supp.sh | 22 ++- bin/patches/patch-control-file_24.0.txt | 2 +- ...systems-rocm-smi-drm-example-include.patch | 12 ++ ...-systems-rocprofiler-sdk-drm-include.patch | 12 ++ 10 files changed, 207 insertions(+), 19 deletions(-) create mode 100755 bin/build_rocm_sysdeps.sh create mode 100644 bin/patches/rocm-systems-rocm-smi-drm-example-include.patch create mode 100644 bin/patches/rocm-systems-rocprofiler-sdk-drm-include.patch diff --git a/bin/aomp_common_vars b/bin/aomp_common_vars index 7511bf71c7..4d1e5a5e00 100644 --- a/bin/aomp_common_vars +++ b/bin/aomp_common_vars @@ -105,7 +105,7 @@ if [ "$AOMP_SKIP_FLANG_NEW" == 1 ] ; then else AOMP_PROJECTS_LIST=${AOMP_PROJECTS_LIST:-"clang;lld;clang-tools-extra;flang"} fi -AOMP_COMPONENT_LIST=${AOMP_COMPONENT_LIST:-"prereq project"} +AOMP_COMPONENT_LIST=${AOMP_COMPONENT_LIST:-"prereq rocm_sysdeps project"} # AOMP_SUPP is for SUPPlemental software components needed for testing. # such as openmpi, hdf5, and silo. Applications that need supplemental @@ -279,11 +279,11 @@ function shquot() { # AOMP_DEBUG_ORIGIN_RPATH, AOMP_ASAN_ORIGIN_RPATH, or OPENMP_EXTRAS_LIB_RPATH. # Spliting options with AOMP_ORIGIN_NO_DTAGS is no longer necessary. -AOMP_ORIGIN_RPATH_LIST="\$ORIGIN:\$ORIGIN/../lib:\$ORIGIN/../lib64:\$ORIGIN/../../../lib:\$ORIGIN/../llvm/lib" +AOMP_ORIGIN_RPATH_LIST="\$ORIGIN:\$ORIGIN/../lib:\$ORIGIN/../lib64:\$ORIGIN/../../../lib:\$ORIGIN/../llvm/lib:\$ORIGIN/../rocm_sysdeps/lib:\$ORIGIN/../../rocm_sysdeps/lib" AOMP_ORIGIN_RPATH=(-DCMAKE_SHARED_LINKER_FLAGS='-Wl,--disable-new-dtags' -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON -DCMAKE_INSTALL_RPATH="$AOMP_ORIGIN_RPATH_LIST") -AOMP_DEBUG_ORIGIN_RPATH_LIST="\$ORIGIN:\$ORIGIN/../lib-debug:\$ORIGIN/../lib64:\$ORIGIN/../../../lib-debug" +AOMP_DEBUG_ORIGIN_RPATH_LIST="\$ORIGIN:\$ORIGIN/../lib-debug:\$ORIGIN/../lib64:\$ORIGIN/../../../lib-debug:\$ORIGIN/../rocm_sysdeps/lib:\$ORIGIN/../../rocm_sysdeps/lib" AOMP_DEBUG_ORIGIN_RPATH=(-DCMAKE_SHARED_LINKER_FLAGS='-Wl,--disable-new-dtags' -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON -DCMAKE_INSTALL_RPATH="$AOMP_DEBUG_ORIGIN_RPATH_LIST") @@ -291,7 +291,7 @@ AOMP_DEBUG_ORIGIN_RPATH=(-DCMAKE_SHARED_LINKER_FLAGS='-Wl,--disable-new-dtags' # Libraries and Binaries need different RUNPATH as below if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then ## Below 3 lines are actually only required for AOMP ASan RPATH Cmake configuration. - AOMP_ASAN_ORIGIN_RPATH_LIST="\$ORIGIN:\$ORIGIN/../../lib:\$ORIGIN/../lib:\$ORIGIN/../lib64:\$ORIGIN/../../../../lib/asan:\$ORIGIN/../lib/llvm" + AOMP_ASAN_ORIGIN_RPATH_LIST="\$ORIGIN:\$ORIGIN/../../lib:\$ORIGIN/../lib:\$ORIGIN/../lib64:\$ORIGIN/../../../../lib/asan:\$ORIGIN/../lib/llvm:\$ORIGIN/../rocm_sysdeps/lib:\$ORIGIN/../../rocm_sysdeps/lib" AOMP_ASAN_ORIGIN_RPATH=(-DCMAKE_SHARED_LINKER_FLAGS='-Wl,--disable-new-dtags' -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=OFF -DCMAKE_INSTALL_RPATH="$AOMP_ASAN_ORIGIN_RPATH_LIST") diff --git a/bin/build_amdsmi.sh b/bin/build_amdsmi.sh index 9429c0d230..e1725b1a89 100755 --- a/bin/build_amdsmi.sh +++ b/bin/build_amdsmi.sh @@ -65,7 +65,7 @@ fi check_writable_installdir "$1" "$AOMP_INSTALL_DIR" -patchrepo "$AOMP_REPOS/amdsmi" +patchrepo "$AOMP_REPOS/rocm-systems" if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then if [ -d "$BUILD_DIR/build/amdsmi" ] ; then @@ -79,6 +79,7 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then MYCMAKEOPTS=("${AOMP_ORIGIN_RPATH[@]}" -DCMAKE_BUILD_TYPE="$BUILDTYPE" -DCMAKE_INSTALL_PREFIX="$AOMP_INSTALL_DIR" + -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/rocm_sysdeps" -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_INSTALL_RPATH="\$ORIGIN/../lib" -DCMAKE_EXE_LINKER_FLAGS='-Wl,--disable-new-dtags') @@ -129,5 +130,5 @@ if [ "$1" == "install" ] ; then echo "ERROR make install failed " exit 1 fi - removepatch "$AOMP_REPOS/amdsmi" + removepatch "$AOMP_REPOS/rocm-systems" fi diff --git a/bin/build_rocm_smi_lib.sh b/bin/build_rocm_smi_lib.sh index 38b552a97b..0f2a5b1f4f 100755 --- a/bin/build_rocm_smi_lib.sh +++ b/bin/build_rocm_smi_lib.sh @@ -65,7 +65,7 @@ fi check_writable_installdir "$1" "$AOMP_INSTALL_DIR" -patchrepo "$AOMP_REPOS/rocm_smi_lib" +patchrepo "$AOMP_REPOS/rocm-systems" if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then if [ -d "$BUILD_DIR/build/rocm_smi_lib" ] ; then @@ -79,6 +79,7 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then MYCMAKEOPTS=("${AOMP_ORIGIN_RPATH[@]}" -DCMAKE_BUILD_TYPE="$BUILDTYPE" -DCMAKE_INSTALL_PREFIX="$AOMP_INSTALL_DIR" + -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/rocm_sysdeps" -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_INSTALL_RPATH="\$ORIGIN/../lib" -DCMAKE_EXE_LINKER_FLAGS='-Wl,--disable-new-dtags') @@ -130,5 +131,5 @@ if [ "$1" == "install" ] ; then echo "ERROR make install failed " exit 1 fi - removepatch "$AOMP_REPOS/rocm_smi_lib" + removepatch "$AOMP_REPOS/rocm-systems" fi diff --git a/bin/build_rocm_sysdeps.sh b/bin/build_rocm_sysdeps.sh new file mode 100755 index 0000000000..190d68cd27 --- /dev/null +++ b/bin/build_rocm_sysdeps.sh @@ -0,0 +1,149 @@ +#!/bin/bash +# +# build_rocm_sysdeps.sh: Script to build the rocm runtime and install into the +# aomp compiler installation +# Requires that "build_roct.sh install" be installed first +# + +# --- Start standard header to set AOMP environment variables ---- +realpath=$(realpath "$0") +thisdir=$(dirname "$realpath") +. "$thisdir/aomp_common_vars" +# --- end standard header ---- + +set -eo pipefail +set -E + +# Error Handling +cmd_error(){ + echo "Error: build_rocm_sysdeps.sh failed" + exit 1 +} + +trap cmd_error ERR + +INSTALL_ROCM_SYSDEPS=${INSTALL_ROCM_SYSDEPS:-$AOMP_INSTALL_DIR/rocm_sysdeps} +ROCM_SYSDEPS_LIST=${ROCM_SYSDEPS_LIST:-libdrm} +BUILD_DIR=$BUILD_AOMP/build/rocm_sysdeps + +if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then + echo " " + echo " This script builds the ROCM sysdeps libraries" + echo " It gets the source from: Functions in this script" + echo " It builds libraries in: $BUILD_AOMP/build/rocm_sysdeps" + echo " It installs in: $INSTALL_ROCM_SYSDEPS" + echo " " + echo "Example commands and actions: " + echo " ./build_rocm_sysdeps.sh cmake, make , NO Install " + echo " ./build_rocm_sysdeps.sh install NO Cmake, make , INSTALL" + echo " " + echo "To build aomp, see the README file in this directory" + echo " " + exit +fi + +check_writable_installdir "$1" "$INSTALL_ROCM_SYSDEPS" + +############################################################################################### +# TheRock ships libdrm in rocm_sysdeps and therefore will not invoke a system install of libdrm. +# AOMP needs this library shipped with the install to satisfy dlopen of libhsa. +############################################################################################### + +function buildlibdrm(){ + _cname="libdrm" + _version="2.4.134" + _installdir="$INSTALL_ROCM_SYSDEPS" + _builddir="$BUILD_DIR/$_cname" + _patcheddir="$BUILD_DIR/$_cname-patched" + _srcdir="$_builddir/$_cname-$_cname-$_version" + TARBALL_URL="https://rocm-third-party-deps.s3.us-east-2.amazonaws.com/libdrm-libdrm-${_version}.tar.bz2" + THEROCK=https://raw.githubusercontent.com/ROCm/TheRock/main/third-party/sysdeps/linux/libdrm + AMDGPU_IDS="$_patcheddir/data/amdgpu.ids" + + if [ "$1" != "install" ]; then + if [ -d "$_builddir" ] ; then + rm -rf "$_builddir" + fi + mkdir -p "$_builddir" + cd "$_builddir" + + wget $THEROCK/inline_amdgpu_ids.sh + chmod +x inline_amdgpu_ids.sh + wget "$TARBALL_URL" + tar -xf $_cname-$_cname-$_version.tar.bz2 + # Need to copy to patch directory or inline_amdgpu_ids.sh complains about patching source + cp -a "$_srcdir" "$_patcheddir" + + # Patch libdrm source with additional amdgpu ids + cat >> "$AMDGPU_IDS" << 'EOF' +7590, C0, AMD Radeon RX 9060 XT +7590, CF, AMD Radeon RX 9050 +7590, DF, AMD Radeon RX 9050 4GB +744B, 00, AMD Radeon PRO W7900D +75A0, 00, AMD Instinct MI350X +75A3, 00, AMD Instinct MI355X +75B0, 00, AMD Instinct MI350X VF +75B3, 00, AMD Instinct MI355X VF +75A8, 00, AMD Instinct MI350P +7551, C1, AMD Radeon AI Pro R9700S +7551, C8, AMD Radeon AI Pro R9600D +EOF + + "$_builddir"/inline_amdgpu_ids.sh "$_patcheddir" + cd "$_cname-$_cname-$_version" + # Configure libdrm + meson setup "$_builddir" "$_patcheddir" \ + --prefix "$_installdir" \ + -Dpkgconfig.relocatable=true \ + -Dlibdir=lib \ + -Damdgpu=enabled \ + -Dintel=disabled \ + -Dman-pages=disabled \ + -Dnouveau=disabled \ + -Dradeon=disabled \ + -Dvmwgfx=disabled + + # Build libdrm + meson compile -C "$_builddir" --verbose + fi + if [ "$1" == "install" ]; then + meson install -C "$_builddir" + fi +} + +function main(){ + for _component in $ROCM_SYSDEPS_LIST ; do + if [ "$_component" == "libdrm" ] ; then + buildlibdrm "$1" + else + echo "ERROR: Invalid component name $_component" + exit 1 + fi +done +} + +if [ "$1" != "install" ] ; then + echo " " + echo "This is a FRESH START. ERASING any previous builds in $BUILD_DIR" + echo "Use ""$0 nocmake"" or ""$0 install"" to avoid FRESH START." + echo "rm -rf $BUILD_DIR" + rm -rf "$BUILD_DIR" + mkdir -p "$BUILD_DIR" + cd "$BUILD_DIR" || exit + echo + + echo " -----Running rocm_sysdeps cmake ---- " + # Call main function + main +fi + +# ----------- Install only if asked ---------------------------- +if [ "$1" == "install" ] ; then + cd "$BUILD_DIR" || exit + echo " -----Installing to $INSTALL_ROCM_SYSDEPS/lib ----- " + # Call main function install + main install + # hwloc depends on rocmsmilib due to (--with-rocm) build option. rocmsmilib depends on libdrm. Moving hwloc and rocmsmilib build invocation here. + ROCM_SYSDEPS_PATH=$INSTALL_ROCM_SYSDEPS PREREQUISITE_COMPONENTS="rocmsmilib hwloc" "$thisdir/build_prereq.sh" +fi + diff --git a/bin/build_rocprofiler-sdk.sh b/bin/build_rocprofiler-sdk.sh index 74e3cb0ec2..8e08e48f57 100755 --- a/bin/build_rocprofiler-sdk.sh +++ b/bin/build_rocprofiler-sdk.sh @@ -46,7 +46,7 @@ if [ "$1" == "install" ] ; then $SUDO rm "$INSTALL_ROCPROF_SDK"/testfile fi -patchrepo "$AOMP_REPOS/rocprofiler-sdk" +patchrepo "$AOMP_REPOS/rocm-systems" if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then echo " " @@ -76,6 +76,7 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then MYCMAKEOPTS=(-DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR;$HOME/local/aqlprofile" -DCMAKE_INSTALL_PREFIX="$INSTALL_ROCPROF_SDK" + -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/rocm_sysdeps" -DCMAKE_BUILD_TYPE="$BUILD_TYPE" -DROCM_ROOT_DIR="$AOMP_INSTALL_DIR" -DBUILD_SHARED_LIBS=On @@ -128,7 +129,7 @@ if [ "$1" == "install" ] ; then exit 1 fi - removepatch "$AOMP_REPOS/rocprofiler-sdk" + removepatch "$AOMP_REPOS/rocm-systems" else echo echo "SUCCESSFUL BUILD, please run: $0 install" diff --git a/bin/build_rocr.sh b/bin/build_rocr.sh index b78bcb9370..c0146ac67c 100755 --- a/bin/build_rocr.sh +++ b/bin/build_rocr.sh @@ -60,7 +60,7 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then declare -a MYCMAKEOPTS MYCMAKEOPTS=(-DCMAKE_INSTALL_PREFIX="$INSTALL_ROCM" -DCMAKE_BUILD_TYPE="$BUILDTYPE" - -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib" + -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/llvm;$AOMP_INSTALL_DIR/rocm_sysdeps" -DIMAGE_SUPPORT=OFF "${AOMP_ORIGIN_RPATH[@]}" -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_C_COMPILER="${AOMP_INSTALL_DIR}/lib/llvm/bin/clang" @@ -89,7 +89,7 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then -DCMAKE_INSTALL_PREFIX="$AOMP_INSTALL_DIR" -DCMAKE_INSTALL_LIBDIR=lib/asan -DCMAKE_BUILD_TYPE="$BUILD_TYPE" - -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib" + -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/llvm;$AOMP_INSTALL_DIR/rocm_sysdeps" -DIMAGE_SUPPORT=OFF "${AOMP_ASAN_ORIGIN_RPATH[@]}" -DBUILD_SHARED_LIBS=On) mkdir -p "$BUILD_AOMP/build/rocr/asan" @@ -117,7 +117,7 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then ROCR_CMAKE_OPTS=(-DCMAKE_C_COMPILER="$AOMP_INSTALL_DIR/lib/llvm/bin/clang" -DCMAKE_CXX_COMPILER="$AOMP_INSTALL_DIR/lib/llvm/bin/clang++" -DLLVM_DIR="$AOMP_INSTALL_DIR/lib/llvm/bin" - -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib" + -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/llvm;$AOMP_INSTALL_DIR/rocm_sysdeps" -DCMAKE_INSTALL_PREFIX="$AOMP_INSTALL_DIR" -DCMAKE_BUILD_TYPE=Debug "${AOMP_DEBUG_ORIGIN_RPATH[@]}" diff --git a/bin/build_supp.sh b/bin/build_supp.sh index 664e336237..68d4555d94 100755 --- a/bin/build_supp.sh +++ b/bin/build_supp.sh @@ -53,7 +53,9 @@ EOF } SUPPLEMENTAL_COMPONENTS=${SUPPLEMENTAL_COMPONENTS:-openmpi silo hdf5 fftw ninja rocmopenmpi xpmem ucx ucc} -PREREQUISITE_COMPONENTS=${PREREQUISITE_COMPONENTS:-cmake rocmsmilib hwloc aqlprofile rocm-core} + +# rocsmilib and hwloc build invocation moved to build_rocm_sysdeps.sh (libdrm support). rocmsmi is dependent on libdrm and hwloc depends on rocmsmi. +PREREQUISITE_COMPONENTS=${PREREQUISITE_COMPONENTS:-cmake aqlprofile rocm-core} # --- Start standard header to set AOMP environment variables ---- realpath=$(realpath "$0") @@ -752,7 +754,7 @@ function buildcmake(){ function buildrocmsmilib(){ _cname="rocmsmilib" - _version=7.1.x + _version=10.0 _installdir=$AOMP_SUPP_INSTALL/rocmsmilib-$_version _linkfrom=$AOMP_SUPP/rocmsmilib _builddir=$AOMP_SUPP_BUILD/rocmsmilib @@ -767,11 +769,21 @@ function buildrocmsmilib(){ fi runcmd "mkdir -p $_builddir" runcmd "cd $_builddir" - runcmd "git clone -b release/rocm-rel-7.1 https://github.com/ROCm/rocm_smi_lib rocmsmilib-$_version" - runcmd "cd rocmsmilib-$_version" + runcmd "wget https://github.com/ROCm/rocm-systems/releases/download/therock-10.0/rocm-smi-lib.tar.gz" + runcmd "tar xf rocm-smi-lib.tar.gz" + runcmd "mv rocm-smi-lib rocm-smi-lib-$_version" + runcmd "cd rocm-smi-lib-$_version" + + # Patch rocm_smi/CMakeLists.txt to add DRM_INCLUDE_DIRS to SMI_EXAMPLE_EXE. TheRock does not need this because they + # have a global include_directories() before rocm_smi is built. runcmd does not like the variables and expands them. + # Just run without the check for now. + # TODO: rocmsmi will be deprecated in 10.1 + grep -Fq 'target_include_directories(${SMI_EXAMPLE_EXE} PRIVATE ${DRM_INCLUDE_DIRS})' rocm_smi/CMakeLists.txt || \ + sed -i '/target_link_libraries(${SMI_EXAMPLE_EXE} ${ROCM_SMI_TARGET})/a target_include_directories(${SMI_EXAMPLE_EXE} PRIVATE ${DRM_INCLUDE_DIRS})' rocm_smi/CMakeLists.txt + runcmd "mkdir -p build" runcmd "cd build" - runcmd "$AOMP_SUPP/cmake/bin/cmake -DCMAKE_INSTALL_PREFIX=$_installdir .." + runcmd "$AOMP_SUPP/cmake/bin/cmake -DCMAKE_INSTALL_PREFIX=$_installdir -DCMAKE_PREFIX_PATH=$ROCM_SYSDEPS_PATH .." if [ -d "$_installdir" ] ; then runcmd "rm -rf $_installdir" fi diff --git a/bin/patches/patch-control-file_24.0.txt b/bin/patches/patch-control-file_24.0.txt index 3c3a812ae7..bb8d9aa998 100644 --- a/bin/patches/patch-control-file_24.0.txt +++ b/bin/patches/patch-control-file_24.0.txt @@ -13,4 +13,4 @@ babelstream: babelstream-usm.patch llvm-project: ATD_ASO_full.patch UMT: umt.patch rocm-xio: xio.patch -rocm-systems: rocm-systems-hip-drop-undefined-version-script-entries.patch +rocm-systems: rocm-systems-hip-drop-undefined-version-script-entries.patch rocm-systems-rocm-smi-drm-example-include.patch rocm-systems-rocprofiler-sdk-drm-include.patch diff --git a/bin/patches/rocm-systems-rocm-smi-drm-example-include.patch b/bin/patches/rocm-systems-rocm-smi-drm-example-include.patch new file mode 100644 index 0000000000..67e158eab6 --- /dev/null +++ b/bin/patches/rocm-systems-rocm-smi-drm-example-include.patch @@ -0,0 +1,12 @@ +diff --git a/projects/rocm-smi-lib/rocm_smi/CMakeLists.txt b/projects/rocm-smi-lib/rocm_smi/CMakeLists.txt +index 88c7f34c..965296a1 100644 +--- a/projects/rocm-smi-lib/rocm_smi/CMakeLists.txt ++++ b/projects/rocm-smi-lib/rocm_smi/CMakeLists.txt +@@ -81,6 +81,7 @@ set(SMI_EXAMPLE_EXE "rocm_smi_ex") + + add_executable(${SMI_EXAMPLE_EXE} "example/rocm_smi_example.cc") + target_link_libraries(${SMI_EXAMPLE_EXE} ${ROCM_SMI_TARGET}) ++target_include_directories(${SMI_EXAMPLE_EXE} PRIVATE ${DRM_INCLUDE_DIRS}) + add_library(${ROCM_SMI_TARGET} ${CMN_SRC_LIST} ${SMI_SRC_LIST} ${CMN_INC_LIST} ${SMI_INC_LIST}) + target_link_libraries(${ROCM_SMI_TARGET} PRIVATE pthread rt dl) + target_include_directories( diff --git a/bin/patches/rocm-systems-rocprofiler-sdk-drm-include.patch b/bin/patches/rocm-systems-rocprofiler-sdk-drm-include.patch new file mode 100644 index 0000000000..6baaaacc0e --- /dev/null +++ b/bin/patches/rocm-systems-rocprofiler-sdk-drm-include.patch @@ -0,0 +1,12 @@ +diff --git a/projects/rocprofiler-sdk/source/lib/aqlprofile/CMakeLists.txt b/projects/rocprofiler-sdk/source/lib/aqlprofile/CMakeLists.txt +index 7d6e67a064..6b5fa842b7 100644 +--- a/projects/rocprofiler-sdk/source/lib/aqlprofile/CMakeLists.txt ++++ b/projects/rocprofiler-sdk/source/lib/aqlprofile/CMakeLists.txt +@@ -35,6 +35,7 @@ target_link_libraries( + $ + $) + set_target_properties(rocprofiler-sdk-aqlprofile PROPERTIES POSITION_INDEPENDENT_CODE ON) ++target_include_directories(rocprofiler-sdk-aqlprofile PRIVATE ${DRM_INCLUDE_DIRS} ${DRM_AMDGPU_INCLUDE_DIRS}) + + add_subdirectory(core) + add_subdirectory(util) From b0dd809e0b4df8950d47079c635c977771f22843 Mon Sep 17 00:00:00 2001 From: Lynd Stringer Date: Tue, 22 Sep 2026 13:16:51 -0500 Subject: [PATCH 04/23] Added Michael's suggestions. --- test/smoke-limbo/launch_latency/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/smoke-limbo/launch_latency/Makefile b/test/smoke-limbo/launch_latency/Makefile index 2277bb1c27..d1f4161754 100644 --- a/test/smoke-limbo/launch_latency/Makefile +++ b/test/smoke-limbo/launch_latency/Makefile @@ -9,7 +9,8 @@ CLANG ?= clang OMP_BIN = $(AOMP)/bin/$(CLANG) CC = $(OMP_BIN) $(VERBOSE) RUNENV = ulimit -s unlimited; -RUNCMD = $(AOMPHIP)/bin/rocprofv3 --output-format csv --kernel-trace --stats -- ./$(TESTNAME) 2> ./rocprofv3.log && python3 printLatency.py +RUNCMD = ( $(AOMPHIP)/bin/rocprofv3 --output-format csv --kernel-trace --stats -- ./$(TESTNAME) 2> ./rocprofv3.log +RUNCMD += && python3 printLatency.py || { status=$$?; cat ./rocprofv3.log; exit $$status; } ) #-ccc-print-phases #"-\#\#\#" From ce2127bd407304437ea0af31f12f04a54aae9497 Mon Sep 17 00:00:00 2001 From: Ron Lieberman Date: Tue, 22 Sep 2026 18:17:01 -0500 Subject: [PATCH 05/23] Revert "Fix for launch_latency." breaks psdb smoke-limbo This reverts commit 9c0956016d70e19303dd047f969fc38ef83e2909. --- test/smoke-limbo/launch_latency/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/smoke-limbo/launch_latency/Makefile b/test/smoke-limbo/launch_latency/Makefile index d1f4161754..0fe4ada40f 100644 --- a/test/smoke-limbo/launch_latency/Makefile +++ b/test/smoke-limbo/launch_latency/Makefile @@ -9,8 +9,7 @@ CLANG ?= clang OMP_BIN = $(AOMP)/bin/$(CLANG) CC = $(OMP_BIN) $(VERBOSE) RUNENV = ulimit -s unlimited; -RUNCMD = ( $(AOMPHIP)/bin/rocprofv3 --output-format csv --kernel-trace --stats -- ./$(TESTNAME) 2> ./rocprofv3.log -RUNCMD += && python3 printLatency.py || { status=$$?; cat ./rocprofv3.log; exit $$status; } ) +RUNCMD = $(AOMPHIP)/bin/rocprofv3 --output-format csv --kernel-trace --stats -- ./$(TESTNAME) && python3 printLatency.py #-ccc-print-phases #"-\#\#\#" From fd559e4c612edadf6135f62ed1dc15b2a5c42507 Mon Sep 17 00:00:00 2001 From: Lynd Stringer Date: Tue, 22 Sep 2026 22:51:19 -0500 Subject: [PATCH 06/23] Keep rocprofv3 messages out of launch_latency timings. Send stderr to rocprofv3.log and print that log only when the run fails. Co-authored-by: Cursor --- test/smoke-limbo/launch_latency/Makefile | 2 +- .../launch_latency/run_launch_latency.sh | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100755 test/smoke-limbo/launch_latency/run_launch_latency.sh diff --git a/test/smoke-limbo/launch_latency/Makefile b/test/smoke-limbo/launch_latency/Makefile index 0fe4ada40f..491decb5e8 100644 --- a/test/smoke-limbo/launch_latency/Makefile +++ b/test/smoke-limbo/launch_latency/Makefile @@ -9,7 +9,7 @@ CLANG ?= clang OMP_BIN = $(AOMP)/bin/$(CLANG) CC = $(OMP_BIN) $(VERBOSE) RUNENV = ulimit -s unlimited; -RUNCMD = $(AOMPHIP)/bin/rocprofv3 --output-format csv --kernel-trace --stats -- ./$(TESTNAME) && python3 printLatency.py +RUNCMD = bash ./run_launch_latency.sh $(AOMPHIP) #-ccc-print-phases #"-\#\#\#" diff --git a/test/smoke-limbo/launch_latency/run_launch_latency.sh b/test/smoke-limbo/launch_latency/run_launch_latency.sh new file mode 100755 index 0000000000..0700424f90 --- /dev/null +++ b/test/smoke-limbo/launch_latency/run_launch_latency.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# rocprofv3 messages go to rocprofv3.log. +# Print that log only when this run fails, and keep the failing status. + +aomphip=$1 +log=rocprofv3.log + +exit_with_log() { + status=$1 + if [ "$status" -ne 0 ]; then + cat "$log" + exit "$status" + fi +} + +"$aomphip/bin/rocprofv3" --output-format csv --kernel-trace --stats -- ./launch_latency 2>"$log" +exit_with_log $? + +python3 printLatency.py +exit_with_log $? From 3611c05f76baeb6632f349cf66cc28d039fe4499 Mon Sep 17 00:00:00 2001 From: Michael Halkenhaeuser Date: Tue, 22 Sep 2026 16:53:35 +0000 Subject: [PATCH 07/23] [NFC] Make aomp_common_vars clean under shellcheck Record once that the file defines variables for the scripts that source it, so their uses are invisible to static analysis, and quote the two expansions flagged for word splitting. Neither has an effect. Quoting the array element in shquot also stops an argument holding a tab or a newline from being split into several quoted words. That output is meant to be pasted back into a shell, where the split silently alters the command. AI-assisted. --- bin/aomp_common_vars | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/bin/aomp_common_vars b/bin/aomp_common_vars index 4d1e5a5e00..e43313bd5a 100644 --- a/bin/aomp_common_vars +++ b/bin/aomp_common_vars @@ -9,6 +9,10 @@ # # The bash syntax ENVNAME=${ENVNAME:-value} checks if ENVNAME is # already set. If not, it assigns it the value following the :- +# +# Most variables defined here are consumed by the sourcing scripts, +# so their uses are invisible to static analysis. +# shellcheck disable=SC2034 # --- Start standard header to set AOMP environment variables ---- realpath=$(realpath "$0") @@ -262,9 +266,11 @@ function cmquot() { # copy & pasted into the user's terminal. Output should not be further quoted. function shquot() { local -a output + local arg Escaped output=() for arg in "$@"; do - output+=(\'${arg//\'/\'\\\'\'}\') + Escaped=${arg//\'/\'\\\'\'} + output+=("'${Escaped}'") done printf '%s' "${output[*]}" } @@ -568,11 +574,11 @@ declare -a ASAN_FLAGS if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then if [ -f "${LLVM_INSTALL_LOC}/bin/clang" ]; then - ASAN_LIB=$(${LLVM_INSTALL_LOC}/bin/clang --print-file-name=libclang_rt.asan-x86_64.so) + ASAN_LIB=$("${LLVM_INSTALL_LOC}"/bin/clang --print-file-name=libclang_rt.asan-x86_64.so) ASAN_LIB_PATH=$(dirname "$ASAN_LIB") if [ ! -d "$ASAN_LIB_PATH" ]; then #Suppose above search path fails then via 'LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON' the host asan library would lose the suffix - ASAN_LIB=$(${LLVM_INSTALL_LOC}/bin/clang --print-file-name=libclang_rt.asan.so) + ASAN_LIB=$("${LLVM_INSTALL_LOC}"/bin/clang --print-file-name=libclang_rt.asan.so) ASAN_LIB_PATH=$(dirname "$ASAN_LIB") fi else From 99b34ac2665e41d981fa3eff76ff5b1f0d074f06 Mon Sep 17 00:00:00 2001 From: Michael Halkenhaeuser Date: Wed, 23 Sep 2026 13:52:37 +0000 Subject: [PATCH 08/23] [NFC] Add common function: merge_variable_with_inputs Merge a delimited variable with a list of inputs, skipping empty ones and avoiding dangling delimiters. Prepends by default so new inputs take priority. AI-assisted. --- bin/aomp_common_vars | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/bin/aomp_common_vars b/bin/aomp_common_vars index e43313bd5a..44b953a223 100644 --- a/bin/aomp_common_vars +++ b/bin/aomp_common_vars @@ -866,3 +866,48 @@ function help_build_aomp(){ EOF exit 0 } + +# Merge the contents of a variable with a list of input items. +# Usage: merge_variable_with_inputs --delimiter \ +# [--append|--prepend] [ ...] +# Default delimiter: ":" +# Default mode: --prepend (new inputs take priority / appear first). +# Empty/unset inputs are skipped; no dangling delimiters are produced. +# +# Example: +# merge_variable_with_inputs PATH "${AOMP:+${AOMP}/bin}" +# merge_variable_with_inputs CMAKE_MODULE_PATH --delimiter ";" \ +# --append "${AOMP:+${AOMP}/lib/cmake}" +function merge_variable_with_inputs() { + local VarName="$1"; shift + local Delimiter=":" + local Mode="prepend" + + while [ "$#" -gt 0 ]; do + case "$1" in + --delimiter) Delimiter="$2"; shift 2 ;; + --append) Mode="append"; shift ;; + --prepend) Mode="prepend"; shift ;; + --) shift; break ;; + *) break ;; + esac + done + + local -a InputItems=("$@") + local -n __MergeTargetVar="${VarName}" + + local Joined="" + local Item + for Item in "${InputItems[@]}"; do + [ -n "${Item}" ] && \ + Joined="${Joined:+${Joined}${Delimiter}}${Item}" + done + + # join2(a, b): a + Delimiter + b, but only if BOTH are non-empty; + # otherwise whichever side is non-empty (or "" if both are). + if [ "${Mode}" == "append" ]; then + __MergeTargetVar="${__MergeTargetVar}${__MergeTargetVar:+${Joined:+${Delimiter}}}${Joined}" + else + __MergeTargetVar="${Joined}${Joined:+${__MergeTargetVar:+${Delimiter}}}${__MergeTargetVar}" + fi +} From ea90073802f520dfecbdb105d1b92ce715d5cb2d Mon Sep 17 00:00:00 2001 From: Michael Halkenhaeuser Date: Wed, 23 Sep 2026 13:52:37 +0000 Subject: [PATCH 09/23] [llamacpp] Fix exports and refactor CMake Fix directory determination used during the aomp_common_vars sourcing. Derive ROCM_PATH from AOMP. Export PATH and LD_LIBRARY_PATH such that AOMP and ROCM_PATH take precedence. Refactor CMake configuration to allow easy printing and add corresponding print. Log the CMake configure step. AI-assisted. --- bin/run_llama.sh | 47 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/bin/run_llama.sh b/bin/run_llama.sh index ddb2f6cd2e..04aad8511e 100755 --- a/bin/run_llama.sh +++ b/bin/run_llama.sh @@ -8,9 +8,12 @@ # Build script for LLaMA with HIP support using AOMP compiler +ScriptDir=$(dirname "$(realpath "$0")") + # shellcheck source=/dev/null -. aomp_common_vars +. "${ScriptDir}"/aomp_common_vars +: "${ROCM_PATH:=$(realpath -m "${AOMP}/../..")}" : "${AOMP_GPU:=gfx90a}" : "${LLAMA_GPU:=$AOMP_GPU}" @@ -24,6 +27,17 @@ : "${LLAMA_BENCH_HF_ID:=ggml-org/gemma-3-1b-it-GGUF}" : "${LLAMA_CACHE:=$HOME/.cache/llama.cpp}" +# Add AOMP and ROCM_PATH to PATH and LD_LIBRARY_PATH and export them. +merge_variable_with_inputs PATH "${AOMP:+${AOMP}/bin}" "${ROCM_PATH:+${ROCM_PATH}/bin}" +merge_variable_with_inputs LD_LIBRARY_PATH \ + "${AOMP:+${AOMP}/lib}" \ + "${AOMP:+${AOMP}/lib/x86_64-unknown-linux-gnu}" \ + "${ROCM_PATH:+${ROCM_PATH}/lib}" + +export PATH +export LD_LIBRARY_PATH +export ROCM_PATH + pushd "${AOMP_REPOS_TEST}" || exit mkdir -p "${LLAMA_TLDIR}" && cd "${LLAMA_TLDIR}" || exit @@ -92,19 +106,28 @@ else cd .. fi -echo "Configuring build with CMake..." if [ "${DoConfigure}" == "yes" ]; then + echo "Configuring build with CMake..." rm -rf "${LLAMA_BUILD_DIR}" - cmake -B build \ - -S src \ - -DCMAKE_PREFIX_PATH="${AOMP}"/lib/cmake \ - -DGGML_HIP=On \ - -DCMAKE_BUILD_TYPE="${LLAMA_BUILD_MODE}" \ - -DGPU_TARGETS="${LLAMA_GPU}" \ - ${CmakeGenerator:+"${CmakeGenerator}"} \ - -DCMAKE_C_COMPILER="${AOMP}"/bin/clang \ - -DCMAKE_CXX_COMPILER="${AOMP}"/bin/clang++ \ - -DCMAKE_HIP_COMPILER="${AOMP}"/bin/clang++ + + CMakeArgs=() + if [ -n "${CmakeGenerator}" ]; then + CMakeArgs+=("${CmakeGenerator}") + fi + + CMakeArgs+=("-S" "src") + CMakeArgs+=("-B" "build") + CMakeArgs+=("-DCMAKE_PREFIX_PATH=${ROCM_PATH}") + CMakeArgs+=("-DGGML_HIP=On") + CMakeArgs+=("-DCMAKE_BUILD_TYPE=${LLAMA_BUILD_MODE}") + CMakeArgs+=("-DGPU_TARGETS=${LLAMA_GPU}") + CMakeArgs+=("-DCMAKE_C_COMPILER=${AOMP}/bin/clang") + CMakeArgs+=("-DCMAKE_CXX_COMPILER=${AOMP}/bin/clang++") + CMakeArgs+=("-DCMAKE_HIP_COMPILER=${AOMP}/bin/clang++") + + printf 'cmake'; printf ' %q' "${CMakeArgs[@]}"; printf '\n' + cmake "${CMakeArgs[@]}" 2>&1 | + tee "${LLAMA_TESTS_LOG_LOCATION}/cmake-configure.log" fi if [ "${DoCompile}" == "yes" ]; then From 5a73f7e8efd68de33b6b110028e266539385d2fb Mon Sep 17 00:00:00 2001 From: Michael Halkenhaeuser Date: Wed, 23 Sep 2026 13:52:37 +0000 Subject: [PATCH 10/23] [NFC] Add common function: get_cmake_module_path Search a list of prefixes for lib/cmake/ and return the cmake directory holding it. Defaults to AOMP, then ROCM_PATH, then /opt/rocm, so a package missing from the ROCm under test resolves to the system ROCm. AI-assisted. --- bin/aomp_common_vars | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/bin/aomp_common_vars b/bin/aomp_common_vars index 44b953a223..c2d803a5da 100644 --- a/bin/aomp_common_vars +++ b/bin/aomp_common_vars @@ -911,3 +911,40 @@ function merge_variable_with_inputs() { __MergeTargetVar="${Joined}${Joined:+${__MergeTargetVar:+${Delimiter}}}${__MergeTargetVar}" fi } + +# Return the path containing the requested CMake module directory. +# Usage: get_cmake_module_path [ ...] +# Searches each given Path, in order, for /lib/cmake/. +# Empty path arguments are skipped (safe to pass an unset/empty variable). +# If no Path arguments are given, defaults to searching AOMP, then ROCM_PATH +# (or a path derived from AOMP, if set), then /opt/rocm. +function get_cmake_module_path() { + local Module="$1" + shift + local -a SearchPaths=("$@") + + # No explicit candidates given: fall back to the default search order. + # Default: AOMP -> ROCM_PATH (if empty: AOMP/../..) -> /opt/rocm + if [ "$#" -eq 0 ]; then + SearchPaths=( + "${AOMP}" + "${ROCM_PATH:-${AOMP:+$(realpath -m "${AOMP}/../../")}}" + "/opt/rocm" + ) + fi + + # Assumptions: + # All CMake modules are located within ./lib/cmake/. + # All CMake module configuration files are named *onfig*.cmake. + local Path + for Path in "${SearchPaths[@]}"; do + if [ -n "${Path}" ] && [ -d "${Path}/lib/cmake/${Module}" ] && + compgen -G "${Path}/lib/cmake/${Module}/${Module}"'*onfig*.cmake' \ + > /dev/null; then + # Return the parent(!) directory. + echo "${Path}/lib/cmake" + return 0 + fi + done + return 1 +} From b40b1caf1f85fd60d60f76f2fee48480bed60d47 Mon Sep 17 00:00:00 2001 From: Michael Halkenhaeuser Date: Wed, 23 Sep 2026 13:52:37 +0000 Subject: [PATCH 11/23] [llamacpp] Resolve the required ROCm packages individually ggml needs hip, hipblas and rocblas. Look each of them up separately so the ROCm under test is preferred and another installation is only added to CMAKE_PREFIX_PATH for what it does not ship itself, with a warning naming it. AI-assisted. --- bin/run_llama.sh | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/bin/run_llama.sh b/bin/run_llama.sh index 04aad8511e..3e85a6ef25 100755 --- a/bin/run_llama.sh +++ b/bin/run_llama.sh @@ -115,9 +115,40 @@ if [ "${DoConfigure}" == "yes" ]; then CMakeArgs+=("${CmakeGenerator}") fi + # Determine the CMake module paths of required ROCm packages. + CMakePrefixPath="${ROCM_PATH}" + declare -A SeenPrefix=() + for Package in hip hipblas rocblas; do + if ! PackageCmakeDir=$(get_cmake_module_path "${Package}"); then + Msg="ERROR: no CMake package '${Package}' below ${AOMP}," + Msg+=" ${ROCM_PATH} or /opt/rocm" + echo "${Msg}" + exit 1 + fi + + # Anything found below the ROCm under test needs no extra prefix. + # Removing a prefix that is present shortens the path, so a path that + # comes back unchanged did not start with it. + if [ "${PackageCmakeDir#"${AOMP}"/}" != "${PackageCmakeDir}" ] || + [ "${PackageCmakeDir#"${ROCM_PATH}"/}" != "${PackageCmakeDir}" ]; then + continue + fi + + Msg="WARNING: ${ROCM_PATH} does not provide ${Package}," + Msg+=" using ${PackageCmakeDir}" + echo "${Msg}" + + # Two packages commonly resolve to the same place; append it only once. + if [ -z "${SeenPrefix[${PackageCmakeDir}]:-}" ]; then + SeenPrefix["${PackageCmakeDir}"]=1 + CMakePrefixPath+=";${PackageCmakeDir}" + fi + done + unset SeenPrefix + CMakeArgs+=("-S" "src") CMakeArgs+=("-B" "build") - CMakeArgs+=("-DCMAKE_PREFIX_PATH=${ROCM_PATH}") + CMakeArgs+=("-DCMAKE_PREFIX_PATH=${CMakePrefixPath}") CMakeArgs+=("-DGGML_HIP=On") CMakeArgs+=("-DCMAKE_BUILD_TYPE=${LLAMA_BUILD_MODE}") CMakeArgs+=("-DGPU_TARGETS=${LLAMA_GPU}") From a6e22e979906181648750b9e945601bebda4ef51 Mon Sep 17 00:00:00 2001 From: Michael Halkenhaeuser Date: Wed, 23 Sep 2026 13:52:37 +0000 Subject: [PATCH 12/23] [NFC] Add common function: add_cmake_rocm_header_priority_args A ROCm package borrowed from another installation exports its whole include directory, HIP headers included, which CMake emits as -isystem. Since clang searches its own ROCm last, those headers win over the ROCm under test. Emit the include directory of the ROCm under test through CMAKE__COMPILER_ARG1, the only slot ahead of the includes CMake generates; every *_FLAGS variable lands behind them. AI-assisted. --- bin/aomp_common_vars | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/bin/aomp_common_vars b/bin/aomp_common_vars index c2d803a5da..91453e244d 100644 --- a/bin/aomp_common_vars +++ b/bin/aomp_common_vars @@ -948,3 +948,28 @@ function get_cmake_module_path() { done return 1 } + +# Keep the HIP headers of the ROCm under test ahead of every other ROCm's. +# Usage: add_cmake_rocm_header_priority_args [ ...] +# Appends one CMake argument per language (default: HIP); does nothing when +# ships no HIP headers of its own. +# +# A borrowed hipBLAS/rocBLAS exports its whole include directory, which CMake +# emits as -isystem, ahead of the compiler's own ROCm that clang searches last. +# CMAKE__COMPILER_ARG1 is the only slot in front of those includes; every +# *_FLAGS variable lands behind them. Keep CMAKE__COMPILER a plain path, +# CMake reassigns ARG1 when the compiler itself carries arguments. +function add_cmake_rocm_header_priority_args() { + local -n __HeaderPriorityArgs="$1"; shift + local RocmRoot="$1"; shift + local -a Languages=("$@") + [ "${#Languages[@]}" -gt 0 ] || Languages=("HIP") + + [ -n "${RocmRoot}" ] && [ -d "${RocmRoot}/include/hip" ] || return 0 + + local Language + for Language in "${Languages[@]}"; do + __HeaderPriorityArgs+=( + "-DCMAKE_${Language}_COMPILER_ARG1:STRING=-isystem ${RocmRoot}/include") + done +} From 0f3c47409b9e5dd31ab42bce860ccd545cc57cb8 Mon Sep 17 00:00:00 2001 From: Michael Halkenhaeuser Date: Wed, 23 Sep 2026 13:52:37 +0000 Subject: [PATCH 13/23] [llamacpp] Keep the HIP headers of the ROCm under test first Without this the HIP headers of whichever ROCm provides hipblas and rocblas are used, which fails to compile whenever they predate the compiler under test. AI-assisted. --- bin/run_llama.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/run_llama.sh b/bin/run_llama.sh index 3e85a6ef25..64d283709e 100755 --- a/bin/run_llama.sh +++ b/bin/run_llama.sh @@ -156,6 +156,10 @@ if [ "${DoConfigure}" == "yes" ]; then CMakeArgs+=("-DCMAKE_CXX_COMPILER=${AOMP}/bin/clang++") CMakeArgs+=("-DCMAKE_HIP_COMPILER=${AOMP}/bin/clang++") + # CMake modules export their whole include directory, HIP headers included, + # which would shadow the ROCm under test and e.g. its HIP headers. + add_cmake_rocm_header_priority_args CMakeArgs "${ROCM_PATH}" + printf 'cmake'; printf ' %q' "${CMakeArgs[@]}"; printf '\n' cmake "${CMakeArgs[@]}" 2>&1 | tee "${LLAMA_TESTS_LOG_LOCATION}/cmake-configure.log" From da337cad84555a71c74d9ac8d9f30a9f041f4729 Mon Sep 17 00:00:00 2001 From: Michael Halkenhaeuser Date: Wed, 23 Sep 2026 13:52:37 +0000 Subject: [PATCH 14/23] [NFC] Add common function: check_cmake_rocm_header_priority Confirm the include directory survived into the CMake cache. A lost entry only breaks the build while the two ROCm header sets are incompatible; otherwise it silently builds against the wrong ones. AI-assisted. --- bin/aomp_common_vars | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/bin/aomp_common_vars b/bin/aomp_common_vars index 91453e244d..b337c7f127 100644 --- a/bin/aomp_common_vars +++ b/bin/aomp_common_vars @@ -973,3 +973,39 @@ function add_cmake_rocm_header_priority_args() { "-DCMAKE_${Language}_COMPILER_ARG1:STRING=-isystem ${RocmRoot}/include") done } + +# Verify that the ROCm header priority survived the CMake run. +# Usage: check_cmake_rocm_header_priority [ ...] +# A lost entry only breaks the build while the two ROCm header sets are +# incompatible, otherwise it silently builds against the wrong ones. +function check_cmake_rocm_header_priority() { + local BuildDir="$1"; shift + local RocmRoot="$1"; shift + local -a Languages=("$@") + [ "${#Languages[@]}" -gt 0 ] || Languages=("HIP") + + [ -n "${RocmRoot}" ] && [ -d "${RocmRoot}/include/hip" ] || return 0 + + local CacheFile="${BuildDir}/CMakeCache.txt" + if [ ! -f "${CacheFile}" ]; then + echo "ERROR: ${CacheFile} not found" + return 1 + fi + + local Language Entry Msg Status=0 + for Language in "${Languages[@]}"; do + Entry=$(grep "^CMAKE_${Language}_COMPILER_ARG1:" "${CacheFile}" || true) + case "${Entry}" in + *"-isystem ${RocmRoot}/include"*) ;; + *) + Msg="ERROR: CMAKE_${Language}_COMPILER_ARG1 lost" + Msg+=" ${RocmRoot}/include, its HIP headers can be shadowed" + Msg+=" by another ROCm" + echo "${Msg}" + Status=1 + ;; + esac + done + + return "${Status}" +} From 48b35d35054e2a066656ce2cf3d49fef5ef18749 Mon Sep 17 00:00:00 2001 From: Michael Halkenhaeuser Date: Wed, 23 Sep 2026 13:52:37 +0000 Subject: [PATCH 15/23] [llamacpp] Verify the ROCm header priority after configuring AI-assisted. --- bin/run_llama.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/run_llama.sh b/bin/run_llama.sh index 64d283709e..1af4860894 100755 --- a/bin/run_llama.sh +++ b/bin/run_llama.sh @@ -163,6 +163,9 @@ if [ "${DoConfigure}" == "yes" ]; then printf 'cmake'; printf ' %q' "${CMakeArgs[@]}"; printf '\n' cmake "${CMakeArgs[@]}" 2>&1 | tee "${LLAMA_TESTS_LOG_LOCATION}/cmake-configure.log" + + # Make sure the ROCm header priority is preserved. + check_cmake_rocm_header_priority "${LLAMA_BUILD_DIR}" "${ROCM_PATH}" || exit 1 fi if [ "${DoCompile}" == "yes" ]; then From 88a70b3004b5e054237a5703d11ead52fb1d7009 Mon Sep 17 00:00:00 2001 From: Michael Halkenhaeuser Date: Wed, 23 Sep 2026 13:52:37 +0000 Subject: [PATCH 16/23] [llamacpp] Raise the ctest timeout test-backend-ops alone runs for about 2500s on MI350X and is killed by the 1500s ctest applies by default, which reports as a test failure rather than as an unfinished test. AI-assisted. --- bin/run_llama.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/run_llama.sh b/bin/run_llama.sh index 1af4860894..fb6eed311d 100755 --- a/bin/run_llama.sh +++ b/bin/run_llama.sh @@ -23,6 +23,10 @@ ScriptDir=$(dirname "$(realpath "$0")") : "${LLAMA_BUILD_MODE:=Release}" : "${LLAMA_TESTS_LOG_LOCATION:=$LLAMA_TLDIR/logs}" +# CTest 'test-backend-ops' exceeds the 1500s default timeout. +# Measured on MI350X: ~2500s +: "${LLAMA_CTEST_TIMEOUT:=3600}" + # Model to use in benchmarks (default is a smaller model) : "${LLAMA_BENCH_HF_ID:=ggml-org/gemma-3-1b-it-GGUF}" : "${LLAMA_CACHE:=$HOME/.cache/llama.cpp}" @@ -179,7 +183,8 @@ if [ "${DoCTest}" == "yes" ]; then echo "Log in ${LLAMA_TESTS_LOG_LOCATION}/ctest.log" # Some model files are git-lfs and come from huggingface. They will auto-download during test - ctest --output-on-failure 2>&1 | tee "${LLAMA_TESTS_LOG_LOCATION}/ctest.log" + ctest --output-on-failure --timeout "${LLAMA_CTEST_TIMEOUT}" 2>&1 | + tee "${LLAMA_TESTS_LOG_LOCATION}/ctest.log" fi run_llama_bench() { From 4b6743aec9a8b1d32d7812e5a7a9de1ad1c98cf3 Mon Sep 17 00:00:00 2001 From: Michael Halkenhaeuser Date: Wed, 23 Sep 2026 13:52:37 +0000 Subject: [PATCH 17/23] [llamacpp] Log the build step AI-assisted. --- bin/run_llama.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/run_llama.sh b/bin/run_llama.sh index fb6eed311d..66105052cb 100755 --- a/bin/run_llama.sh +++ b/bin/run_llama.sh @@ -174,7 +174,8 @@ fi if [ "${DoCompile}" == "yes" ]; then echo "Building LLaMA..." - cmake --build "${LLAMA_BUILD_DIR}" --parallel -j "${AOMP_BUILD_JOBS}" + cmake --build "${LLAMA_BUILD_DIR}" --parallel -j "${AOMP_BUILD_JOBS}" 2>&1 | + tee "${LLAMA_TESTS_LOG_LOCATION}/cmake-build.log" fi if [ "${DoCTest}" == "yes" ]; then From 3163d95710e14bf9345b56315b4d6b4d5337625f Mon Sep 17 00:00:00 2001 From: Nicole Aschenbrenner Date: Mon, 21 Sep 2026 10:25:30 -0500 Subject: [PATCH 18/23] [build] Remove classic flang components and build scripts Removes the five classic flang components (llvm-classic, flang-classic, pgmath, flang, flang_runtime) and their build scripts. They build from $AOMP_REPOS/flang, which manifest 24.0 no longer clones, and flang-classic was the only consumer of the clang-offload-wrapper and clang-build-select-link tools already removed from amd-staging. New flang is untouched. --- bin/README.md | 17 +-- bin/aomp_common_vars | 12 -- bin/build_aomp.sh | 34 +---- bin/build_fixups.sh | 2 - bin/build_flang-classic.sh | 164 -------------------- bin/build_flang.sh | 196 ------------------------ bin/build_flang_runtime.sh | 235 ----------------------------- bin/build_llvm-classic.sh | 148 ------------------ bin/build_pgmath.sh | 198 ------------------------ bin/build_supp.sh | 2 +- bin/disableClassic | 0 bin/package.py | 5 - bin/patches/README.md | 2 +- docs/SOURCEINSTALL.md | 1 - docs/SOURCEINSTALL_PREREQUISITE.md | 2 +- 15 files changed, 8 insertions(+), 1010 deletions(-) delete mode 100755 bin/build_flang-classic.sh delete mode 100755 bin/build_flang.sh delete mode 100755 bin/build_flang_runtime.sh delete mode 100755 bin/build_llvm-classic.sh delete mode 100755 bin/build_pgmath.sh delete mode 100644 bin/disableClassic diff --git a/bin/README.md b/bin/README.md index 2b5e3b3009..29ca870f4c 100644 --- a/bin/README.md +++ b/bin/README.md @@ -162,7 +162,7 @@ There are options to select a subset of components to build and install. ``` 2) Select a subset of components to build. ``` - ./build_aomp.sh select openmp flang flang_runtime + ./build_aomp.sh select openmp ``` The default AOMP source build is a standalone build of all components needed for compilation and execution with the exception of the kfd Linux kernel module for AMD GPUs or the CUDA SDK for Nvidia GPUs. @@ -298,7 +298,7 @@ export AOMP_GPU=`/opt/rocm/lib/llvm/bin/offload-arch` ## The AOMP developer patch subsystem -Of the many repos identified above, AOMP developers may only change core aomp repositories (llvm-project, aomp, aomp-extras, and flang). AOMP required changes to other non-core components must be patched. The [patches/README.md](patches/README.md) describes the AOMP patch mechanism in detail. +Of the many repos identified above, AOMP developers may only change core aomp repositories (llvm-project, aomp, and aomp-extras). AOMP required changes to other non-core components must be patched. The [patches/README.md](patches/README.md) describes the AOMP patch mechanism in detail. ## Building debuggable compiler @@ -328,16 +328,3 @@ The default is 1, which creates these CMake vars: ``` Change it to 0 to avoid `ccache`. - - -## AOMP_SKIP_FLANG - -The default for this variable is 0. Setting this to 1 will shorten build time by -changing the defaults for AOMP_COMPONENT_LIST and AOMP_PROJECTS_LIST to - -``` -AOMP_COMPONENT_LIST=" prereq project" -AOMP_PROJECTS_LIST="clang;lld" -``` - -The AOMP_SKIP_FLANG variable is for developers working upstream but not on LLVM flang. diff --git a/bin/aomp_common_vars b/bin/aomp_common_vars index e43313bd5a..5787cd5efb 100644 --- a/bin/aomp_common_vars +++ b/bin/aomp_common_vars @@ -99,9 +99,7 @@ else -DCMAKE_CXX_COMPILER_LAUNCHER="$_ccache_bin") fi -AOMP_SKIP_FLANG=${AOMP_SKIP_FLANG:-1} AOMP_SKIP_FLANG_NEW=${AOMP_SKIP_FLANG_NEW:-0} -AOMP_FLANG_DRIVER=${AOMP_FLANG_DRIVER:-flang} AOMP_SKIP_AMD_FLANGRT=${AOMP_SKIP_AMD_FLANGRT:-1} if [ "$AOMP_SKIP_FLANG_NEW" == 1 ] ; then @@ -420,16 +418,6 @@ else AOMP_PROJECT_REPO_NAME="../llvm-project" fi fi -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-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_CLASSIC=0 -fi # The AOMP_XXX_REPO_NAME is the directory name following $AOMP_REPOS. diff --git a/bin/build_aomp.sh b/bin/build_aomp.sh index 6ec08c0bc8..4887053b15 100755 --- a/bin/build_aomp.sh +++ b/bin/build_aomp.sh @@ -76,17 +76,6 @@ if ! $TOPSUDO touch "$AOMP_INSTALL_DIR/testfile"; then fi $TOPSUDO rm "$AOMP_INSTALL_DIR/testfile" -#Check for gawk on Ubuntu, which is needed for the flang build. -GAWK=$(gawk --version | grep "^GNU Awk") -OS=$(grep "^NAME=" < /etc/os-release) - -if [[ -z "$GAWK" ]] && [[ "$OS" == *"Ubuntu"* ]] ; then - echo - echo "Build Error: gawk was not found and is required for building flang! Please run 'sudo apt-get install gawk' and run build_aomp.sh again." - echo - exit 1 -fi - if [ "$DISABLE_LLVM_TESTS" == "1" ]; then export DO_TESTS="-DLLVM_INCLUDE_TESTS=OFF -DCLANG_INCLUDE_TESTS=OFF" fi @@ -104,12 +93,9 @@ if [ "$AOMP_STANDALONE_BUILD" == 1 ] ; then # rocclr, we have no HIP or OpenCL for ppc64 :-( However, rocr works for ppc64 so AOMP works. 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-classic flang-classic pgmath flang flang_runtime" - fi components="$components hipcc hipamd hipify" fi - if [ "$AOMP_SKIP_FLANG_NEW" == 0 ] && [ "$AOMP_SKIP_FLANG" == 1 ] ; then + if [ "$AOMP_SKIP_FLANG_NEW" == 0 ] ; then # We can only build hipfort for flang components="$components hipfort " fi @@ -133,13 +119,6 @@ else # roctracer, rocprofiler, rocm_smi_lib, and amdsmi should be found # in ROCM in /opt/rocm. The ROCM build only needs these components: components="llvm_runtimes_standalone" - if [ "$AOMP_SKIP_FLANG" == 0 ] ; then - if [ "$SANITIZER" == 1 ] && [ -f "$AOMP/bin/flang-classic" ] ; then - components="$components pgmath flang flang_runtime" - else - components="$components llvm-classic flang-classic pgmath flang flang_runtime" - fi - fi fi echo "COMPONENTS:$components" @@ -196,12 +175,10 @@ echo if [ "$AOMP_STANDALONE_BUILD" -eq 0 ]; then cd "$BUILD_DIR/build" || exit - classic_version=$(ls flang-classic) - classic_install_manifest=$classic_version/install_manifest.txt if [ "$SANITIZER" == 1 ]; then - install_manifest_orig=asan/install_manifest.txt + install_manifest=asan/install_manifest.txt else - install_manifest_orig=install_manifest.txt + install_manifest=install_manifest.txt fi # Clean file log @@ -209,11 +186,6 @@ if [ "$AOMP_STANDALONE_BUILD" -eq 0 ]; then for directory in ./*/; do pushd "$directory" > /dev/null || exit - if [[ "$directory" =~ "flang-classic" ]]; then - install_manifest=$classic_install_manifest - else - install_manifest="$install_manifest_orig" - fi if [ -f "$install_manifest" ]; then cat "$install_manifest" >> "$BUILD_DIR/build/installed_files.txt" echo "" >> "$BUILD_DIR/build/installed_files.txt" diff --git a/bin/build_fixups.sh b/bin/build_fixups.sh index 8cfba9b6de..fb09b358c3 100755 --- a/bin/build_fixups.sh +++ b/bin/build_fixups.sh @@ -25,8 +25,6 @@ if [ "$AOMP_STANDALONE_BUILD" == 1 ] ; then $SUDO cp "$AOMP_SRC/LICENSE" "$AOMP/share/doc/aomp/LICENSE.apache2" echo $SUDO cp "$AOMP_REPOS/$AOMP_EXTRAS_REPO_NAME/LICENSE" "$AOMP/share/doc/aomp/LICENSE.mit" $SUDO cp "$AOMP_REPOS/$AOMP_EXTRAS_REPO_NAME/LICENSE" "$AOMP/share/doc/aomp/LICENSE.mit" - echo $SUDO cp "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME/LICENSE.txt" "$AOMP/share/doc/aomp/LICENSE.flang" - $SUDO cp "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME/LICENSE.txt" "$AOMP/share/doc/aomp/LICENSE.flang" fi echo Cleaning AOMP Directory... diff --git a/bin/build_flang-classic.sh b/bin/build_flang-classic.sh deleted file mode 100755 index b61228f56c..0000000000 --- a/bin/build_flang-classic.sh +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/bash -# -#Copyright © Advanced Micro Devices, Inc., or its affiliates. -# -#SPDX-License-Identifier: MIT -# -# 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-classic build step. -# These libs/headers are not installed and will picked up from the build -# tree for flang-classic. -# -BUILD_TYPE=${BUILD_TYPE:-Release} - -# --- Start standard header to set AOMP environment variables ---- -realpath=$(realpath "$0") -thisdir=$(dirname "$realpath") -. "$thisdir/aomp_common_vars" -# --- end standard header ---- - -if [ "$AOMP_BUILD_FLANG_CLASSIC" == 0 ] ; then - if [ "$1" != "install" ] ; then - 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 -fi - -if [ "$AOMP_USE_NINJA" == 0 ] ; then - AOMP_SET_NINJA_GEN=() -else - AOMP_SET_NINJA_GEN=(-G Ninja) -fi -osversion=$(grep -e ^VERSION_ID < /etc/os-release) -if [[ $osversion =~ \"7\. ]] || [[ $osversion =~ \"8\. ]]; then - _cxx_flag=(-DCMAKE_CXX_FLAGS='-D_GLIBCXX_USE_CXX11_ABI=0') -else - _cxx_flag=() -fi - -# 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 flang-classic driver support -# from clang to make way for flang - -# Do not change the AOMP_LFL_DIR default because it is the subdirectory -# 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-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 -#AOMP_LFL_DIR=${AOMP_LFL_DIR:-17.0-4} - -declare -a MYCMAKEOPTS - -MYCMAKEOPTS=(-DCMAKE_BUILD_TYPE="$BUILD_TYPE" - -DCMAKE_C_COMPILER="$LLVM_INSTALL_LOC/bin/clang" - -DCMAKE_CXX_COMPILER="$LLVM_INSTALL_LOC/bin/clang++" - "${_cxx_flag[@]}" - -DCMAKE_CXX_STANDARD=17 - -DCMAKE_INSTALL_PREFIX="$LLVM_INSTALL_LOC" - "${AOMP_SET_NINJA_GEN[@]}") - -if [ "$AOMP_STANDALONE_BUILD" == 1 ] ; then - MYCMAKEOPTS=("${MYCMAKEOPTS[@]}" -DBUILD_SHARED_LIBS=ON - "${AOMP_ORIGIN_RPATH[@]}") -else - MYCMAKEOPTS=("${MYCMAKEOPTS[@]}" -DBUILD_SHARED_LIBS=OFF - "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}") -fi - - -if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then - help_build_aomp -fi - -if [ "$AOMP_STANDALONE_BUILD" == 1 ] ; then - if [ ! -L "$AOMP" ] && [ -d "$AOMP" ] ; then - echo "ERROR: Directory $AOMP is a physical directory." - echo " It must be a symbolic link or not exist" - exit 1 - fi -fi - -check_writable_installdir "$1" "$AOMP_INSTALL_DIR" - -# Allow extglobs -- seems like this must be set before bash starts parsing -# the 'if' block below. -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-classic/$AOMP_LFL_DIR" - echo "Use ""$0 nocmake"" or ""$0 install"" to avoid FRESH START." - if [ -d "$BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR" ]; then - # This needs extglob enabled, as set above. - rm -rf "$BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR"/!("llvm-classic") - else - echo "ERROR: Build llvm-classic before flang-classic." - exit 1 - fi -else - 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-classic. -if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then - cd "$BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR" || exit - echo " -----Running cmake ---- " - echo "${AOMP_CMAKE}" "$(shquot "${MYCMAKEOPTS[@]}")" "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME/flang-classic/$AOMP_LFL_DIR" - - if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME/flang-classic/$AOMP_LFL_DIR" 2>&1; then - echo "ERROR cmake failed. Cmake flags" - echo " $(shquot "${MYCMAKEOPTS[@]}")" - exit 1 - fi -fi - -if [ "$1" = "cmake" ]; then - exit 0 -fi - -echo - -# 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" || exit - -if ! $AOMP_NINJA_BIN -j "$AOMP_JOB_THREADS"; then - echo " " - echo "ERROR: $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS FAILED" - echo "To restart:" - echo " cd $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR" - echo " $AOMP_NINJA_BIN" - exit 1 -fi - -if [ "$1" == "install" ] ; then - echo " -----Installing to $AOMP_INSTALL_DIR ---- " - - if ! $SUDO "${AOMP_CMAKE}" --build . -j "$AOMP_JOB_THREADS" --target install; then - echo "ERROR make install failed " - exit 1 - fi - echo - echo "SUCCESSFUL INSTALL to $AOMP_INSTALL_DIR" - echo -else - echo - echo "SUCCESSFUL BUILD, please run: $0 install" - echo " to install into $AOMP" - echo -fi diff --git a/bin/build_flang.sh b/bin/build_flang.sh deleted file mode 100755 index 74f9162b23..0000000000 --- a/bin/build_flang.sh +++ /dev/null @@ -1,196 +0,0 @@ -#!/bin/bash -# -# build_flang.sh: Script to build the flang component of the AOMP compiler. -# -# -BUILD_TYPE=${BUILD_TYPE:-Release} - -# --- Start standard header to set AOMP environment variables ---- -realpath=$(realpath "$0") -thisdir=$(dirname "$realpath") -. "$thisdir/aomp_common_vars" -# --- end standard header ---- - -INSTALL_FLANG=${INSTALL_FLANG:-$AOMP_INSTALL_DIR} - -if [ "$AOMP_PROC" == "ppc64le" ] ; then - TARGETS_TO_BUILD="AMDGPU;${AOMP_NVPTX_TARGET}PowerPC" -else - if [ "$AOMP_PROC" == "aarch64" ] ; then - TARGETS_TO_BUILD="AMDGPU;${AOMP_NVPTX_TARGET}AArch64" - else - TARGETS_TO_BUILD="AMDGPU;${AOMP_NVPTX_TARGET}X86" - fi -fi - -REPO_DIR=$AOMP_REPOS/$AOMP_FLANG_REPO_NAME -COMP_INC_DIR=$REPO_DIR/runtime/libpgmath/lib/common - -declare -a MYCMAKEOPTS - -MYCMAKEOPTS=(-DCMAKE_BUILD_TYPE="$BUILD_TYPE" - -DCMAKE_INSTALL_PREFIX="$LLVM_INSTALL_LOC" - -DLLVM_ENABLE_ASSERTIONS=ON - -DLLVM_CONFIG="$LLVM_INSTALL_LOC/bin/llvm-config" - -DCMAKE_CXX_COMPILER="$LLVM_INSTALL_LOC/bin/clang++" - -DCMAKE_C_COMPILER="$LLVM_INSTALL_LOC/bin/clang" - -DCMAKE_Fortran_COMPILER=gfortran - -DLLVM_TARGETS_TO_BUILD="$TARGETS_TO_BUILD" - -DFLANG_OPENMP_GPU_AMD=ON - -DFLANG_OPENMP_GPU_NVIDIA=ON - -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON - -DFLANG_INCLUDE_TESTS=OFF) - -declare -a ASAN_CMAKE_OPTS - -if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then - ASAN_FLAGS=("${ASAN_FLAGS[@]}" "-I$COMP_INC_DIR") - ASAN_CMAKE_OPTS=("${MYCMAKEOPTS[@]}" - -DCMAKE_PREFIX_PATH="$AOMP/lib/asan/cmake" - "${AOMP_ASAN_ORIGIN_RPATH[@]}" - -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF - -DCMAKE_INSTALL_LIBDIR=lib/asan) - if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then - ASAN_CMAKE_OPTS=("${ASAN_CMAKE_OPTS[@]}" -DCMAKE_INSTALL_BINDIR=bin/asan) - fi -fi - -if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then - MYCMAKEOPTS=("${MYCMAKEOPTS[@]}" "${AOMP_ORIGIN_RPATH[@]}") -else - MYCMAKEOPTS=("${MYCMAKEOPTS[@]}" "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}") -fi - -MYCMAKEOPTS=("${MYCMAKEOPTS[@]}" "-DCMAKE_PREFIX_PATH=$AOMP/lib/cmake") - -if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then - help_build_aomp -fi - -check_writable_installdir "$1" "$INSTALL_FLANG" - -# Skip synchronization from git repos if nocmake or install are specified -if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then - echo - echo "This is a FRESH START. ERASING any previous builds in $BUILD_DIR/build/$AOMP_FLANG_REPO_NAME" - echo "Use ""$0 nocmake"" or ""$0 install"" to avoid FRESH START." - rm -rf "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME" - mkdir -p "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME" - if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then - mkdir -p "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME/asan" - fi -else - if [ ! -d "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME" ] ; then - echo "ERROR: The build directory $BUILD_DIR/build/$AOMP_FLANG_REPO_NAME does not exist" - echo " run $0 without nocmake or install options. " - exit 1 - fi - if [ "$AOMP_BUILD_SANITIZER" == 1 ] && [ ! -d "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME/asan" ] ; then - echo "ERROR: The build directory $BUILD_DIR/build/$AOMP_FLANG_REPO_NAME/asan does not exist" - echo " run $0 without nocmake or install options. " - exit 1 - fi -fi - -cd "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME" || exit - -# Need llvm-config to come from previous LLVM build -export PATH=$AOMP_INSTALL_DIR/bin:$PATH - -if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then - if [ "$SANITIZER" != 1 ]; then - echo - echo " -----Running cmake ---- " - echo "${AOMP_CMAKE}" "$(shquot "${MYCMAKEOPTS[@]}")" \ - -DCMAKE_C_FLAGS="$CFLAGS -I$COMP_INC_DIR" \ - -DCMAKE_CXX_FLAGS="$CXXFLAGS -I$COMP_INC_DIR" \ - "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME" - - if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" \ - -DCMAKE_C_FLAGS="$CFLAGS -I$COMP_INC_DIR" \ - -DCMAKE_CXX_FLAGS="$CXXFLAGS -I$COMP_INC_DIR" \ - "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME" 2>&1; then - echo "ERROR cmake failed. Cmake flags" - echo " $(shquot "${MYCMAKEOPTS[@]}")" - exit 1 - fi - fi - - if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then - cd "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME/asan" || exit - echo - echo " ----Running cmake for flang-asan ----- " - echo "${AOMP_CMAKE}" "$(shquot "${ASAN_CMAKE_OPTS[@]}")" \ - -DCMAKE_C_FLAGS="\"$CFLAGS $(cmquot "${ASAN_FLAGS[@]}")\"" \ - -DCMAKE_CXX_FLAGS="\"$CXXFLAGS $(cmquot "${ASAN_FLAGS[@]}")\"" \ - "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME" - - - if ! ${AOMP_CMAKE} "${ASAN_CMAKE_OPTS[@]}" \ - -DCMAKE_C_FLAGS="$CFLAGS $(cmquot "${ASAN_FLAGS[@]}")" \ - -DCMAKE_CXX_FLAGS="$CXXFLAGS $(cmquot "${ASAN_FLAGS[@]}")" \ - "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME" 2>&1; then - echo "ERROR flang-asan cmake failed. Cmake flags" - echo " $(shquot "${ASAN_CMAKE_OPTS[@]}")" - exit 1 - fi - fi -fi - -if [ "$1" = "cmake" ]; then - exit 0 -fi - -echo -if [ "$SANITIZER" != 1 ]; then - echo " ----- Running make ---- " - cd "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME" || exit - echo "make -j $AOMP_JOB_THREADS" - - if ! make -j "$AOMP_JOB_THREADS"; then - echo "ERROR make -j $AOMP_JOB_THREADS failed" - exit 1 - fi -fi - -if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then - cd "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME/asan" || exit - echo - echo " ----- Running make for flang-asan ---- " - echo "make -j $AOMP_JOB_THREADS" - - if ! make -j "$AOMP_JOB_THREADS"; then - echo "ERROR make -j $AOMP_JOB_THREADS failed" - exit 1 - fi -fi - -if [ "$1" == "install" ] ; then - if [ "$SANITIZER" != 1 ]; then - cd "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME" || exit - echo " -----Installing to $INSTALL_FLANG ---- " - - if ! $SUDO make install; then - echo "ERROR make install failed " - exit 1 - fi - echo "SUCCESSFUL INSTALL to $INSTALL_FLANG " - fi - - echo - if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then - cd "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME/asan" || exit - echo " -----Installing to $INSTALL_FLANG/lib/asan ---- " - - if ! $SUDO make install; then - echo "ERROR make install failed " - exit 1 - fi - echo "SUCCESSFUL INSTALL to $INSTALL_FLANG/lib/asan" - fi -else - echo - echo "SUCCESSFUL BUILD, please run: $0 install" - echo " to install into $AOMP" - echo -fi diff --git a/bin/build_flang_runtime.sh b/bin/build_flang_runtime.sh deleted file mode 100755 index 1bddf15381..0000000000 --- a/bin/build_flang_runtime.sh +++ /dev/null @@ -1,235 +0,0 @@ -#!/bin/bash -# -# build_flang_runtime.sh: Script to build the flang runtime component of the AOMP compiler. -# -# -BUILD_TYPE=${BUILD_TYPE:-Release} - -# --- Start standard header to set AOMP environment variables ---- -realpath=$(realpath "$0") -thisdir=$(dirname "$realpath") -. "$thisdir/aomp_common_vars" -# --- end standard header ---- - -INSTALL_FLANG=${INSTALL_FLANG:-$AOMP_INSTALL_DIR} - -if [ "$AOMP_PROC" == "ppc64le" ] ; then - TARGETS_TO_BUILD="AMDGPU;${AOMP_NVPTX_TARGET}PowerPC" -else - if [ "$AOMP_PROC" == "aarch64" ] ; then - TARGETS_TO_BUILD="AMDGPU;${AOMP_NVPTX_TARGET}AArch64" - else - TARGETS_TO_BUILD="AMDGPU;${AOMP_NVPTX_TARGET}X86" - fi -fi - -COMP_INC_DIR=$(ls -d "$AOMP_INSTALL_DIR"/lib/llvm/lib/clang/*/include ) - -REPO_DIR=$AOMP_REPOS/$AOMP_FLANG_REPO_NAME -COMP_INC_DIR=$REPO_DIR/runtime/libpgmath/lib/common - -if [ "$AOMP_STANDALONE_BUILD" == 0 ]; then - if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then - openmp_build_runtime_src=$BUILD_DIR/build/openmp/asan/runtime/src - CMAKE_PREFIX_PATH=$BUILD_DIR/build/pgmath/asan - else - openmp_build_runtime_src=$BUILD_DIR/build/openmp/runtime/src - CMAKE_PREFIX_PATH=$BUILD_DIR/build/pgmath - fi -else - if [ -d "$BUILD_DIR/build/openmp/runtime/src" ] ; then - openmp_build_runtime_src="$BUILD_DIR/build/openmp/runtime/src" - else - openmp_build_runtime_src="$BUILD_DIR/build/llvm-project/runtimes/runtimes-bins/openmp/runtime/src" - fi - if [ "$AOMP_BUILD_SANITIZER" == 1 ] && [ -d "$BUILD_DIR/build/openmp/asan/runtime/src" ]; then - openmp_build_runtime_src="$BUILD_DIR/build/openmp/asan/runtime/src" - fi -fi - -declare -a MYCMAKEOPTS - -MYCMAKEOPTS=(-DCMAKE_BUILD_TYPE="$BUILD_TYPE" - -DCMAKE_INSTALL_PREFIX="$LLVM_INSTALL_LOC" - -DLLVM_ENABLE_ASSERTIONS=ON - -DLLVM_CONFIG="$LLVM_INSTALL_LOC/bin/llvm-config" - -DCMAKE_CXX_COMPILER="$LLVM_INSTALL_LOC/bin/clang++" - -DCMAKE_C_COMPILER="$LLVM_INSTALL_LOC/bin/clang" - -DCMAKE_Fortran_COMPILER="$LLVM_INSTALL_LOC/bin/flang-classic" - -DLLVM_TARGETS_TO_BUILD="$TARGETS_TO_BUILD" - -DLLVM_INSTALL_RUNTIME=ON - -DFLANG_BUILD_RUNTIME=ON - -DOPENMP_BUILD_DIR="$openmp_build_runtime_src" - -DFLANG_INCLUDE_TESTS=OFF) - -# Note this variable is used only for AOMP ASan-ROCm builds don't remove it. -# This is not used for AOMP-ASan standalone build. -if [ "$SANITIZER" == 1 ]; then - MYCMAKEOPTS=("${MYCMAKEOPTS[@]}" -DSANITIZER="$SANITIZER") -fi - -declare -a ASAN_CMAKE_OPTS - -if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then - ASAN_FLAGS=("${ASAN_FLAGS[@]}" -I"$COMP_INC_DIR") - ASAN_CMAKE_OPTS=("${MYCMAKEOPTS[@]}" - -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF - -DCMAKE_INSTALL_BINDIR=bin/asan - -DCMAKE_INSTALL_LIBDIR=lib/asan) - if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then - ASAN_CMAKE_OPTS=("${ASAN_CMAKE_OPTS[@]}" - -DCMAKE_PREFIX_PATH="$AOMP/lib/asan/cmake;$AOMP/lib/asan" - "${AOMP_ASAN_ORIGIN_RPATH[@]}") - else - ASAN_CMAKE_OPTS=("${ASAN_CMAKE_OPTS[@]}" - -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;$INSTALL_PREFIX/lib/asan/cmake" - "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}" - -DOPENMP_EXTRAS_SHARED_LINKER_FLAGS="$(cmquot "${OPENMP_EXTRAS_SHARED_LINKER_FLAGS[@]}")") - fi -fi - -if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then - MYCMAKEOPTS=("${MYCMAKEOPTS[@]}" - -DCMAKE_PREFIX_PATH="$AOMP/lib/cmake;$AOMP_INSTALL_DIR/lib" - "${AOMP_ORIGIN_RPATH[@]}") -else - MYCMAKEOPTS=("${MYCMAKEOPTS[@]}" - -DCMAKE_PREFIX_PATH="$INSTALL_PREFIX/lib/asan/cmake" - -DOPENMP_EXTRAS_SHARED_LINKER_FLAGS="$(cmquot "${OPENMP_EXTRAS_SHARED_LINKER_FLAGS[@]}")" - -DAOMP_BUILD_SANITIZER="$AOMP_BUILD_SANITIZER" - -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" - "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}") -fi - -if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then - help_build_aomp -fi - -check_writable_installdir "$1" "$INSTALL_FLANG" - -# Skip synchronization from git repos if nocmake or install are specified -if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then - echo - echo "This is a FRESH START. ERASING any previous builds in $BUILD_DIR/build/flang_runtime" - echo "Use ""$0 nocmake"" or ""$0 install"" to avoid FRESH START." - rm -rf "$BUILD_DIR/build/flang_runtime" - mkdir -p "$BUILD_DIR/build/flang_runtime" - if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then - mkdir -p "$BUILD_DIR/build/flang_runtime/asan" - fi -else - if [ ! -d "$BUILD_DIR/build/flang_runtime" ] ; then - echo "ERROR: The build directory $BUILD_DIR/build/flang_runtime does not exist" - echo " run $0 without nocmake or install options. " - exit 1 - fi - if [ "$AOMP_BUILD_SANITIZER" == 1 ] && [ ! -d "$BUILD_DIR/build/flang_runtime/asan" ]; then - echo "ERROR: The build directory $BUILD_DIR/build/flang_runtime/asan does not exist" - echo " run $0 without nocmake or install options. " - exit 1 - fi -fi - -# Need llvm-config to come from previous LLVM build -export PATH="$AOMP_INSTALL_DIR/bin":$PATH -# Old CMAKE uses FC env variable to find fortran compiler -export FC="$AOMP_INSTALL_DIR/bin/flang" - -if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then - if [ "$SANITIZER" != 1 ]; then - cd "$BUILD_DIR/build/flang_runtime" || exit - echo - echo " -----Running cmake ---- " - echo "${AOMP_CMAKE}" "$(shquot "${MYCMAKEOPTS[@]}")" \ - -DCMAKE_C_FLAGS="$CFLAGS -I$COMP_INC_DIR" \ - -DCMAKE_CXX_FLAGS="$CXXFLAGS -I$COMP_INC_DIR" \ - "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME" - - if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" \ - -DCMAKE_C_FLAGS="$CFLAGS -I$COMP_INC_DIR" \ - -DCMAKE_CXX_FLAGS="$CXXFLAGS -I$COMP_INC_DIR" \ - "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME" 2>&1; then - echo "ERROR cmake failed. Cmake flags" - echo " $(shquot "${MYCMAKEOPTS[@]}")" - exit 1 - fi - fi - - if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then - cd "$BUILD_DIR/build/flang_runtime/asan" || exit - echo - echo " -----Running cmake flang_runtime-asan ---- " - echo "${AOMP_CMAKE}" "$(shquot "${ASAN_CMAKE_OPTS[@]}")" \ - -DCMAKE_C_FLAGS="\"$CFLAGS $(cmquot "${ASAN_FLAGS[@]}")\"" \ - -DCMAKE_CXX_FLAGS="\"$CXXFLAGS $(cmquot "${ASAN_FLAGS[@]}")\"" \ - "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME" - - if ! ${AOMP_CMAKE} "${ASAN_CMAKE_OPTS[@]}" \ - -DCMAKE_C_FLAGS="$CFLAGS $(cmquot "${ASAN_FLAGS[@]}")" \ - -DCMAKE_CXX_FLAGS="$CXXFLAGS $(cmquot "${ASAN_FLAGS[@]}")" \ - "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME" 2>&1; then - echo "ERROR flang_runtime-asan cmake failed. Cmake flags" - echo " $(shquot "${ASAN_CMAKE_OPTS[@]}")" - exit 1 - fi - fi -fi - -if [ "$1" = "cmake" ]; then - exit 0 -fi - -echo -if [ "$SANITIZER" != 1 ]; then - echo " -----Running make ---- " - cd "$BUILD_DIR/build/flang_runtime" || exit - echo make -j "$AOMP_JOB_THREADS" - - if ! make -j "$AOMP_JOB_THREADS"; then - echo "ERROR make -j $AOMP_JOB_THREADS failed" - exit 1 - fi -fi - -if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then - echo - echo " -----Running make ---- " - cd "$BUILD_DIR/build/flang_runtime/asan" || exit - echo make -j "$AOMP_JOB_THREADS" - - if ! make -j "$AOMP_JOB_THREADS"; then - echo "ERROR make -j $AOMP_JOB_THREADS failed" - exit 1 - fi -fi - -if [ "$1" == "install" ] ; then - if [ "$SANITIZER" != 1 ]; then - cd "$BUILD_DIR/build/flang_runtime" || exit - echo " -----Installing to $INSTALL_FLANG ---- " - - if ! $SUDO make install; then - echo "ERROR make install failed " - exit 1 - fi - echo "SUCCESSFUL INSTALL to $INSTALL_FLANG " - echo - fi - - if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then - cd "$BUILD_DIR/build/flang_runtime/asan" || exit - echo " -----Installing to $INSTALL_FLANG/lib/asan ---- " - - if ! $SUDO make install; then - echo "ERROR make install failed " - exit 1 - fi - echo "SUCCESSFUL INSTALL to $INSTALL_FLANG/lib/asan " - echo - fi -else - echo - echo "SUCCESSFUL BUILD, please run: $0 install" - echo " to install into $AOMP" - echo -fi diff --git a/bin/build_llvm-classic.sh b/bin/build_llvm-classic.sh deleted file mode 100755 index 9c456233dc..0000000000 --- a/bin/build_llvm-classic.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/bin/bash -# -#Copyright © Advanced Micro Devices, Inc., or its affiliates. -# -#SPDX-License-Identifier: MIT -# -# 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-classic build step. -# These libs/headers are not installed and will picked up from the build -# tree for flang-classic. -# -BUILD_TYPE=${BUILD_TYPE:-Release} - -# --- Start standard header to set AOMP environment variables ---- -realpath=$(realpath "$0") -thisdir=$(dirname "$realpath") -. "$thisdir/aomp_common_vars" -# --- end standard header ---- - -if [ "$AOMP_BUILD_FLANG_CLASSIC" == 0 ] ; then - if [ "$1" != "install" ] ; then - 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 -fi -TARGETS_TO_BUILD="AMDGPU;${AOMP_NVPTX_TARGET}X86" - -if [ "$AOMP_USE_NINJA" == 0 ] ; then - AOMP_SET_NINJA_GEN=() -else - AOMP_SET_NINJA_GEN=(-G Ninja) -fi -osversion=$(grep -e ^VERSION_ID < /etc/os-release) -if [[ $osversion =~ \"7\. ]] || [[ $osversion =~ \"8\. ]]; then - _cxx_flag=(-DCMAKE_CXX_FLAGS='-D_GLIBCXX_USE_CXX11_ABI=0') -else - _cxx_flag=() -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 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 flang-classic -# via the link from flang to clang. rocm 5.5 would be best. -# This will enable removal of flang-classic driver support -# from clang to make way for flang. - -# 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-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-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 -#AOMP_LFL_DIR=${AOMP_LFL_DIR:-17.0-4} - -declare -a LLVMCMAKEOPTS - -LLVMCMAKEOPTS=(-DLLVM_ENABLE_PROJECTS=clang - -DCMAKE_BUILD_TYPE=Release - -DLLVM_ENABLE_ASSERTIONS=ON - -DLLVM_TARGETS_TO_BUILD="$TARGETS_TO_BUILD" - -DCLANG_DEFAULT_LINKER=lld - -DLLVM_VERSION_MAJOR="$LLVM_VERSION_MAJOR" - -DLLVM_INCLUDE_BENCHMARKS=0 - -DLLVM_INCLUDE_RUNTIMES=0 - -DLLVM_INCLUDE_EXAMPLES=0 - -DLLVM_INCLUDE_TESTS=0 - -DLLVM_INCLUDE_DOCS=0 - -DLLVM_INCLUDE_UTILS=0 - -DCLANG_DEFAULT_PIE_ON_LINUX=0 - -DLLVM_ENABLE_ZSTD=OFF - "${_cxx_flag[@]}" - "${AOMP_SET_NINJA_GEN[@]}") - -if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then - help_build_aomp -fi - -if [ "$AOMP_STANDALONE_BUILD" == 1 ] ; then - if [ ! -L "$AOMP" ] && [ -d "$AOMP" ] ; then - echo "ERROR: Directory $AOMP is a physical directory." - echo " It must be a symbolic link or not exist" - exit 1 - fi -fi - -check_writable_installdir "$1" "$AOMP_INSTALL_DIR" - -if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then - echo - 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-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-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 classic (ROCm 5.5). -if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then - cd "$BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR/llvm-classic" || exit - echo " -----Running cmake ---- " - echo "${AOMP_CMAKE}" "${LLVMCMAKEOPTS[@]}" "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME/flang-classic/$AOMP_LFL_DIR/llvm-classic/llvm" - - if ! ${AOMP_CMAKE} "${LLVMCMAKEOPTS[@]}" \ - "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME/flang-classic/$AOMP_LFL_DIR/llvm-classic/llvm" 2>&1; then - echo "ERROR cmake failed. Cmake flags" - echo " $(shquot "${LLVMCMAKEOPTS[@]}")" - exit 1 - fi - echo -fi - -if [ "$1" = "cmake" ]; then - exit 0 -fi - -# 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" || exit - -if ! $AOMP_NINJA_BIN -j "$AOMP_JOB_THREADS"; then - echo " " - echo "ERROR: $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS FAILED" - echo "To restart:" - echo " cd $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR/llvm-classic" - echo " $AOMP_NINJA_BIN" - exit 1 -fi diff --git a/bin/build_pgmath.sh b/bin/build_pgmath.sh deleted file mode 100755 index cdd1045cf9..0000000000 --- a/bin/build_pgmath.sh +++ /dev/null @@ -1,198 +0,0 @@ -#!/bin/bash -# -# build_pgmath.sh: Script to build the pgmath component of the AOMP compiler. -# -# -BUILD_TYPE=${BUILD_TYPE:-Release} - -# --- Start standard header to set AOMP environment variables ---- -realpath=$(realpath "$0") -thisdir=$(dirname "$realpath") -. "$thisdir/aomp_common_vars" -# --- end standard header ---- - -INSTALL_FLANG=${INSTALL_FLANG:-$AOMP_INSTALL_DIR} - -if [ "$AOMP_PROC" == "ppc64le" ] ; then - TARGETS_TO_BUILD="AMDGPU;${AOMP_NVPTX_TARGET}PowerPC" -else - if [ "$AOMP_PROC" == "aarch64" ] ; then - TARGETS_TO_BUILD="AMDGPU;${AOMP_NVPTX_TARGET}AArch64" - else - TARGETS_TO_BUILD="AMDGPU;${AOMP_NVPTX_TARGET}X86" - fi -fi - -COMP_INC_DIR=$(ls -d "$AOMP_INSTALL_DIR"/lib/clang/*/include ) - -declare -a MYCMAKEOPTS - -if [ "$AOMP_PROC" == "ppc64le" ] ; then - MYCMAKEOPTS=(-DCMAKE_BUILD_TYPE="$BUILD_TYPE" - -DCMAKE_INSTALL_PREFIX="$LLVM_INSTALL_LOC" - -DLLVM_ENABLE_ASSERTIONS=ON - -DCMAKE_Fortran_COMPILER="$LLVM_INSTALL_LOC/bin/flang" - -DLLVM_TARGETS_TO_BUILD="$TARGETS_TO_BUILD") -else - MYCMAKEOPTS=(-DCMAKE_BUILD_TYPE="$BUILD_TYPE" - -DCMAKE_INSTALL_PREFIX="$LLVM_INSTALL_LOC" - -DLLVM_ENABLE_ASSERTIONS=ON - -DLLVM_CONFIG="$LLVM_INSTALL_LOC/bin/llvm-config" - -DCMAKE_CXX_COMPILER=clang++ - -DCMAKE_C_COMPILER=clang - -DLLVM_TARGETS_TO_BUILD="$TARGETS_TO_BUILD") -fi - -declare -a ASAN_CMAKE_OPTS - -if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then - ASAN_FLAGS=("${ASAN_FLAGS[@]}" "-I$COMP_INC_DIR") - ASAN_CMAKE_OPTS=("${MYCMAKEOPTS[@]}" - -DCMAKE_PREFIX_PATH="$AOMP/lib/asan/cmake" - -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF - -DCMAKE_INSTALL_BINDIR=bin/asan - -DCMAKE_INSTALL_LIBDIR=lib/asan) - if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then - ASAN_CMAKE_OPTS=("${ASAN_CMAKE_OPTS[@]}" "${AOMP_ASAN_ORIGIN_RPATH[@]}") - else - ASAN_CMAKE_OPTS=("${ASAN_CMAKE_OPTS[@]}" "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}") - fi -fi - -if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then - MYCMAKEOPTS=("${MYCMAKEOPTS[@]}" "${AOMP_ORIGIN_RPATH[@]}") -else - MYCMAKEOPTS=("${MYCMAKEOPTS[@]}" "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}") -fi - -MYCMAKEOPTS=("${MYCMAKEOPTS[@]}" -DCMAKE_PREFIX_PATH="$AOMP/lib/cmake") - -if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then - help_build_aomp -fi - -check_writable_installdir "$1" "$INSTALL_FLANG" - -# Skip synchronization from git repos if nocmake or install are specified -if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then - echo - echo "This is a FRESH START. ERASING any previous builds in $BUILD_DIR/build/pgmath" - echo "Use ""$0 nocmake"" or ""$0 install"" to avoid FRESH START." - rm -rf "$BUILD_DIR/build/pgmath" - mkdir -p "$BUILD_DIR/build/pgmath" - if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then - mkdir -p "$BUILD_DIR/build/pgmath/asan" - fi -else - if [ ! -d "$BUILD_DIR/build/pgmath" ] ; then - echo "ERROR: The build directory $BUILD_DIR/build/pgmath does not exist" - echo " run $0 without nocmake or install options. " - exit 1 - fi - if [ "$AOMP_BUILD_SANITIZER" == 1 ] && [ ! -d "$BUILD_DIR/build/pgmath/asan" ] ; then - echo "ERROR: The build directory $BUILD_DIR/build/pgmath/asan does not exist" - echo " run $0 without nocmake or install options. " - exit 1 - fi -fi - -# Need llvm-config to come from previous LLVM build -export PATH="$LLVM_INSTALL_LOC/bin":$PATH - -if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then - if [ "$SANITIZER" != 1 ]; then - echo - cd "$BUILD_DIR/build/pgmath" || exit - echo " -----Running cmake ---- " - echo "${AOMP_CMAKE}" "$(shquot "${MYCMAKEOPTS[@]}")" \ - -DCMAKE_C_FLAGS="$CFLAGS -I$COMP_INC_DIR" \ - -DCMAKE_CXX_FLAGS="$CXXFLAGS -I$COMP_INC_DIR" \ - "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME/runtime/libpgmath" - - if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" \ - -DCMAKE_C_FLAGS="$CFLAGS -I$COMP_INC_DIR" \ - -DCMAKE_CXX_FLAGS="$CXXFLAGS -I$COMP_INC_DIR" \ - "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME/runtime/libpgmath" 2>&1; then - echo "ERROR cmake failed. Cmake flags" - echo " $(shquot "${MYCMAKEOPTS[@]}")" - exit 1 - fi - fi - - if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then - echo - cd "$BUILD_DIR/build/pgmath/asan" || exit - echo " -----Running cmake pgmath-asan ---- " - echo "${AOMP_CMAKE}" "$(shquot "${ASAN_CMAKE_OPTS[@]}")" \ - -DCMAKE_C_FLAGS="\"$CFLAGS $(cmquot "${ASAN_FLAGS[@]}")\"" \ - -DCMAKE_CXX_FLAGS="\"$CXXFLAGS $(cmquot "${ASAN_FLAGS[@]}")\"" \ - "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME/runtime/libpgmath" - - if ! ${AOMP_CMAKE} "${ASAN_CMAKE_OPTS[@]}" \ - -DCMAKE_C_FLAGS="$CFLAGS $(cmquot "${ASAN_FLAGS[@]}")" \ - -DCMAKE_CXX_FLAGS="$CXXFLAGS $(cmquot "${ASAN_FLAGS[@]}")" \ - "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME/runtime/libpgmath" 2>&1; then - echo "ERROR pgmath-asan cmake failed. Cmake flags" - echo " $(shquot "${ASAN_CMAKE_OPTS[@]}")" - exit 1 - fi - fi -fi - -if [ "$1" = "cmake" ]; then - exit 0 -fi - -if [ "$SANITIZER" != 1 ]; then - echo - cd "$BUILD_DIR/build/pgmath" || exit - echo " -----Running make ---- " - echo make -j "$AOMP_JOB_THREADS" - - if ! make -j "$AOMP_JOB_THREADS"; then - echo "ERROR make -j $AOMP_JOB_THREADS failed" - exit 1 - fi -fi - -if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then - echo - cd "$BUILD_DIR/build/pgmath/asan" || exit - echo " -----Running make ---- " - echo "make -j $AOMP_JOB_THREADS" - - if ! make -j "$AOMP_JOB_THREADS"; then - echo "ERROR make -j $AOMP_JOB_THREADS failed" - exit 1 - fi -fi - -if [ "$1" == "install" ] ; then - if [ "$SANITIZER" != 1 ]; then - cd "$BUILD_DIR/build/pgmath" || exit - echo " -----Installing to $INSTALL_FLANG ---- " - - if ! $SUDO make install; then - echo "ERROR make install failed " - exit 1 - fi - echo "SUCCESSFUL INSTALL to $INSTALL_FLANG " - echo - fi - if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then - cd "$BUILD_DIR/build/pgmath/asan" || exit - echo " -----Installing to $INSTALL_FLANG/lib/asan ---- " - - if ! $SUDO make install; then - echo "ERROR make install failed " - exit 1 - fi - echo "SUCCESSFUL INSTALL to $INSTALL_FLANG/lib/asan" - echo - fi -else - echo - echo "SUCCESSFUL BUILD, please run: $0 install" - echo " to install into $AOMP" - echo -fi diff --git a/bin/build_supp.sh b/bin/build_supp.sh index 68d4555d94..a790460f97 100755 --- a/bin/build_supp.sh +++ b/bin/build_supp.sh @@ -629,7 +629,7 @@ function buildhdf5(){ echo echo " -----Running cmake ---- " echo "${AOMP_CMAKE}" "$(shquot "${MYCMAKEOPTS[@]}")" \ - "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME" + "../" if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" ../; then echo "ERROR cmake failed. Cmake flags" diff --git a/bin/disableClassic b/bin/disableClassic deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/bin/package.py b/bin/package.py index af3d22b68a..6dffa69c0d 100644 --- a/bin/package.py +++ b/bin/package.py @@ -23,11 +23,6 @@ def edit(self, spec, prefix): makefile = FileFilter('Makefile') filter_file('add_subdirectory(test)', '#add_subdirectory(test)','llvm-project/compiler-rt/CMakeLists.txt', string=True) filter_file('add_subdirectory(test)', '#add_subdirectory(test)','llvm-project/llvm/CMakeLists.txt', string=True) - filter_file('add_subdirectory(test)', '#add_subdirectory(test)','flang/CMakeLists.txt', string=True) - - # Add -w to suppress warnings, which spack thinks are errors - filter_file('-std=c11', '-std=c11 -w','flang/tools/flang1/flang1exe/CMakeLists.txt', string=True) - filter_file('PRIVATE -fPIC)', 'PRIVATE -fPIC PRIVATE -w)','flang/runtime/flang/CMakeLists.txt', string=True) def install(self, spec, prefix): make() diff --git a/bin/patches/README.md b/bin/patches/README.md index b73c3c37a5..fc37ec3c3f 100644 --- a/bin/patches/README.md +++ b/bin/patches/README.md @@ -10,7 +10,7 @@ If we created a mirror, we would not get maintenance unless we kept updating the The components that AOMP developers have direct control over are: - llvm-project, aomp-extras, flang, aomp + llvm-project, aomp-extras, aomp All other components are non-AOMP components that often require patching to work with AOMP. The AOMP build scripts for non-AOMP components use this patching process: diff --git a/docs/SOURCEINSTALL.md b/docs/SOURCEINSTALL.md index 0ca767b43b..a6e4aa1509 100644 --- a/docs/SOURCEINSTALL.md +++ b/docs/SOURCEINSTALL.md @@ -79,7 +79,6 @@ The above command will produce output like this showing you the location and bra -------- ------ ---- --------- --------- ------- -------- ---------- emu amd-staging llvm-project lightning/ec/llvm-project f986706166c9 2023-12-06 Ron Lieberman JP Lehr emu amd-staging SPIRV-LLVM-Translator SPIRV-LLVM-Translator 0659e45216b2 2024-12-04 AlexVlx AlexVlx - roc aomp-dev flang flang 88b81b0a8ead 2023-11-30 GitHub Emma Pilkington roc aomp-dev aomp aomp df5b5d8ddffa 2023-12-05 Dhruva Chakrabarti Dhruva Chakrabarti roc release/rocm-rel-7.2 rocprofiler-sdk rocprofiler-sdk 7283f62b2c16 2025-09-22 GitHub Ammar ELWazir roc release/rocm-rel-7.2 roctracer roctracer 6fbf7673aa7f 2023-07-13 Ranjith Ramakrishnan Ranjith Ramakrishnan diff --git a/docs/SOURCEINSTALL_PREREQUISITE.md b/docs/SOURCEINSTALL_PREREQUISITE.md index ebfc62a6b8..8efc4540a6 100644 --- a/docs/SOURCEINSTALL_PREREQUISITE.md +++ b/docs/SOURCEINSTALL_PREREQUISITE.md @@ -21,7 +21,7 @@ #### Debian or Ubuntu Packages ``` - sudo apt-get install wget gcc g++ pkg-config libpci-dev libnuma-dev libffi-dev git python3 libopenmpi-dev gawk mesa-common-dev libtool libdrm-amdgpu1 libdrm-dev ccache libdw-dev libgtest-dev libsystemd-dev cmake openssl libssl-dev libgmp-dev libmpfr-dev libelf-dev patchelf pciutils python3.10-dev libudev-dev libgtest-dev libstdc++-12-dev python3-lxml ocl-icd-opencl-dev libsystemd-dev libfmt-dev libmsgpack-dev libsqlite3-dev libnl-3-dev libnl-genl-3-dev libmnl-dev + sudo apt-get install wget gcc g++ pkg-config libpci-dev libnuma-dev libffi-dev git python3 libopenmpi-dev mesa-common-dev libtool libdrm-amdgpu1 libdrm-dev ccache libdw-dev libgtest-dev libsystemd-dev cmake openssl libssl-dev libgmp-dev libmpfr-dev libelf-dev patchelf pciutils python3.10-dev libudev-dev libgtest-dev libstdc++-12-dev python3-lxml ocl-icd-opencl-dev libsystemd-dev libfmt-dev libmsgpack-dev libsqlite3-dev libnl-3-dev libnl-genl-3-dev libmnl-dev # Additional packages used by rocgdb sudo apt-get install texinfo libbison-dev bison flex libbabeltrace-dev python3-pip libncurses5-dev liblzma-dev python3-setuptools python3-dev libudev-dev libgmp-dev libmpfr-dev libdw-dev From fdcb61e08f1ceb30cce3a00420c4260f7fab228e Mon Sep 17 00:00:00 2001 From: Nicole Aschenbrenner Date: Thu, 24 Sep 2026 09:12:33 -0500 Subject: [PATCH 19/23] [build] Fix CMAKE_PREFIX_PATH for rocprofiler-sdk A second -DCMAKE_PREFIX_PATH replaces the first, which dropped the AOMP install from the search path and broke the rocprofiler-sdk build (no rocprofv3 since #2545). --- bin/build_rocprofiler-sdk.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/build_rocprofiler-sdk.sh b/bin/build_rocprofiler-sdk.sh index 8e08e48f57..c1c2a18cc5 100755 --- a/bin/build_rocprofiler-sdk.sh +++ b/bin/build_rocprofiler-sdk.sh @@ -74,9 +74,8 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then declare -a MYCMAKEOPTS - MYCMAKEOPTS=(-DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR;$HOME/local/aqlprofile" + MYCMAKEOPTS=(-DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR;$HOME/local/aqlprofile;$AOMP_INSTALL_DIR/rocm_sysdeps" -DCMAKE_INSTALL_PREFIX="$INSTALL_ROCPROF_SDK" - -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/rocm_sysdeps" -DCMAKE_BUILD_TYPE="$BUILD_TYPE" -DROCM_ROOT_DIR="$AOMP_INSTALL_DIR" -DBUILD_SHARED_LIBS=On From b411cea349473087d5d79d893ff8375bcddea1e2 Mon Sep 17 00:00:00 2001 From: estewart08 Date: Thu, 24 Sep 2026 13:06:40 -0500 Subject: [PATCH 20/23] [docs]: Add meson to SOURCEINSTALL_PREREQUISITE.md (#2585) Now that libdrm is built and installed with AOMP, meson is needed for configuration. --- docs/SOURCEINSTALL_PREREQUISITE.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/SOURCEINSTALL_PREREQUISITE.md b/docs/SOURCEINSTALL_PREREQUISITE.md index 8efc4540a6..62f554a56b 100644 --- a/docs/SOURCEINSTALL_PREREQUISITE.md +++ b/docs/SOURCEINSTALL_PREREQUISITE.md @@ -4,7 +4,7 @@ #### ManyLinux (AlmaLinux 8) ``` - sudo dnf -y install bison ccache cmake elfutils-libelf-devel elfutis-devel expat-devel flex fmt-devel gcc-c++ gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ gcc-toolset-12-gcc-gfortran gcc-toolset-12-libatomic-devel gcc-toolset-12-libstdc++-devel gdb git gmp-devel gtest-devel libatomic libbabeltrace-devel libffi-devel libquadmath-devel libtool mesa-libGL-devel mpfr-devel msgpack-devel ncurses-devel numactl-devel openssl-devel ocl-icd-devel pciutils-devel python3-devel rpm-build rsync sqlite-devel systemd-devel texinfo vim wget xz-devel libmnl-devel libnl3-devel + sudo dnf -y install bison ccache cmake elfutils-libelf-devel elfutis-devel expat-devel flex fmt-devel gcc-c++ gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ gcc-toolset-12-gcc-gfortran gcc-toolset-12-libatomic-devel gcc-toolset-12-libstdc++-devel gdb git gmp-devel gtest-devel libatomic libbabeltrace-devel libffi-devel libquadmath-devel libtool mesa-libGL-devel mpfr-devel msgpack-devel ncurses-devel numactl-devel openssl-devel ocl-icd-devel pciutils-devel python3-devel rpm-build rsync sqlite-devel systemd-devel texinfo vim wget xz-devel libmnl-devel libnl3-devel meson # Download and install Python 3.10.18 wget https://www.python.org/ftp/python/3.10.18/Python-3.10.18.tgz; tar xf Python-3.10.18.tgz; cd Python-3.10.18; ./configure --enable-optimizations --enable-shared; make altinstall; --prefix=$HOME/local/Python-3.10.18; ln -s $HOME/local/Python-3.10.18/bin/python3.10 $HOME/local/Python-3.10.18/bin/python3 @@ -21,7 +21,7 @@ #### Debian or Ubuntu Packages ``` - sudo apt-get install wget gcc g++ pkg-config libpci-dev libnuma-dev libffi-dev git python3 libopenmpi-dev mesa-common-dev libtool libdrm-amdgpu1 libdrm-dev ccache libdw-dev libgtest-dev libsystemd-dev cmake openssl libssl-dev libgmp-dev libmpfr-dev libelf-dev patchelf pciutils python3.10-dev libudev-dev libgtest-dev libstdc++-12-dev python3-lxml ocl-icd-opencl-dev libsystemd-dev libfmt-dev libmsgpack-dev libsqlite3-dev libnl-3-dev libnl-genl-3-dev libmnl-dev + sudo apt-get install wget gcc g++ pkg-config libpci-dev libnuma-dev libffi-dev git python3 libopenmpi-dev mesa-common-dev libtool libdrm-amdgpu1 libdrm-dev ccache libdw-dev libgtest-dev libsystemd-dev cmake openssl libssl-dev libgmp-dev libmpfr-dev libelf-dev patchelf pciutils python3.10-dev libudev-dev libgtest-dev libstdc++-12-dev python3-lxml ocl-icd-opencl-dev libsystemd-dev libfmt-dev libmsgpack-dev libsqlite3-dev libnl-3-dev libnl-genl-3-dev libmnl-dev meson # Additional packages used by rocgdb sudo apt-get install texinfo libbison-dev bison flex libbabeltrace-dev python3-pip libncurses5-dev liblzma-dev python3-setuptools python3-dev libudev-dev libgmp-dev libmpfr-dev libdw-dev @@ -45,7 +45,7 @@ Ubuntu 24.04 Only #### SLES-15-SP6 Packages ``` - sudo zypper install wget libopenssl-devel elfutils libelf-devel git pciutils-devel libffi-devel gcc gcc-c++ libnuma-devel openmpi4-devel Mesa-libGL-devel libquadmath0 libtool libX11-devel systemd-devel hwdata unzip mpfr-devel ocl-icd-devel gcc7-fortran ncurses-devel gcc13-c++ gcc13 libstdc++6-devel-gcc13 libc++-devel sqlite-devel + sudo zypper install wget libopenssl-devel elfutils libelf-devel git pciutils-devel libffi-devel gcc gcc-c++ libnuma-devel openmpi4-devel Mesa-libGL-devel libquadmath0 libtool libX11-devel systemd-devel hwdata unzip mpfr-devel ocl-icd-devel gcc7-fortran ncurses-devel gcc13-c++ gcc13 libstdc++6-devel-gcc13 libc++-devel sqlite-devel meson A symbolic link may be required at /usr/lib64: /usr/lib64/libquadmath.so -> /usr/lib64/libquadmath.so.0. @@ -77,7 +77,7 @@ Ubuntu 24.04 Only #### RHEL Packages RHEL 8 ``` - sudo yum install dnf-plugins-core gcc-c++ git wget openssl-devel elfutils-libelf-devel elfutils-devel ccache pciutils-devel numactl-devel libffi-devel mesa-libGL-devel libtool libdrm libdrm-devel gmp-devel rpm-build gcc-gfortran libdw-devel libgtest-devel systemd-devel mpfr-devel python38 python38-devel ocl-icd-devel libatomic libquadmath-devel sqlite-devel + sudo yum install dnf-plugins-core gcc-c++ git wget openssl-devel elfutils-libelf-devel elfutils-devel ccache pciutils-devel numactl-devel libffi-devel mesa-libGL-devel libtool libdrm libdrm-devel gmp-devel rpm-build gcc-gfortran libdw-devel libgtest-devel systemd-devel mpfr-devel python38 python38-devel ocl-icd-devel libatomic libquadmath-devel sqlite-devel meson # Additional packages used by rocgdb and roctracer sudo yum install texinfo bison flex ncurses-devel expat-devel xz-devel libbabeltrace-devel libatomic libdwarf-devel gtest-devel @@ -91,7 +91,7 @@ RHEL 8 RHEL 9 ``` - sudo dnf install dnf-plugins-core gcc-c++ git wget openssl-devel elfutils-libelf-devel elfutils-devel ccache pciutils-devel numactl-devel libffi-devel mesa-libGL-devel libtool libdrm libdrm-devel gmp-devel rpm-build gcc-gfortran libdw-devel libgtest-devel systemd-devel mpfr-devel python3-devel ocl-icd-devel libatomic libquadmath-devel sqlite-devel + sudo dnf install dnf-plugins-core gcc-c++ git wget openssl-devel elfutils-libelf-devel elfutils-devel ccache pciutils-devel numactl-devel libffi-devel mesa-libGL-devel libtool libdrm libdrm-devel gmp-devel rpm-build gcc-gfortran libdw-devel libgtest-devel systemd-devel mpfr-devel python3-devel ocl-icd-devel libatomic libquadmath-devel sqlite-devel meson # Additional packages used by rocgdb and roctracer sudo dnf install texinfo bison flex ncurses-devel expat-devel xz-devel libbabeltrace-devel libatomic libdwarf-devel gtest-devel From afefc8620095e0928a3a73d8deaef2b2ddcfeba8 Mon Sep 17 00:00:00 2001 From: Nicole Aschenbrenner Date: Fri, 25 Sep 2026 06:22:06 -0500 Subject: [PATCH 21/23] [build] Remove classic flang leftovers Follow up to #2569. Removes missed references to classic flang in usage notes for test scripts and README files, commented out and flang-classic libs and prereq tools in build-scripts. --- bin/build_aomp_docker_release.sh | 8 ++++---- bin/build_project.sh | 2 -- bin/run_genasis.sh | 2 +- f18bin/build_f18.sh | 12 ------------ trunk/build_trunk.sh | 11 ----------- .../test/parallel_no_teams_test/parallel_no_teams.sh | 4 ---- trunk/test/parallel_no_teams_test/pt2_no_teams.sh | 4 ---- trunk/test/parallel_test/parallel_test.sh | 4 ---- trunk/test/parallel_test/pt2.sh | 4 ---- .../reduction_no_teams_test/reduction_no_teams.sh | 4 ---- trunk/test/reduction_no_teams_test/rt2_no_teams.sh | 4 ---- trunk/test/reduction_sim/README | 7 ------- trunk/test/reduction_sim/reduction_sim.sh | 4 ---- trunk/test/reduction_test/reduction_test.sh | 4 ---- trunk/test/reduction_test/rt2.sh | 4 ---- trunk/test/stream/stream.sh | 4 ---- trunk/test/stream_no_teams/stream_no_teams.sh | 4 ---- 17 files changed, 5 insertions(+), 81 deletions(-) diff --git a/bin/build_aomp_docker_release.sh b/bin/build_aomp_docker_release.sh index 75c8af12f7..8187cd6dfa 100755 --- a/bin/build_aomp_docker_release.sh +++ b/bin/build_aomp_docker_release.sh @@ -71,13 +71,13 @@ pip_install_alma="python3.10 -m pip install --ignore-installed --no-cache-dir ba pip_install_2404="python3 -m venv /opt/venv; PATH=/opt/venv/bin:$PATH python3 -m pip install CppHeaderParser argparse lxml pandas setuptools PyYAML pandas" # Populate prereq arrays -prereq_array["ubuntu1804"]="apt-get -y update && apt-get install -y git cmake wget vim openssl libssl-dev libelf-dev kmod pciutils gcc g++ pkg-config libpci-dev libnuma-dev libffi-dev git python libopenmpi-dev gawk mesa-common-dev libtool python3 texinfo libbison-dev bison flex libbabeltrace-dev python3-pip libncurses5-dev liblzma-dev python3-setuptools python3-dev libpython3.8-dev libudev-dev libgmp-dev debianutils devscripts cli-common-dev rsync sudo && $pip_install" +prereq_array["ubuntu1804"]="apt-get -y update && apt-get install -y git cmake wget vim openssl libssl-dev libelf-dev kmod pciutils gcc g++ pkg-config libpci-dev libnuma-dev libffi-dev git python libopenmpi-dev mesa-common-dev libtool python3 texinfo libbison-dev bison flex libbabeltrace-dev python3-pip libncurses5-dev liblzma-dev python3-setuptools python3-dev libpython3.8-dev libudev-dev libgmp-dev debianutils devscripts cli-common-dev rsync sudo && $pip_install" -prereq_array["ubuntu2004"]="apt-get -y update && apt-get install -y git cmake wget vim openssl libssl-dev libelf-dev kmod pciutils gcc g++ pkg-config libpci-dev libnuma-dev libffi-dev git python libopenmpi-dev gawk mesa-common-dev libtool python3 texinfo libbison-dev bison flex libbabeltrace-dev python3-pip libncurses5-dev liblzma-dev python3-setuptools python3-dev libpython3.8-dev libudev-dev libgmp-dev debianutils devscripts cli-common-dev rsync libsystemd-dev libdw-dev libgtest-dev sudo ccache libgmp-dev libmpfr-dev && $pip_install" +prereq_array["ubuntu2004"]="apt-get -y update && apt-get install -y git cmake wget vim openssl libssl-dev libelf-dev kmod pciutils gcc g++ pkg-config libpci-dev libnuma-dev libffi-dev git python libopenmpi-dev mesa-common-dev libtool python3 texinfo libbison-dev bison flex libbabeltrace-dev python3-pip libncurses5-dev liblzma-dev python3-setuptools python3-dev libpython3.8-dev libudev-dev libgmp-dev debianutils devscripts cli-common-dev rsync libsystemd-dev libdw-dev libgtest-dev sudo ccache libgmp-dev libmpfr-dev && $pip_install" -prereq_array["ubuntu2204"]="apt-get -y update && apt-get install -y git cmake wget vim openssl libssl-dev libelf-dev kmod pciutils gcc g++ pkg-config libpci-dev libnuma-dev libffi-dev git libopenmpi-dev gawk mesa-common-dev libtool python3 texinfo libbison-dev bison flex libbabeltrace-dev python3-pip libncurses5-dev liblzma-dev python3-setuptools python3-dev libpython3.10-dev libudev-dev libgmp-dev debianutils devscripts cli-common-dev rsync libsystemd-dev libdw-dev libgtest-dev libstdc++-12-dev sudo python3-lxml ccache libgmp-dev libmpfr-dev ocl-icd-opencl-dev libfmt-dev libmsgpack-dev python3-venv libsqlite3-dev && $pip_install_2204" +prereq_array["ubuntu2204"]="apt-get -y update && apt-get install -y git cmake wget vim openssl libssl-dev libelf-dev kmod pciutils gcc g++ pkg-config libpci-dev libnuma-dev libffi-dev git libopenmpi-dev mesa-common-dev libtool python3 texinfo libbison-dev bison flex libbabeltrace-dev python3-pip libncurses5-dev liblzma-dev python3-setuptools python3-dev libpython3.10-dev libudev-dev libgmp-dev debianutils devscripts cli-common-dev rsync libsystemd-dev libdw-dev libgtest-dev libstdc++-12-dev sudo python3-lxml ccache libgmp-dev libmpfr-dev ocl-icd-opencl-dev libfmt-dev libmsgpack-dev python3-venv libsqlite3-dev && $pip_install_2204" -prereq_array["ubuntu2404"]="apt-get -y update && apt-get install -y git cmake wget vim openssl libssl-dev libelf-dev kmod pciutils gcc g++ pkg-config libpci-dev libnuma-dev libffi-dev git libopenmpi-dev gawk mesa-common-dev libtool python3 texinfo libbison-dev bison flex libbabeltrace-dev python3-pip libncurses-dev liblzma-dev python3-setuptools python3-dev python3-barectf python3-pip python3-pip-whl python3-requests python3-venv python3-yaml libudev-dev libgmp-dev debianutils devscripts cli-common-dev rsync libsystemd-dev libdw-dev libgtest-dev libstdc++-12-dev sudo python3-lxml ccache libgmp-dev libmpfr-dev make ocl-icd-opencl-dev libfmt-dev libmsgpack-dev libsqlite3-dev && $pip_install_2404" +prereq_array["ubuntu2404"]="apt-get -y update && apt-get install -y git cmake wget vim openssl libssl-dev libelf-dev kmod pciutils gcc g++ pkg-config libpci-dev libnuma-dev libffi-dev git libopenmpi-dev mesa-common-dev libtool python3 texinfo libbison-dev bison flex libbabeltrace-dev python3-pip libncurses-dev liblzma-dev python3-setuptools python3-dev python3-barectf python3-pip python3-pip-whl python3-requests python3-venv python3-yaml libudev-dev libgmp-dev debianutils devscripts cli-common-dev rsync libsystemd-dev libdw-dev libgtest-dev libstdc++-12-dev sudo python3-lxml ccache libgmp-dev libmpfr-dev make ocl-icd-opencl-dev libfmt-dev libmsgpack-dev libsqlite3-dev && $pip_install_2404" prereq_array["centos7"]="yum install -y make gcc-c++ git cmake wget vim openssl-devel elfutils-libelf-devel pciutils-devel numactl-devel libffi-devel mesa-libGL-devel libtool texinfo bison flex ncurses-devel expat-devel xz-devel libbabeltrace-devel gmp-devel rpm-build rsync systemd-devel gtest-devel libpciaccess-devel elfutils-devel ccache libxml2-devel xz-lzma-compat devtoolset-9 devtoolset-9-libatomic-devel devtoolset-9-elfutils-libelf-devel scl-utils mpfr-devel gettext libcurl-devel ocl-icd-devel && yum remove -y python3*" diff --git a/bin/build_project.sh b/bin/build_project.sh index 9a84723ae9..d3a3e3fa1c 100755 --- a/bin/build_project.sh +++ b/bin/build_project.sh @@ -151,8 +151,6 @@ if [ -f "$AOMP_PROJECT_SRC/openmp/device/CMakeLists.txt" ]; then -DRUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON) fi -# -DCLANG_LINK_FLANG_LEGACY=ON - # Enable amdflang, amdclang, amdclang++, amdllvm. # clang-tools-extra added to LLVM_ENABLE_PROJECTS above. MYCMAKEOPTS=("${MYCMAKEOPTS[@]}" diff --git a/bin/run_genasis.sh b/bin/run_genasis.sh index a097b75648..9e379649b2 100755 --- a/bin/run_genasis.sh +++ b/bin/run_genasis.sh @@ -84,7 +84,7 @@ fi export LD_LIBRARY_PATH=$AOMP/lib:$AOMPHIP/lib:$OPENMPI_DIR/lib:$LD_LIBRARY_PATH export FORTRAN_COMPILE="$AOMP/bin/$FLANG -c -fPIC -I$OPENMPI_DIR/lib" export CC_COMPILE="$AOMP/bin/clang -fPIC" -export OTHER_LIBS="-lm -L$AOMP/lib -lflang -lflangmain -lflangrti -lpgmath -lomp -lomptarget -z muldefs" +export OTHER_LIBS="-lm -L$AOMP/lib -lomp -lomptarget -z muldefs" export FORTRAN_LINK="$AOMP/bin/clang $OTHER_LIBS" export DEVICE_COMPILE="$AOMPHIP/bin/hipcc -D__HIP_PLATFORM_HCC__" export HIP_DIR=$ROCM diff --git a/f18bin/build_f18.sh b/f18bin/build_f18.sh index 4e1c5299c1..6286999ce4 100755 --- a/f18bin/build_f18.sh +++ b/f18bin/build_f18.sh @@ -68,17 +68,6 @@ if [ $? != 0 ] ; then fi $TOPSUDO rm $F18_INSTALL_DIR/testfile -#Check for gawk on Ubuntu, which is needed for the flang build. -GAWK=$(gawk --version | grep "^GNU Awk") -OS=$(cat /etc/os-release | grep "^NAME=") - -if [[ -z $GAWK ]] && [[ "$OS" == *"Ubuntu"* ]] ; then - echo - echo "Build Error: gawk was not found and is required for building flang! Please run 'sudo apt-get install gawk' and run build_f18.sh again." - echo - exit 1 -fi - echo date echo " ================= START build_f18.sh ===================" @@ -86,7 +75,6 @@ echo if [ "$F18_STANDALONE_BUILD" == 1 ] ; then # There is no good external repo for the opencl runtime but we only need the headers for build_vdi.sh # So build_ocl.sh is currently not called. - #components="roct rocr project libdevice extras openmp pgmath flang flang_runtime comgr rocminfo vdi hipvdi ocl " components="project" else # With AOMP 11, ROCM integrated build will not need roct rocr libdevice comgr and rocminfo diff --git a/trunk/build_trunk.sh b/trunk/build_trunk.sh index 10deceb6df..34eb54c120 100755 --- a/trunk/build_trunk.sh +++ b/trunk/build_trunk.sh @@ -40,17 +40,6 @@ if [ $? != 0 ] ; then fi rm $TRUNK_INSTALL_DIR/testfile -#Check for gawk on Ubuntu, which is needed for building flang in build_project.sh. -GAWK=$(gawk --version | grep "^GNU Awk") -OS=$(cat /etc/os-release | grep "^NAME=") - -if [[ -z $GAWK ]] && [[ "$OS" == *"Ubuntu"* ]] ; then - echo - echo "Build Error: gawk was not found and is required for building flang! Please run 'sudo apt-get install gawk' and run build_trunk.sh again." - echo - exit 1 -fi - echo date echo " ================= START build_trunk.sh ===================" diff --git a/trunk/test/parallel_no_teams_test/parallel_no_teams.sh b/trunk/test/parallel_no_teams_test/parallel_no_teams.sh index daf6e06cba..7fd98909e4 100755 --- a/trunk/test/parallel_no_teams_test/parallel_no_teams.sh +++ b/trunk/test/parallel_no_teams_test/parallel_no_teams.sh @@ -8,10 +8,6 @@ # OARCH: Offload architecture, sm_70, gfx908, etc # FLANG: binary name for flang compiler, default is flang-new # -# To test this script with AOMP legacy flang compiler -# export TRUNK=$AOMP (where AOMP is installed) -# export FLANG=flang-legacy -# # Set environment variable defaults here: TRUNK=${TRUNK:-$HOME/rocm/trunk} OFFLOAD=${OFFLOAD:-MANDATORY} diff --git a/trunk/test/parallel_no_teams_test/pt2_no_teams.sh b/trunk/test/parallel_no_teams_test/pt2_no_teams.sh index 984bfa927f..8f101f99cc 100755 --- a/trunk/test/parallel_no_teams_test/pt2_no_teams.sh +++ b/trunk/test/parallel_no_teams_test/pt2_no_teams.sh @@ -8,10 +8,6 @@ # OARCH: Offload architecture, sm_70, gfx908, etc # FLANG: binary name for flang compiler, default is flang-new # -# To test this script with the AOMP legacy flang compiler, set these vars -# export TRUNK=$AOMP (where AOMP is installed) -# export FLANG=flang-legacy -# # pt2_no_teams.sh is identical to parallel_no_teams.sh except pt2_no_teams.sh # does not use -save-temps because sometimes -save-temps changes behavior or fails # outputs to directories tmpc2 and tmpf2 instead of tmpc and tmpf diff --git a/trunk/test/parallel_test/parallel_test.sh b/trunk/test/parallel_test/parallel_test.sh index 7a69f3fb84..edab3b4a68 100755 --- a/trunk/test/parallel_test/parallel_test.sh +++ b/trunk/test/parallel_test/parallel_test.sh @@ -8,10 +8,6 @@ # OARCH: Offload architecture, sm_70, gfx908, etc # FLANG: binary name for flang compiler, default is flang-new # -# To test this script with AOMP legacy flang compiler -# export TRUNK=$AOMP (where AOMP is installed) -# export FLANG=flang-legacy -# # Set environment variable defaults here: TRUNK=${TRUNK:-$HOME/rocm/trunk} OFFLOAD=${OFFLOAD:-MANDATORY} diff --git a/trunk/test/parallel_test/pt2.sh b/trunk/test/parallel_test/pt2.sh index 2783e8e6d6..78517284e5 100755 --- a/trunk/test/parallel_test/pt2.sh +++ b/trunk/test/parallel_test/pt2.sh @@ -8,10 +8,6 @@ # OARCH: Offload architecture, sm_70, gfx908, etc # FLANG: binary name for flang compiler, default is flang-new # -# To test this script with the AOMP legacy flang compiler, set these vars -# export TRUNK=$AOMP (where AOMP is installed) -# export FLANG=flang-legacy -# # pt2.sh is identical to parallel_test.sh except pt2.sh # does not use -save-temps because sometimes -save-temps changes behavior or fails # outputs to directories tmpc2 and tmpf2 instead of tmpc and tmpf diff --git a/trunk/test/reduction_no_teams_test/reduction_no_teams.sh b/trunk/test/reduction_no_teams_test/reduction_no_teams.sh index 121b39ee9c..6a299277be 100755 --- a/trunk/test/reduction_no_teams_test/reduction_no_teams.sh +++ b/trunk/test/reduction_no_teams_test/reduction_no_teams.sh @@ -8,10 +8,6 @@ # OARCH: Offload architecture, sm_70, gfx908, etc # FLANG: binary name for flang compiler, default is flang-new # -# To test this script with AOMP legacy flang compiler -# export TRUNK=$AOMP (where AOMP is installed) -# export FLANG=flang-legacy -# # Set environment variable defaults here: TRUNK=${TRUNK:-$HOME/rocm/trunk} OFFLOAD=${OFFLOAD:-MANDATORY} diff --git a/trunk/test/reduction_no_teams_test/rt2_no_teams.sh b/trunk/test/reduction_no_teams_test/rt2_no_teams.sh index d2642693de..7ca0da60e4 100755 --- a/trunk/test/reduction_no_teams_test/rt2_no_teams.sh +++ b/trunk/test/reduction_no_teams_test/rt2_no_teams.sh @@ -8,10 +8,6 @@ # OARCH: Offload architecture, sm_70, gfx908, etc # FLANG: binary name for flang compiler, default is flang-new # -# To test this script with the AOMP legacy flang compiler, set these vars -# export TRUNK=$AOMP (where AOMP is installed) -# export FLANG=flang-legacy -# # pt2.sh is identical to reduction_test.sh except pt2.sh # does not use -save-temps because sometimes -save-temps changes behavior or fails # outputs to directories tmpc2 and tmpf2 instead of tmpc and tmpf diff --git a/trunk/test/reduction_sim/README b/trunk/test/reduction_sim/README index 228cb68092..7b8dd2e14a 100644 --- a/trunk/test/reduction_sim/README +++ b/trunk/test/reduction_sim/README @@ -23,13 +23,6 @@ This will create directores tmpc and tmpf For the current (1/10/2024) amd-trunk-dev branch patched as above, this test works for c and gets the wrong answer (0) for flang-new. -This test works with AOMP. To test with AOMP, save your tmpf and tmpc -directories. then run these commands - -export TRUNK=/CAR/aomp_18.0-0 -export FLANG=flang-legacy -./reduction_sim.sh - Both sources reduction_sim.c and reduction_sim.f95 use the fast_add version of the helper function. If you change the sources to use the nonfast version (remove _fast_sum suffix in the CALL) diff --git a/trunk/test/reduction_sim/reduction_sim.sh b/trunk/test/reduction_sim/reduction_sim.sh index a262fbc975..e7d9afe06e 100755 --- a/trunk/test/reduction_sim/reduction_sim.sh +++ b/trunk/test/reduction_sim/reduction_sim.sh @@ -8,10 +8,6 @@ # OARCH: Offload architecture, sm_70, gfx908, etc # FLANG: binary name for flang compiler, default is flang-new # -# To test this script with AOMP legacy flang compiler -# export TRUNK=$AOMP (where AOMP is installed) -# export FLANG=flang-legacy -# # Set environment variable defaults here: TRUNK=${TRUNK:-$HOME/rocm/trunk} OFFLOAD=${OFFLOAD:-MANDATORY} diff --git a/trunk/test/reduction_test/reduction_test.sh b/trunk/test/reduction_test/reduction_test.sh index 121b39ee9c..6a299277be 100755 --- a/trunk/test/reduction_test/reduction_test.sh +++ b/trunk/test/reduction_test/reduction_test.sh @@ -8,10 +8,6 @@ # OARCH: Offload architecture, sm_70, gfx908, etc # FLANG: binary name for flang compiler, default is flang-new # -# To test this script with AOMP legacy flang compiler -# export TRUNK=$AOMP (where AOMP is installed) -# export FLANG=flang-legacy -# # Set environment variable defaults here: TRUNK=${TRUNK:-$HOME/rocm/trunk} OFFLOAD=${OFFLOAD:-MANDATORY} diff --git a/trunk/test/reduction_test/rt2.sh b/trunk/test/reduction_test/rt2.sh index d2642693de..7ca0da60e4 100755 --- a/trunk/test/reduction_test/rt2.sh +++ b/trunk/test/reduction_test/rt2.sh @@ -8,10 +8,6 @@ # OARCH: Offload architecture, sm_70, gfx908, etc # FLANG: binary name for flang compiler, default is flang-new # -# To test this script with the AOMP legacy flang compiler, set these vars -# export TRUNK=$AOMP (where AOMP is installed) -# export FLANG=flang-legacy -# # pt2.sh is identical to reduction_test.sh except pt2.sh # does not use -save-temps because sometimes -save-temps changes behavior or fails # outputs to directories tmpc2 and tmpf2 instead of tmpc and tmpf diff --git a/trunk/test/stream/stream.sh b/trunk/test/stream/stream.sh index 97236962f8..2c8840df7d 100755 --- a/trunk/test/stream/stream.sh +++ b/trunk/test/stream/stream.sh @@ -8,10 +8,6 @@ # OARCH: Offload architecture, sm_70, gfx908, etc # FLANG: binary name for flang compiler, default is flang-new # -# To test this script with AOMP legacy flang compiler -# export TRUNK=$AOMP (where AOMP is installed) -# export FLANG=flang-legacy -# # Set environment variable defaults here: TRUNK=${TRUNK:-$HOME/rocm/trunk} OFFLOAD=${OFFLOAD:-MANDATORY} diff --git a/trunk/test/stream_no_teams/stream_no_teams.sh b/trunk/test/stream_no_teams/stream_no_teams.sh index cc528befeb..48f5357aa2 100755 --- a/trunk/test/stream_no_teams/stream_no_teams.sh +++ b/trunk/test/stream_no_teams/stream_no_teams.sh @@ -8,10 +8,6 @@ # OARCH: Offload architecture, sm_70, gfx908, etc # FLANG: binary name for flang compiler, default is flang-new # -# To test this script with AOMP legacy flang compiler -# export TRUNK=$AOMP (where AOMP is installed) -# export FLANG=flang-legacy -# # Set environment variable defaults here: TRUNK=${TRUNK:-$HOME/rocm/trunk} OFFLOAD=${OFFLOAD:-MANDATORY} From 8990ea6362365555c0f57109338d4346aa49e274 Mon Sep 17 00:00:00 2001 From: estewart08 Date: Fri, 25 Sep 2026 14:44:19 -0500 Subject: [PATCH 22/23] [build] - Move meson prereq to pip install (#2591) On older operating systems like Ubuntu 22.04, meson's version is too old for the pkgconfig.relocatable option (v1.1.0 minimum). AOMP docs suggest installing meson via pip. Updated PATH in build_rocm_sysdeps.sh to pick up default pip install location: ~/.local/bin --- bin/build_rocm_sysdeps.sh | 11 +++++++++++ docs/SOURCEINSTALL_PREREQUISITE.md | 18 +++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/bin/build_rocm_sysdeps.sh b/bin/build_rocm_sysdeps.sh index 190d68cd27..86d4ca475d 100755 --- a/bin/build_rocm_sysdeps.sh +++ b/bin/build_rocm_sysdeps.sh @@ -26,6 +26,17 @@ INSTALL_ROCM_SYSDEPS=${INSTALL_ROCM_SYSDEPS:-$AOMP_INSTALL_DIR/rocm_sysdeps} ROCM_SYSDEPS_LIST=${ROCM_SYSDEPS_LIST:-libdrm} BUILD_DIR=$BUILD_AOMP/build/rocm_sysdeps +# On older operating systems like Ubuntu 22.04, meson's version is too old +# for the pkgconfig.relocatable option (v1.1.0 minimum). AOMP docs suggest installing meson via pip. +# Add default install path ~/.local/bin to PATH. +PATH=$HOME/.local/bin:$PATH + +echo "Checking meson version..." +meson_loc=$(which meson) +echo "--- Meson location: $(which meson)" +meson_version=$($meson_loc --version) +echo "--- Meson version: $meson_version" + if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then echo " " echo " This script builds the ROCM sysdeps libraries" diff --git a/docs/SOURCEINSTALL_PREREQUISITE.md b/docs/SOURCEINSTALL_PREREQUISITE.md index 62f554a56b..f8d6bdc01f 100644 --- a/docs/SOURCEINSTALL_PREREQUISITE.md +++ b/docs/SOURCEINSTALL_PREREQUISITE.md @@ -4,7 +4,7 @@ #### ManyLinux (AlmaLinux 8) ``` - sudo dnf -y install bison ccache cmake elfutils-libelf-devel elfutis-devel expat-devel flex fmt-devel gcc-c++ gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ gcc-toolset-12-gcc-gfortran gcc-toolset-12-libatomic-devel gcc-toolset-12-libstdc++-devel gdb git gmp-devel gtest-devel libatomic libbabeltrace-devel libffi-devel libquadmath-devel libtool mesa-libGL-devel mpfr-devel msgpack-devel ncurses-devel numactl-devel openssl-devel ocl-icd-devel pciutils-devel python3-devel rpm-build rsync sqlite-devel systemd-devel texinfo vim wget xz-devel libmnl-devel libnl3-devel meson + sudo dnf -y install bison ccache cmake elfutils-libelf-devel elfutis-devel expat-devel flex fmt-devel gcc-c++ gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ gcc-toolset-12-gcc-gfortran gcc-toolset-12-libatomic-devel gcc-toolset-12-libstdc++-devel gdb git gmp-devel gtest-devel libatomic libbabeltrace-devel libffi-devel libquadmath-devel libtool mesa-libGL-devel mpfr-devel msgpack-devel ncurses-devel numactl-devel openssl-devel ocl-icd-devel pciutils-devel python3-devel rpm-build rsync sqlite-devel systemd-devel texinfo vim wget xz-devel libmnl-devel libnl3-devel # Download and install Python 3.10.18 wget https://www.python.org/ftp/python/3.10.18/Python-3.10.18.tgz; tar xf Python-3.10.18.tgz; cd Python-3.10.18; ./configure --enable-optimizations --enable-shared; make altinstall; --prefix=$HOME/local/Python-3.10.18; ln -s $HOME/local/Python-3.10.18/bin/python3.10 $HOME/local/Python-3.10.18/bin/python3 @@ -21,7 +21,7 @@ #### Debian or Ubuntu Packages ``` - sudo apt-get install wget gcc g++ pkg-config libpci-dev libnuma-dev libffi-dev git python3 libopenmpi-dev mesa-common-dev libtool libdrm-amdgpu1 libdrm-dev ccache libdw-dev libgtest-dev libsystemd-dev cmake openssl libssl-dev libgmp-dev libmpfr-dev libelf-dev patchelf pciutils python3.10-dev libudev-dev libgtest-dev libstdc++-12-dev python3-lxml ocl-icd-opencl-dev libsystemd-dev libfmt-dev libmsgpack-dev libsqlite3-dev libnl-3-dev libnl-genl-3-dev libmnl-dev meson + sudo apt-get install wget gcc g++ pkg-config libpci-dev libnuma-dev libffi-dev git python3 libopenmpi-dev mesa-common-dev libtool libdrm-amdgpu1 libdrm-dev ccache libdw-dev libgtest-dev libsystemd-dev cmake openssl libssl-dev libgmp-dev libmpfr-dev libelf-dev patchelf pciutils python3.10-dev libudev-dev libgtest-dev libstdc++-12-dev python3-lxml ocl-icd-opencl-dev libsystemd-dev libfmt-dev libmsgpack-dev libsqlite3-dev libnl-3-dev libnl-genl-3-dev libmnl-dev # Additional packages used by rocgdb sudo apt-get install texinfo libbison-dev bison flex libbabeltrace-dev python3-pip libncurses5-dev liblzma-dev python3-setuptools python3-dev libudev-dev libgmp-dev libmpfr-dev libdw-dev @@ -45,7 +45,7 @@ Ubuntu 24.04 Only #### SLES-15-SP6 Packages ``` - sudo zypper install wget libopenssl-devel elfutils libelf-devel git pciutils-devel libffi-devel gcc gcc-c++ libnuma-devel openmpi4-devel Mesa-libGL-devel libquadmath0 libtool libX11-devel systemd-devel hwdata unzip mpfr-devel ocl-icd-devel gcc7-fortran ncurses-devel gcc13-c++ gcc13 libstdc++6-devel-gcc13 libc++-devel sqlite-devel meson + sudo zypper install wget libopenssl-devel elfutils libelf-devel git pciutils-devel libffi-devel gcc gcc-c++ libnuma-devel openmpi4-devel Mesa-libGL-devel libquadmath0 libtool libX11-devel systemd-devel hwdata unzip mpfr-devel ocl-icd-devel gcc7-fortran ncurses-devel gcc13-c++ gcc13 libstdc++6-devel-gcc13 libc++-devel sqlite-devel A symbolic link may be required at /usr/lib64: /usr/lib64/libquadmath.so -> /usr/lib64/libquadmath.so.0. @@ -77,7 +77,7 @@ Ubuntu 24.04 Only #### RHEL Packages RHEL 8 ``` - sudo yum install dnf-plugins-core gcc-c++ git wget openssl-devel elfutils-libelf-devel elfutils-devel ccache pciutils-devel numactl-devel libffi-devel mesa-libGL-devel libtool libdrm libdrm-devel gmp-devel rpm-build gcc-gfortran libdw-devel libgtest-devel systemd-devel mpfr-devel python38 python38-devel ocl-icd-devel libatomic libquadmath-devel sqlite-devel meson + sudo yum install dnf-plugins-core gcc-c++ git wget openssl-devel elfutils-libelf-devel elfutils-devel ccache pciutils-devel numactl-devel libffi-devel mesa-libGL-devel libtool libdrm libdrm-devel gmp-devel rpm-build gcc-gfortran libdw-devel libgtest-devel systemd-devel mpfr-devel python38 python38-devel ocl-icd-devel libatomic libquadmath-devel sqlite-devel # Additional packages used by rocgdb and roctracer sudo yum install texinfo bison flex ncurses-devel expat-devel xz-devel libbabeltrace-devel libatomic libdwarf-devel gtest-devel @@ -91,7 +91,7 @@ RHEL 8 RHEL 9 ``` - sudo dnf install dnf-plugins-core gcc-c++ git wget openssl-devel elfutils-libelf-devel elfutils-devel ccache pciutils-devel numactl-devel libffi-devel mesa-libGL-devel libtool libdrm libdrm-devel gmp-devel rpm-build gcc-gfortran libdw-devel libgtest-devel systemd-devel mpfr-devel python3-devel ocl-icd-devel libatomic libquadmath-devel sqlite-devel meson + sudo dnf install dnf-plugins-core gcc-c++ git wget openssl-devel elfutils-libelf-devel elfutils-devel ccache pciutils-devel numactl-devel libffi-devel mesa-libGL-devel libtool libdrm libdrm-devel gmp-devel rpm-build gcc-gfortran libdw-devel libgtest-devel systemd-devel mpfr-devel python3-devel ocl-icd-devel libatomic libquadmath-devel sqlite-devel # Additional packages used by rocgdb and roctracer sudo dnf install texinfo bison flex ncurses-devel expat-devel xz-devel libbabeltrace-devel libatomic libdwarf-devel gtest-devel @@ -112,22 +112,22 @@ After all the required system package from section 1 are installed, there are so ManyLinux (AlmaLinux 8) ``` - python3 -m pip install --ignore-installed --no-cache-dir barectf==3.1.2 PyYAML==5.3.1; python3.10 -m pip install CppHeaderParser argparse wheel lit lxml pandas + python3 -m pip install --ignore-installed --no-cache-dir barectf==3.1.2 PyYAML==5.3.1; python3.10 -m pip install CppHeaderParser argparse wheel lit lxml pandas meson ``` Ubuntu 22.04 ``` - python3 -m pip install --ignore-installed --no-cache-dir barectf==3.1.2 PyYAML==5.3.1; python3 -m pip install CppHeaderParser argparse wheel lit lxml pandas + python3 -m pip install --ignore-installed --no-cache-dir barectf==3.1.2 PyYAML==5.3.1; python3 -m pip install CppHeaderParser argparse wheel lit lxml pandas meson ``` Ubuntu 24.04 ``` - python3 -m venv /opt/venv; PATH=/opt/venv/bin:$PATH python3 -m pip install CppHeaderParser argparse lxml pandas setuptools PyYAML pandas + python3 -m venv /opt/venv; PATH=/opt/venv/bin:$PATH python3 -m pip install CppHeaderParser argparse lxml pandas setuptools PyYAML pandas meson ``` RHEL 8/9 and SLES15 ``` - python3 -m pip install CppHeaderParser argparse wheel lit lxml barectf termcolor pandas + python3 -m pip install CppHeaderParser argparse wheel lit lxml barectf termcolor pandas meson ``` ### 3. cmake From 658704bec6ad969558ecc53a39cd5fbac093ba4e Mon Sep 17 00:00:00 2001 From: estewart08 Date: Fri, 25 Sep 2026 16:48:27 -0500 Subject: [PATCH 23/23] [test] - Update LD_LIBRARY_PATH for matrimul_omp_for do_debug (#2594) AOMP is set with /path/to/aomp/llvm. LD_LIBRARY_PATH still needs to access top level lib/lib-debug outside of llvm install so other ROCm libs can be located. --- test/hip-openmp/matrixmul_omp_for/do_debug | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/hip-openmp/matrixmul_omp_for/do_debug b/test/hip-openmp/matrixmul_omp_for/do_debug index 4d6ba2764e..d11d33afe5 100755 --- a/test/hip-openmp/matrixmul_omp_for/do_debug +++ b/test/hip-openmp/matrixmul_omp_for/do_debug @@ -14,14 +14,17 @@ if [ ! -f "$ompd_dir/__init__.py" ] ; then ompd_dir="$AOMP/lib-debug/ompd" fi if [ ! -f "$ompd_dir/__init__.py" ] ; then - echo "ERROR ompd directory not found in $AOMP/share/gdb/python/ompd" + echo "ERROR ompd directory not found in:" + echo "$AOMP/share/gdb/python/ompd" + echo "$AOMP/lib-debug/ompd" exit 1 fi bldcmd="$hipcc_loc -O0 -g -ggdb -fopenmp -Wl,--enable-new-dtags matrixmul.cpp -o matrixmul" #cgdb=`which cgdb` && [ "$cgdb" != "" ] && gdbcmd="$cgdb -d $gdbcmd" -export LD_LIBRARY_PATH=$AOMP/lib-debug:$AOMP/lib:$ompd_dir +# AOMP is usually set to /path/to/aomp/llvm. Ensure lib-debug libs are picked up first. +export LD_LIBRARY_PATH=$AOMP/../../lib-debug:$AOMP/lib-debug:$AOMP/../../lib:$AOMP/lib export OMP_DEBUG=enabled export OMP_NUM_THREADS=3