Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9c09560
Fix for launch_latency.
Lynd98 Sep 18, 2026
2b6b810
Added a log file to rocprofv3.
Lynd98 Sep 21, 2026
4978178
[build] - Add build of rocm_sysdeps (#2545)
estewart08 Sep 21, 2026
b0dd809
Added Michael's suggestions.
Lynd98 Sep 22, 2026
ae6bb71
Merge pull request #2564 from ROCm/launchfix1
Lynd98 Sep 22, 2026
ce2127b
Revert "Fix for launch_latency."
ronlieb Sep 22, 2026
fd559e4
Keep rocprofv3 messages out of launch_latency timings.
Lynd98 Sep 23, 2026
3611c05
[NFC] Make aomp_common_vars clean under shellcheck
mhalk Sep 22, 2026
99b34ac
[NFC] Add common function: merge_variable_with_inputs
mhalk Sep 23, 2026
ea90073
[llamacpp] Fix exports and refactor CMake
mhalk Sep 23, 2026
5a73f7e
[NFC] Add common function: get_cmake_module_path
mhalk Sep 23, 2026
b40b1ca
[llamacpp] Resolve the required ROCm packages individually
mhalk Sep 23, 2026
a6e22e9
[NFC] Add common function: add_cmake_rocm_header_priority_args
mhalk Sep 23, 2026
0f3c474
[llamacpp] Keep the HIP headers of the ROCm under test first
mhalk Sep 23, 2026
da337ca
[NFC] Add common function: check_cmake_rocm_header_priority
mhalk Sep 23, 2026
48b35d3
[llamacpp] Verify the ROCm header priority after configuring
mhalk Sep 23, 2026
88a70b3
[llamacpp] Raise the ctest timeout
mhalk Sep 23, 2026
4b6743a
[llamacpp] Log the build step
mhalk Sep 23, 2026
a1e919c
Merge pull request #2577 from ROCm/launchfix2
Lynd98 Sep 23, 2026
527f7bc
Merge pull request #2578 from mhalk/amd/dev/mhalkenh/nfc/shellcheck-c…
mhalk Sep 24, 2026
3163d95
[build] Remove classic flang components and build scripts
nicebert Sep 21, 2026
fdcb61e
[build] Fix CMAKE_PREFIX_PATH for rocprofiler-sdk
nicebert Sep 24, 2026
22e67f4
Merge pull request #2573 from mhalk/amd/dev/mhalkenh/fix/ci-llamacpp-…
mhalk Sep 24, 2026
b411cea
[docs]: Add meson to SOURCEINSTALL_PREREQUISITE.md (#2585)
estewart08 Sep 24, 2026
afefc86
[build] Remove classic flang leftovers
nicebert Sep 25, 2026
8990ea6
[build] - Move meson prereq to pip install (#2591)
estewart08 Sep 25, 2026
658704b
[test] - Update LD_LIBRARY_PATH for matrimul_omp_for do_debug (#2594)
estewart08 Sep 25, 2026
ebd3cc9
merge aomp-dev into amd-staging
z1-cciauto Sep 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 2 additions & 15 deletions bin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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.
175 changes: 156 additions & 19 deletions bin/aomp_common_vars
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -95,17 +99,15 @@ 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
AOMP_PROJECTS_LIST=${AOMP_PROJECTS_LIST:-"clang;lld;clang-tools-extra"}
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
Expand Down Expand Up @@ -262,9 +264,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[*]}"
}
Expand All @@ -279,19 +283,19 @@ 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")

# 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")
Expand Down Expand Up @@ -414,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.

Expand Down Expand Up @@ -568,11 +562,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
Expand Down Expand Up @@ -860,3 +854,146 @@ function help_build_aomp(){
EOF
exit 0
}

# Merge the contents of a variable with a list of input items.
# Usage: merge_variable_with_inputs <VarName> --delimiter <Delim> \
# [--append|--prepend] <Input1> [<Input2> ...]
# 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
}

# Return the path containing the requested CMake module directory.
# Usage: get_cmake_module_path <Module> [<Path1> <Path2> ...]
# Searches each given Path, in order, for <Path>/lib/cmake/<Module>.
# 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/<Module>.
# All CMake module configuration files are named <Module>*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
}

# Keep the HIP headers of the ROCm under test ahead of every other ROCm's.
# Usage: add_cmake_rocm_header_priority_args <ArrayName> <RocmRoot> [<Lang> ...]
# Appends one CMake argument per language (default: HIP); does nothing when
# <RocmRoot> 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_<LANG>_COMPILER_ARG1 is the only slot in front of those includes; every
# *_FLAGS variable lands behind them. Keep CMAKE_<LANG>_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
}

# Verify that the ROCm header priority survived the CMake run.
# Usage: check_cmake_rocm_header_priority <BuildDir> <RocmRoot> [<Lang> ...]
# 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}"
}
5 changes: 3 additions & 2 deletions bin/build_amdsmi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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')
Expand Down Expand Up @@ -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
34 changes: 3 additions & 31 deletions bin/build_aomp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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"

Expand Down Expand Up @@ -196,24 +175,17 @@ 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
rm -f "$BUILD_DIR/build/installed_files.txt"

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"
Expand Down
Loading
Loading