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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 7 additions & 18 deletions bin/clone_aomp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -218,26 +218,15 @@ if [[ "$AOMP_VERSION" == "13.1" ]] || [[ $AOMP_MAJOR_VERSION -gt 13 ]] ; then
# However, we gave up on using the repo command to clone the repos.
# That is all done here by parsing the manifest file.

# According to git documentation this ssh command should return 1 if authentication is successful
ssh -T $AOMP_GIT_INTERNAL_IP 2> /dev/null
if [ $? == 1 ] && [ "$AOMP_EXTERNAL_MANIFEST" != 1 ]; then
# AMD internal repo file
if [ "$AOMP_NEW" == "1" ]; then
manifest_file=$thisdir/../manifests/aompi_new_${AOMP_VERSION}.xml
else
manifest_file=$thisdir/../manifests/aompi_${AOMP_VERSION}.xml
fi
abranch=$(git branch | awk '/\*/ { print $2; }')
# Use release manifest if on release branch
if [ "$abranch" == "aomp-${AOMP_VERSION_STRING}" ]; then
manifest_file=$thisdir/../manifests/aomp_${AOMP_VERSION_STRING}.xml
else
abranch=$(git branch | awk '/\*/ { print $2; }')
# Use release manifest if on release branch
if [ "$abranch" == "aomp-${AOMP_VERSION_STRING}" ]; then
manifest_file=$thisdir/../manifests/aomp_${AOMP_VERSION_STRING}.xml
if [ "$AOMP_NEW" == "1" ]; then
manifest_file=$thisdir/../manifests/aomp_new_${AOMP_VERSION}.xml
else
if [ "$AOMP_NEW" == "1" ]; then
manifest_file=$thisdir/../manifests/aomp_new_${AOMP_VERSION}.xml
else
manifest_file=$thisdir/../manifests/aomp_${AOMP_VERSION}.xml
fi
manifest_file=$thisdir/../manifests/aomp_${AOMP_VERSION}.xml
fi
fi
echo "USED manifest file: $manifest_file"
Expand Down
9 changes: 8 additions & 1 deletion bin/run_composable-kernels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,14 @@ if [ ! -d "${CK_TOP}" ]; then
mkdir -p "${CK_TOP}" || exit 1
fi

if [ ! -d "${CK_REPO}" ]; then
# Validate that CK_REPO is an actual git checkout, not just an existing
# directory. Alola periodically wipes the *contents* of old node-local dirs
# while leaving the directory shells behind, which yields a CK_REPO that
# exists but has no .git (and no CMakeLists.txt), breaking the build. A plain
# "-d" test would skip the clone and then fail. Re-clone when the tree is
# missing or not a valid repo; only pull when it is a healthy checkout.
if ! git -C "${CK_REPO}" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
rm -rf "${CK_REPO}"
git clone --single-branch --depth 1 ${CKRepoURL} "${CK_REPO}"
elif [ "${ShouldUpdateCKRepo}" == 'yes' ]; then
pushd "${CK_REPO}" || exit 1
Expand Down
28 changes: 9 additions & 19 deletions manifests/aomp_23.0.xml
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<!-- Manifest for AOMP 23.0-x which uses ROCM 7.2 release branches of external repositories -->
<!-- Manifest for AOMP 23.0-x which uses ROCM 7.13 release branches of external repositories -->

<remote name="gerritgit" review="git.amd.com:8080" fetch="ssh://gerritgit/" />
<default revision="release/rocm-rel-7.2" remote="gerritgit" sync-j="4" sync-c="true" />
<remote name="roc" fetch="https://github.com/ROCm" />
<remote name="simde" fetch="https://github.com/simd-everywhere" />

<!-- These first 4 repos are NOT rocm 7.2. They are compiler developer branches -->
<project remote="roc" path="llvm-project" name="llvm-project" revision="amd-staging" groups="unlocked" />
<project remote="roc" path="SPIRV-LLVM-Translator" name="SPIRV-LLVM-Translator" revision="amd-staging" groups="unlocked" />
<project remote="roc" path="hipify" name="hipify" revision="amd-staging" groups="unlocked" />
<!-- These first 4 repos are NOT rocm 7.13. They are compiler developer branches -->
<project remote="roc" path="llvm-project" name="llvm-project.git" revision="amd-staging" groups="unlocked" />
<project remote="roc" path="SPIRV-LLVM-Translator" name="spirv-llvm-translator.git" revision="amd-staging" groups="unlocked" />
<project remote="roc" path="hipify" name="hipify.git" revision="amd-staging" groups="unlocked" />
<project remote="simde" path="simde" name="simde" revision="master" groups="unlocked" />

<project remote="roc" path="aomp" name="aomp" revision="aomp-dev" groups="unlocked" />

<project remote="roc" path="rocprofiler-sdk" name="rocprofiler-sdk" revision="release/rocm-rel-7.2" groups="unlocked" />
<project remote="roc" path="ROCdbgapi" name="ROCdbgapi" revision="release/rocm-rel-7.2" groups="unlocked" />
<project remote="roc" path="ROCgdb" name="ROCgdb" revision="release/rocm-rel-7.2" groups="unlocked" />
<project remote="roc" path="hip" name="hip" revision="release/rocm-rel-7.2" groups="unlocked" />
<project remote="roc" path="clr" name="clr" revision="release/rocm-rel-7.2" groups="unlocked" />
<project remote="roc" path="rocminfo" name="rocminfo" revision="release/rocm-rel-7.2" groups="unlocked" />
<project remote="roc" path="rocm_smi_lib" name="rocm_smi_lib" revision="release/rocm-rel-7.2" groups="unlocked" />
<project remote="roc" path="amdsmi" name="amdsmi" revision="release/rocm-rel-7.2" groups="unlocked" />
<project remote="roc" path="rocm-cmake" name="rocm-cmake" revision="release/rocm-rel-7.2" groups="unlocked" />
<project remote="roc" path="rocr-runtime" name="ROCR-Runtime" revision="release/rocm-rel-7.2" groups="unlocked" />
<project remote="roc" path="rocprofiler-register" name="rocprofiler-register" revision="release/rocm-rel-7.2" groups="unlocked" />
<project remote="roc" path="hipfort" name="hipfort" revision="release/rocm-rel-7.2" groups="unlocked" />
<project remote="roc" path="ROCgdb" name="ROCgdb" upstream="amd-staging" revision="therock-7.13" tag="true" groups="revlocked" />
<project remote="roc" path="rocm-cmake" name="rocm-cmake" upstream="develop" revision="therock-7.13" tag="true" groups="revlocked" />
<project remote="roc" path="hipfort" name="hipfort" revision="release/rocm-rel-7.2" groups="unlocked" />
<project remote="roc" path="rocm-systems" name="rocm-systems" upstream="develop" revision="therock-7.13" tag="true" groups="revlocked" />
</manifest>
20 changes: 0 additions & 20 deletions manifests/aompi_23.0.xml

This file was deleted.

4 changes: 2 additions & 2 deletions test/smoke-dev/HipDevCov/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ LINK_FLAGS = -L$(ROCM_PATH)/lib -lamdhip64 -Wl,-rpath,$(ROCM_PATH)/lib

CC = $(AOMP)/bin/clang $(VERBOSE)

RUNCMD = ./run_and_check.sh "$(AOMP)" "$(GPU_W_FEATURES)" "$(FILECHECK)" "$(ROCM_PATH)"
RUNCMD = ./run_and_check.sh "$(AOMP)" "$(GPU_W_FEATURES)" "$(ROCM_PATH)"

include ../Makefile.rules

clean::
rm -f mod.co builder builder.*.host-* builder.*.hip-amdgcn-amd-amdhsa--* \
*.profraw merged.profdata
*.profraw merged.profdata devcov-profile.txt DEVCOV-SKIPPED.txt
6 changes: 0 additions & 6 deletions test/smoke-dev/HipDevCov/check.txt

This file was deleted.

81 changes: 47 additions & 34 deletions test/smoke-dev/HipDevCov/run_and_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,50 @@
# Args (passed from the Makefile):
# $1 = AOMP (LLVM dir containing bin/clang, llvm-profdata, llvm-objdump)
# $2 = GPU arch (e.g. gfx90a, may include :features)
# $3 = FILECHECK (path to FileCheck)
# $4 = ROCM_PATH (HIP/ROCm install for --rocm-path and libamdhip64)
# $3 = ROCM_PATH (HIP/ROCm install for --rocm-path and libamdhip64)
#
# Returns 0 only if BOTH the host-shadow kernel and the module-only kernel are
# present in the merged profile (the latter requires the HSA drain).
# Proves the HSA-introspection drain captured device coverage that the HIP
# host-shadow drain cannot see. Verifies, against the actual merged profile:
# * the HSA drain produced its own profraw (uniquely named *.hsa<N>.*.profraw),
# * mod_kernel (loaded via hipModuleLoad, no host shadow) is present with a
# NONZERO function count -- only possible via the HSA drain,
# * host_kernel (host-shadow path) is also present with a nonzero count.
# The human-readable profile dump is left in devcov-profile.txt for inspection.

set -u
AOMP="$1"; ARCH="$2"; FILECHECK="$3"; ROCM="$4"
AOMP="$1"; ARCH="$2"; ROCM="$3"
CLANG="$AOMP/bin/clang"
PROFDATA="$AOMP/bin/llvm-profdata"
OBJDUMP="$AOMP/bin/llvm-objdump"
COV="$AOMP/bin/llvm-cov"

here="$(cd "$(dirname "$0")" && pwd)"
cd "$here" || exit 1

# Capability gate: skip cleanly on toolchains that do not ship the device
# profile runtime / HSA drain yet (so this does not red-fail CI before the
# feature lands). A real, drain-capable toolchain has the amdgcn device profile
# RT and the host drain symbol.
fail() { echo "FAIL HipDevCov: $*"; exit 1; }

# Function count for a front-end-instrumented function in the --counts dump.
func_count() {
awk -v fn="$1" '
$0 ~ ("^[ \t]*" fn ":$") { inblk = 1; next }
inblk && /Function count:/ { print $3; exit }
' "$2"
}

# Capability gate: skip cleanly only when the toolchain truly cannot do device
# PGO (no amdgcn device profile runtime / no host HSA-drain runtime). Leaves a
# marker so the skip is visible in archived results rather than a silent pass.
resdir="$("$CLANG" -print-resource-dir 2>/dev/null)"
devrt="$resdir/lib/amdgcn-amd-amdhsa/libclang_rt.profile.a"
if [ ! -f "$devrt" ]; then
echo "SKIP HipDevCov: no device profile runtime at $devrt"
exit 0
fi
if ! ls "$resdir"/lib/*/libclang_rt.profile_rocm*.a >/dev/null 2>&1; then
echo "SKIP HipDevCov: no host profile_rocm runtime (HSA drain) in toolchain"
rm -f DEVCOV-SKIPPED.txt
if [ ! -f "$devrt" ] || ! ls "$resdir"/lib/*/libclang_rt.profile_rocm*.a >/dev/null 2>&1; then
echo "no device profile runtime / HSA-drain runtime in $resdir" > DEVCOV-SKIPPED.txt
echo "SKIP HipDevCov: $(cat DEVCOV-SKIPPED.txt)"
exit 0
fi

set -e
rm -f ./*.profraw mod.co merged.profdata builder builder.*.host-* \
builder.*.hip-amdgcn-amd-amdhsa--* 2>/dev/null || true
rm -f ./*.profraw mod.co merged.profdata devcov-profile.txt builder \
builder.*.host-* builder.*.hip-amdgcn-amd-amdhsa--* 2>/dev/null || true

# 1. Build mod.hip as a full executable so the device link gets the device
# profile RT, then extract its device code object as the loadable mod.co.
Expand All @@ -47,35 +57,38 @@ rm -f ./*.profraw mod.co merged.profdata builder builder.*.host-* \
"$OBJDUMP" --offloading builder >/dev/null 2>&1 || true
shopt -s nullglob
extracted=(builder*.hip-amdgcn-amd-amdhsa--*gfx*)
if [ ${#extracted[@]} -eq 0 ]; then
echo "FAIL HipDevCov: could not extract device code object from builder"
exit 1
fi
[ ${#extracted[@]} -gt 0 ] || fail "could not extract device code object from builder"
cp "${extracted[0]}" mod.co

# 2. main is built by the smoke harness (TESTNAME=main). Build it here too if it
# is missing, so the script also works when run standalone.
# 2. main is built by the harness (TESTNAME=main); build it here if missing.
if [ ! -x ./main ]; then
"$CLANG" -x hip --offload-arch="$ARCH" -fno-gpu-rdc \
-fprofile-instr-generate -fcoverage-mapping --rocm-path="$ROCM" \
main.hip -o main -L"$ROCM/lib" -lamdhip64 -Wl,-rpath,"$ROCM/lib"
fi

# 3. Run. Device .profraw files are written to CWD (arch-prefixed for the
# host-shadow drain, arch.hsa<N>-prefixed for the HSA drain); the host one
# goes to LLVM_PROFILE_FILE.
# 3. Run with mod.co in CWD.
rm -f ./*.profraw
LLVM_PROFILE_FILE="$here/host.profraw" \
LD_LIBRARY_PATH="$ROCM/lib:${LD_LIBRARY_PATH:-}" \
./main

# 4. Merge host + all device profraws and assert both kernels are present.
# 4. The HSA-introspection drain writes its own, uniquely-named profraw
# (<arch>.hsa<N>.<file>.profraw). Its presence is a direct fingerprint that
# the HSA pass ran (the host-shadow drain names files <arch>[:feat].<file>).
hsa=(*.hsa[0-9]*.profraw)
[ ${#hsa[@]} -gt 0 ] || fail "no HSA-drain profraw (*.hsa<N>.*.profraw) produced"
echo "HipDevCov: HSA-drain profraw(s): ${hsa[*]}"

# 5. Merge and verify real counts from the dump.
"$PROFDATA" merge -sparse -o merged.profdata ./*.profraw
"$PROFDATA" show --all-functions merged.profdata | "$FILECHECK" check.txt
"$PROFDATA" show --all-functions --counts merged.profdata > devcov-profile.txt

# 5. Sanity (non-fatal): llvm-cov can consume the merged device+host profile.
# main's covmap only describes host_kernel/main, so llvm-cov warns about the
# module-only function; that is expected, hence non-fatal.
"$COV" report ./main -instr-profile=merged.profdata >/dev/null 2>&1 || true
mc="$(func_count mod_kernel devcov-profile.txt)"
hc="$(func_count _Z11host_kernelPii devcov-profile.txt)"
[ -n "$mc" ] || fail "mod_kernel absent from merged profile (HSA drain did not capture it)"
[ -n "$hc" ] || fail "host_kernel absent from merged profile"
[ "$mc" -gt 0 ] 2>/dev/null || fail "mod_kernel function count is '$mc' (expected > 0)"
[ "$hc" -gt 0 ] 2>/dev/null || fail "host_kernel function count is '$hc' (expected > 0)"

echo "HipDevCov PASSED"
echo "HipDevCov PASSED (mod_kernel=$mc via HSA drain, host_kernel=$hc)"
4 changes: 2 additions & 2 deletions test/smoke-dev/OmpDevCov/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ LINK_FLAGS = -Wl,-rpath,$(AOMP)/lib

CC = $(AOMP)/bin/clang $(VERBOSE)

RUNCMD = ./run_and_check.sh "$(AOMP)" "$(GPU_W_FEATURES)" "$(FILECHECK)"
RUNCMD = ./run_and_check.sh "$(AOMP)" "$(GPU_W_FEATURES)"

include ../Makefile.rules

clean::
rm -f omp_pgo omp_pgo_use *.profraw merged.profdata
rm -f omp_pgo omp_pgo_use *.profraw merged.profdata devcov-profile.txt DEVCOV-SKIPPED.txt
6 changes: 0 additions & 6 deletions test/smoke-dev/OmpDevCov/check.txt

This file was deleted.

Loading
Loading