[llvm] X86 share isdispordisp8 (PR #222589)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 03:26:41 PDT 2026
https://github.com/nishant-sachdeva-amd created https://github.com/llvm/llvm-project/pull/222589
None
>From 478aa595ff6f5b73bad994e7f1552b7e057160ba Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Wed, 4 Jun 2025 12:08:19 +0000
Subject: [PATCH 01/72] Ported presub_upstream-main to be GitHub enabled. Uses
builder container.
Change-Id: Ia034e265388cf6b4ecf99ef0e7a2180657497bc9
---
.amd-ci/upstream/Jenkinsfile | 169 ++++++++++++++++++++++++++++++
.amd-ci/upstream/apptainer_run.sh | 22 ++++
.amd-ci/upstream/run.sh | 125 ++++++++++++++++++++++
3 files changed, 316 insertions(+)
create mode 100644 .amd-ci/upstream/Jenkinsfile
create mode 100755 .amd-ci/upstream/apptainer_run.sh
create mode 100755 .amd-ci/upstream/run.sh
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
new file mode 100644
index 00000000000000..45cde19cead419
--- /dev/null
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -0,0 +1,169 @@
+import hudson.model.Result
+
+/* groovylint-disable-next-line CompileStatic */
+String actualTarget = env.CHANGE_TARGET ?: env.BRANCH_NAME
+
+if (actualTarget != 'upstream-main') {
+ echo 'Pipeline skipped for base branch ' + actualTarget
+ return this
+}
+
+String actualHead = env.CHANGE_BRANCH ?: env.BRANCH_NAME
+Boolean isPrBranch = env.CHANGE_BRANCH != null
+
+if (!isPrBranch) {
+ echo 'Pipeline skipped for non-PR branch ' + actualHead
+ return this
+}
+
+/**
+ * Coerce Result enums to String, seems to
+ * be required by CatchErrorStep.setStageResult()
+ */
+String abortedResultStr = Result.ABORTED, failureResultStr = Result.FAILURE
+String notBuiltResultStr = Result.NOT_BUILT, successResultStr = Result.SUCCESS
+
+String space = ' ', andChain = '&&'
+
+List propsList = []
+if (isPrBranch) {
+ propsList.add(
+ disableConcurrentBuilds(abortPrevious: true)
+ )
+ propsList.add(
+ buildDiscarder(
+ logRotator(
+ daysToKeepStr: '7',
+ numToKeepStr: '10'
+ )
+ )
+ )
+}
+properties(propsList)
+
+String linuxBasePath = '/usr/sbin:/usr/bin:/bin'
+String gitHubAppCredsId = 'Jenkins-AOCC'
+
+Integer fullTimeoutH = 15
+
+try {
+ timeout(time: fullTimeoutH, unit: 'HOURS') {
+ node ('atl && apptainer') {
+ skipDefaultCheckout()
+ List cleanExcludes = [
+ [pattern: 'llvm-project/.git/**', type: 'EXCLUDE']
+ ]
+ stage ('prepare') {
+ String gitTool = 'LinuxGit2.45'
+ String referenceRepo = env.JENKINS_REMOTE_GIT_CACHE ?: 'NoSuchReferenceRepo'
+ cleanWs(
+ deleteDirs: true,
+ patterns: cleanExcludes
+ )
+ dir('aocc-devops') {
+ checkout(
+ changelog: false,
+ scm: scmGit(
+ gitTool: gitTool,
+ branches: [[name: 'main']],
+ extensions: [
+ cloneOption(
+ reference: referenceRepo + '/aocc-devops.git'
+ )
+ ],
+ userRemoteConfigs: [
+ [
+ credentialsId: 'mat-amd-csg-demo',
+ url: 'https://github.com/AMD-CSG/aocc-devops.git'
+ ]
+ ]
+ )
+ )
+ }
+ withCredentials([
+ gitUsernamePassword(
+ credentialsId: gitHubAppCredsId,
+ gitToolName: gitTool
+ )
+ ]) {
+ withEnv([
+ 'PATH=/proj/csse_jenkins2/swtools/c/rhel7-gcc8.3.1/git-2.45.2-ilh23rcg/bin:' +
+ linuxBasePath
+ ]) {
+ sh(
+ label: 'clone-essentials',
+ script: (
+ 'set +x; . aocc-devops/utils.sh' + space + andChain + space +
+ 'export BRANCH_NAME=amd-staging' + space + andChain + space +
+ 'sparse_clone_essentials' + space + andChain + space +
+ 'mv llvm-project/aocc-essentials . ' + space + andChain + space +
+ 'rm -rf llvm-project'
+ )
+ )
+ }
+ }
+ dir ('llvm-project') {
+ String theUrl = 'https://er.github.amd.com/AOCC/llvm-project'
+ checkout(
+ changelog: true,
+ scm: scmGit(
+ gitTool: gitTool,
+ branches: scm.branches,
+ browser: github(theUrl),
+ extensions: scm.extensions + [
+ cloneOption(
+ depth: 2, // To compute the changelog.
+ honorRefspec: true, noTags: true, shallow: true,
+ reference: referenceRepo + '/llvm-project.git'
+ ),
+ firstBuildChangelog()
+ ],
+ userRemoteConfigs: [
+ [
+ credentialsId: gitHubAppCredsId,
+ refspec: (
+ '+refs/heads/' + actualHead + ':' +
+ 'refs/remotes/origin/' + actualHead
+ ),
+ url: theUrl
+ ]
+ ]
+ )
+ )
+ }
+ // ToDo could now call build_essentials/has_active_files.sh
+ }
+ stage ('run') {
+ try {
+ withEnv([
+ 'PATH=' + linuxBasePath
+ ]) {
+ sh 'llvm-project/.amd-ci/upstream/apptainer_run.sh'
+ }
+ currentBuild.result = successResultStr
+ } finally {
+ archiveArtifacts(
+ allowEmptyArchive: true,
+ artifacts: '*.tar.xz,*.txt'
+ )
+ cleanWs(
+ deleteDirs: true,
+ patterns: cleanExcludes
+ )
+ }
+ }
+ }
+ }
+} catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
+ /*
+ * This may be raised if the run is 'superseded' by a new patch,
+ * when result will be NOT_BUILT. Don't overwrite this.
+ */
+ if (currentBuild.result != notBuiltResultStr) {
+ currentBuild.result = abortedResultStr
+ }
+ throw e
+} catch (Exception e) {
+ currentBuild.result = failureResultStr
+ throw e
+}
diff --git a/.amd-ci/upstream/apptainer_run.sh b/.amd-ci/upstream/apptainer_run.sh
new file mode 100755
index 00000000000000..5d6d4d74aafd85
--- /dev/null
+++ b/.amd-ci/upstream/apptainer_run.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+set -eux
+
+_script_dir="$(dirname "$(realpath "${0}")")"
+bind_point='/aocc'
+
+image_tail=containers/AOCC_builder/aocc-rhel8:0.4-rh8.9-gcc8.5.0.sif # Code smell: parameterize?
+image_path=/proj/csg_tools/${image_tail}
+if test ! -f "${image_path}"
+then
+ image_path=/proj/csse_jenkins2/swtools/${image_tail}
+fi
+
+apptainer exec \
+ --cleanenv \
+ --env BUILD_NUMBER="${BUILD_NUMBER:-0}" \
+ --env CI="${CI:-false}" \
+ --env JOB_NAME="${JOB_NAME:-NoSuchJobName}" \
+ --bind "/proj:/proj:ro,$(pwd):${bind_point}:rw" \
+ ${image_path} \
+ bash -c "cd ${bind_point} && ${_script_dir}/run.sh"
diff --git a/.amd-ci/upstream/run.sh b/.amd-ci/upstream/run.sh
new file mode 100755
index 00000000000000..f20d5695e8da90
--- /dev/null
+++ b/.amd-ci/upstream/run.sh
@@ -0,0 +1,125 @@
+#!/usr/bin/env bash
+
+#{Function to print command execution status by checking it's return value
+execute_and_check()
+{
+ cmd="$1"
+ $cmd
+ retVal=$?
+
+ if [ "$retVal" -eq 0 ]; then
+ echo "********************************************************"
+ echo "Execution of command : $cmd - was successful" >> "${WORKSPACE}/command_executed.txt"
+ echo "Execution of command : $cmd - was successful"
+ echo "********************************************************"
+ else
+ echo "########################################################"
+ echo "Execution of command : $cmd - was failed"
+ echo "Please check ${WORKSPACE}/command_executed.txt file for commands executed till now"
+ rm -v ${WORKSPACE}/build_success.txt
+ exit 1
+ echo "########################################################"
+ fi
+}
+#}
+
+WORKSPACE=$PWD
+touch "${WORKSPACE}"/build_success.txt
+
+execute_and_check "cd ${WORKSPACE}/llvm-project/llvm/"
+LLVM_VERSION_MAJOR=$(grep -w "set(LLVM_VERSION_MAJOR" CMakeLists.txt | awk -F' ' '{print $NF}' | tr -d ')')
+LLVM_VERSION_MINOR=$(grep -w "set(LLVM_VERSION_MINOR" CMakeLists.txt | awk -F' ' '{print $NF}' | tr -d ')')
+LLVM_VERSION_PATCH=$(grep -w "set(LLVM_VERSION_PATCH" CMakeLists.txt | awk -F' ' '{print $NF}' | tr -d ')')
+CLANG_VERSION=$LLVM_VERSION_MAJOR.$LLVM_VERSION_MINOR.$LLVM_VERSION_PATCH
+echo "CLANG_VERSION value is - $CLANG_VERSION" > "${WORKSPACE}"/VERSION_AND_COMMIT_HASH_OF_BUILD_"${BUILD_NUMBER}".txt
+
+execute_and_check "cd ${WORKSPACE}"
+
+echo "source aocc-essentials/build_essentials/linux/aocc_env.sh"
+source aocc-essentials/build_essentials/linux/aocc_env.sh
+
+echo ". /proj/csse_jenkins2/swtools/c/rhel7-gcc8.3.1/environment-modules-5.4.0-j6k56q3i/bin/../init/bash"
+. /proj/csse_jenkins2/swtools/c/rhel7-gcc8.3.1/environment-modules-5.4.0-j6k56q3i/bin/../init/bash
+
+echo "module use --prepend /proj/csse_jenkins2/swtools/c/modulefiles"
+module use --prepend /proj/csse_jenkins2/swtools/c/modulefiles
+
+echo "module load gcc/11.4.0"
+module load gcc/11.4.0
+
+execute_and_check "mkdir -p ${WORKSPACE}/BUILD"
+execute_and_check "cd ${WORKSPACE}/BUILD"
+echo "Executing cmake"
+cmake \
+ -G Ninja \
+ -DCMAKE_BUILD_TYPE:STRING=Release \
+ -DCMAKE_INSTALL_PREFIX="${WORKSPACE}/${JOB_NAME}-${BUILD_NUMBER}" \
+ -DCMAKE_CXX_STANDARD=17 \
+ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
+ -DCMAKE_CXX_LINK_FLAGS="-Wl,-rpath,$LD_LIBRARY_PATH" \
+ -DLLVM_ENABLE_ASSERTIONS=ON \
+ -DLLVM_TARGETS_TO_BUILD=host \
+ -DLLVM_LIT_ARGS=-v \
+ -DLLVM_ENABLE_PROJECTS="clang;lld;llvm;flang;mlir" \
+ -DLLVM_ENABLE_RUNTIMES="compiler-rt;openmp;flang-rt" \
+ -S "${WORKSPACE}/llvm-project/llvm" \
+ -B "${WORKSPACE}/BUILD" \
+ -DPython3_EXECUTABLE:STRING=/proj/csse_jenkins2/swtools/apps/python/versions/3.8.12/bin/python \
+ -DCMAKE_INSTALL_MESSAGE=LAZY \
+ -DCMAKE_C_COMPILER=gcc \
+ -DCMAKE_CXX_COMPILER=g++ \
+ -DLLVM_PARALLEL_LINK_JOBS=16 \
+ -DBUILD_SHARED_LIBS:STRING=ON \
+ -DFLANG_ENABLE_WERROR=ON \
+ -DCMAKE_CXX_FLAGS="-Wno-array-bounds" \
+ -DLLVM_TARGETS_TO_BUILD:STRING="X86;AMDGPU" \
+ -DFLANG_RUNTIME_F128_MATH_LIB=libquadmath
+
+# -DLLVM_USE_LINKER:STRING=lld \
+echo 'cmake-G Ninja-DCMAKE_BUILD_TYPE:STRING=Release-DCMAKE_INSTALL_PREFIX="${WORKSPACE}/${JOB_NAME}-${BUILD_NUMBER}"-DCMAKE_CXX_STANDARD=17-DCMAKE_EXPORT_COMPILE_COMMANDS=ON-DCMAKE_CXX_LINK_FLAGS="-Wl,-rpath,$LD_LIBRARY_PATH"-DLLVM_ENABLE_ASSERTIONS=ON-DLLVM_TARGETS_TO_BUILD=host-DLLVM_LIT_ARGS=-v-DLLVM_ENABLE_PROJECTS="clang;lld;llvm;flang;mlir;openmp"-DLLVM_ENABLE_RUNTIMES="compiler-rt"-S "${WORKSPACE}/llvm-project/llvm"-B "${WORKSPACE}/BUILD"-DPython3_EXECUTABLE:STRING=/proj/csse_jenkins2/swtools/apps/python/versions/3.8.12/bin/python-DCMAKE_INSTALL_MESSAGE=LAZY-DCMAKE_C_COMPILER=gcc-DCMAKE_CXX_COMPILER=g++-DLLVM_PARALLEL_LINK_JOBS=16-DBUILD_SHARED_LIBS:STRING=ON-DLLVM_USE_LINKER:STRING=lld-DFLANG_ENABLE_WERROR=ON-DLLVM_TARGETS_TO_BUILD:STRING="X86;AMDGPU"'
+
+echo "ninja -C ${WORKSPACE}/BUILD install"
+ninja -C "${WORKSPACE}"/BUILD install
+ if [ "$?" -eq 0 ]; then
+ echo "********************************************************"
+ echo "Execution of command : ninja -C ${WORKSPACE}/BUILD install - was successful" >> "${WORKSPACE}/command_executed.txt"
+ echo "Execution of command : ninja -C ${WORKSPACE}/BUILD install - was successful"
+ echo "********************************************************"
+ else
+ echo "########################################################"
+ echo "Execution of command : ninja -C ${WORKSPACE}/BUILD install - was failed"
+ echo "Please check BUILD_INSTALL.log file for details"
+ echo "Please check ${WORKSPACE}/command_executed.txt file for commands executed till now"
+ rm -v "${WORKSPACE}"/build_success.txt
+ exit 1
+ echo "########################################################"
+ fi
+
+execute_and_check "cd ${WORKSPACE}"
+execute_and_check "tar -cJf ${JOB_NAME}-${BUILD_NUMBER}.tar.xz ${JOB_NAME}-${BUILD_NUMBER}"
+
+echo "ninja -C ${WORKSPACE}/BUILD check-flang check-mlir"
+ninja -C "${WORKSPACE}"/BUILD check-flang check-mlir
+ if [ "$?" -eq 0 ]; then
+ echo "********************************************************"
+ echo "Execution of command : ninja -C ${WORKSPACE}/BUILD check-flang - was successful" >> "${WORKSPACE}/command_executed.txt"
+ echo "Execution of command : ninja -C ${WORKSPACE}/BUILD check-flang - was successful"
+ echo "********************************************************"
+ else
+ echo "########################################################"
+ echo "Execution of command : ninja -C ${WORKSPACE}/BUILD check-flang - was failed"
+ echo "Please check ${WORKSPACE}/command_executed.txt file for commands executed till now"
+ rm -v "${WORKSPACE}"/build_success.txt
+ exit 1
+ echo "########################################################"
+ fi
+
+execute_and_check "cd ${WORKSPACE}/llvm-project"
+MAIN_COMMIT_HASH=$(git rev-parse HEAD)
+echo "$MAIN_COMMIT_HASH" >> "${WORKSPACE}"/VERSION_AND_COMMIT_HASH_OF_BUILD_"${BUILD_NUMBER}".txt
+
+if [ ! -f "${WORKSPACE}/build_success.txt" ]
+then
+ echo "Job failed - Please check ${WORKSPACE}/command_executed.txt file for commands executed till now"
+ exit 1
+fi
>From 5121c1a589fc205065f68bb3ccc7d965675d478d Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Wed, 4 Jun 2025 13:37:46 +0000
Subject: [PATCH 02/72] JOB_NAME compatibility with the freestyle original.
Change-Id: If2e2f3e6728989409b4e3b93d70919d730aa229e
---
.amd-ci/upstream/apptainer_run.sh | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/.amd-ci/upstream/apptainer_run.sh b/.amd-ci/upstream/apptainer_run.sh
index 5d6d4d74aafd85..3e23d4b2b26f95 100755
--- a/.amd-ci/upstream/apptainer_run.sh
+++ b/.amd-ci/upstream/apptainer_run.sh
@@ -11,12 +11,16 @@ if test ! -f "${image_path}"
then
image_path=/proj/csse_jenkins2/swtools/${image_tail}
fi
-
+job_name="presub_${CHANGE_TARGET:-${BRANCH_NAME:-NoSuchBranchName}}"
+if test -n "${CHANGE_BRANCH:-}"
+then
+ job_name+="_${BRANCH_NAME}" # Sic, the PR-<n> string.
+fi
apptainer exec \
--cleanenv \
--env BUILD_NUMBER="${BUILD_NUMBER:-0}" \
--env CI="${CI:-false}" \
- --env JOB_NAME="${JOB_NAME:-NoSuchJobName}" \
+ --env JOB_NAME="${job_name}" \
--bind "/proj:/proj:ro,$(pwd):${bind_point}:rw" \
${image_path} \
bash -c "cd ${bind_point} && ${_script_dir}/run.sh"
>From 0603108a9e5ac9e07cdbcd0b324ff2758ec1980d Mon Sep 17 00:00:00 2001
From: lcpu <Llvm.Cpu at amd.com>
Date: Thu, 5 Jun 2025 13:17:49 +0000
Subject: [PATCH 03/72] Build NTS, with JOB_NAME controlled from the pipeline.
Change-Id: Ia3de60311f34ba3c1e2249e46b8333d5348b3147
---
.amd-ci/upstream/Jenkinsfile | 24 +++++++++++++++++++++++-
.amd-ci/upstream/apptainer_run.sh | 7 +------
2 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index 45cde19cead419..b1de450ee6cebe 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -134,9 +134,15 @@ try {
// ToDo could now call build_essentials/has_active_files.sh
}
stage ('run') {
+ // ToDo this jobName string is 'presub' specific:
+ String jobName = 'presub_' + env.CHANGE_TARGET ?: (env.BRANCH_NAME ?: 'NoSuchBranchName')
+ if (env.CHANGE_BRANCH) {
+ jobName += '_' + env.BRANCH_NAME // Sic, the PR-<n> string.
+ }
try {
withEnv([
- 'PATH=' + linuxBasePath
+ 'PATH=' + linuxBasePath,
+ 'JOB_NAME=' + jobName
]) {
sh 'llvm-project/.amd-ci/upstream/apptainer_run.sh'
}
@@ -150,6 +156,22 @@ try {
deleteDirs: true,
patterns: cleanExcludes
)
+ build(
+ propagate: true,
+ wait: true,
+ job: 'AOCC-Workloads/TestSuites/NAGLLVM',
+ parameters: [
+ // Use the name of build tar as defined in the run script:
+ string(
+ name: 'CUT',
+ value: (
+ env.BUILD_URL + 'artifact/' +
+ jobName + '-' + env.BUILD_NUMBER + '.tar.xz'
+ )
+ ),
+ string(name: 'CHANGE_ID', value: env.CHANGE_ID)
+ ]
+ )
}
}
}
diff --git a/.amd-ci/upstream/apptainer_run.sh b/.amd-ci/upstream/apptainer_run.sh
index 3e23d4b2b26f95..3f314c585994de 100755
--- a/.amd-ci/upstream/apptainer_run.sh
+++ b/.amd-ci/upstream/apptainer_run.sh
@@ -11,16 +11,11 @@ if test ! -f "${image_path}"
then
image_path=/proj/csse_jenkins2/swtools/${image_tail}
fi
-job_name="presub_${CHANGE_TARGET:-${BRANCH_NAME:-NoSuchBranchName}}"
-if test -n "${CHANGE_BRANCH:-}"
-then
- job_name+="_${BRANCH_NAME}" # Sic, the PR-<n> string.
-fi
apptainer exec \
--cleanenv \
--env BUILD_NUMBER="${BUILD_NUMBER:-0}" \
--env CI="${CI:-false}" \
- --env JOB_NAME="${job_name}" \
+ --env JOB_NAME="${JOB_NAME:-NoSuchJobName}" \
--bind "/proj:/proj:ro,$(pwd):${bind_point}:rw" \
${image_path} \
bash -c "cd ${bind_point} && ${_script_dir}/run.sh"
>From 72eea5665b8a89447fff8da3a088f9bc88aa3a33 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Thu, 5 Jun 2025 16:50:57 +0000
Subject: [PATCH 04/72] Look for source changes.
Change-Id: I8065746dba09a2da6becfc2a7911d7582691695a
---
.amd-ci/upstream/Jenkinsfile | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index b1de450ee6cebe..43b4d6ea1ee6d7 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -43,6 +43,7 @@ properties(propsList)
String linuxBasePath = '/usr/sbin:/usr/bin:/bin'
String gitHubAppCredsId = 'Jenkins-AOCC'
+Boolean hasSourceChanges = true
Integer fullTimeoutH = 15
@@ -104,7 +105,7 @@ try {
}
dir ('llvm-project') {
String theUrl = 'https://er.github.amd.com/AOCC/llvm-project'
- checkout(
+ def gitVars = checkout( // groovylint-disable-line NoDef,VariableTypeRequired
changelog: true,
scm: scmGit(
gitTool: gitTool,
@@ -130,8 +131,30 @@ try {
]
)
)
+ assert gitVars.GIT_COMMIT
+ String dummyFile = env.BUILD_TAG + '_dummy.txt'
+ Integer activeStat = sh(
+ label: 'has-active-files',
+ script: (
+ 'set +x; echo "# Dummy" > ' + dummyFile + ' && ' +
+ 'bash ../aocc-essentials/build_essentials/has_active_files.sh' + space +
+ gitVars.GIT_COMMIT + space + dummyFile + ' && rm -f ' + dummyFile
+ ),
+ returnStatus: true
+ )
+ if (activeStat == 1) {
+ echo('Skipping build.')
+ hasSourceChanges = false
+ return // From stage
+ }
}
- // ToDo could now call build_essentials/has_active_files.sh
+ }
+ if (!hasSourceChanges) {
+ cleanWs(
+ deleteDirs: true,
+ patterns: cleanExcludes
+ )
+ return this
}
stage ('run') {
// ToDo this jobName string is 'presub' specific:
>From 2d31752b8634d5edac4416196fed4dfd68b181bb Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Fri, 6 Jun 2025 07:57:27 +0000
Subject: [PATCH 05/72] Updated extraction of LLVM_VERSION values to use
LLVMVersion.cmake location.
Change-Id: I0e6056063dacd75479635c21e475569d1b0c8d1a
---
.amd-ci/upstream/run.sh | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/.amd-ci/upstream/run.sh b/.amd-ci/upstream/run.sh
index f20d5695e8da90..f228a678191701 100755
--- a/.amd-ci/upstream/run.sh
+++ b/.amd-ci/upstream/run.sh
@@ -26,15 +26,13 @@ execute_and_check()
WORKSPACE=$PWD
touch "${WORKSPACE}"/build_success.txt
-execute_and_check "cd ${WORKSPACE}/llvm-project/llvm/"
-LLVM_VERSION_MAJOR=$(grep -w "set(LLVM_VERSION_MAJOR" CMakeLists.txt | awk -F' ' '{print $NF}' | tr -d ')')
-LLVM_VERSION_MINOR=$(grep -w "set(LLVM_VERSION_MINOR" CMakeLists.txt | awk -F' ' '{print $NF}' | tr -d ')')
-LLVM_VERSION_PATCH=$(grep -w "set(LLVM_VERSION_PATCH" CMakeLists.txt | awk -F' ' '{print $NF}' | tr -d ')')
+_ver_file=llvm-project/cmake/Modules/LLVMVersion.cmake
+LLVM_VERSION_MAJOR=$(grep -w "set(LLVM_VERSION_MAJOR" "${_ver_file}" | awk -F' ' '{print $NF}' | tr -d ')')
+LLVM_VERSION_MINOR=$(grep -w "set(LLVM_VERSION_MINOR" "${_ver_file}" | awk -F' ' '{print $NF}' | tr -d ')')
+LLVM_VERSION_PATCH=$(grep -w "set(LLVM_VERSION_PATCH" "${_ver_file}" | awk -F' ' '{print $NF}' | tr -d ')')
CLANG_VERSION=$LLVM_VERSION_MAJOR.$LLVM_VERSION_MINOR.$LLVM_VERSION_PATCH
echo "CLANG_VERSION value is - $CLANG_VERSION" > "${WORKSPACE}"/VERSION_AND_COMMIT_HASH_OF_BUILD_"${BUILD_NUMBER}".txt
-execute_and_check "cd ${WORKSPACE}"
-
echo "source aocc-essentials/build_essentials/linux/aocc_env.sh"
source aocc-essentials/build_essentials/linux/aocc_env.sh
>From c6317b914d9c87306e9c780e58ae5b5ced9ed399 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Mon, 9 Jun 2025 15:16:37 +0000
Subject: [PATCH 06/72] Also check for non-metadata changes.
Change-Id: I6231312c74a3e916c52b7f04111e6cc6168e1964
---
.amd-ci/upstream/Jenkinsfile | 58 +++++++++++++++++++++++++++---------
1 file changed, 44 insertions(+), 14 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index 43b4d6ea1ee6d7..a444c0b366389a 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -44,6 +44,7 @@ properties(propsList)
String linuxBasePath = '/usr/sbin:/usr/bin:/bin'
String gitHubAppCredsId = 'Jenkins-AOCC'
Boolean hasSourceChanges = true
+Integer successStat = 0
Integer fullTimeoutH = 15
@@ -57,6 +58,10 @@ try {
stage ('prepare') {
String gitTool = 'LinuxGit2.45'
String referenceRepo = env.JENKINS_REMOTE_GIT_CACHE ?: 'NoSuchReferenceRepo'
+ String gitPathEnv = (
+ 'PATH=/proj/csse_jenkins2/swtools/c/rhel7-gcc8.3.1/git-2.45.2-ilh23rcg/bin:' +
+ linuxBasePath
+ )
cleanWs(
deleteDirs: true,
patterns: cleanExcludes
@@ -87,10 +92,7 @@ try {
gitToolName: gitTool
)
]) {
- withEnv([
- 'PATH=/proj/csse_jenkins2/swtools/c/rhel7-gcc8.3.1/git-2.45.2-ilh23rcg/bin:' +
- linuxBasePath
- ]) {
+ withEnv([gitPathEnv]) {
sh(
label: 'clone-essentials',
script: (
@@ -132,16 +134,44 @@ try {
)
)
assert gitVars.GIT_COMMIT
- String dummyFile = env.BUILD_TAG + '_dummy.txt'
- Integer activeStat = sh(
- label: 'has-active-files',
- script: (
- 'set +x; echo "# Dummy" > ' + dummyFile + ' && ' +
- 'bash ../aocc-essentials/build_essentials/has_active_files.sh' + space +
- gitVars.GIT_COMMIT + space + dummyFile + ' && rm -f ' + dummyFile
- ),
- returnStatus: true
- )
+ Integer activeStat
+ withEnv([gitPathEnv]) {
+ if (
+ gitVars.GIT_PREVIOUS_SUCCESSFUL_COMMIT &&
+ gitVars.GIT_PREVIOUS_SUCCESSFUL_COMMIT != gitVars.GIT_COMMIT
+ ) {
+ withCredentials([
+ gitUsernamePassword(
+ credentialsId: gitHubAppCredsId,
+ gitToolName: gitTool
+ )
+ ]) {
+ activeStat = sh(
+ label: 'has-file-changes',
+ script: (
+ 'bash ../aocc-essentials/build_essentials/has_file_changes.sh' + space +
+ gitVars.GIT_COMMIT + space + gitVars.GIT_PREVIOUS_SUCCESSFUL_COMMIT
+ ),
+ returnStatus: true
+ )
+ }
+ }
+ if (activeStat == successStat) {
+ String dummyFile = env.BUILD_TAG + '_dummy.txt'
+ activeStat = sh(
+ label: 'has-active-files',
+ script: (
+ 'set +x; echo "# Dummy" > ' + dummyFile + ' && ' +
+ 'bash ../aocc-essentials/build_essentials/has_active_files.sh' + space +
+ gitVars.GIT_COMMIT + space + dummyFile + ' && rm -f ' + dummyFile
+ ),
+ returnStatus: true
+ )
+ }
+ }
+ if (activeStat != successStat && activeStat != 1) {
+ error 'Unexpected exit checking file activity.'
+ }
if (activeStat == 1) {
echo('Skipping build.')
hasSourceChanges = false
>From 54a5881fed79050f66fb854831f4e72419a9d65d Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Tue, 10 Jun 2025 08:40:24 +0000
Subject: [PATCH 07/72] Missing initialization of activeStat.
Change-Id: I9c3f9b9c031b7c8ade8605049ff7a201e7de15df
---
.amd-ci/upstream/Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index a444c0b366389a..aaf287cfd89a96 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -134,7 +134,7 @@ try {
)
)
assert gitVars.GIT_COMMIT
- Integer activeStat
+ Integer activeStat = successStat
withEnv([gitPathEnv]) {
if (
gitVars.GIT_PREVIOUS_SUCCESSFUL_COMMIT &&
>From 05c41ad769e97c0f4525bbe03d0ec3d8298563f1 Mon Sep 17 00:00:00 2001
From: Thirumalai-Shaktivel <tshaktiv at amd.com>
Date: Fri, 20 Jun 2025 08:39:37 +0000
Subject: [PATCH 08/72] Disable Flang-rt and compiler-rt for the llvm build
There is a failure in building the application
which complains the library is not created,
we can't link it with some option as well
Change-Id: Ic413a0cff18e87cfc155818f931a797c72e65221
---
.amd-ci/upstream/run.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.amd-ci/upstream/run.sh b/.amd-ci/upstream/run.sh
index f228a678191701..bce30263c0e667 100755
--- a/.amd-ci/upstream/run.sh
+++ b/.amd-ci/upstream/run.sh
@@ -59,7 +59,7 @@ cmake \
-DLLVM_TARGETS_TO_BUILD=host \
-DLLVM_LIT_ARGS=-v \
-DLLVM_ENABLE_PROJECTS="clang;lld;llvm;flang;mlir" \
- -DLLVM_ENABLE_RUNTIMES="compiler-rt;openmp;flang-rt" \
+ -DLLVM_ENABLE_RUNTIMES="openmp" \
-S "${WORKSPACE}/llvm-project/llvm" \
-B "${WORKSPACE}/BUILD" \
-DPython3_EXECUTABLE:STRING=/proj/csse_jenkins2/swtools/apps/python/versions/3.8.12/bin/python \
>From 5041d69f2d49c735d2178bc10621c048e58824c0 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Tue, 1 Jul 2025 17:48:44 +0000
Subject: [PATCH 09/72] CPUPC-7979: updated upstream pipeline to use non-ER
GitHub.
Change-Id: I02eea3578e7865d32f5533ecfe2dc41237627dcb
---
.amd-ci/upstream/Jenkinsfile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index aaf287cfd89a96..9697ed89da9b8e 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -42,7 +42,7 @@ if (isPrBranch) {
properties(propsList)
String linuxBasePath = '/usr/sbin:/usr/bin:/bin'
-String gitHubAppCredsId = 'Jenkins-AOCC'
+String gitHubAppCredsId = 'Jenkins-AOCC-nonER'
Boolean hasSourceChanges = true
Integer successStat = 0
@@ -106,7 +106,7 @@ try {
}
}
dir ('llvm-project') {
- String theUrl = 'https://er.github.amd.com/AOCC/llvm-project'
+ String theUrl = 'https://github.amd.com/AOCC/llvm-project'
def gitVars = checkout( // groovylint-disable-line NoDef,VariableTypeRequired
changelog: true,
scm: scmGit(
>From 280a47bec4e52bdcb0b2151fc7ccc6bde8db41eb Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Mon, 7 Jul 2025 10:09:55 +0000
Subject: [PATCH 10/72] CPUPC-7979: postsub operations added to GitHub LLVM
Flang upstream pipeline.
Change-Id: Ib094b2d5414e33ccc5658cc24772710119810d1f
---
.amd-ci/upstream/Jenkinsfile | 52 +++++++++++++++++++++++++++++------
.amd-ci/upstream/repo_sync.sh | 43 +++++++++++++++++++++++++++++
2 files changed, 87 insertions(+), 8 deletions(-)
create mode 100755 .amd-ci/upstream/repo_sync.sh
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index 9697ed89da9b8e..debce654b352e0 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -2,8 +2,9 @@ import hudson.model.Result
/* groovylint-disable-next-line CompileStatic */
String actualTarget = env.CHANGE_TARGET ?: env.BRANCH_NAME
+String upstreamBranch = 'upstream-main', stagingBranch = 'amd-staging'
-if (actualTarget != 'upstream-main') {
+if (!(actualTarget in [stagingBranch, upstreamBranch])) {
echo 'Pipeline skipped for base branch ' + actualTarget
return this
}
@@ -11,11 +12,13 @@ if (actualTarget != 'upstream-main') {
String actualHead = env.CHANGE_BRANCH ?: env.BRANCH_NAME
Boolean isPrBranch = env.CHANGE_BRANCH != null
-if (!isPrBranch) {
- echo 'Pipeline skipped for non-PR branch ' + actualHead
+if (!isPrBranch && actualTarget != upstreamBranch) {
+ echo 'Pipeline skipped for non-PR branch ' + actualHead + ' of base ' + actualTarget
return this
}
+Boolean postsub = !isPrBranch && actualTarget == upstreamBranch && actualHead == upstreamBranch
+
/**
* Coerce Result enums to String, seems to
* be required by CatchErrorStep.setStageResult()
@@ -23,7 +26,7 @@ if (!isPrBranch) {
String abortedResultStr = Result.ABORTED, failureResultStr = Result.FAILURE
String notBuiltResultStr = Result.NOT_BUILT, successResultStr = Result.SUCCESS
-String space = ' ', andChain = '&&'
+String space = ' ', andChain = '&&', underScore = '_'
List propsList = []
if (isPrBranch) {
@@ -97,7 +100,7 @@ try {
label: 'clone-essentials',
script: (
'set +x; . aocc-devops/utils.sh' + space + andChain + space +
- 'export BRANCH_NAME=amd-staging' + space + andChain + space +
+ 'export BRANCH_NAME=' + stagingBranch + space + andChain + space +
'sparse_clone_essentials' + space + andChain + space +
'mv llvm-project/aocc-essentials . ' + space + andChain + space +
'rm -rf llvm-project'
@@ -186,11 +189,30 @@ try {
)
return this
}
+ if (postsub) {
+ stage ('merge-pre') {
+ withCredentials([
+ gitUsernamePassword(
+ credentialsId: gitHubAppCredsId,
+ gitToolName: gitTool
+ )
+ ]) {
+ withEnv([gitPathEnv]) {
+ sh(
+ label: 'merge-main',
+ script: '''git merge origin/main -m "Merge from main on $(date +'%Y-%m-%d')"'''
+ )
+ }
+ }
+ }
+ }
stage ('run') {
- // ToDo this jobName string is 'presub' specific:
- String jobName = 'presub_' + env.CHANGE_TARGET ?: (env.BRANCH_NAME ?: 'NoSuchBranchName')
+ String jobName = (
+ (isPrBranch ? 'presub' : 'update') + underScore +
+ env.CHANGE_TARGET ?: (env.BRANCH_NAME ?: 'NoSuchBranchName')
+ )
if (env.CHANGE_BRANCH) {
- jobName += '_' + env.BRANCH_NAME // Sic, the PR-<n> string.
+ jobName += underScore + env.BRANCH_NAME // Sic, the PR-<n> string.
}
try {
withEnv([
@@ -201,6 +223,20 @@ try {
}
currentBuild.result = successResultStr
} finally {
+ if (postsub) {
+ stage ('merge-post') {
+ withCredentials([
+ gitUsernamePassword(
+ credentialsId: gitHubAppCredsId,
+ gitToolName: gitTool
+ )
+ ]) {
+ withEnv([gitPathEnv]) {
+ sh 'llvm-project/.amd-ci/upstream/repo_sync.sh'
+ }
+ }
+ }
+ }
archiveArtifacts(
allowEmptyArchive: true,
artifacts: '*.tar.xz,*.txt'
diff --git a/.amd-ci/upstream/repo_sync.sh b/.amd-ci/upstream/repo_sync.sh
new file mode 100755
index 00000000000000..7962a1462c4a64
--- /dev/null
+++ b/.amd-ci/upstream/repo_sync.sh
@@ -0,0 +1,43 @@
+#!/usr/bin/env bash
+
+WORKSPACE=$PWD
+cd "${WORKSPACE}/llvm-project" || exit 1
+
+set -x
+echo "git push origin HEAD:refs/heads/upstream-main"
+git push origin HEAD:refs/heads/upstream-main
+if [ "$?" -eq 0 ]; then
+ echo "********************************************************"
+ echo "Execution of command : git push origin HEAD:refs/heads/upstream-main - was successful" >> "${WORKSPACE}/command_executed.txt"
+ echo "Execution of command : git push origin HEAD:refs/heads/upstream-main - was successful"
+ echo "********************************************************"
+else
+ echo "########################################################"
+ echo "Execution of command : git push origin HEAD:refs/heads/upstream-main - was failed"
+ echo "Please check ${WORKSPACE}/command_executed.txt file for commands executed till now"
+ rm -v "${WORKSPACE}"/build_success.txt
+ exit 1
+ echo "########################################################"
+fi
+
+if [ ! -f "${WORKSPACE}/build_success.txt" ]
+then
+ echo "Job failed - Please check ${WORKSPACE}/command_executed.txt file for commands executed till now"
+ exit 1
+fi
+
+cd "${WORKSPACE}/llvm-project" || exit 1
+declare -A branch_map
+branch_map["release/20.x"]="aocc/upstream/20.x"
+branch_map["main"]="aocc/upstream/main"
+
+for src_branch in "${!branch_map[@]}"; do
+ dest_branch="${branch_map[$src_branch]}"
+ echo "Pushing branch from $src_branch to $dest_branch"
+ if ! git fetch origin $src_branch:$dest_branch; then
+ echo "Failed to fetch branch: $src_branch"
+ fi
+ if ! git push origin "$dest_branch:$dest_branch"; then
+ echo "Failed to push branch: $dest_branch"
+ fi
+done
>From 64ef5c3e3cd2ec434979720b72c5c2f3086cc8d6 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Mon, 7 Jul 2025 12:48:41 +0000
Subject: [PATCH 11/72] CPUPC-7979: fixed variable scoping, merge location.
Change-Id: I0fde8cdf0d401faad0121bf9cc9b0cbd59b487bc
---
.amd-ci/upstream/Jenkinsfile | 187 ++++++++++++++++++-----------------
1 file changed, 95 insertions(+), 92 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index debce654b352e0..abce71e4a20e3e 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -19,6 +19,11 @@ if (!isPrBranch && actualTarget != upstreamBranch) {
Boolean postsub = !isPrBranch && actualTarget == upstreamBranch && actualHead == upstreamBranch
+if (postsub && env.BRANCH_NAME != upstreamBranch) {
+ echo 'Pipeline postsub not supported for branch ' + env.BRANCH_NAME
+ return this
+}
+
/**
* Coerce Result enums to String, seems to
* be required by CatchErrorStep.setStageResult()
@@ -26,7 +31,7 @@ Boolean postsub = !isPrBranch && actualTarget == upstreamBranch && actualHead ==
String abortedResultStr = Result.ABORTED, failureResultStr = Result.FAILURE
String notBuiltResultStr = Result.NOT_BUILT, successResultStr = Result.SUCCESS
-String space = ' ', andChain = '&&', underScore = '_'
+String space = ' ', andChain = '&&', underScore = '_', slash = '/'
List propsList = []
if (isPrBranch) {
@@ -46,6 +51,13 @@ properties(propsList)
String linuxBasePath = '/usr/sbin:/usr/bin:/bin'
String gitHubAppCredsId = 'Jenkins-AOCC-nonER'
+String gitTool = 'LinuxGit2.45'
+String gitPathEnv = (
+ 'PATH=/proj/csse_jenkins2/swtools/c/rhel7-gcc8.3.1/git-2.45.2-ilh23rcg/bin:' +
+ linuxBasePath
+)
+String llvmProj = 'llvm-project', llvmProjRepo = llvmProj + '.git'
+String theUrl
Boolean hasSourceChanges = true
Integer successStat = 0
@@ -59,12 +71,7 @@ try {
[pattern: 'llvm-project/.git/**', type: 'EXCLUDE']
]
stage ('prepare') {
- String gitTool = 'LinuxGit2.45'
String referenceRepo = env.JENKINS_REMOTE_GIT_CACHE ?: 'NoSuchReferenceRepo'
- String gitPathEnv = (
- 'PATH=/proj/csse_jenkins2/swtools/c/rhel7-gcc8.3.1/git-2.45.2-ilh23rcg/bin:' +
- linuxBasePath
- )
cleanWs(
deleteDirs: true,
patterns: cleanExcludes
@@ -108,77 +115,97 @@ try {
)
}
}
- dir ('llvm-project') {
- String theUrl = 'https://github.amd.com/AOCC/llvm-project'
- def gitVars = checkout( // groovylint-disable-line NoDef,VariableTypeRequired
- changelog: true,
- scm: scmGit(
- gitTool: gitTool,
- branches: scm.branches,
- browser: github(theUrl),
- extensions: scm.extensions + [
- cloneOption(
- depth: 2, // To compute the changelog.
- honorRefspec: true, noTags: true, shallow: true,
- reference: referenceRepo + '/llvm-project.git'
- ),
- firstBuildChangelog()
- ],
- userRemoteConfigs: [
- [
- credentialsId: gitHubAppCredsId,
- refspec: (
- '+refs/heads/' + actualHead + ':' +
- 'refs/remotes/origin/' + actualHead
+ if (postsub) {
+ theUrl = 'ssh://git@github.amd.com/AOCC/llvm-project.git'
+ /*
+ * Direct CLI clone using the system's orequest SSH credentials,
+ * so that the later pushes in repo_sync.sh are successful.
+ */
+ withEnv([gitPathEnv]) {
+ sh(
+ label: 'clone-direct',
+ script: (
+ 'git clone -q --reference ' +
+ referenceRepo + slash + llvmProjRepo + ' -b main ' + theUrl + andChain +
+ 'cd ' + llvmProj + andChain +
+ 'git checkout ' + env.BRANCH_NAME + andChain +
+ '''git merge main -m "Merge from main on $(date +'%Y-%m-%d')"'''
+ )
+ )
+ }
+ } else {
+ theUrl = 'https://github.amd.com/AOCC/llvm-project'
+ dir (llvmProj) {
+ def gitVars = checkout( // groovylint-disable-line NoDef,VariableTypeRequired
+ changelog: true,
+ scm: scmGit(
+ gitTool: gitTool,
+ branches: scm.branches,
+ browser: github(theUrl),
+ extensions: scm.extensions + [
+ cloneOption(
+ depth: 2, // To compute the changelog.
+ honorRefspec: true, noTags: true, shallow: true,
+ reference: referenceRepo + slash + llvmProjRepo
),
- url: theUrl
+ firstBuildChangelog()
+ ],
+ userRemoteConfigs: [
+ [
+ credentialsId: gitHubAppCredsId,
+ refspec: (
+ '+refs/heads/' + actualHead + ':' +
+ 'refs/remotes/origin/' + actualHead
+ ),
+ url: theUrl
+ ]
]
- ]
+ )
)
- )
- assert gitVars.GIT_COMMIT
- Integer activeStat = successStat
- withEnv([gitPathEnv]) {
- if (
- gitVars.GIT_PREVIOUS_SUCCESSFUL_COMMIT &&
- gitVars.GIT_PREVIOUS_SUCCESSFUL_COMMIT != gitVars.GIT_COMMIT
- ) {
- withCredentials([
- gitUsernamePassword(
- credentialsId: gitHubAppCredsId,
- gitToolName: gitTool
- )
- ]) {
+ assert gitVars.GIT_COMMIT
+ Integer activeStat = successStat
+ withEnv([gitPathEnv]) {
+ if (
+ gitVars.GIT_PREVIOUS_SUCCESSFUL_COMMIT &&
+ gitVars.GIT_PREVIOUS_SUCCESSFUL_COMMIT != gitVars.GIT_COMMIT
+ ) {
+ withCredentials([
+ gitUsernamePassword(
+ credentialsId: gitHubAppCredsId,
+ gitToolName: gitTool
+ )
+ ]) {
+ activeStat = sh(
+ label: 'has-file-changes',
+ script: (
+ 'bash ../aocc-essentials/build_essentials/has_file_changes.sh' + space +
+ gitVars.GIT_COMMIT + space + gitVars.GIT_PREVIOUS_SUCCESSFUL_COMMIT
+ ),
+ returnStatus: true
+ )
+ }
+ }
+ if (activeStat == successStat) {
+ String dummyFile = env.BUILD_TAG + '_dummy.txt'
activeStat = sh(
- label: 'has-file-changes',
+ label: 'has-active-files',
script: (
- 'bash ../aocc-essentials/build_essentials/has_file_changes.sh' + space +
- gitVars.GIT_COMMIT + space + gitVars.GIT_PREVIOUS_SUCCESSFUL_COMMIT
+ 'set +x; echo "# Dummy" > ' + dummyFile + andChain +
+ 'bash ../aocc-essentials/build_essentials/has_active_files.sh' + space +
+ gitVars.GIT_COMMIT + space + dummyFile + ' && rm -f ' + dummyFile
),
returnStatus: true
)
}
}
- if (activeStat == successStat) {
- String dummyFile = env.BUILD_TAG + '_dummy.txt'
- activeStat = sh(
- label: 'has-active-files',
- script: (
- 'set +x; echo "# Dummy" > ' + dummyFile + ' && ' +
- 'bash ../aocc-essentials/build_essentials/has_active_files.sh' + space +
- gitVars.GIT_COMMIT + space + dummyFile + ' && rm -f ' + dummyFile
- ),
- returnStatus: true
- )
+ if (activeStat != successStat && activeStat != 1) {
+ error 'Unexpected exit checking file activity.'
+ }
+ if (activeStat == 1) {
+ echo('Skipping build.')
+ hasSourceChanges = false
+ return // From stage
}
- }
- if (activeStat != successStat && activeStat != 1) {
- error 'Unexpected exit checking file activity.'
- }
- if (activeStat == 1) {
- echo('Skipping build.')
- hasSourceChanges = false
- return // From stage
}
}
}
@@ -189,23 +216,6 @@ try {
)
return this
}
- if (postsub) {
- stage ('merge-pre') {
- withCredentials([
- gitUsernamePassword(
- credentialsId: gitHubAppCredsId,
- gitToolName: gitTool
- )
- ]) {
- withEnv([gitPathEnv]) {
- sh(
- label: 'merge-main',
- script: '''git merge origin/main -m "Merge from main on $(date +'%Y-%m-%d')"'''
- )
- }
- }
- }
- }
stage ('run') {
String jobName = (
(isPrBranch ? 'presub' : 'update') + underScore +
@@ -225,15 +235,8 @@ try {
} finally {
if (postsub) {
stage ('merge-post') {
- withCredentials([
- gitUsernamePassword(
- credentialsId: gitHubAppCredsId,
- gitToolName: gitTool
- )
- ]) {
- withEnv([gitPathEnv]) {
- sh 'llvm-project/.amd-ci/upstream/repo_sync.sh'
- }
+ withEnv([gitPathEnv]) {
+ sh 'llvm-project/.amd-ci/upstream/repo_sync.sh'
}
}
}
>From e1acf50cbd0ee2d5c43bce9f6379aa1c5b70b73e Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Tue, 8 Jul 2025 06:44:21 +0000
Subject: [PATCH 12/72] CPUPC-7979: added cron trigger for postsub upstream
job.
Change-Id: I3c01489f813cca867e0b0a3e8f1f47d471192025
---
.amd-ci/upstream/Jenkinsfile | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index abce71e4a20e3e..23164be11b0076 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -47,6 +47,11 @@ if (isPrBranch) {
)
)
}
+if (postsub) {
+ propsList.add(
+ pipelineTriggers([cron('@midnight')])
+ )
+}
properties(propsList)
String linuxBasePath = '/usr/sbin:/usr/bin:/bin'
>From b1b760d4db06983973a9c1dc9a6a18df36d7b96d Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Tue, 15 Jul 2025 10:51:52 +0000
Subject: [PATCH 13/72] Synced from amd-staging.
Cherry picked:
Change-Id: Idac43c784915d699833714f73b8c939fea3f4724
Change-Id: Iadafb4b14cb84d2d718754b6190f3949d38b8f74
Change-Id: Iaaf0f112919a3a5b3124c9b9a45b8a10124c5e0d
---
.amd-ci/upstream/Jenkinsfile | 51 ++++++++++++++++++------------------
1 file changed, 26 insertions(+), 25 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index 23164be11b0076..ae0efe4061196d 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -66,6 +66,14 @@ String theUrl
Boolean hasSourceChanges = true
Integer successStat = 0
+String jobName = (
+ (isPrBranch ? 'presub' : 'update') + underScore +
+ env.CHANGE_TARGET ?: (env.BRANCH_NAME ?: 'NoSuchBranchName')
+)
+if (env.CHANGE_BRANCH) {
+ jobName += underScore + env.BRANCH_NAME // Sic, the PR-<n> string.
+}
+
Integer fullTimeoutH = 15
try {
@@ -94,8 +102,8 @@ try {
],
userRemoteConfigs: [
[
- credentialsId: 'mat-amd-csg-demo',
- url: 'https://github.com/AMD-CSG/aocc-devops.git'
+ credentialsId: gitHubAppCredsId,
+ url: 'https://github.amd.com/AOCC/aocc-devops.git'
]
]
)
@@ -222,13 +230,6 @@ try {
return this
}
stage ('run') {
- String jobName = (
- (isPrBranch ? 'presub' : 'update') + underScore +
- env.CHANGE_TARGET ?: (env.BRANCH_NAME ?: 'NoSuchBranchName')
- )
- if (env.CHANGE_BRANCH) {
- jobName += underScore + env.BRANCH_NAME // Sic, the PR-<n> string.
- }
try {
withEnv([
'PATH=' + linuxBasePath,
@@ -253,25 +254,25 @@ try {
deleteDirs: true,
patterns: cleanExcludes
)
- build(
- propagate: true,
- wait: true,
- job: 'AOCC-Workloads/TestSuites/NAGLLVM',
- parameters: [
- // Use the name of build tar as defined in the run script:
- string(
- name: 'CUT',
- value: (
- env.BUILD_URL + 'artifact/' +
- jobName + '-' + env.BUILD_NUMBER + '.tar.xz'
- )
- ),
- string(name: 'CHANGE_ID', value: env.CHANGE_ID)
- ]
- )
}
}
}
+ build(
+ propagate: true,
+ wait: true,
+ job: 'AOCC-Workloads/TestSuites/NAGLLVM',
+ parameters: [
+ // Use the name of build tar as defined in the run script:
+ string(
+ name: 'CUT',
+ value: (
+ env.BUILD_URL + 'artifact/' +
+ jobName + '-' + env.BUILD_NUMBER + '.tar.xz'
+ )
+ ),
+ string(name: 'CHANGE_ID', value: env.CHANGE_ID)
+ ]
+ )
}
} catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
/*
>From 3a564d535d4b7f2ca214d9ea2b4e16efb1dc49e5 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Tue, 22 Jul 2025 09:29:14 +0000
Subject: [PATCH 14/72] CPUPC-7979: Corrected for operator precedence in
constructing job name.
Change-Id: I5c20fe37eb51a8951aca6bf4a369354c6f13d9b1
---
.amd-ci/upstream/Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index ae0efe4061196d..110e21ff981f7a 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -68,7 +68,7 @@ Integer successStat = 0
String jobName = (
(isPrBranch ? 'presub' : 'update') + underScore +
- env.CHANGE_TARGET ?: (env.BRANCH_NAME ?: 'NoSuchBranchName')
+ (env.CHANGE_TARGET ?: (env.BRANCH_NAME ?: 'NoSuchBranchName'))
)
if (env.CHANGE_BRANCH) {
jobName += underScore + env.BRANCH_NAME // Sic, the PR-<n> string.
>From e052e4f10db19f16f2e43cab307c9c54739c66c1 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Fri, 25 Jul 2025 08:40:38 +0000
Subject: [PATCH 15/72] CPUPC-7979: Synced upstream pipeline from amd-staging.
Change-Id: Id95babf13d5391ccbccfc04bcceb50daa705e63b
---
.amd-ci/upstream/Jenkinsfile | 68 +++++++++++++++++++++++++++---------
1 file changed, 52 insertions(+), 16 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index 110e21ff981f7a..f7ca4010c1183d 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -24,6 +24,15 @@ if (postsub && env.BRANCH_NAME != upstreamBranch) {
return this
}
+if (actualTarget == stagingBranch &&
+ !currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause') &&
+ !currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause')) {
+ String cause = currentBuild.getBuildCauses().shortDescription // groovylint-disable-line UnnecessaryGetter
+ echo 'Pipeline for base ' + actualTarget + ' skipped for cause ' + cause
+ echo 'Pipeline only runs if manually or timer triggered.'
+ return this
+}
+
/**
* Coerce Result enums to String, seems to
* be required by CatchErrorStep.setStageResult()
@@ -219,6 +228,31 @@ try {
hasSourceChanges = false
return // From stage
}
+
+ String mstat
+ withEnv([gitPathEnv, 'GIT_COMMIT=' + gitVars.GIT_COMMIT]) {
+ withCredentials([
+ usernamePassword(
+ credentialsId: gitHubAppCredsId,
+ usernameVariable: 'GH_APP_USR_NOTREQUIRED',
+ passwordVariable: 'GH_ENTERPRISE_TOKEN'
+ )
+ ]) {
+ mstat = sh(
+ label: 'merge-stat',
+ script: (
+ 'bash ../aocc-essentials/build_essentials/merge_commit_status.sh' + space +
+ gitVars.GIT_COMMIT
+ ),
+ returnStdout: true
+ ).trim()
+ }
+ }
+ if (mstat && mstat != 'None') {
+ echo('Skipping build, merge status is ' + mstat)
+ hasSourceChanges = false
+ return // From stage
+ }
}
}
}
@@ -257,22 +291,24 @@ try {
}
}
}
- build(
- propagate: true,
- wait: true,
- job: 'AOCC-Workloads/TestSuites/NAGLLVM',
- parameters: [
- // Use the name of build tar as defined in the run script:
- string(
- name: 'CUT',
- value: (
- env.BUILD_URL + 'artifact/' +
- jobName + '-' + env.BUILD_NUMBER + '.tar.xz'
- )
- ),
- string(name: 'CHANGE_ID', value: env.CHANGE_ID)
- ]
- )
+ stage ('downstream-tasks') {
+ build(
+ propagate: true,
+ wait: true,
+ job: 'AOCC-Workloads/TestSuites/NAGLLVM',
+ parameters: [
+ // Use the name of build tar as defined in the run script:
+ string(
+ name: 'CUT',
+ value: (
+ env.BUILD_URL + 'artifact/' +
+ jobName + '-' + env.BUILD_NUMBER + '.tar.xz'
+ )
+ ),
+ string(name: 'CHANGE_ID', value: env.CHANGE_ID)
+ ]
+ )
+ }
}
} catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
/*
>From cd600263ed7730d3575a1c98504ccdc89b4622e8 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Wed, 30 Jul 2025 07:24:57 +0000
Subject: [PATCH 16/72] CPUPC-7979: Pass GIT_COMMIT to downstream job.
Change-Id: If4917b4ed6f440944e831db874f27ee14df5f38c
---
.amd-ci/upstream/Jenkinsfile | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index f7ca4010c1183d..bee673196476c1 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -41,6 +41,7 @@ String abortedResultStr = Result.ABORTED, failureResultStr = Result.FAILURE
String notBuiltResultStr = Result.NOT_BUILT, successResultStr = Result.SUCCESS
String space = ' ', andChain = '&&', underScore = '_', slash = '/'
+String gitCommitEnv = 'GIT_COMMIT'
List propsList = []
if (isPrBranch) {
@@ -83,6 +84,8 @@ if (env.CHANGE_BRANCH) {
jobName += underScore + env.BRANCH_NAME // Sic, the PR-<n> string.
}
+def gitVars // groovylint-disable-line NoDef,VariableTypeRequired
+
Integer fullTimeoutH = 15
try {
@@ -154,11 +157,19 @@ try {
'''git merge main -m "Merge from main on $(date +'%Y-%m-%d')"'''
)
)
+ dir(llvmProj) {
+ String gitCommit = sh(
+ label: 'rev-parse',
+ script: 'git rev-parse HEAD',
+ returnStdout: true
+ ).trim()
+ gitVars = [(gitCommitEnv): gitCommit]
+ }
}
} else {
theUrl = 'https://github.amd.com/AOCC/llvm-project'
dir (llvmProj) {
- def gitVars = checkout( // groovylint-disable-line NoDef,VariableTypeRequired
+ gitVars = checkout(
changelog: true,
scm: scmGit(
gitTool: gitTool,
@@ -230,7 +241,7 @@ try {
}
String mstat
- withEnv([gitPathEnv, 'GIT_COMMIT=' + gitVars.GIT_COMMIT]) {
+ withEnv([gitPathEnv, gitCommitEnv + '=' + gitVars.GIT_COMMIT]) {
withCredentials([
usernamePassword(
credentialsId: gitHubAppCredsId,
@@ -305,7 +316,8 @@ try {
jobName + '-' + env.BUILD_NUMBER + '.tar.xz'
)
),
- string(name: 'CHANGE_ID', value: env.CHANGE_ID)
+ string(name: 'CHANGE_ID', value: env.CHANGE_ID ?: ''),
+ string(name: gitCommitEnv, value: gitVars.GIT_COMMIT ?: '')
]
)
}
>From e0688617c7e4dbd264ea208e2f34250b93b74bdf Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Wed, 20 Aug 2025 10:58:13 +0000
Subject: [PATCH 17/72] CPUPC-7979: parallel block for downstream jobs,
including GFortran.
Change-Id: I2e3bd8e66bdaa43d7f7218ede3b737f58f97fc5b
---
.amd-ci/upstream/Jenkinsfile | 44 +++++++++++++++++++++++-------------
1 file changed, 28 insertions(+), 16 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index bee673196476c1..eb44bf51a11363 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -303,23 +303,35 @@ try {
}
}
stage ('downstream-tasks') {
- build(
- propagate: true,
- wait: true,
- job: 'AOCC-Workloads/TestSuites/NAGLLVM',
- parameters: [
- // Use the name of build tar as defined in the run script:
- string(
- name: 'CUT',
- value: (
- env.BUILD_URL + 'artifact/' +
- jobName + '-' + env.BUILD_NUMBER + '.tar.xz'
+ Map allTasks = [
+ failFast: false,
+ ]
+ List<String> downstreamSuites = ['GFortran', 'NAGLLVM']
+ for (suite in downstreamSuites) {
+ String suiteName = suite
+ allTasks[suiteName] = {
+ stage ('downstream-suite-' + suiteName) {
+ build(
+ propagate: true,
+ wait: true,
+ job: 'AOCC-Workloads/TestSuites/' + suiteName,
+ parameters: [
+ // Use the name of build tar as defined in the run script:
+ string(
+ name: 'CUT',
+ value: (
+ env.BUILD_URL + 'artifact/' +
+ jobName + '-' + env.BUILD_NUMBER + '.tar.xz'
+ )
+ ),
+ string(name: 'CHANGE_ID', value: env.CHANGE_ID ?: ''),
+ string(name: gitCommitEnv, value: gitVars.GIT_COMMIT ?: '')
+ ]
)
- ),
- string(name: 'CHANGE_ID', value: env.CHANGE_ID ?: ''),
- string(name: gitCommitEnv, value: gitVars.GIT_COMMIT ?: '')
- ]
- )
+ }
+ }
+ }
+ parallel(allTasks)
}
}
} catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
>From 7d973816ce0d183b8e83532385ffc8b27d3cde93 Mon Sep 17 00:00:00 2001
From: "T P, Kiran Kumar" <KiranKumar.TP at amd.com>
Date: Fri, 22 Aug 2025 10:51:16 +0530
Subject: [PATCH 18/72] =?UTF-8?q?LLVMCC-49=20:=20Update=20build=20script?=
=?UTF-8?q?=20in=20.amd-ci/upstream/=20for=20llvm-flang=20b=E2=80=A6=20(#4?=
=?UTF-8?q?98)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
[LLVMCC-49] : Update build script in .amd-ci/upstream/ for llvm-flang build [on upstream-main branch]
Added below modifications:
-DLLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra;flang"
-DLLVM_ENABLE_RUNTIMES="openmp;flang-rt;compiler-rt"
-DLIBOMP_OMPT_SUPPORT=ON
-DLIBOMP_USE_DEBUGGER=ON
-DLIBOMP_CFLAGS=\'-O2\'
-DLIBOMP_CPPFLAGS=\'-O2\'
-DLIBOMPTARGET_OMPD_SUPPORT=ON
-DLIBOMP_OMPD_ENABLED=ON
-DLIBOMP_OMPD_SUPPORT=ON
The above changes are borrowed from the upstream presubmit build bot.
---
.amd-ci/upstream/run.sh | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/.amd-ci/upstream/run.sh b/.amd-ci/upstream/run.sh
index bce30263c0e667..b68b453861ab18 100755
--- a/.amd-ci/upstream/run.sh
+++ b/.amd-ci/upstream/run.sh
@@ -56,10 +56,10 @@ cmake \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_CXX_LINK_FLAGS="-Wl,-rpath,$LD_LIBRARY_PATH" \
-DLLVM_ENABLE_ASSERTIONS=ON \
- -DLLVM_TARGETS_TO_BUILD=host \
-DLLVM_LIT_ARGS=-v \
- -DLLVM_ENABLE_PROJECTS="clang;lld;llvm;flang;mlir" \
- -DLLVM_ENABLE_RUNTIMES="openmp" \
+ -DCLANG_DEFAULT_LINKER=lld \
+ -DLLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra;flang" \
+ -DLLVM_ENABLE_RUNTIMES="openmp;flang-rt;compiler-rt" \
-S "${WORKSPACE}/llvm-project/llvm" \
-B "${WORKSPACE}/BUILD" \
-DPython3_EXECUTABLE:STRING=/proj/csse_jenkins2/swtools/apps/python/versions/3.8.12/bin/python \
@@ -68,13 +68,19 @@ cmake \
-DCMAKE_CXX_COMPILER=g++ \
-DLLVM_PARALLEL_LINK_JOBS=16 \
-DBUILD_SHARED_LIBS:STRING=ON \
+ -DLIBOMP_OMP_VERSION=50 \
+ -DLIBOMP_OMPT_SUPPORT=ON \
+ -DLIBOMP_USE_DEBUGGER=ON \
+ -DLIBOMP_CFLAGS="-O2" \
+ -DLIBOMP_CPPFLAGS="-O2" \
+ -DLIBOMPTARGET_OMPD_SUPPORT=ON \
+ -DLIBOMP_OMPD_ENABLED=ON \
+ -DLIBOMP_OMPD_SUPPORT=ON \
-DFLANG_ENABLE_WERROR=ON \
- -DCMAKE_CXX_FLAGS="-Wno-array-bounds" \
-DLLVM_TARGETS_TO_BUILD:STRING="X86;AMDGPU" \
-DFLANG_RUNTIME_F128_MATH_LIB=libquadmath
-# -DLLVM_USE_LINKER:STRING=lld \
-echo 'cmake-G Ninja-DCMAKE_BUILD_TYPE:STRING=Release-DCMAKE_INSTALL_PREFIX="${WORKSPACE}/${JOB_NAME}-${BUILD_NUMBER}"-DCMAKE_CXX_STANDARD=17-DCMAKE_EXPORT_COMPILE_COMMANDS=ON-DCMAKE_CXX_LINK_FLAGS="-Wl,-rpath,$LD_LIBRARY_PATH"-DLLVM_ENABLE_ASSERTIONS=ON-DLLVM_TARGETS_TO_BUILD=host-DLLVM_LIT_ARGS=-v-DLLVM_ENABLE_PROJECTS="clang;lld;llvm;flang;mlir;openmp"-DLLVM_ENABLE_RUNTIMES="compiler-rt"-S "${WORKSPACE}/llvm-project/llvm"-B "${WORKSPACE}/BUILD"-DPython3_EXECUTABLE:STRING=/proj/csse_jenkins2/swtools/apps/python/versions/3.8.12/bin/python-DCMAKE_INSTALL_MESSAGE=LAZY-DCMAKE_C_COMPILER=gcc-DCMAKE_CXX_COMPILER=g++-DLLVM_PARALLEL_LINK_JOBS=16-DBUILD_SHARED_LIBS:STRING=ON-DLLVM_USE_LINKER:STRING=lld-DFLANG_ENABLE_WERROR=ON-DLLVM_TARGETS_TO_BUILD:STRING="X86;AMDGPU"'
+echo 'cmake -G Ninja -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX="${WORKSPACE}/${JOB_NAME}-${BUILD_NUMBER}" -DCMAKE_CXX_STANDARD=17 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_CXX_LINK_FLAGS="-Wl,-rpath,$LD_LIBRARY_PATH" -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_LIT_ARGS=-v -DCLANG_DEFAULT_LINKER=lld -DLLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra;flang" -DLLVM_ENABLE_RUNTIMES="openmp;flang-rt;compiler-rt" -S "${WORKSPACE}/llvm-project/llvm" -B "${WORKSPACE}/BUILD" -DPython3_EXECUTABLE:STRING=/proj/csse_jenkins2/swtools/apps/python/versions/3.8.12/bin/python -DCMAKE_INSTALL_MESSAGE=LAZY -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLLVM_PARALLEL_LINK_JOBS=16 -DBUILD_SHARED_LIBS:STRING=ON -DLIBOMP_OMP_VERSION=50 -DLIBOMP_OMPT_SUPPORT=ON -DLIBOMP_USE_DEBUGGER=ON -DLIBOMP_CFLAGS="-O2" -DLIBOMP_CPPFLAGS="-O2" -DLIBOMPTARGET_OMPD_SUPPORT=ON -DLIBOMP_OMPD_ENABLED=ON -DLIBOMP_OMPD_SUPPORT=ON -DFLANG_ENABLE_WERROR=ON -DFLANG_ENABLE_WERROR=ON -DLLVM_TARGETS_TO_BUILD:STRING="X86;AMDGPU" -DFLANG_RUNTIME_F128_MATH_LIB=libquadmath'
echo "ninja -C ${WORKSPACE}/BUILD install"
ninja -C "${WORKSPACE}"/BUILD install
>From 9fec289e127fb946b8d5372d6fef07d18efc13e4 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Tue, 19 Aug 2025 15:01:59 +0000
Subject: [PATCH 19/72] CPUPC-7979: simplified command echoing.
Change-Id: I98d7070f852a4e617d7c7eff13f6c4601d313644
---
.amd-ci/upstream/run.sh | 49 +++++++++++++++++++++++------------------
1 file changed, 28 insertions(+), 21 deletions(-)
diff --git a/.amd-ci/upstream/run.sh b/.amd-ci/upstream/run.sh
index b68b453861ab18..c4777a60e1605b 100755
--- a/.amd-ci/upstream/run.sh
+++ b/.amd-ci/upstream/run.sh
@@ -16,7 +16,7 @@ execute_and_check()
echo "########################################################"
echo "Execution of command : $cmd - was failed"
echo "Please check ${WORKSPACE}/command_executed.txt file for commands executed till now"
- rm -v ${WORKSPACE}/build_success.txt
+ rm -v "${WORKSPACE}/build_success.txt"
exit 1
echo "########################################################"
fi
@@ -33,21 +33,27 @@ LLVM_VERSION_PATCH=$(grep -w "set(LLVM_VERSION_PATCH" "${_ver_file}" | awk -F' '
CLANG_VERSION=$LLVM_VERSION_MAJOR.$LLVM_VERSION_MINOR.$LLVM_VERSION_PATCH
echo "CLANG_VERSION value is - $CLANG_VERSION" > "${WORKSPACE}"/VERSION_AND_COMMIT_HASH_OF_BUILD_"${BUILD_NUMBER}".txt
-echo "source aocc-essentials/build_essentials/linux/aocc_env.sh"
-source aocc-essentials/build_essentials/linux/aocc_env.sh
-
-echo ". /proj/csse_jenkins2/swtools/c/rhel7-gcc8.3.1/environment-modules-5.4.0-j6k56q3i/bin/../init/bash"
-. /proj/csse_jenkins2/swtools/c/rhel7-gcc8.3.1/environment-modules-5.4.0-j6k56q3i/bin/../init/bash
-
-echo "module use --prepend /proj/csse_jenkins2/swtools/c/modulefiles"
-module use --prepend /proj/csse_jenkins2/swtools/c/modulefiles
+if test -d aocc-essentials
+then
+ ess_dir=aocc-essentials
+else
+ ess_dir=llvm-project/aocc-essentials
+fi
-echo "module load gcc/11.4.0"
-module load gcc/11.4.0
+mod_cmd1=". ${ess_dir}/build_essentials/linux/aocc_env.sh"
+echo "${mod_cmd1}"
+${mod_cmd1}
+mod_cmd2=". /proj/csse_jenkins2/swtools/c/rhel7-gcc8.3.1/environment-modules-5.4.0-j6k56q3i/init/bash"
+echo "${mod_cmd2}"
+${mod_cmd2}
+mod_cmd3="module load gcc/11.4.0"
+echo "${mod_cmd3}"
+${mod_cmd3}
execute_and_check "mkdir -p ${WORKSPACE}/BUILD"
execute_and_check "cd ${WORKSPACE}/BUILD"
-echo "Executing cmake"
+
+set -x
cmake \
-G Ninja \
-DCMAKE_BUILD_TYPE:STRING=Release \
@@ -80,11 +86,10 @@ cmake \
-DLLVM_TARGETS_TO_BUILD:STRING="X86;AMDGPU" \
-DFLANG_RUNTIME_F128_MATH_LIB=libquadmath
-echo 'cmake -G Ninja -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX="${WORKSPACE}/${JOB_NAME}-${BUILD_NUMBER}" -DCMAKE_CXX_STANDARD=17 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_CXX_LINK_FLAGS="-Wl,-rpath,$LD_LIBRARY_PATH" -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_LIT_ARGS=-v -DCLANG_DEFAULT_LINKER=lld -DLLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra;flang" -DLLVM_ENABLE_RUNTIMES="openmp;flang-rt;compiler-rt" -S "${WORKSPACE}/llvm-project/llvm" -B "${WORKSPACE}/BUILD" -DPython3_EXECUTABLE:STRING=/proj/csse_jenkins2/swtools/apps/python/versions/3.8.12/bin/python -DCMAKE_INSTALL_MESSAGE=LAZY -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLLVM_PARALLEL_LINK_JOBS=16 -DBUILD_SHARED_LIBS:STRING=ON -DLIBOMP_OMP_VERSION=50 -DLIBOMP_OMPT_SUPPORT=ON -DLIBOMP_USE_DEBUGGER=ON -DLIBOMP_CFLAGS="-O2" -DLIBOMP_CPPFLAGS="-O2" -DLIBOMPTARGET_OMPD_SUPPORT=ON -DLIBOMP_OMPD_ENABLED=ON -DLIBOMP_OMPD_SUPPORT=ON -DFLANG_ENABLE_WERROR=ON -DFLANG_ENABLE_WERROR=ON -DLLVM_TARGETS_TO_BUILD:STRING="X86;AMDGPU" -DFLANG_RUNTIME_F128_MATH_LIB=libquadmath'
-
-echo "ninja -C ${WORKSPACE}/BUILD install"
ninja -C "${WORKSPACE}"/BUILD install
- if [ "$?" -eq 0 ]; then
+stat=$?
+set +x
+ if [ "${stat}" -eq 0 ]; then
echo "********************************************************"
echo "Execution of command : ninja -C ${WORKSPACE}/BUILD install - was successful" >> "${WORKSPACE}/command_executed.txt"
echo "Execution of command : ninja -C ${WORKSPACE}/BUILD install - was successful"
@@ -102,16 +107,18 @@ ninja -C "${WORKSPACE}"/BUILD install
execute_and_check "cd ${WORKSPACE}"
execute_and_check "tar -cJf ${JOB_NAME}-${BUILD_NUMBER}.tar.xz ${JOB_NAME}-${BUILD_NUMBER}"
-echo "ninja -C ${WORKSPACE}/BUILD check-flang check-mlir"
+set -x
ninja -C "${WORKSPACE}"/BUILD check-flang check-mlir
- if [ "$?" -eq 0 ]; then
+stat=$?
+set +x
+ if [ "${stat}" -eq 0 ]; then
echo "********************************************************"
- echo "Execution of command : ninja -C ${WORKSPACE}/BUILD check-flang - was successful" >> "${WORKSPACE}/command_executed.txt"
- echo "Execution of command : ninja -C ${WORKSPACE}/BUILD check-flang - was successful"
+ echo "Execution of command : ninja -C ${WORKSPACE}/BUILD check-flang check-mlir - was successful" >> "${WORKSPACE}/command_executed.txt"
+ echo "Execution of command : ninja -C ${WORKSPACE}/BUILD check-flang check-mlir - was successful"
echo "********************************************************"
else
echo "########################################################"
- echo "Execution of command : ninja -C ${WORKSPACE}/BUILD check-flang - was failed"
+ echo "Execution of command : ninja -C ${WORKSPACE}/BUILD check-flang check-mlir - was failed"
echo "Please check ${WORKSPACE}/command_executed.txt file for commands executed till now"
rm -v "${WORKSPACE}"/build_success.txt
exit 1
>From 6440d58f4764f0d199cbdf5bfff77279f393f788 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Tue, 26 Aug 2025 13:45:04 +0000
Subject: [PATCH 20/72] CPUPC-7979: quantitative limits for COMPILE_JOBS and
LINK_JOBS.
Change-Id: I95e50319ea1dbef5dd7b084a59cdadf66a29a7ee
---
.amd-ci/upstream/run.sh | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/.amd-ci/upstream/run.sh b/.amd-ci/upstream/run.sh
index c4777a60e1605b..3221a762cb9c99 100755
--- a/.amd-ci/upstream/run.sh
+++ b/.amd-ci/upstream/run.sh
@@ -53,6 +53,11 @@ ${mod_cmd3}
execute_and_check "mkdir -p ${WORKSPACE}/BUILD"
execute_and_check "cd ${WORKSPACE}/BUILD"
+MEMORY_KILOS=$(grep MemTotal /proc/meminfo | awk '{print $2}')
+MEMORY_GIGS=$(( MEMORY_KILOS / 1000000 ))
+MEMORY_COMPILE_LIMIT=$(( MEMORY_GIGS / 4 ))
+MEMORY_LINK_LIMIT=$(( MEMORY_GIGS / 12 ))
+
set -x
cmake \
-G Ninja \
@@ -72,7 +77,8 @@ cmake \
-DCMAKE_INSTALL_MESSAGE=LAZY \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_CXX_COMPILER=g++ \
- -DLLVM_PARALLEL_LINK_JOBS=16 \
+ -DLLVM_PARALLEL_COMPILE_JOBS=${MEMORY_COMPILE_LIMIT} \
+ -DLLVM_PARALLEL_LINK_JOBS=${MEMORY_LINK_LIMIT} \
-DBUILD_SHARED_LIBS:STRING=ON \
-DLIBOMP_OMP_VERSION=50 \
-DLIBOMP_OMPT_SUPPORT=ON \
>From e6f7b718fa7b7545182a26ff201980cf64a2a5fc Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Fri, 19 Sep 2025 13:34:54 +0000
Subject: [PATCH 21/72] CPUPC-7979: synced upstream CI materials from
amd-staging.
Change-Id: I5bb9b909b22518d2f23a835c7afdee6faee10bbe
---
.amd-ci/upstream/Jenkinsfile | 136 ++++++++++++------
.../upstream/upstream_jenkins_excludes.txt | 18 +++
2 files changed, 107 insertions(+), 47 deletions(-)
create mode 100644 .amd-ci/upstream/upstream_jenkins_excludes.txt
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index eb44bf51a11363..0c9a6acced0d2c 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -3,8 +3,17 @@ import hudson.model.Result
/* groovylint-disable-next-line CompileStatic */
String actualTarget = env.CHANGE_TARGET ?: env.BRANCH_NAME
String upstreamBranch = 'upstream-main', stagingBranch = 'amd-staging'
+String releaseBranchPrefix = 'aocc_'
-if (!(actualTarget in [stagingBranch, upstreamBranch])) {
+/**
+ * Coerce Result enums to String, seems to
+ * be required by CatchErrorStep.setStageResult()
+ */
+String abortedResultStr = Result.ABORTED, failureResultStr = Result.FAILURE
+String notBuiltResultStr = Result.NOT_BUILT, successResultStr = Result.SUCCESS
+
+if (!(actualTarget in [stagingBranch, upstreamBranch]) &&
+ !(actualTarget.startsWith(releaseBranchPrefix))) {
echo 'Pipeline skipped for base branch ' + actualTarget
return this
}
@@ -12,33 +21,62 @@ if (!(actualTarget in [stagingBranch, upstreamBranch])) {
String actualHead = env.CHANGE_BRANCH ?: env.BRANCH_NAME
Boolean isPrBranch = env.CHANGE_BRANCH != null
-if (!isPrBranch && actualTarget != upstreamBranch) {
+if (!isPrBranch &&
+ !(actualTarget in [stagingBranch, upstreamBranch]) &&
+ !(actualTarget.startsWith(releaseBranchPrefix))) {
echo 'Pipeline skipped for non-PR branch ' + actualHead + ' of base ' + actualTarget
return this
}
-Boolean postsub = !isPrBranch && actualTarget == upstreamBranch && actualHead == upstreamBranch
+String manualCause = 'hudson.model.Cause$UserIdCause'
+if (isPrBranch &&
+ pullRequest.draft &&
+ !currentBuild.getBuildCauses(manualCause)) {
+ String cause = currentBuild.getBuildCauses().shortDescription // groovylint-disable-line UnnecessaryGetter
+ echo 'Draft PR aborted for cause ' + cause
+ echo 'Pipeline only runs for draft PRs if manually triggered.'
+ currentBuild.result = abortedResultStr
+ return this
+}
-if (postsub && env.BRANCH_NAME != upstreamBranch) {
+Boolean postsub = (
+ !isPrBranch &&
+ (
+ (actualTarget == upstreamBranch && actualHead == upstreamBranch) ||
+ (actualTarget == stagingBranch && actualHead == stagingBranch) ||
+ (actualTarget.startsWith(releaseBranchPrefix) &&
+ actualHead.startsWith(releaseBranchPrefix))
+ )
+)
+
+if (postsub && !(env.BRANCH_NAME in [stagingBranch, upstreamBranch]) &&
+ !(env.BRANCH_NAME.startsWith(releaseBranchPrefix))) {
echo 'Pipeline postsub not supported for branch ' + env.BRANCH_NAME
return this
}
-if (actualTarget == stagingBranch &&
- !currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause') &&
+// Code smell: should be false; we should be doing merge/push syncing in the separate llvm_sync job:
+Boolean intraJobRepoSync = postsub && env.BRANCH_NAME == upstreamBranch
+
+Boolean disableStaging = false, disableRelease = true
+if (((disableStaging &&
+ actualTarget == stagingBranch) ||
+ (disableRelease &&
+ actualTarget.startsWith(releaseBranchPrefix))) &&
+ !currentBuild.getBuildCauses(manualCause) &&
!currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause')) {
String cause = currentBuild.getBuildCauses().shortDescription // groovylint-disable-line UnnecessaryGetter
- echo 'Pipeline for base ' + actualTarget + ' skipped for cause ' + cause
+ echo 'Pipeline for base ' + actualTarget + ' not built for cause ' + cause
echo 'Pipeline only runs if manually or timer triggered.'
+ currentBuild.result = notBuiltResultStr
return this
}
-/**
- * Coerce Result enums to String, seems to
- * be required by CatchErrorStep.setStageResult()
- */
-String abortedResultStr = Result.ABORTED, failureResultStr = Result.FAILURE
-String notBuiltResultStr = Result.NOT_BUILT, successResultStr = Result.SUCCESS
+Boolean runDownstream = (
+ actualTarget == upstreamBranch ||
+ (actualTarget == stagingBranch && isPrBranch) ||
+ (actualTarget.startsWith(releaseBranchPrefix) && isPrBranch)
+)
String space = ' ', andChain = '&&', underScore = '_', slash = '/'
String gitCommitEnv = 'GIT_COMMIT'
@@ -140,7 +178,7 @@ try {
)
}
}
- if (postsub) {
+ if (intraJobRepoSync) {
theUrl = 'ssh://git@github.amd.com/AOCC/llvm-project.git'
/*
* Direct CLI clone using the system's orequest SSH credentials,
@@ -219,13 +257,12 @@ try {
}
}
if (activeStat == successStat) {
- String dummyFile = env.BUILD_TAG + '_dummy.txt'
activeStat = sh(
label: 'has-active-files',
script: (
- 'set +x; echo "# Dummy" > ' + dummyFile + andChain +
- 'bash ../aocc-essentials/build_essentials/has_active_files.sh' + space +
- gitVars.GIT_COMMIT + space + dummyFile + ' && rm -f ' + dummyFile
+ 'bash ../aocc-essentials/build_essentials/has_active_files.sh' + space +
+ gitVars.GIT_COMMIT + space +
+ '.amd-ci/upstream/upstream_jenkins_excludes.txt'
),
returnStatus: true
)
@@ -272,7 +309,7 @@ try {
deleteDirs: true,
patterns: cleanExcludes
)
- return this
+ return // From node
}
stage ('run') {
try {
@@ -284,7 +321,7 @@ try {
}
currentBuild.result = successResultStr
} finally {
- if (postsub) {
+ if (intraJobRepoSync) {
stage ('merge-post') {
withEnv([gitPathEnv]) {
sh 'llvm-project/.amd-ci/upstream/repo_sync.sh'
@@ -302,36 +339,41 @@ try {
}
}
}
- stage ('downstream-tasks') {
- Map allTasks = [
- failFast: false,
- ]
- List<String> downstreamSuites = ['GFortran', 'NAGLLVM']
- for (suite in downstreamSuites) {
- String suiteName = suite
- allTasks[suiteName] = {
- stage ('downstream-suite-' + suiteName) {
- build(
- propagate: true,
- wait: true,
- job: 'AOCC-Workloads/TestSuites/' + suiteName,
- parameters: [
- // Use the name of build tar as defined in the run script:
- string(
- name: 'CUT',
- value: (
- env.BUILD_URL + 'artifact/' +
- jobName + '-' + env.BUILD_NUMBER + '.tar.xz'
- )
- ),
- string(name: 'CHANGE_ID', value: env.CHANGE_ID ?: ''),
- string(name: gitCommitEnv, value: gitVars.GIT_COMMIT ?: '')
- ]
- )
+ if (!hasSourceChanges) {
+ return // From timeout
+ }
+ if (runDownstream) {
+ stage ('downstream-tasks') {
+ Map allTasks = [
+ failFast: false,
+ ]
+ List<String> downstreamSuites = ['GFortran', 'NAGLLVM']
+ for (suite in downstreamSuites) {
+ String suiteName = suite
+ allTasks[suiteName] = {
+ stage ('downstream-suite-' + suiteName) {
+ build(
+ propagate: true,
+ wait: true,
+ job: 'AOCC-Workloads/TestSuites/' + suiteName,
+ parameters: [
+ // Use the name of build tar as defined in the run script:
+ string(
+ name: 'CUT',
+ value: (
+ env.BUILD_URL + 'artifact/' +
+ jobName + '-' + env.BUILD_NUMBER + '.tar.xz'
+ )
+ ),
+ string(name: 'CHANGE_ID', value: env.CHANGE_ID ?: ''),
+ string(name: gitCommitEnv, value: gitVars.GIT_COMMIT ?: '')
+ ]
+ )
+ }
}
}
+ parallel(allTasks)
}
- parallel(allTasks)
}
}
} catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
diff --git a/.amd-ci/upstream/upstream_jenkins_excludes.txt b/.amd-ci/upstream/upstream_jenkins_excludes.txt
new file mode 100644
index 00000000000000..9c6aa40043bf08
--- /dev/null
+++ b/.amd-ci/upstream/upstream_jenkins_excludes.txt
@@ -0,0 +1,18 @@
+# Extended regexp patterns of files to exclude from the AOCC 'upstream' pipeline.
+^.*aocc-essentials/notes/
+^.*SPEC_perf_cfgs/cpuV8/
+^.*SPEC_perf_cfgs/cpuv8_.*
+^.*_jenkins_excludes.txt
+^.*/create_rel_branch.sh
+# Other pipelines or their test materials:
+^aocc-essentials/build_essentials/Jenkinsfile.*
+^aocc-essentials/build_essentials/groovy_lib/test/
+^aocc-essentials/build_essentials/groovy_lib/src/test/
+^.*aocc-essentials/build_essentials/groovy_lib/Jenkinsfile.GitHub
+^.*aocc-essentials/build_essentials/groovy_lib/build.gradle
+^.*aocc-essentials/build_essentials/groovy_lib/test.sh
+#
+^.*prj-essentials/devo/aocc/merge/
+^prj-essentials/devo/aocc/CODEOWNERS\.AOCC\.m4
+^\.github/\.ai_pr_platform/
+^\.github/workflows/amd-validate-.*config-file\.yml
>From 258184ed2bc5754cdf8658a7dd758513788b7063 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Wed, 1 Oct 2025 08:32:02 +0000
Subject: [PATCH 22/72] CPUPC-7979: CI sync from staging.
Change-Id: I3f5df8fb8fc5a1069d42296745e0c835ffbd9b5d
---
.amd-ci/upstream/Jenkinsfile | 43 +++++++++++++------
.../upstream/upstream_jenkins_excludes.txt | 2 +
2 files changed, 31 insertions(+), 14 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index 0c9a6acced0d2c..dd9f9774fb1609 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -5,6 +5,8 @@ String actualTarget = env.CHANGE_TARGET ?: env.BRANCH_NAME
String upstreamBranch = 'upstream-main', stagingBranch = 'amd-staging'
String releaseBranchPrefix = 'aocc_'
+Boolean targetIsRelBranch = actualTarget.startsWith(releaseBranchPrefix)
+
/**
* Coerce Result enums to String, seems to
* be required by CatchErrorStep.setStageResult()
@@ -13,7 +15,7 @@ String abortedResultStr = Result.ABORTED, failureResultStr = Result.FAILURE
String notBuiltResultStr = Result.NOT_BUILT, successResultStr = Result.SUCCESS
if (!(actualTarget in [stagingBranch, upstreamBranch]) &&
- !(actualTarget.startsWith(releaseBranchPrefix))) {
+ !targetIsRelBranch) {
echo 'Pipeline skipped for base branch ' + actualTarget
return this
}
@@ -23,7 +25,7 @@ Boolean isPrBranch = env.CHANGE_BRANCH != null
if (!isPrBranch &&
!(actualTarget in [stagingBranch, upstreamBranch]) &&
- !(actualTarget.startsWith(releaseBranchPrefix))) {
+ !targetIsRelBranch) {
echo 'Pipeline skipped for non-PR branch ' + actualHead + ' of base ' + actualTarget
return this
}
@@ -44,7 +46,7 @@ Boolean postsub = (
(
(actualTarget == upstreamBranch && actualHead == upstreamBranch) ||
(actualTarget == stagingBranch && actualHead == stagingBranch) ||
- (actualTarget.startsWith(releaseBranchPrefix) &&
+ (targetIsRelBranch &&
actualHead.startsWith(releaseBranchPrefix))
)
)
@@ -59,12 +61,13 @@ if (postsub && !(env.BRANCH_NAME in [stagingBranch, upstreamBranch]) &&
Boolean intraJobRepoSync = postsub && env.BRANCH_NAME == upstreamBranch
Boolean disableStaging = false, disableRelease = true
+Boolean timerTrigger = currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause')
if (((disableStaging &&
actualTarget == stagingBranch) ||
(disableRelease &&
- actualTarget.startsWith(releaseBranchPrefix))) &&
+ targetIsRelBranch)) &&
!currentBuild.getBuildCauses(manualCause) &&
- !currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause')) {
+ !timerTrigger) {
String cause = currentBuild.getBuildCauses().shortDescription // groovylint-disable-line UnnecessaryGetter
echo 'Pipeline for base ' + actualTarget + ' not built for cause ' + cause
echo 'Pipeline only runs if manually or timer triggered.'
@@ -75,10 +78,10 @@ if (((disableStaging &&
Boolean runDownstream = (
actualTarget == upstreamBranch ||
(actualTarget == stagingBranch && isPrBranch) ||
- (actualTarget.startsWith(releaseBranchPrefix) && isPrBranch)
+ targetIsRelBranch
)
-String space = ' ', andChain = '&&', underScore = '_', slash = '/'
+String space = ' ', andChain = '&&', underScore = '_', slash = '/', dash = '-'
String gitCommitEnv = 'GIT_COMMIT'
List propsList = []
@@ -114,12 +117,21 @@ String theUrl
Boolean hasSourceChanges = true
Integer successStat = 0
-String jobName = (
- (isPrBranch ? 'presub' : 'update') + underScore +
- (env.CHANGE_TARGET ?: (env.BRANCH_NAME ?: 'NoSuchBranchName'))
-)
-if (env.CHANGE_BRANCH) {
- jobName += underScore + env.BRANCH_NAME // Sic, the PR-<n> string.
+String jobName
+if (postsub && targetIsRelBranch) {
+ // llvmVer is processed by automation:
+ String llvmVer = '21.1.2'
+ // stageBuildNum is processed during branch creation:
+ String stageBuildNum = '12786'
+ jobName = 'aocc-compiler-llvm-flang-rel' + dash + llvmVer + dash + stageBuildNum
+} else {
+ jobName = (
+ (isPrBranch ? 'presub' : 'update') + underScore +
+ (env.CHANGE_TARGET ?: (env.BRANCH_NAME ?: 'NoSuchBranchName'))
+ )
+ if (env.CHANGE_BRANCH) {
+ jobName += underScore + env.BRANCH_NAME // Sic, the PR-<n> string.
+ }
}
def gitVars // groovylint-disable-line NoDef,VariableTypeRequired
@@ -348,6 +360,9 @@ try {
failFast: false,
]
List<String> downstreamSuites = ['GFortran', 'NAGLLVM']
+ if (timerTrigger) {
+ downstreamSuites += 'Fujitsu'
+ }
for (suite in downstreamSuites) {
String suiteName = suite
allTasks[suiteName] = {
@@ -362,7 +377,7 @@ try {
name: 'CUT',
value: (
env.BUILD_URL + 'artifact/' +
- jobName + '-' + env.BUILD_NUMBER + '.tar.xz'
+ jobName + dash + env.BUILD_NUMBER + '.tar.xz'
)
),
string(name: 'CHANGE_ID', value: env.CHANGE_ID ?: ''),
diff --git a/.amd-ci/upstream/upstream_jenkins_excludes.txt b/.amd-ci/upstream/upstream_jenkins_excludes.txt
index 9c6aa40043bf08..195bec42c4de94 100644
--- a/.amd-ci/upstream/upstream_jenkins_excludes.txt
+++ b/.amd-ci/upstream/upstream_jenkins_excludes.txt
@@ -3,6 +3,8 @@
^.*SPEC_perf_cfgs/cpuV8/
^.*SPEC_perf_cfgs/cpuv8_.*
^.*_jenkins_excludes.txt
+^.*/bump_aocc_ver.sh
+^.*/bump_llvm_ver.sh
^.*/create_rel_branch.sh
# Other pipelines or their test materials:
^aocc-essentials/build_essentials/Jenkinsfile.*
>From 64b1a7b126482be90d2ced01232ae88cefbbc560 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Thu, 2 Oct 2025 08:53:52 +0000
Subject: [PATCH 23/72] CPUPC-7979: synced pipeline from staging.
Change-Id: Ia74f2de672957f9e2846848b56fa11606beba89d
---
.amd-ci/upstream/Jenkinsfile | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index dd9f9774fb1609..819a0951b39dc5 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -83,6 +83,8 @@ Boolean runDownstream = (
String space = ' ', andChain = '&&', underScore = '_', slash = '/', dash = '-'
String gitCommitEnv = 'GIT_COMMIT'
+String skipStr = 'Skipping build.', contStr = 'Continuing build.'
+String contTimerReason = 'Timer trigger.' + space + contStr
List propsList = []
if (isPrBranch) {
@@ -284,9 +286,13 @@ try {
error 'Unexpected exit checking file activity.'
}
if (activeStat == 1) {
- echo('Skipping build.')
- hasSourceChanges = false
- return // From stage
+ if (timerTrigger) {
+ echo(contTimerReason)
+ } else {
+ echo(skipStr)
+ hasSourceChanges = false
+ return // From stage
+ }
}
String mstat
@@ -309,14 +315,19 @@ try {
}
}
if (mstat && mstat != 'None') {
- echo('Skipping build, merge status is ' + mstat)
- hasSourceChanges = false
- return // From stage
+ echo('Merge status is ' + mstat)
+ if (timerTrigger) {
+ echo(contTimerReason)
+ } else {
+ echo(skipStr)
+ hasSourceChanges = false
+ return // From stage
+ }
}
}
}
}
- if (!hasSourceChanges) {
+ if (!timerTrigger && !hasSourceChanges) {
cleanWs(
deleteDirs: true,
patterns: cleanExcludes
@@ -351,7 +362,7 @@ try {
}
}
}
- if (!hasSourceChanges) {
+ if (!timerTrigger && !hasSourceChanges) {
return // From timeout
}
if (runDownstream) {
>From 2cf46ffb48d71c1feb31927b95804d57c5cf0056 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Fri, 3 Oct 2025 08:42:18 +0000
Subject: [PATCH 24/72] CPUPC-7979: synced pipeline from staging.
Change-Id: Ifbd33c3e434dc88a51fbc737f7b5e36c26aca56d
---
.amd-ci/upstream/Jenkinsfile | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index 819a0951b39dc5..5c20e3621f7528 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -116,7 +116,7 @@ String gitPathEnv = (
)
String llvmProj = 'llvm-project', llvmProjRepo = llvmProj + '.git'
String theUrl
-Boolean hasSourceChanges = true
+Boolean hasSourceChanges = true, isSkippableMerge = false
Integer successStat = 0
String jobName
@@ -286,13 +286,9 @@ try {
error 'Unexpected exit checking file activity.'
}
if (activeStat == 1) {
- if (timerTrigger) {
- echo(contTimerReason)
- } else {
- echo(skipStr)
- hasSourceChanges = false
- return // From stage
- }
+ echo(skipStr)
+ hasSourceChanges = false
+ return // From stage
}
String mstat
@@ -320,14 +316,14 @@ try {
echo(contTimerReason)
} else {
echo(skipStr)
- hasSourceChanges = false
+ isSkippableMerge = true
return // From stage
}
}
}
}
}
- if (!timerTrigger && !hasSourceChanges) {
+ if (isSkippableMerge || !hasSourceChanges) {
cleanWs(
deleteDirs: true,
patterns: cleanExcludes
@@ -362,7 +358,7 @@ try {
}
}
}
- if (!timerTrigger && !hasSourceChanges) {
+ if (isSkippableMerge || !hasSourceChanges) {
return // From timeout
}
if (runDownstream) {
>From 25c8b7a6df1930c1d9b7527f9e0ead9b8110c339 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Mon, 6 Oct 2025 12:07:48 +0000
Subject: [PATCH 25/72] CPUPC-7979: synced pipeline from staging.
Change-Id: Ib36dcdb50c209f883d98c09002fdfc000e75a99d
---
.amd-ci/upstream/Jenkinsfile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index 5c20e3621f7528..8c8987bdcc668e 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -102,7 +102,7 @@ if (isPrBranch) {
}
if (postsub) {
propsList.add(
- pipelineTriggers([cron('@midnight')])
+ pipelineTriggers([cron('TZ=Asia/Kolkata\n at midnight')])
)
}
properties(propsList)
@@ -368,7 +368,7 @@ try {
]
List<String> downstreamSuites = ['GFortran', 'NAGLLVM']
if (timerTrigger) {
- downstreamSuites += 'Fujitsu'
+ downstreamSuites.addAll(['Fujitsu', 'Polyhedron'])
}
for (suite in downstreamSuites) {
String suiteName = suite
>From b9e74cedee0f00ec5d5f2da521d44646d3958338 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Fri, 10 Oct 2025 10:36:07 +0000
Subject: [PATCH 26/72] CPUPC-7979: synced pipeline from staging.
Change-Id: Ic62752ec7bcb2cc86045dd0265c6f2da913ce496
---
.amd-ci/upstream/Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index 8c8987bdcc668e..bdc9ba9400927b 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -102,7 +102,7 @@ if (isPrBranch) {
}
if (postsub) {
propsList.add(
- pipelineTriggers([cron('TZ=Asia/Kolkata\n at midnight')])
+ pipelineTriggers([cron('TZ=Asia/Kolkata\nH 0 * * *')])
)
}
properties(propsList)
>From 43004f8d3f1bc9364cae44dee6d31ef31ecc7aa0 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Fri, 10 Oct 2025 10:55:53 +0000
Subject: [PATCH 27/72] CPUPC-7979: branch agnostic run script.
Change-Id: I73c08fd28a60a700811777026906409d564ba3e9
---
.amd-ci/upstream/run.sh | 78 ++++++++++++++++++++++++-----------------
1 file changed, 45 insertions(+), 33 deletions(-)
diff --git a/.amd-ci/upstream/run.sh b/.amd-ci/upstream/run.sh
index 3221a762cb9c99..c5d937d0d0f89b 100755
--- a/.amd-ci/upstream/run.sh
+++ b/.amd-ci/upstream/run.sh
@@ -58,40 +58,52 @@ MEMORY_GIGS=$(( MEMORY_KILOS / 1000000 ))
MEMORY_COMPILE_LIMIT=$(( MEMORY_GIGS / 4 ))
MEMORY_LINK_LIMIT=$(( MEMORY_GIGS / 12 ))
-set -x
-cmake \
- -G Ninja \
- -DCMAKE_BUILD_TYPE:STRING=Release \
- -DCMAKE_INSTALL_PREFIX="${WORKSPACE}/${JOB_NAME}-${BUILD_NUMBER}" \
- -DCMAKE_CXX_STANDARD=17 \
- -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
- -DCMAKE_CXX_LINK_FLAGS="-Wl,-rpath,$LD_LIBRARY_PATH" \
- -DLLVM_ENABLE_ASSERTIONS=ON \
- -DLLVM_LIT_ARGS=-v \
- -DCLANG_DEFAULT_LINKER=lld \
- -DLLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra;flang" \
- -DLLVM_ENABLE_RUNTIMES="openmp;flang-rt;compiler-rt" \
- -S "${WORKSPACE}/llvm-project/llvm" \
- -B "${WORKSPACE}/BUILD" \
- -DPython3_EXECUTABLE:STRING=/proj/csse_jenkins2/swtools/apps/python/versions/3.8.12/bin/python \
- -DCMAKE_INSTALL_MESSAGE=LAZY \
- -DCMAKE_C_COMPILER=gcc \
- -DCMAKE_CXX_COMPILER=g++ \
- -DLLVM_PARALLEL_COMPILE_JOBS=${MEMORY_COMPILE_LIMIT} \
- -DLLVM_PARALLEL_LINK_JOBS=${MEMORY_LINK_LIMIT} \
- -DBUILD_SHARED_LIBS:STRING=ON \
- -DLIBOMP_OMP_VERSION=50 \
- -DLIBOMP_OMPT_SUPPORT=ON \
- -DLIBOMP_USE_DEBUGGER=ON \
- -DLIBOMP_CFLAGS="-O2" \
- -DLIBOMP_CPPFLAGS="-O2" \
- -DLIBOMPTARGET_OMPD_SUPPORT=ON \
- -DLIBOMP_OMPD_ENABLED=ON \
- -DLIBOMP_OMPD_SUPPORT=ON \
- -DFLANG_ENABLE_WERROR=ON \
- -DLLVM_TARGETS_TO_BUILD:STRING="X86;AMDGPU" \
- -DFLANG_RUNTIME_F128_MATH_LIB=libquadmath
+cmake_args=(
+ -G Ninja
+ -DCMAKE_BUILD_TYPE:STRING=Release
+ -DCMAKE_INSTALL_PREFIX="${WORKSPACE}/${JOB_NAME}-${BUILD_NUMBER}"
+ -DCMAKE_CXX_STANDARD=17
+ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
+ -DCMAKE_CXX_LINK_FLAGS="-Wl,-rpath,$LD_LIBRARY_PATH"
+ -DLLVM_ENABLE_ASSERTIONS=ON
+ -DLLVM_LIT_ARGS=-v
+ -DCLANG_DEFAULT_LINKER=lld
+ -DLLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra;flang"
+ -DLLVM_ENABLE_RUNTIMES="openmp;flang-rt;compiler-rt"
+ -S "${WORKSPACE}/llvm-project/llvm"
+ -B "${WORKSPACE}/BUILD"
+ -DPython3_EXECUTABLE:STRING=/proj/csse_jenkins2/swtools/apps/python/versions/3.8.12/bin/python
+ -DCMAKE_INSTALL_MESSAGE=LAZY
+ -DCMAKE_C_COMPILER=gcc
+ -DCMAKE_CXX_COMPILER=g++
+ -DLLVM_PARALLEL_COMPILE_JOBS="${MEMORY_COMPILE_LIMIT}"
+ -DLLVM_PARALLEL_LINK_JOBS="${MEMORY_LINK_LIMIT}"
+ -DBUILD_SHARED_LIBS:STRING=ON
+ -DLIBOMP_OMP_VERSION=50
+ -DLIBOMP_OMPT_SUPPORT=ON
+ -DLIBOMP_USE_DEBUGGER=ON
+ -DLIBOMP_CFLAGS="-O2"
+ -DLIBOMP_CPPFLAGS="-O2"
+ -DLIBOMPTARGET_OMPD_SUPPORT=ON
+ -DLIBOMP_OMPD_ENABLED=ON
+ -DLIBOMP_OMPD_SUPPORT=ON
+ -DFLANG_ENABLE_WERROR=ON
+ -DLLVM_TARGETS_TO_BUILD:STRING="X86;AMDGPU"
+ -DFLANG_RUNTIME_F128_MATH_LIB=libquadmath
+)
+if test -d "${WORKSPACE}/llvm-project/aocc-essentials"
+then
+ echo "This looks like an AOCC branch; adding extra required CMake switches."
+ cmake_args+=(
+ -DCMAKE_CXX_FLAGS="-Wno-error=pedantic -pthread"
+ -DLLVM_LIT_ARGS="--xunit-xml-output=testresults.xunit.xml -v --timeout=600 --param blacklist=${WORKSPACE}/llvm-project/prj-essentials/devo/lit.blacklist.cfg"
+ -DLLVM_ENABLE_CLASSIC_FLANG=OFF
+ )
+fi
+
+set -x
+cmake "${cmake_args[@]}"
ninja -C "${WORKSPACE}"/BUILD install
stat=$?
set +x
>From 4947fc9be4c8f5bc786c4df0aaa7e61dee6ab722 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Wed, 15 Oct 2025 11:48:11 +0000
Subject: [PATCH 28/72] CPUPC-7979: synced pipeline from staging.
Change-Id: I84e6a65efe9d967b33da5104cdc5c1cc1bc59f6e
---
.amd-ci/upstream/upstream_jenkins_excludes.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/.amd-ci/upstream/upstream_jenkins_excludes.txt b/.amd-ci/upstream/upstream_jenkins_excludes.txt
index 195bec42c4de94..0a9c012dea2b17 100644
--- a/.amd-ci/upstream/upstream_jenkins_excludes.txt
+++ b/.amd-ci/upstream/upstream_jenkins_excludes.txt
@@ -18,3 +18,4 @@
^prj-essentials/devo/aocc/CODEOWNERS\.AOCC\.m4
^\.github/\.ai_pr_platform/
^\.github/workflows/amd-validate-.*config-file\.yml
+^CODEOWNERS
>From fb22a75bbe92ab6283adb25f817058efd8aa1c60 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Tue, 21 Oct 2025 08:44:01 +0000
Subject: [PATCH 29/72] CPUPC-7979: delegate upstream syncing to the separate
llvm_sync Jenkins job.
Change-Id: I9c75ead60a17222c1398781487d4f73a1efb40e0
---
.amd-ci/upstream/Jenkinsfile | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index bdc9ba9400927b..e64ca552553c26 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -57,8 +57,12 @@ if (postsub && !(env.BRANCH_NAME in [stagingBranch, upstreamBranch]) &&
return this
}
-// Code smell: should be false; we should be doing merge/push syncing in the separate llvm_sync job:
-Boolean intraJobRepoSync = postsub && env.BRANCH_NAME == upstreamBranch
+/*
+ * Code smell: intraJobRepoSync should be false;
+ * we should be doing merge/push syncing in the separate llvm_sync job:
+ * delete it (set to false), and the repo_sync.sh script.
+ */
+Boolean intraJobRepoSync = false
Boolean disableStaging = false, disableRelease = true
Boolean timerTrigger = currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause')
>From 6b14310fddd5cdf0ca3c434629998489f77a05d7 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Fri, 14 Nov 2025 11:40:00 +0000
Subject: [PATCH 30/72] CPUPC-7979: CI materials synced from aocc_llvm21.
Change-Id: Ice727084e2bb18ee980899c1766fd513cedd0476
---
.amd-ci/upstream/Jenkinsfile | 246 ++++++++---------
.amd-ci/upstream/apptainer_run.sh | 1 +
.amd-ci/upstream/repo_sync.sh | 43 ---
.amd-ci/upstream/run.sh | 259 +++++++++++++++---
.../upstream/upstream_jenkins_excludes.txt | 2 +-
5 files changed, 337 insertions(+), 214 deletions(-)
delete mode 100755 .amd-ci/upstream/repo_sync.sh
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index e64ca552553c26..ace670b6266e67 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -7,6 +7,8 @@ String releaseBranchPrefix = 'aocc_'
Boolean targetIsRelBranch = actualTarget.startsWith(releaseBranchPrefix)
+Boolean dualFlangBuild = actualTarget != upstreamBranch
+
/**
* Coerce Result enums to String, seems to
* be required by CatchErrorStep.setStageResult()
@@ -57,13 +59,6 @@ if (postsub && !(env.BRANCH_NAME in [stagingBranch, upstreamBranch]) &&
return this
}
-/*
- * Code smell: intraJobRepoSync should be false;
- * we should be doing merge/push syncing in the separate llvm_sync job:
- * delete it (set to false), and the repo_sync.sh script.
- */
-Boolean intraJobRepoSync = false
-
Boolean disableStaging = false, disableRelease = true
Boolean timerTrigger = currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause')
if (((disableStaging &&
@@ -126,7 +121,7 @@ Integer successStat = 0
String jobName
if (postsub && targetIsRelBranch) {
// llvmVer is processed by automation:
- String llvmVer = '21.1.2'
+ String llvmVer = '21.1.6'
// stageBuildNum is processed during branch creation:
String stageBuildNum = '12786'
jobName = 'aocc-compiler-llvm-flang-rel' + dash + llvmVer + dash + stageBuildNum
@@ -196,133 +191,105 @@ try {
)
}
}
- if (intraJobRepoSync) {
- theUrl = 'ssh://git@github.amd.com/AOCC/llvm-project.git'
- /*
- * Direct CLI clone using the system's orequest SSH credentials,
- * so that the later pushes in repo_sync.sh are successful.
- */
- withEnv([gitPathEnv]) {
- sh(
- label: 'clone-direct',
- script: (
- 'git clone -q --reference ' +
- referenceRepo + slash + llvmProjRepo + ' -b main ' + theUrl + andChain +
- 'cd ' + llvmProj + andChain +
- 'git checkout ' + env.BRANCH_NAME + andChain +
- '''git merge main -m "Merge from main on $(date +'%Y-%m-%d')"'''
- )
- )
- dir(llvmProj) {
- String gitCommit = sh(
- label: 'rev-parse',
- script: 'git rev-parse HEAD',
- returnStdout: true
- ).trim()
- gitVars = [(gitCommitEnv): gitCommit]
- }
- }
- } else {
- theUrl = 'https://github.amd.com/AOCC/llvm-project'
- dir (llvmProj) {
- gitVars = checkout(
- changelog: true,
- scm: scmGit(
- gitTool: gitTool,
- branches: scm.branches,
- browser: github(theUrl),
- extensions: scm.extensions + [
- cloneOption(
- depth: 2, // To compute the changelog.
- honorRefspec: true, noTags: true, shallow: true,
- reference: referenceRepo + slash + llvmProjRepo
+ theUrl = 'https://github.amd.com/AOCC/llvm-project'
+ dir (llvmProj) {
+ gitVars = checkout(
+ changelog: true,
+ scm: scmGit(
+ gitTool: gitTool,
+ branches: scm.branches,
+ browser: github(theUrl),
+ extensions: scm.extensions + [
+ cloneOption(
+ depth: 2, // To compute the changelog.
+ honorRefspec: true, noTags: true, shallow: true,
+ reference: referenceRepo + slash + llvmProjRepo
+ ),
+ firstBuildChangelog()
+ ],
+ userRemoteConfigs: [
+ [
+ credentialsId: gitHubAppCredsId,
+ refspec: (
+ '+refs/heads/' + actualHead + ':' +
+ 'refs/remotes/origin/' + actualHead
),
- firstBuildChangelog()
- ],
- userRemoteConfigs: [
- [
- credentialsId: gitHubAppCredsId,
- refspec: (
- '+refs/heads/' + actualHead + ':' +
- 'refs/remotes/origin/' + actualHead
- ),
- url: theUrl
- ]
+ url: theUrl
]
- )
+ ]
)
- assert gitVars.GIT_COMMIT
- Integer activeStat = successStat
- withEnv([gitPathEnv]) {
- if (
- gitVars.GIT_PREVIOUS_SUCCESSFUL_COMMIT &&
- gitVars.GIT_PREVIOUS_SUCCESSFUL_COMMIT != gitVars.GIT_COMMIT
- ) {
- withCredentials([
- gitUsernamePassword(
- credentialsId: gitHubAppCredsId,
- gitToolName: gitTool
- )
- ]) {
- activeStat = sh(
- label: 'has-file-changes',
- script: (
- 'bash ../aocc-essentials/build_essentials/has_file_changes.sh' + space +
- gitVars.GIT_COMMIT + space + gitVars.GIT_PREVIOUS_SUCCESSFUL_COMMIT
- ),
- returnStatus: true
- )
- }
- }
- if (activeStat == successStat) {
+ )
+ assert gitVars.GIT_COMMIT
+ Integer activeStat = successStat
+ withEnv([gitPathEnv]) {
+ if (
+ gitVars.GIT_PREVIOUS_SUCCESSFUL_COMMIT &&
+ gitVars.GIT_PREVIOUS_SUCCESSFUL_COMMIT != gitVars.GIT_COMMIT
+ ) {
+ withCredentials([
+ gitUsernamePassword(
+ credentialsId: gitHubAppCredsId,
+ gitToolName: gitTool
+ )
+ ]) {
activeStat = sh(
- label: 'has-active-files',
+ label: 'has-file-changes',
script: (
- 'bash ../aocc-essentials/build_essentials/has_active_files.sh' + space +
- gitVars.GIT_COMMIT + space +
- '.amd-ci/upstream/upstream_jenkins_excludes.txt'
+ 'bash ../aocc-essentials/build_essentials/has_file_changes.sh' + space +
+ gitVars.GIT_COMMIT + space + gitVars.GIT_PREVIOUS_SUCCESSFUL_COMMIT
),
returnStatus: true
)
}
}
- if (activeStat != successStat && activeStat != 1) {
- error 'Unexpected exit checking file activity.'
- }
- if (activeStat == 1) {
- echo(skipStr)
- hasSourceChanges = false
- return // From stage
+ if (activeStat == successStat) {
+ activeStat = sh(
+ label: 'has-active-files',
+ script: (
+ 'bash ../aocc-essentials/build_essentials/has_active_files.sh' + space +
+ gitVars.GIT_COMMIT + space +
+ '.amd-ci/upstream/upstream_jenkins_excludes.txt'
+ ),
+ returnStatus: true
+ )
}
+ }
+ if (activeStat != successStat && activeStat != 1) {
+ error 'Unexpected exit checking file activity.'
+ }
+ if (activeStat == 1) {
+ echo(skipStr)
+ hasSourceChanges = false
+ return // From stage
+ }
- String mstat
- withEnv([gitPathEnv, gitCommitEnv + '=' + gitVars.GIT_COMMIT]) {
- withCredentials([
- usernamePassword(
- credentialsId: gitHubAppCredsId,
- usernameVariable: 'GH_APP_USR_NOTREQUIRED',
- passwordVariable: 'GH_ENTERPRISE_TOKEN'
- )
- ]) {
- mstat = sh(
- label: 'merge-stat',
- script: (
- 'bash ../aocc-essentials/build_essentials/merge_commit_status.sh' + space +
- gitVars.GIT_COMMIT
- ),
- returnStdout: true
- ).trim()
- }
+ String mstat
+ withEnv([gitPathEnv, gitCommitEnv + '=' + gitVars.GIT_COMMIT]) {
+ withCredentials([
+ usernamePassword(
+ credentialsId: gitHubAppCredsId,
+ usernameVariable: 'GH_APP_USR_NOTREQUIRED',
+ passwordVariable: 'GH_ENTERPRISE_TOKEN'
+ )
+ ]) {
+ mstat = sh(
+ label: 'merge-stat',
+ script: (
+ 'bash ../aocc-essentials/build_essentials/merge_commit_status.sh' + space +
+ gitVars.GIT_COMMIT
+ ),
+ returnStdout: true
+ ).trim()
}
- if (mstat && mstat != 'None') {
- echo('Merge status is ' + mstat)
- if (timerTrigger) {
- echo(contTimerReason)
- } else {
- echo(skipStr)
- isSkippableMerge = true
- return // From stage
- }
+ }
+ if (mstat && mstat != 'None') {
+ echo('Merge status is ' + mstat)
+ if (timerTrigger) {
+ echo(contTimerReason)
+ } else {
+ echo(skipStr)
+ isSkippableMerge = true
+ return // From stage
}
}
}
@@ -338,19 +305,13 @@ try {
try {
withEnv([
'PATH=' + linuxBasePath,
- 'JOB_NAME=' + jobName
+ 'JOB_NAME=' + jobName,
+ 'AOCC_DUAL_FLANG_BUILD=' + dualFlangBuild
]) {
sh 'llvm-project/.amd-ci/upstream/apptainer_run.sh'
}
currentBuild.result = successResultStr
} finally {
- if (intraJobRepoSync) {
- stage ('merge-post') {
- withEnv([gitPathEnv]) {
- sh 'llvm-project/.amd-ci/upstream/repo_sync.sh'
- }
- }
- }
archiveArtifacts(
allowEmptyArchive: true,
artifacts: '*.tar.xz,*.txt'
@@ -415,3 +376,28 @@ try {
currentBuild.result = failureResultStr
throw e
}
+
+/*
+ * For when work is skipped.
+ * Code smell: this method is also in the main AOCC CommitCheck class.
+ */
+void setStatusToLastCompleted() {
+ def previousBuild = currentBuild.previousBuild // groovylint-disable-line NoDef,VariableTypeRequired
+ // Default fallback:
+ String previousResult = 'SUCCESS' // Keep as a literal string because of scoping.
+ String nBStr = 'NOT_BUILT' // Keep as a literal string because of scoping.
+
+ while (previousBuild &&
+ (!(previousBuild.result) || previousBuild.result == nBStr)) {
+ previousBuild = previousBuild.previousBuild
+ }
+
+ if (previousBuild && previousBuild.result) {
+ previousResult = previousBuild.result
+ } else {
+ previousResult = nBStr
+ }
+
+ echo('Setting build result to ' + previousResult + ' from a previous build.')
+ currentBuild.result = previousResult
+}
diff --git a/.amd-ci/upstream/apptainer_run.sh b/.amd-ci/upstream/apptainer_run.sh
index 3f314c585994de..8c89b2f9823643 100755
--- a/.amd-ci/upstream/apptainer_run.sh
+++ b/.amd-ci/upstream/apptainer_run.sh
@@ -13,6 +13,7 @@ then
fi
apptainer exec \
--cleanenv \
+ --env AOCC_DUAL_FLANG_BUILD="${AOCC_DUAL_FLANG_BUILD:-false}" \
--env BUILD_NUMBER="${BUILD_NUMBER:-0}" \
--env CI="${CI:-false}" \
--env JOB_NAME="${JOB_NAME:-NoSuchJobName}" \
diff --git a/.amd-ci/upstream/repo_sync.sh b/.amd-ci/upstream/repo_sync.sh
deleted file mode 100755
index 7962a1462c4a64..00000000000000
--- a/.amd-ci/upstream/repo_sync.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/env bash
-
-WORKSPACE=$PWD
-cd "${WORKSPACE}/llvm-project" || exit 1
-
-set -x
-echo "git push origin HEAD:refs/heads/upstream-main"
-git push origin HEAD:refs/heads/upstream-main
-if [ "$?" -eq 0 ]; then
- echo "********************************************************"
- echo "Execution of command : git push origin HEAD:refs/heads/upstream-main - was successful" >> "${WORKSPACE}/command_executed.txt"
- echo "Execution of command : git push origin HEAD:refs/heads/upstream-main - was successful"
- echo "********************************************************"
-else
- echo "########################################################"
- echo "Execution of command : git push origin HEAD:refs/heads/upstream-main - was failed"
- echo "Please check ${WORKSPACE}/command_executed.txt file for commands executed till now"
- rm -v "${WORKSPACE}"/build_success.txt
- exit 1
- echo "########################################################"
-fi
-
-if [ ! -f "${WORKSPACE}/build_success.txt" ]
-then
- echo "Job failed - Please check ${WORKSPACE}/command_executed.txt file for commands executed till now"
- exit 1
-fi
-
-cd "${WORKSPACE}/llvm-project" || exit 1
-declare -A branch_map
-branch_map["release/20.x"]="aocc/upstream/20.x"
-branch_map["main"]="aocc/upstream/main"
-
-for src_branch in "${!branch_map[@]}"; do
- dest_branch="${branch_map[$src_branch]}"
- echo "Pushing branch from $src_branch to $dest_branch"
- if ! git fetch origin $src_branch:$dest_branch; then
- echo "Failed to fetch branch: $src_branch"
- fi
- if ! git push origin "$dest_branch:$dest_branch"; then
- echo "Failed to push branch: $dest_branch"
- fi
-done
diff --git a/.amd-ci/upstream/run.sh b/.amd-ci/upstream/run.sh
index c5d937d0d0f89b..56e039c76cd9e6 100755
--- a/.amd-ci/upstream/run.sh
+++ b/.amd-ci/upstream/run.sh
@@ -4,6 +4,9 @@
execute_and_check()
{
cmd="$1"
+ echo "********************************************************"
+ echo "Executing command : $cmd - please wait ..."
+ echo "********************************************************"
$cmd
retVal=$?
@@ -50,28 +53,29 @@ mod_cmd3="module load gcc/11.4.0"
echo "${mod_cmd3}"
${mod_cmd3}
-execute_and_check "mkdir -p ${WORKSPACE}/BUILD"
-execute_and_check "cd ${WORKSPACE}/BUILD"
-
MEMORY_KILOS=$(grep MemTotal /proc/meminfo | awk '{print $2}')
MEMORY_GIGS=$(( MEMORY_KILOS / 1000000 ))
MEMORY_COMPILE_LIMIT=$(( MEMORY_GIGS / 4 ))
MEMORY_LINK_LIMIT=$(( MEMORY_GIGS / 12 ))
+CURRENT_DATE=$(date +"%Y_%m_%d")
-cmake_args=(
+dual_flang_build="${AOCC_DUAL_FLANG_BUILD:-false}"
+
+next_build_dir="${WORKSPACE}/BUILD"
+inst_dir="${JOB_NAME}-${BUILD_NUMBER}"
+cmake_base_args=(
-G Ninja
-DCMAKE_BUILD_TYPE:STRING=Release
- -DCMAKE_INSTALL_PREFIX="${WORKSPACE}/${JOB_NAME}-${BUILD_NUMBER}"
+ -DCMAKE_INSTALL_PREFIX="${WORKSPACE}/${inst_dir}"
+ -DLLVM_VERSION_SUFFIX="pre"
+ -DAOCC_REVISION="AOCC_6.0.0-Build#${BUILD_NUMBER} ${CURRENT_DATE}"
-DCMAKE_CXX_STANDARD=17
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_CXX_LINK_FLAGS="-Wl,-rpath,$LD_LIBRARY_PATH"
-DLLVM_ENABLE_ASSERTIONS=ON
-DLLVM_LIT_ARGS=-v
-DCLANG_DEFAULT_LINKER=lld
- -DLLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra;flang"
- -DLLVM_ENABLE_RUNTIMES="openmp;flang-rt;compiler-rt"
-S "${WORKSPACE}/llvm-project/llvm"
- -B "${WORKSPACE}/BUILD"
-DPython3_EXECUTABLE:STRING=/proj/csse_jenkins2/swtools/apps/python/versions/3.8.12/bin/python
-DCMAKE_INSTALL_MESSAGE=LAZY
-DCMAKE_C_COMPILER=gcc
@@ -94,54 +98,229 @@ cmake_args=(
if test -d "${WORKSPACE}/llvm-project/aocc-essentials"
then
- echo "This looks like an AOCC branch; adding extra required CMake switches."
- cmake_args+=(
+ echo "This looks like an AOCC branch."
+ aocc_branch=1
+else
+ aocc_branch=0
+fi
+
+if test ${aocc_branch} -ne 0
+then
+ echo "AOCC branch; adding extra required CMake switches."
+ cmake_base_args+=(
-DCMAKE_CXX_FLAGS="-Wno-error=pedantic -pthread"
-DLLVM_LIT_ARGS="--xunit-xml-output=testresults.xunit.xml -v --timeout=600 --param blacklist=${WORKSPACE}/llvm-project/prj-essentials/devo/lit.blacklist.cfg"
+ )
+fi
+
+if test "${dual_flang_build}" = "true"
+then
+ amd_prefix="aocc-"
+fi
+
+amd_tool_links() {
+ ln -sf clang++ "${amd_prefix}clang++"
+ ln -sf clang "${amd_prefix}clang"
+ ln -sf clang-cpp "${amd_prefix}clang-cpp"
+ ln -sf clang-cl "${amd_prefix}clang-cl"
+ ln -sf lld "${amd_prefix}lld"
+ ln -sf "${amd_prefix}flang" flang
+}
+
+execute_and_check "mkdir -p ${next_build_dir}"
+execute_and_check "cd ${next_build_dir}"
+
+cmake_args=("${cmake_base_args[@]}")
+
+if test ${aocc_branch} -ne 0
+then
+ cmake_args+=(
-DLLVM_ENABLE_CLASSIC_FLANG=OFF
)
fi
+next_vendor_string="AMD AOCC"
+cmake_args+=(
+ -B "${next_build_dir}"
+ -DCLANG_VENDOR="${next_vendor_string}"
+ -DFLANG_VENDOR="${next_vendor_string}"
+ -DLLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra;flang"
+ -DLLVM_ENABLE_RUNTIMES="openmp;flang-rt;compiler-rt"
+)
+
set -x
cmake "${cmake_args[@]}"
-ninja -C "${WORKSPACE}"/BUILD install
+ninja -C "${next_build_dir}" install
stat=$?
set +x
- if [ "${stat}" -eq 0 ]; then
- echo "********************************************************"
- echo "Execution of command : ninja -C ${WORKSPACE}/BUILD install - was successful" >> "${WORKSPACE}/command_executed.txt"
- echo "Execution of command : ninja -C ${WORKSPACE}/BUILD install - was successful"
- echo "********************************************************"
- else
- echo "########################################################"
- echo "Execution of command : ninja -C ${WORKSPACE}/BUILD install - was failed"
- echo "Please check BUILD_INSTALL.log file for details"
- echo "Please check ${WORKSPACE}/command_executed.txt file for commands executed till now"
- rm -v "${WORKSPACE}"/build_success.txt
- exit 1
- echo "########################################################"
- fi
+if [ "${stat}" -eq 0 ]; then
+ echo "********************************************************"
+ echo "Execution of command : ninja -C ${next_build_dir} install - was successful" >> "${WORKSPACE}/command_executed.txt"
+ echo "Execution of command : ninja -C ${next_build_dir} install - was successful"
+ echo "********************************************************"
+else
+ echo "########################################################"
+ echo "Execution of command : ninja -C ${next_build_dir} install - was failed"
+ echo "Please check BUILD_INSTALL.log file for details"
+ echo "Please check ${WORKSPACE}/command_executed.txt file for commands executed till now"
+ rm -v "${WORKSPACE}"/build_success.txt
+ exit 1
+ echo "########################################################"
+fi
execute_and_check "cd ${WORKSPACE}"
-execute_and_check "tar -cJf ${JOB_NAME}-${BUILD_NUMBER}.tar.xz ${JOB_NAME}-${BUILD_NUMBER}"
+
+if test "${dual_flang_build}" = "true"
+then
+ (
+ cd "${next_build_dir}/bin" || exit 1
+ amd_tool_links
+ ) || exit 1
+ (
+ cd "${inst_dir}/bin" || exit 1
+ amd_tool_links
+ ) || exit 1
+fi
+
+if test "${dual_flang_build}" != "true"
+then
+ execute_and_check "tar -cJf ${inst_dir}.tar.xz ${inst_dir}"
+fi
set -x
-ninja -C "${WORKSPACE}"/BUILD check-flang check-mlir
+ninja -C "${next_build_dir}" check-flang check-mlir
stat=$?
set +x
- if [ "${stat}" -eq 0 ]; then
- echo "********************************************************"
- echo "Execution of command : ninja -C ${WORKSPACE}/BUILD check-flang check-mlir - was successful" >> "${WORKSPACE}/command_executed.txt"
- echo "Execution of command : ninja -C ${WORKSPACE}/BUILD check-flang check-mlir - was successful"
- echo "********************************************************"
- else
- echo "########################################################"
- echo "Execution of command : ninja -C ${WORKSPACE}/BUILD check-flang check-mlir - was failed"
- echo "Please check ${WORKSPACE}/command_executed.txt file for commands executed till now"
- rm -v "${WORKSPACE}"/build_success.txt
- exit 1
- echo "########################################################"
- fi
+if [ "${stat}" -eq 0 ]; then
+ echo "********************************************************"
+ echo "Execution of command : ninja -C ${next_build_dir} check-flang check-mlir - was successful" >> "${WORKSPACE}/command_executed.txt"
+ echo "Execution of command : ninja -C ${next_build_dir} check-flang check-mlir - was successful"
+ echo "********************************************************"
+else
+ echo "########################################################"
+ echo "Execution of command : ninja -C ${next_build_dir} check-flang check-mlir - was failed"
+ echo "Please check ${WORKSPACE}/command_executed.txt file for commands executed till now"
+ rm -v "${WORKSPACE}"/build_success.txt
+ exit 1
+ echo "########################################################"
+fi
+
+if test "${dual_flang_build}" = "true"
+then
+ next_build_dir="${WORKSPACE}/BUILD_c"
+ execute_and_check "mkdir -p ${next_build_dir}"
+ execute_and_check "cd ${next_build_dir}"
+
+ cmake_args=("${cmake_base_args[@]}")
+ next_vendor_string="AMD"
+ cmake_args+=(
+ -DLLVM_ENABLE_CLASSIC_FLANG=ON
+ -B "${next_build_dir}"
+ -DCLANG_VENDOR="${next_vendor_string}"
+ -DFLANG_VENDOR="${next_vendor_string}"
+ -DLLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra"
+ -DLLVM_ENABLE_RUNTIMES="openmp;compiler-rt"
+ )
+
+ set -x
+ cmake "${cmake_args[@]}"
+ ninja -C "${next_build_dir}" install
+ stat=$?
+ set +x
+
+ if test "${stat}" -ne 0
+ then
+ rm -v "${WORKSPACE}"/build_success.txt
+ exit 1
+ fi
+
+ set -x
+ ninja -C "${next_build_dir}" check-clang # Code smell: check-all fails in check of Python bindings.
+ stat=$?
+ set +x
+
+ if test "${stat}" -ne 0
+ then
+ rm -v "${WORKSPACE}"/build_success.txt
+ exit 1
+ fi
+
+ pgmath64_build_dir="${next_build_dir}/libpgmath64"
+ next_build_dir="${pgmath64_build_dir}"
+ mkdir -p "${next_build_dir}/include"
+ cp /usr/lib/gcc/x86_64-redhat-linux/8/include/quadmath.h "${next_build_dir}/include"
+
+ cmake_args=(
+ -G Ninja
+ -DCMAKE_BUILD_TYPE:STRING=Release
+ -DCMAKE_INSTALL_PREFIX="${WORKSPACE}/${inst_dir}"
+ -S "${WORKSPACE}/llvm-project/classic-flang/runtime/libpgmath"
+ -B "${next_build_dir}"
+ -DPython3_EXECUTABLE:STRING=/proj/csse_jenkins2/swtools/apps/python/versions/3.8.12/bin/python
+ -DCMAKE_INSTALL_MESSAGE=LAZY
+ -DCMAKE_C_COMPILER="${WORKSPACE}/${inst_dir}/bin/clang"
+ -DCMAKE_CXX_COMPILER="${WORKSPACE}/${inst_dir}/bin/clang++"
+ -DLLVM_PARALLEL_COMPILE_JOBS="${MEMORY_COMPILE_LIMIT}"
+ -DLLVM_PARALLEL_LINK_JOBS="${MEMORY_LINK_LIMIT}"
+ -DCMAKE_C_FLAGS="-I${next_build_dir}/include"
+ -DCMAKE_CXX_FLAGS="-I${next_build_dir}/include"
+ )
+
+ set -x
+ cmake "${cmake_args[@]}"
+ ninja -C "${next_build_dir}" install
+ stat=$?
+ set +x
+
+ if test "${stat}" -ne 0
+ then
+ rm -v "${WORKSPACE}"/build_success.txt
+ exit 1
+ fi
+
+ # ToDo libpgmath32?
+
+ next_build_dir="${next_build_dir}/classic-flang"
+
+ cmake_args=(
+ -G Ninja
+ -DCMAKE_BUILD_TYPE:STRING=Release
+ -DCMAKE_INSTALL_PREFIX="${WORKSPACE}/${inst_dir}"
+ -S "${WORKSPACE}/llvm-project/classic-flang"
+ -B "${next_build_dir}"
+ -DPYTHON_EXECUTABLE:STRING=/proj/csse_jenkins2/swtools/apps/python/versions/3.8.12/bin/python
+ -DCMAKE_INSTALL_MESSAGE=LAZY
+ -DCMAKE_C_COMPILER="${WORKSPACE}/${inst_dir}/bin/clang"
+ -DCMAKE_CXX_COMPILER="${WORKSPACE}/${inst_dir}/bin/clang++"
+ -DCMAKE_Fortran_COMPILER="${WORKSPACE}/${inst_dir}/bin/flang"
+ -DCMAKE_Fortran_COMPILER_ID=Flang
+ -DLLVM_PARALLEL_COMPILE_JOBS="${MEMORY_COMPILE_LIMIT}"
+ -DLLVM_PARALLEL_LINK_JOBS="${MEMORY_LINK_LIMIT}"
+ -DCMAKE_C_FLAGS="-I${pgmath64_build_dir}/include"
+ -DCMAKE_CXX_FLAGS="-I${pgmath64_build_dir}/include"
+ -DFLANG_INCLUDE_DOCS:BOOL=OFF
+ -DFLANG_INCLUDE_TESTS:BOOL=OFF
+ -DFLANG_OPENMP_GPU_NVIDIA=on
+ -DFLANG_OPENMP_GPU_AMD=on
+ -DLLVM_CONFIG="${WORKSPACE}/${inst_dir}/bin/llvm-config"
+ )
+
+ set -x
+ cmake "${cmake_args[@]}"
+ ninja -C "${next_build_dir}" install
+ stat=$?
+ set +x
+
+ if test "${stat}" -ne 0
+ then
+ rm -v "${WORKSPACE}"/build_success.txt
+ exit 1
+ fi
+
+ execute_and_check "cd ${WORKSPACE}"
+
+ execute_and_check "tar -cJf ${inst_dir}.tar.xz ${inst_dir}"
+fi
execute_and_check "cd ${WORKSPACE}/llvm-project"
MAIN_COMMIT_HASH=$(git rev-parse HEAD)
diff --git a/.amd-ci/upstream/upstream_jenkins_excludes.txt b/.amd-ci/upstream/upstream_jenkins_excludes.txt
index 0a9c012dea2b17..9e7be5fd325bd7 100644
--- a/.amd-ci/upstream/upstream_jenkins_excludes.txt
+++ b/.amd-ci/upstream/upstream_jenkins_excludes.txt
@@ -17,5 +17,5 @@
^.*prj-essentials/devo/aocc/merge/
^prj-essentials/devo/aocc/CODEOWNERS\.AOCC\.m4
^\.github/\.ai_pr_platform/
-^\.github/workflows/amd-validate-.*config-file\.yml
+^\.github/workflows/amd-.*\.yml
^CODEOWNERS
>From a9ce782a46c81646ed19b0d7c5918fa841f36984 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Mon, 17 Nov 2025 19:19:30 +0000
Subject: [PATCH 31/72] CPUPC-7979: CI sync from aocc_llvm21.
Change-Id: Id60872f01e6d9622aa908d097b53b5534844b66c
---
.amd-ci/upstream/Jenkinsfile | 119 +++++++++++++++++++-----------
.amd-ci/upstream/apptainer_run.sh | 39 ++++++++--
2 files changed, 109 insertions(+), 49 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index ace670b6266e67..513aa9964f5a6a 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -43,6 +43,20 @@ if (isPrBranch &&
return this
}
+// Code smell: buildTypes are also defined in CommitCheck
+String buildTypePresub = 'PRESUB' // groovylint-disable-line UnusedVariable
+String buildTypeRelease = 'RELEASE' // groovylint-disable-line UnusedVariable
+String buildTypeStaging = 'STAGING' // groovylint-disable-line UnusedVariable
+// buildType is processed during branch creation:
+String buildType = (isPrBranch ? buildTypePresub : buildTypeRelease)
+
+if (!isPrBranch &&
+ env.BRANCH_NAME != stagingBranch &&
+ !env.BRANCH_NAME.startsWith(releaseBranchPrefix)) {
+ // Treat it as 'presub'.
+ buildType = buildTypePresub
+}
+
Boolean postsub = (
!isPrBranch &&
(
@@ -81,7 +95,7 @@ Boolean runDownstream = (
)
String space = ' ', andChain = '&&', underScore = '_', slash = '/', dash = '-'
-String gitCommitEnv = 'GIT_COMMIT'
+String gitCommitEnv = 'GIT_COMMIT', bashCmd = 'bash'
String skipStr = 'Skipping build.', contStr = 'Continuing build.'
String contTimerReason = 'Timer trigger.' + space + contStr
@@ -118,12 +132,18 @@ String theUrl
Boolean hasSourceChanges = true, isSkippableMerge = false
Integer successStat = 0
+// llvmVer is processed by automation:
+String llvmVer = '22.0.0'
+// stageBuildNum is processed during branch creation:
+String stageBuildNum = env.BUILD_NUMBER
+// versionVal is processed during branch creation:
+String versionVal = 'AOCC_' + llvmVer + dash + (buildType == buildTypePresub ? 'Presub' : 'Stage')
+
+// relMode should be changed to 'CANDIDATE' when the release is close to readiness:
+String relMode = 'PRE'
+
String jobName
if (postsub && targetIsRelBranch) {
- // llvmVer is processed by automation:
- String llvmVer = '21.1.6'
- // stageBuildNum is processed during branch creation:
- String stageBuildNum = '12786'
jobName = 'aocc-compiler-llvm-flang-rel' + dash + llvmVer + dash + stageBuildNum
} else {
jobName = (
@@ -152,44 +172,50 @@ try {
deleteDirs: true,
patterns: cleanExcludes
)
- dir('aocc-devops') {
- checkout(
- changelog: false,
- scm: scmGit(
- gitTool: gitTool,
- branches: [[name: 'main']],
- extensions: [
- cloneOption(
- reference: referenceRepo + '/aocc-devops.git'
- )
- ],
- userRemoteConfigs: [
- [
- credentialsId: gitHubAppCredsId,
- url: 'https://github.amd.com/AOCC/aocc-devops.git'
+ String essDir
+ if (actualTarget == upstreamBranch) {
+ dir('aocc-devops') {
+ checkout(
+ changelog: false,
+ scm: scmGit(
+ gitTool: gitTool,
+ branches: [[name: 'main']],
+ extensions: [
+ cloneOption(
+ reference: referenceRepo + '/aocc-devops.git'
+ )
+ ],
+ userRemoteConfigs: [
+ [
+ credentialsId: gitHubAppCredsId,
+ url: 'https://github.amd.com/AOCC/aocc-devops.git'
+ ]
]
- ]
- )
- )
- }
- withCredentials([
- gitUsernamePassword(
- credentialsId: gitHubAppCredsId,
- gitToolName: gitTool
- )
- ]) {
- withEnv([gitPathEnv]) {
- sh(
- label: 'clone-essentials',
- script: (
- 'set +x; . aocc-devops/utils.sh' + space + andChain + space +
- 'export BRANCH_NAME=' + stagingBranch + space + andChain + space +
- 'sparse_clone_essentials' + space + andChain + space +
- 'mv llvm-project/aocc-essentials . ' + space + andChain + space +
- 'rm -rf llvm-project'
)
)
}
+ withCredentials([
+ gitUsernamePassword(
+ credentialsId: gitHubAppCredsId,
+ gitToolName: gitTool
+ )
+ ]) {
+ withEnv([gitPathEnv]) {
+ sh(
+ label: 'clone-essentials',
+ script: (
+ 'set +x; . aocc-devops/utils.sh' + space + andChain + space +
+ 'export BRANCH_NAME=' + stagingBranch + space + andChain + space +
+ 'sparse_clone_essentials' + space + andChain + space +
+ 'mv llvm-project/aocc-essentials . ' + space + andChain + space +
+ 'rm -rf llvm-project'
+ )
+ )
+ }
+ }
+ essDir = '../aocc-essentials'
+ } else {
+ essDir = 'aocc-essentials'
}
theUrl = 'https://github.amd.com/AOCC/llvm-project'
dir (llvmProj) {
@@ -235,7 +261,7 @@ try {
activeStat = sh(
label: 'has-file-changes',
script: (
- 'bash ../aocc-essentials/build_essentials/has_file_changes.sh' + space +
+ bashCmd + space + essDir + '/build_essentials/has_file_changes.sh' + space +
gitVars.GIT_COMMIT + space + gitVars.GIT_PREVIOUS_SUCCESSFUL_COMMIT
),
returnStatus: true
@@ -246,8 +272,9 @@ try {
activeStat = sh(
label: 'has-active-files',
script: (
- 'bash ../aocc-essentials/build_essentials/has_active_files.sh' + space +
+ bashCmd + space + essDir + '/build_essentials/has_active_files.sh' + space +
gitVars.GIT_COMMIT + space +
+ gitVars.GIT_PREVIOUS_SUCCESSFUL_COMMIT + space +
'.amd-ci/upstream/upstream_jenkins_excludes.txt'
),
returnStatus: true
@@ -275,7 +302,7 @@ try {
mstat = sh(
label: 'merge-stat',
script: (
- 'bash ../aocc-essentials/build_essentials/merge_commit_status.sh' + space +
+ bashCmd + space + essDir + '/build_essentials/merge_commit_status.sh' + space +
gitVars.GIT_COMMIT
),
returnStdout: true
@@ -306,7 +333,11 @@ try {
withEnv([
'PATH=' + linuxBasePath,
'JOB_NAME=' + jobName,
- 'AOCC_DUAL_FLANG_BUILD=' + dualFlangBuild
+ 'AOCC_DUAL_FLANG_BUILD=' + dualFlangBuild,
+ 'STAGE_BUILD_NUM=' + stageBuildNum,
+ 'VERSION_VAL=' + versionVal,
+ 'REL_MODE=' + relMode,
+ 'BUILD_TYPE=' + buildType
]) {
sh 'llvm-project/.amd-ci/upstream/apptainer_run.sh'
}
@@ -314,7 +345,7 @@ try {
} finally {
archiveArtifacts(
allowEmptyArchive: true,
- artifacts: '*.tar.xz,*.txt'
+ artifacts: '*_logs/**,*.tar.xz,*.txt'
)
cleanWs(
deleteDirs: true,
diff --git a/.amd-ci/upstream/apptainer_run.sh b/.amd-ci/upstream/apptainer_run.sh
index 8c89b2f9823643..daf8f683fbd6e1 100755
--- a/.amd-ci/upstream/apptainer_run.sh
+++ b/.amd-ci/upstream/apptainer_run.sh
@@ -11,12 +11,41 @@ if test ! -f "${image_path}"
then
image_path=/proj/csse_jenkins2/swtools/${image_tail}
fi
+envs=(
+ --env AOCC_DUAL_FLANG_BUILD="${AOCC_DUAL_FLANG_BUILD:-false}"
+ --env BRANCH_NAME="${BRANCH_NAME:-NoSuchBranchName}"
+ --env BUILD_NUMBER="${BUILD_NUMBER:-0}"
+ --env CI="${CI:-false}"
+ --env JOB_NAME="${JOB_NAME:-NoSuchJobName}"
+)
+if test -n "${BUILD_TYPE:-}"
+then
+ envs+=(--env BUILD_TYPE="${BUILD_TYPE}")
+fi
+if test -n "${CHANGE_TARGET:-}"
+then
+ envs+=(--env CHANGE_TARGET="${CHANGE_TARGET}")
+fi
+if test -n "${REL_MODE:-}"
+then
+ envs+=(--env REL_MODE="${REL_MODE}")
+fi
+if test -n "${STAGE_BUILD_NUM:-}"
+then
+ envs+=(--env STAGE_BUILD_NUM="${STAGE_BUILD_NUM}")
+fi
+if test -n "${VERSION_VAL:-}"
+then
+ envs+=(--env VERSION_VAL="${VERSION_VAL}")
+fi
+binds="/proj:/proj:ro,$(pwd):${bind_point}:rw"
+if test -n "${JENKINS_REMOTE_GIT_CACHE:-}"
+then
+ binds+=",${JENKINS_REMOTE_GIT_CACHE}:${JENKINS_REMOTE_GIT_CACHE}:ro"
+fi
apptainer exec \
--cleanenv \
- --env AOCC_DUAL_FLANG_BUILD="${AOCC_DUAL_FLANG_BUILD:-false}" \
- --env BUILD_NUMBER="${BUILD_NUMBER:-0}" \
- --env CI="${CI:-false}" \
- --env JOB_NAME="${JOB_NAME:-NoSuchJobName}" \
- --bind "/proj:/proj:ro,$(pwd):${bind_point}:rw" \
+ "${envs[@]}" \
+ --bind "${binds}" \
${image_path} \
bash -c "cd ${bind_point} && ${_script_dir}/run.sh"
>From ec6d733f4531f9e94eef8907a700746fbbf11d96 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Tue, 18 Nov 2025 18:32:41 +0000
Subject: [PATCH 32/72] CPUPC-7979: Find compiler tar dynamically.
Change-Id: Ie79acdd2f4c954055ca5e3b25451448af7256f01
---
.amd-ci/upstream/Jenkinsfile | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index 513aa9964f5a6a..9f989dcb3818fc 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -130,7 +130,7 @@ String gitPathEnv = (
String llvmProj = 'llvm-project', llvmProjRepo = llvmProj + '.git'
String theUrl
Boolean hasSourceChanges = true, isSkippableMerge = false
-Integer successStat = 0
+Integer zero = 0, successStat = zero
// llvmVer is processed by automation:
String llvmVer = '22.0.0'
@@ -159,6 +159,8 @@ def gitVars // groovylint-disable-line NoDef,VariableTypeRequired
Integer fullTimeoutH = 15
+String compilerTar
+
try {
timeout(time: fullTimeoutH, unit: 'HOURS') {
node ('atl && apptainer') {
@@ -343,6 +345,12 @@ try {
}
currentBuild.result = successResultStr
} finally {
+ def compilerZips = findFiles( // groovylint-disable-line NoDef,VariableTypeRequired
+ glob: "*-${env.BUILD_NUMBER}*.tar.xz"
+ )
+ if (compilerZips) {
+ compilerTar = compilerZips[zero].path
+ }
archiveArtifacts(
allowEmptyArchive: true,
artifacts: '*_logs/**,*.tar.xz,*.txt'
@@ -357,7 +365,7 @@ try {
if (isSkippableMerge || !hasSourceChanges) {
return // From timeout
}
- if (runDownstream) {
+ if (runDownstream && compilerTar) {
stage ('downstream-tasks') {
Map allTasks = [
failFast: false,
@@ -375,13 +383,9 @@ try {
wait: true,
job: 'AOCC-Workloads/TestSuites/' + suiteName,
parameters: [
- // Use the name of build tar as defined in the run script:
string(
name: 'CUT',
- value: (
- env.BUILD_URL + 'artifact/' +
- jobName + dash + env.BUILD_NUMBER + '.tar.xz'
- )
+ value: env.BUILD_URL + 'artifact/' + compilerTar
),
string(name: 'CHANGE_ID', value: env.CHANGE_ID ?: ''),
string(name: gitCommitEnv, value: gitVars.GIT_COMMIT ?: '')
>From 6ec870fa0c83c7490024f00f03dffaf1428abd7b Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Mon, 17 Nov 2025 17:08:21 +0000
Subject: [PATCH 33/72] CPUPC-7979: CI synced from staging.
Change-Id: Iafb92a34767c2cdce49f5be1402d09fc244c77ad
---
.amd-ci/upstream/run.sh | 349 ++++++----------------------------------
1 file changed, 49 insertions(+), 300 deletions(-)
diff --git a/.amd-ci/upstream/run.sh b/.amd-ci/upstream/run.sh
index 56e039c76cd9e6..39b18ba4f5c8c3 100755
--- a/.amd-ci/upstream/run.sh
+++ b/.amd-ci/upstream/run.sh
@@ -1,333 +1,82 @@
#!/usr/bin/env bash
-#{Function to print command execution status by checking it's return value
-execute_and_check()
-{
- cmd="$1"
- echo "********************************************************"
- echo "Executing command : $cmd - please wait ..."
- echo "********************************************************"
- $cmd
- retVal=$?
-
- if [ "$retVal" -eq 0 ]; then
- echo "********************************************************"
- echo "Execution of command : $cmd - was successful" >> "${WORKSPACE}/command_executed.txt"
- echo "Execution of command : $cmd - was successful"
- echo "********************************************************"
- else
- echo "########################################################"
- echo "Execution of command : $cmd - was failed"
- echo "Please check ${WORKSPACE}/command_executed.txt file for commands executed till now"
- rm -v "${WORKSPACE}/build_success.txt"
- exit 1
- echo "########################################################"
- fi
-}
-#}
+if test -d llvm-project/aocc-essentials
+then
+ ess_dir=llvm-project/aocc-essentials
+else
+ ess_dir=aocc-essentials
+fi
-WORKSPACE=$PWD
-touch "${WORKSPACE}"/build_success.txt
+mod_cmd1=". ${ess_dir}/build_essentials/linux/aocc_env.sh"
+echo "${mod_cmd1}"
+${mod_cmd1}
_ver_file=llvm-project/cmake/Modules/LLVMVersion.cmake
LLVM_VERSION_MAJOR=$(grep -w "set(LLVM_VERSION_MAJOR" "${_ver_file}" | awk -F' ' '{print $NF}' | tr -d ')')
LLVM_VERSION_MINOR=$(grep -w "set(LLVM_VERSION_MINOR" "${_ver_file}" | awk -F' ' '{print $NF}' | tr -d ')')
LLVM_VERSION_PATCH=$(grep -w "set(LLVM_VERSION_PATCH" "${_ver_file}" | awk -F' ' '{print $NF}' | tr -d ')')
CLANG_VERSION=$LLVM_VERSION_MAJOR.$LLVM_VERSION_MINOR.$LLVM_VERSION_PATCH
-echo "CLANG_VERSION value is - $CLANG_VERSION" > "${WORKSPACE}"/VERSION_AND_COMMIT_HASH_OF_BUILD_"${BUILD_NUMBER}".txt
+MAIN_COMMIT_HASH=$(git -C llvm-project rev-parse HEAD)
+{
+ echo "CLANG_VERSION value is - $CLANG_VERSION"
+ echo "$MAIN_COMMIT_HASH"
+} > VERSION_AND_COMMIT_HASH_OF_BUILD_"${BUILD_NUMBER}".txt
-if test -d aocc-essentials
+if test "${LLVM_VERSION_MAJOR}" -gt 21
then
- ess_dir=aocc-essentials
-else
- ess_dir=llvm-project/aocc-essentials
+ mod_cmd2=". /proj/csse_jenkins2/swtools/c/rhel7-gcc8.3.1/environment-modules-5.4.0-j6k56q3i/init/bash"
+ echo "${mod_cmd2}"
+ ${mod_cmd2}
+ mod_cmd3="module load -v gcc/11.4.0"
+ echo "${mod_cmd3}"
+ ${mod_cmd3}
fi
-mod_cmd1=". ${ess_dir}/build_essentials/linux/aocc_env.sh"
-echo "${mod_cmd1}"
-${mod_cmd1}
-mod_cmd2=". /proj/csse_jenkins2/swtools/c/rhel7-gcc8.3.1/environment-modules-5.4.0-j6k56q3i/init/bash"
-echo "${mod_cmd2}"
-${mod_cmd2}
-mod_cmd3="module load gcc/11.4.0"
-echo "${mod_cmd3}"
-${mod_cmd3}
-
-MEMORY_KILOS=$(grep MemTotal /proc/meminfo | awk '{print $2}')
-MEMORY_GIGS=$(( MEMORY_KILOS / 1000000 ))
-MEMORY_COMPILE_LIMIT=$(( MEMORY_GIGS / 4 ))
-MEMORY_LINK_LIMIT=$(( MEMORY_GIGS / 12 ))
-CURRENT_DATE=$(date +"%Y_%m_%d")
-
dual_flang_build="${AOCC_DUAL_FLANG_BUILD:-false}"
-next_build_dir="${WORKSPACE}/BUILD"
-inst_dir="${JOB_NAME}-${BUILD_NUMBER}"
-cmake_base_args=(
- -G Ninja
- -DCMAKE_BUILD_TYPE:STRING=Release
- -DCMAKE_INSTALL_PREFIX="${WORKSPACE}/${inst_dir}"
- -DLLVM_VERSION_SUFFIX="pre"
- -DAOCC_REVISION="AOCC_6.0.0-Build#${BUILD_NUMBER} ${CURRENT_DATE}"
- -DCMAKE_CXX_STANDARD=17
- -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- -DCMAKE_CXX_LINK_FLAGS="-Wl,-rpath,$LD_LIBRARY_PATH"
- -DLLVM_ENABLE_ASSERTIONS=ON
- -DLLVM_LIT_ARGS=-v
- -DCLANG_DEFAULT_LINKER=lld
- -S "${WORKSPACE}/llvm-project/llvm"
- -DPython3_EXECUTABLE:STRING=/proj/csse_jenkins2/swtools/apps/python/versions/3.8.12/bin/python
- -DCMAKE_INSTALL_MESSAGE=LAZY
- -DCMAKE_C_COMPILER=gcc
- -DCMAKE_CXX_COMPILER=g++
- -DLLVM_PARALLEL_COMPILE_JOBS="${MEMORY_COMPILE_LIMIT}"
- -DLLVM_PARALLEL_LINK_JOBS="${MEMORY_LINK_LIMIT}"
- -DBUILD_SHARED_LIBS:STRING=ON
- -DLIBOMP_OMP_VERSION=50
- -DLIBOMP_OMPT_SUPPORT=ON
- -DLIBOMP_USE_DEBUGGER=ON
- -DLIBOMP_CFLAGS="-O2"
- -DLIBOMP_CPPFLAGS="-O2"
- -DLIBOMPTARGET_OMPD_SUPPORT=ON
- -DLIBOMP_OMPD_ENABLED=ON
- -DLIBOMP_OMPD_SUPPORT=ON
- -DFLANG_ENABLE_WERROR=ON
- -DLLVM_TARGETS_TO_BUILD:STRING="X86;AMDGPU"
- -DFLANG_RUNTIME_F128_MATH_LIB=libquadmath
-)
-
-if test -d "${WORKSPACE}/llvm-project/aocc-essentials"
+if test "${dual_flang_build}" = "true"
then
- echo "This looks like an AOCC branch."
- aocc_branch=1
+ fc=LLVM_then_Classic
else
- aocc_branch=0
+ fc=LLVM
fi
-if test ${aocc_branch} -ne 0
+if test -n "${CHANGE_TARGET}"
then
- echo "AOCC branch; adding extra required CMake switches."
- cmake_base_args+=(
- -DCMAKE_CXX_FLAGS="-Wno-error=pedantic -pthread"
- -DLLVM_LIT_ARGS="--xunit-xml-output=testresults.xunit.xml -v --timeout=600 --param blacklist=${WORKSPACE}/llvm-project/prj-essentials/devo/lit.blacklist.cfg"
- )
+ actual_target="${CHANGE_TARGET}"
+else
+ actual_target="${BRANCH_NAME}"
fi
-if test "${dual_flang_build}" = "true"
+build_args=(
+ --build_mode=All
+ --fc="${fc}"
+ --verbose
+)
+if test -n "${BUILD_TYPE:-}"
then
- amd_prefix="aocc-"
+ build_args+=(--aocc_build_type="${BUILD_TYPE}")
+ if test "${BUILD_TYPE}" = "RELEASE" -o "${BUILD_TYPE}" = "STAGING"
+ then
+ build_args+=(--branch="${BRANCH_NAME}")
+ fi
fi
-
-amd_tool_links() {
- ln -sf clang++ "${amd_prefix}clang++"
- ln -sf clang "${amd_prefix}clang"
- ln -sf clang-cpp "${amd_prefix}clang-cpp"
- ln -sf clang-cl "${amd_prefix}clang-cl"
- ln -sf lld "${amd_prefix}lld"
- ln -sf "${amd_prefix}flang" flang
-}
-
-execute_and_check "mkdir -p ${next_build_dir}"
-execute_and_check "cd ${next_build_dir}"
-
-cmake_args=("${cmake_base_args[@]}")
-
-if test ${aocc_branch} -ne 0
+if test "${actual_target}" != "amd-staging" -a "${actual_target}" != "upstream-main"
then
- cmake_args+=(
- -DLLVM_ENABLE_CLASSIC_FLANG=OFF
- )
-fi
-
-next_vendor_string="AMD AOCC"
-cmake_args+=(
- -B "${next_build_dir}"
- -DCLANG_VENDOR="${next_vendor_string}"
- -DFLANG_VENDOR="${next_vendor_string}"
- -DLLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra;flang"
- -DLLVM_ENABLE_RUNTIMES="openmp;flang-rt;compiler-rt"
-)
-
-set -x
-cmake "${cmake_args[@]}"
-ninja -C "${next_build_dir}" install
-stat=$?
-set +x
-if [ "${stat}" -eq 0 ]; then
- echo "********************************************************"
- echo "Execution of command : ninja -C ${next_build_dir} install - was successful" >> "${WORKSPACE}/command_executed.txt"
- echo "Execution of command : ninja -C ${next_build_dir} install - was successful"
- echo "********************************************************"
-else
- echo "########################################################"
- echo "Execution of command : ninja -C ${next_build_dir} install - was failed"
- echo "Please check BUILD_INSTALL.log file for details"
- echo "Please check ${WORKSPACE}/command_executed.txt file for commands executed till now"
- rm -v "${WORKSPACE}"/build_success.txt
- exit 1
- echo "########################################################"
+ build_args+=(--enable_how=PROJECTS)
fi
-
-execute_and_check "cd ${WORKSPACE}"
-
-if test "${dual_flang_build}" = "true"
+if test -n "${REL_MODE:-}"
then
- (
- cd "${next_build_dir}/bin" || exit 1
- amd_tool_links
- ) || exit 1
- (
- cd "${inst_dir}/bin" || exit 1
- amd_tool_links
- ) || exit 1
+ build_args+=(--release_mode="${REL_MODE}")
fi
-
-if test "${dual_flang_build}" != "true"
+if test -n "${STAGE_BUILD_NUM:-}"
then
- execute_and_check "tar -cJf ${inst_dir}.tar.xz ${inst_dir}"
+ build_args+=(--stage_build_num="${STAGE_BUILD_NUM}")
fi
-
-set -x
-ninja -C "${next_build_dir}" check-flang check-mlir
-stat=$?
-set +x
-if [ "${stat}" -eq 0 ]; then
- echo "********************************************************"
- echo "Execution of command : ninja -C ${next_build_dir} check-flang check-mlir - was successful" >> "${WORKSPACE}/command_executed.txt"
- echo "Execution of command : ninja -C ${next_build_dir} check-flang check-mlir - was successful"
- echo "********************************************************"
-else
- echo "########################################################"
- echo "Execution of command : ninja -C ${next_build_dir} check-flang check-mlir - was failed"
- echo "Please check ${WORKSPACE}/command_executed.txt file for commands executed till now"
- rm -v "${WORKSPACE}"/build_success.txt
- exit 1
- echo "########################################################"
-fi
-
-if test "${dual_flang_build}" = "true"
+if test -n "${VERSION_VAL:-}"
then
- next_build_dir="${WORKSPACE}/BUILD_c"
- execute_and_check "mkdir -p ${next_build_dir}"
- execute_and_check "cd ${next_build_dir}"
-
- cmake_args=("${cmake_base_args[@]}")
- next_vendor_string="AMD"
- cmake_args+=(
- -DLLVM_ENABLE_CLASSIC_FLANG=ON
- -B "${next_build_dir}"
- -DCLANG_VENDOR="${next_vendor_string}"
- -DFLANG_VENDOR="${next_vendor_string}"
- -DLLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra"
- -DLLVM_ENABLE_RUNTIMES="openmp;compiler-rt"
- )
-
- set -x
- cmake "${cmake_args[@]}"
- ninja -C "${next_build_dir}" install
- stat=$?
- set +x
-
- if test "${stat}" -ne 0
- then
- rm -v "${WORKSPACE}"/build_success.txt
- exit 1
- fi
-
- set -x
- ninja -C "${next_build_dir}" check-clang # Code smell: check-all fails in check of Python bindings.
- stat=$?
- set +x
-
- if test "${stat}" -ne 0
- then
- rm -v "${WORKSPACE}"/build_success.txt
- exit 1
- fi
-
- pgmath64_build_dir="${next_build_dir}/libpgmath64"
- next_build_dir="${pgmath64_build_dir}"
- mkdir -p "${next_build_dir}/include"
- cp /usr/lib/gcc/x86_64-redhat-linux/8/include/quadmath.h "${next_build_dir}/include"
-
- cmake_args=(
- -G Ninja
- -DCMAKE_BUILD_TYPE:STRING=Release
- -DCMAKE_INSTALL_PREFIX="${WORKSPACE}/${inst_dir}"
- -S "${WORKSPACE}/llvm-project/classic-flang/runtime/libpgmath"
- -B "${next_build_dir}"
- -DPython3_EXECUTABLE:STRING=/proj/csse_jenkins2/swtools/apps/python/versions/3.8.12/bin/python
- -DCMAKE_INSTALL_MESSAGE=LAZY
- -DCMAKE_C_COMPILER="${WORKSPACE}/${inst_dir}/bin/clang"
- -DCMAKE_CXX_COMPILER="${WORKSPACE}/${inst_dir}/bin/clang++"
- -DLLVM_PARALLEL_COMPILE_JOBS="${MEMORY_COMPILE_LIMIT}"
- -DLLVM_PARALLEL_LINK_JOBS="${MEMORY_LINK_LIMIT}"
- -DCMAKE_C_FLAGS="-I${next_build_dir}/include"
- -DCMAKE_CXX_FLAGS="-I${next_build_dir}/include"
- )
-
- set -x
- cmake "${cmake_args[@]}"
- ninja -C "${next_build_dir}" install
- stat=$?
- set +x
-
- if test "${stat}" -ne 0
- then
- rm -v "${WORKSPACE}"/build_success.txt
- exit 1
- fi
-
- # ToDo libpgmath32?
-
- next_build_dir="${next_build_dir}/classic-flang"
-
- cmake_args=(
- -G Ninja
- -DCMAKE_BUILD_TYPE:STRING=Release
- -DCMAKE_INSTALL_PREFIX="${WORKSPACE}/${inst_dir}"
- -S "${WORKSPACE}/llvm-project/classic-flang"
- -B "${next_build_dir}"
- -DPYTHON_EXECUTABLE:STRING=/proj/csse_jenkins2/swtools/apps/python/versions/3.8.12/bin/python
- -DCMAKE_INSTALL_MESSAGE=LAZY
- -DCMAKE_C_COMPILER="${WORKSPACE}/${inst_dir}/bin/clang"
- -DCMAKE_CXX_COMPILER="${WORKSPACE}/${inst_dir}/bin/clang++"
- -DCMAKE_Fortran_COMPILER="${WORKSPACE}/${inst_dir}/bin/flang"
- -DCMAKE_Fortran_COMPILER_ID=Flang
- -DLLVM_PARALLEL_COMPILE_JOBS="${MEMORY_COMPILE_LIMIT}"
- -DLLVM_PARALLEL_LINK_JOBS="${MEMORY_LINK_LIMIT}"
- -DCMAKE_C_FLAGS="-I${pgmath64_build_dir}/include"
- -DCMAKE_CXX_FLAGS="-I${pgmath64_build_dir}/include"
- -DFLANG_INCLUDE_DOCS:BOOL=OFF
- -DFLANG_INCLUDE_TESTS:BOOL=OFF
- -DFLANG_OPENMP_GPU_NVIDIA=on
- -DFLANG_OPENMP_GPU_AMD=on
- -DLLVM_CONFIG="${WORKSPACE}/${inst_dir}/bin/llvm-config"
- )
-
- set -x
- cmake "${cmake_args[@]}"
- ninja -C "${next_build_dir}" install
- stat=$?
- set +x
-
- if test "${stat}" -ne 0
- then
- rm -v "${WORKSPACE}"/build_success.txt
- exit 1
- fi
-
- execute_and_check "cd ${WORKSPACE}"
-
- execute_and_check "tar -cJf ${inst_dir}.tar.xz ${inst_dir}"
+ build_args+=(--version_val="${VERSION_VAL}")
fi
-execute_and_check "cd ${WORKSPACE}/llvm-project"
-MAIN_COMMIT_HASH=$(git rev-parse HEAD)
-echo "$MAIN_COMMIT_HASH" >> "${WORKSPACE}"/VERSION_AND_COMMIT_HASH_OF_BUILD_"${BUILD_NUMBER}".txt
-
-if [ ! -f "${WORKSPACE}/build_success.txt" ]
-then
- echo "Job failed - Please check ${WORKSPACE}/command_executed.txt file for commands executed till now"
- exit 1
-fi
+echo python3 -u "${ess_dir}/build_essentials/aocc_build.py" "${build_args[@]}"
+python3 -u "${ess_dir}/build_essentials/aocc_build.py" "${build_args[@]}"
>From a6b4151de2915400c97bdc7b1e62f7dd834f2973 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Fri, 21 Nov 2025 12:01:19 +0000
Subject: [PATCH 34/72] CPUPC-7979: CI materials synced from staging.
Change-Id: Id01b76dab8e94eb34160dd310d07039626168e2d
---
.amd-ci/upstream/Jenkinsfile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index 9f989dcb3818fc..48c41449cfdc67 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -7,7 +7,8 @@ String releaseBranchPrefix = 'aocc_'
Boolean targetIsRelBranch = actualTarget.startsWith(releaseBranchPrefix)
-Boolean dualFlangBuild = actualTarget != upstreamBranch
+// Code smell: should be enabled for staging once the underlying llvm code catches up:
+Boolean dualFlangBuild = actualTarget != upstreamBranch && actualTarget != stagingBranch
/**
* Coerce Result enums to String, seems to
>From 3cf65bd343017ade1f153793f9775040e8f692d3 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Thu, 15 Jan 2026 11:18:10 +0000
Subject: [PATCH 35/72] CPUPC-7979: Use new facility in aocc_env for selecting
a non-default GCC for building.
Change-Id: Ib03fa76bfeb8391959db02df43f5037bd9a75df8
---
.amd-ci/upstream/run.sh | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/.amd-ci/upstream/run.sh b/.amd-ci/upstream/run.sh
index 39b18ba4f5c8c3..015d139405becb 100755
--- a/.amd-ci/upstream/run.sh
+++ b/.amd-ci/upstream/run.sh
@@ -7,14 +7,20 @@ else
ess_dir=aocc-essentials
fi
-mod_cmd1=". ${ess_dir}/build_essentials/linux/aocc_env.sh"
-echo "${mod_cmd1}"
-${mod_cmd1}
-
_ver_file=llvm-project/cmake/Modules/LLVMVersion.cmake
LLVM_VERSION_MAJOR=$(grep -w "set(LLVM_VERSION_MAJOR" "${_ver_file}" | awk -F' ' '{print $NF}' | tr -d ')')
LLVM_VERSION_MINOR=$(grep -w "set(LLVM_VERSION_MINOR" "${_ver_file}" | awk -F' ' '{print $NF}' | tr -d ')')
LLVM_VERSION_PATCH=$(grep -w "set(LLVM_VERSION_PATCH" "${_ver_file}" | awk -F' ' '{print $NF}' | tr -d ')')
+
+if test "${LLVM_VERSION_MAJOR}" -gt 21
+then
+ export AOCC_GCC_VER="11.4.0"
+fi
+
+mod_cmd=". ${ess_dir}/build_essentials/linux/aocc_env.sh"
+echo "${mod_cmd}"
+${mod_cmd}
+
CLANG_VERSION=$LLVM_VERSION_MAJOR.$LLVM_VERSION_MINOR.$LLVM_VERSION_PATCH
MAIN_COMMIT_HASH=$(git -C llvm-project rev-parse HEAD)
{
@@ -22,16 +28,6 @@ MAIN_COMMIT_HASH=$(git -C llvm-project rev-parse HEAD)
echo "$MAIN_COMMIT_HASH"
} > VERSION_AND_COMMIT_HASH_OF_BUILD_"${BUILD_NUMBER}".txt
-if test "${LLVM_VERSION_MAJOR}" -gt 21
-then
- mod_cmd2=". /proj/csse_jenkins2/swtools/c/rhel7-gcc8.3.1/environment-modules-5.4.0-j6k56q3i/init/bash"
- echo "${mod_cmd2}"
- ${mod_cmd2}
- mod_cmd3="module load -v gcc/11.4.0"
- echo "${mod_cmd3}"
- ${mod_cmd3}
-fi
-
dual_flang_build="${AOCC_DUAL_FLANG_BUILD:-false}"
if test "${dual_flang_build}" = "true"
>From b436e405bee2f531205d6826ab391f39137a619a Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Thu, 15 Jan 2026 13:44:50 +0000
Subject: [PATCH 36/72] CPUPC-7979: Synced CI materials.
Change-Id: Ia03916add3675fc1b6e68033e44e489286c18bae
---
.amd-ci/upstream/Jenkinsfile | 1 +
.amd-ci/upstream/upstream_jenkins_excludes.txt | 1 +
2 files changed, 2 insertions(+)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index 48c41449cfdc67..55b426f1d95455 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -388,6 +388,7 @@ try {
name: 'CUT',
value: env.BUILD_URL + 'artifact/' + compilerTar
),
+ string(name: 'BRANCH_CONTEXT', value: actualTarget),
string(name: 'CHANGE_ID', value: env.CHANGE_ID ?: ''),
string(name: gitCommitEnv, value: gitVars.GIT_COMMIT ?: '')
]
diff --git a/.amd-ci/upstream/upstream_jenkins_excludes.txt b/.amd-ci/upstream/upstream_jenkins_excludes.txt
index 9e7be5fd325bd7..ac0492fca8f315 100644
--- a/.amd-ci/upstream/upstream_jenkins_excludes.txt
+++ b/.amd-ci/upstream/upstream_jenkins_excludes.txt
@@ -18,4 +18,5 @@
^prj-essentials/devo/aocc/CODEOWNERS\.AOCC\.m4
^\.github/\.ai_pr_platform/
^\.github/workflows/amd-.*\.yml
+^\.github/workflows/amd-.*\.yaml
^CODEOWNERS
>From 55fc7b591a39434c372c90362fdd78a7eca851c1 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Tue, 20 Jan 2026 15:48:33 +0000
Subject: [PATCH 37/72] CPUPC-7979: Bumped LLVM version.
Change-Id: I1b5fda36677429a73ead8f7b0e520275d8e35dec
---
.amd-ci/upstream/Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index 55b426f1d95455..5eb9cfbb2de5b3 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -134,7 +134,7 @@ Boolean hasSourceChanges = true, isSkippableMerge = false
Integer zero = 0, successStat = zero
// llvmVer is processed by automation:
-String llvmVer = '22.0.0'
+String llvmVer = '23.0.0'
// stageBuildNum is processed during branch creation:
String stageBuildNum = env.BUILD_NUMBER
// versionVal is processed during branch creation:
>From a548bcb0c60d57c75b9749f3459527f396b6c264 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Wed, 28 Jan 2026 13:30:19 +0000
Subject: [PATCH 38/72] CPUPC-7979: Synced CI materials from aocc_llvm21.
Change-Id: I80f9d2a5419d7b4e43fdb3a9b9ace86032a5d451
---
.amd-ci/upstream/upstream_jenkins_excludes.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/.amd-ci/upstream/upstream_jenkins_excludes.txt b/.amd-ci/upstream/upstream_jenkins_excludes.txt
index ac0492fca8f315..68a9fc85af2f75 100644
--- a/.amd-ci/upstream/upstream_jenkins_excludes.txt
+++ b/.amd-ci/upstream/upstream_jenkins_excludes.txt
@@ -20,3 +20,4 @@
^\.github/workflows/amd-.*\.yml
^\.github/workflows/amd-.*\.yaml
^CODEOWNERS
+^.*/.vscode/
>From 963394670c8066f2911414d466d2022cee59f014 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Tue, 24 Feb 2026 09:47:43 +0000
Subject: [PATCH 39/72] CPUPC-7979: Synced CI materials.
Change-Id: I223fc799b12fcb21093126934d49e73db2a16a5c
---
.amd-ci/upstream/Jenkinsfile | 4 ++--
.amd-ci/upstream/upstream_jenkins_excludes.txt | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index 5eb9cfbb2de5b3..c1012f4bc46f9c 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -191,7 +191,7 @@ try {
userRemoteConfigs: [
[
credentialsId: gitHubAppCredsId,
- url: 'https://github.amd.com/AOCC/aocc-devops.git'
+ url: 'https://github.amd.com/cpu-compilers/aocc-devops.git'
]
]
)
@@ -220,7 +220,7 @@ try {
} else {
essDir = 'aocc-essentials'
}
- theUrl = 'https://github.amd.com/AOCC/llvm-project'
+ theUrl = 'https://github.amd.com/cpu-compilers/llvm-project'
dir (llvmProj) {
gitVars = checkout(
changelog: true,
diff --git a/.amd-ci/upstream/upstream_jenkins_excludes.txt b/.amd-ci/upstream/upstream_jenkins_excludes.txt
index 68a9fc85af2f75..771210e0aa04b8 100644
--- a/.amd-ci/upstream/upstream_jenkins_excludes.txt
+++ b/.amd-ci/upstream/upstream_jenkins_excludes.txt
@@ -1,7 +1,5 @@
# Extended regexp patterns of files to exclude from the AOCC 'upstream' pipeline.
^.*aocc-essentials/notes/
-^.*SPEC_perf_cfgs/cpuV8/
-^.*SPEC_perf_cfgs/cpuv8_.*
^.*_jenkins_excludes.txt
^.*/bump_aocc_ver.sh
^.*/bump_llvm_ver.sh
@@ -17,6 +15,7 @@
^.*prj-essentials/devo/aocc/merge/
^prj-essentials/devo/aocc/CODEOWNERS\.AOCC\.m4
^\.github/\.ai_pr_platform/
+^\.github/copilot-instructions\.md
^\.github/workflows/amd-.*\.yml
^\.github/workflows/amd-.*\.yaml
^CODEOWNERS
>From 1f31acd5651d7f7e360262096e333acb925f9534 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Tue, 24 Feb 2026 13:21:21 +0000
Subject: [PATCH 40/72] CPUPC-7979: Want to be able to build with GCC 8.
Change-Id: I55e652e27027250905d34834c559c76870fe577f
---
.amd-ci/upstream/run.sh | 5 -----
1 file changed, 5 deletions(-)
diff --git a/.amd-ci/upstream/run.sh b/.amd-ci/upstream/run.sh
index 015d139405becb..075c949f6902b9 100755
--- a/.amd-ci/upstream/run.sh
+++ b/.amd-ci/upstream/run.sh
@@ -12,11 +12,6 @@ LLVM_VERSION_MAJOR=$(grep -w "set(LLVM_VERSION_MAJOR" "${_ver_file}" | awk -F' '
LLVM_VERSION_MINOR=$(grep -w "set(LLVM_VERSION_MINOR" "${_ver_file}" | awk -F' ' '{print $NF}' | tr -d ')')
LLVM_VERSION_PATCH=$(grep -w "set(LLVM_VERSION_PATCH" "${_ver_file}" | awk -F' ' '{print $NF}' | tr -d ')')
-if test "${LLVM_VERSION_MAJOR}" -gt 21
-then
- export AOCC_GCC_VER="11.4.0"
-fi
-
mod_cmd=". ${ess_dir}/build_essentials/linux/aocc_env.sh"
echo "${mod_cmd}"
${mod_cmd}
>From d12585a86e53c66de641966f86c85c044a9e32df Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Wed, 25 Feb 2026 10:07:41 +0000
Subject: [PATCH 41/72] CPUPC-7979: Maintain llvm-flang package name fragment
in this pipeline.
Change-Id: I7e1450966f315f47562107c4b474908e31a30364
---
.amd-ci/upstream/run.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.amd-ci/upstream/run.sh b/.amd-ci/upstream/run.sh
index 075c949f6902b9..ccf1e600a88542 100755
--- a/.amd-ci/upstream/run.sh
+++ b/.amd-ci/upstream/run.sh
@@ -69,5 +69,7 @@ then
build_args+=(--version_val="${VERSION_VAL}")
fi
+export AOCC_LLVM_FLANG_PKG_NAME="true"
+
echo python3 -u "${ess_dir}/build_essentials/aocc_build.py" "${build_args[@]}"
python3 -u "${ess_dir}/build_essentials/aocc_build.py" "${build_args[@]}"
>From 3e0c6296613ff32992e5ebc242348f2b06223641 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Wed, 25 Feb 2026 13:14:06 +0000
Subject: [PATCH 42/72] CPUPC-7979: Turn downstream flow interruption on
failure into legitimate failure.
Change-Id: Ifd425c709b13eeb10b663a5b4fea9ba9ad3bab4e
---
.amd-ci/upstream/Jenkinsfile | 120 +++++++++++++++++++++++++++--------
1 file changed, 94 insertions(+), 26 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index c1012f4bc46f9c..21277b50761b0d 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -17,8 +17,10 @@ Boolean dualFlangBuild = actualTarget != upstreamBranch && actualTarget != stagi
String abortedResultStr = Result.ABORTED, failureResultStr = Result.FAILURE
String notBuiltResultStr = Result.NOT_BUILT, successResultStr = Result.SUCCESS
-if (!(actualTarget in [stagingBranch, upstreamBranch]) &&
- !targetIsRelBranch) {
+if (
+ !(actualTarget in [stagingBranch, upstreamBranch]) &&
+ !targetIsRelBranch
+) {
echo 'Pipeline skipped for base branch ' + actualTarget
return this
}
@@ -26,17 +28,21 @@ if (!(actualTarget in [stagingBranch, upstreamBranch]) &&
String actualHead = env.CHANGE_BRANCH ?: env.BRANCH_NAME
Boolean isPrBranch = env.CHANGE_BRANCH != null
-if (!isPrBranch &&
- !(actualTarget in [stagingBranch, upstreamBranch]) &&
- !targetIsRelBranch) {
+if (
+ !isPrBranch &&
+ !(actualTarget in [stagingBranch, upstreamBranch]) &&
+ !targetIsRelBranch
+) {
echo 'Pipeline skipped for non-PR branch ' + actualHead + ' of base ' + actualTarget
return this
}
String manualCause = 'hudson.model.Cause$UserIdCause'
-if (isPrBranch &&
- pullRequest.draft &&
- !currentBuild.getBuildCauses(manualCause)) {
+if (
+ isPrBranch &&
+ pullRequest.draft &&
+ !currentBuild.getBuildCauses(manualCause)
+) {
String cause = currentBuild.getBuildCauses().shortDescription // groovylint-disable-line UnnecessaryGetter
echo 'Draft PR aborted for cause ' + cause
echo 'Pipeline only runs for draft PRs if manually triggered.'
@@ -51,9 +57,11 @@ String buildTypeStaging = 'STAGING' // groovylint-disable-line UnusedVariable
// buildType is processed during branch creation:
String buildType = (isPrBranch ? buildTypePresub : buildTypeRelease)
-if (!isPrBranch &&
+if (
+ !isPrBranch &&
env.BRANCH_NAME != stagingBranch &&
- !env.BRANCH_NAME.startsWith(releaseBranchPrefix)) {
+ !env.BRANCH_NAME.startsWith(releaseBranchPrefix)
+) {
// Treat it as 'presub'.
buildType = buildTypePresub
}
@@ -68,20 +76,24 @@ Boolean postsub = (
)
)
-if (postsub && !(env.BRANCH_NAME in [stagingBranch, upstreamBranch]) &&
- !(env.BRANCH_NAME.startsWith(releaseBranchPrefix))) {
+if (
+ postsub && !(env.BRANCH_NAME in [stagingBranch, upstreamBranch]) &&
+ !(env.BRANCH_NAME.startsWith(releaseBranchPrefix))
+) {
echo 'Pipeline postsub not supported for branch ' + env.BRANCH_NAME
return this
}
Boolean disableStaging = false, disableRelease = true
Boolean timerTrigger = currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause')
-if (((disableStaging &&
- actualTarget == stagingBranch) ||
+if (
+ ((disableStaging &&
+ actualTarget == stagingBranch) ||
(disableRelease &&
targetIsRelBranch)) &&
- !currentBuild.getBuildCauses(manualCause) &&
- !timerTrigger) {
+ !currentBuild.getBuildCauses(manualCause) &&
+ !timerTrigger
+) {
String cause = currentBuild.getBuildCauses().shortDescription // groovylint-disable-line UnnecessaryGetter
echo 'Pipeline for base ' + actualTarget + ' not built for cause ' + cause
echo 'Pipeline only runs if manually or timer triggered.'
@@ -164,12 +176,12 @@ String compilerTar
try {
timeout(time: fullTimeoutH, unit: 'HOURS') {
- node ('atl && apptainer') {
+ node('atl && apptainer') {
skipDefaultCheckout()
List cleanExcludes = [
[pattern: 'llvm-project/.git/**', type: 'EXCLUDE']
]
- stage ('prepare') {
+ stage('prepare') {
String referenceRepo = env.JENKINS_REMOTE_GIT_CACHE ?: 'NoSuchReferenceRepo'
cleanWs(
deleteDirs: true,
@@ -221,7 +233,7 @@ try {
essDir = 'aocc-essentials'
}
theUrl = 'https://github.amd.com/cpu-compilers/llvm-project'
- dir (llvmProj) {
+ dir(llvmProj) {
gitVars = checkout(
changelog: true,
scm: scmGit(
@@ -331,7 +343,7 @@ try {
)
return // From node
}
- stage ('run') {
+ stage('run') {
try {
withEnv([
'PATH=' + linuxBasePath,
@@ -367,7 +379,7 @@ try {
return // From timeout
}
if (runDownstream && compilerTar) {
- stage ('downstream-tasks') {
+ stage('downstream-tasks') {
Map allTasks = [
failFast: false,
]
@@ -378,9 +390,9 @@ try {
for (suite in downstreamSuites) {
String suiteName = suite
allTasks[suiteName] = {
- stage ('downstream-suite-' + suiteName) {
- build(
- propagate: true,
+ stage('downstream-suite-' + suiteName) {
+ def result = build( // groovylint-disable-line NoDef,VariableTypeRequired
+ propagate: false,
wait: true,
job: 'AOCC-Workloads/TestSuites/' + suiteName,
parameters: [
@@ -393,6 +405,7 @@ try {
string(name: gitCommitEnv, value: gitVars.GIT_COMMIT ?: '')
]
)
+ handleBuildResult(result, true)
}
}
}
@@ -424,8 +437,10 @@ void setStatusToLastCompleted() {
String previousResult = 'SUCCESS' // Keep as a literal string because of scoping.
String nBStr = 'NOT_BUILT' // Keep as a literal string because of scoping.
- while (previousBuild &&
- (!(previousBuild.result) || previousBuild.result == nBStr)) {
+ while (
+ previousBuild &&
+ (!(previousBuild.result) || previousBuild.result == nBStr)
+ ) {
previousBuild = previousBuild.previousBuild
}
@@ -438,3 +453,56 @@ void setStatusToLastCompleted() {
echo('Setting build result to ' + previousResult + ' from a previous build.')
currentBuild.result = previousResult
}
+
+/*
+ * Using build(propagate: false, ...) and the following function
+ * supplies better information back to GitHub Checks than if
+ * we leave it to 'propagate: true'.
+ * Code smell: this method is also in the main AOCC CommitCheck class.
+ */
+void handleBuildResult(Object result, Boolean blocking) {
+ // groovylint-disable DuplicateStringLiteral,UnnecessaryGetter
+ String squote = "'", space = ' ', dot = '.'
+ String closeAnchor = '</a>', closeChevron = '>', closeTag = closeChevron
+ String downUrl = (
+ "Downstream job <a href='" +
+ result.getAbsoluteUrl() +
+ 'console' + squote + closeTag +
+ result.getFullDisplayName() + closeAnchor
+ )
+ String downMsg = 'Downstream job ' + result.getFullDisplayName()
+ String resultStr = result.result
+ switch (resultStr) {
+ case 'SUCCESS':
+ break
+ case 'UNSTABLE':
+ // Code smell: might want to downgrade currentBuild result here?
+ break
+ case 'ABORTED':
+ // No whitelisted way to throw FlowInterruptedException explicitly:
+ String theStat = 'aborted.'
+ catchError(
+ buildResult: resultStr,
+ stageResult: resultStr,
+ message: downMsg + space + theStat
+ ) {
+ error(downUrl + space + theStat)
+ }
+ case 'FAILURE':
+ String theStat = 'failed'
+ if (blocking) {
+ catchError(
+ buildResult: resultStr,
+ stageResult: resultStr,
+ message: downMsg + space + theStat
+ ) {
+ error(downUrl + space + theStat + dot)
+ }
+ } else {
+ echo(downUrl + space + theStat + ' but non-blocking was requested.')
+ }
+ break
+ default:
+ throw new RuntimeException('Unexpected downstream result: ' + resultStr) // groovylint-disable-line LineLength,ThrowRuntimeException
+ }
+}
>From aeebbdff704b94e641c83df1fc1310ab34fcfe96 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Mon, 16 Mar 2026 07:48:49 +0000
Subject: [PATCH 43/72] CPUPC-7979: CI materials synced from aocc_llvm21.
Change-Id: Ia76baee15f208576cb37a4a37bcffe47458b7753
---
.amd-ci/upstream/Jenkinsfile | 45 +++++++++++++------
.amd-ci/upstream/run.sh | 9 +---
.../upstream/upstream_jenkins_excludes.txt | 1 +
3 files changed, 34 insertions(+), 21 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index 21277b50761b0d..698c590ba00765 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -173,6 +173,7 @@ def gitVars // groovylint-disable-line NoDef,VariableTypeRequired
Integer fullTimeoutH = 15
String compilerTar
+String mainBranchName = 'main'
try {
timeout(time: fullTimeoutH, unit: 'HOURS') {
@@ -194,7 +195,7 @@ try {
changelog: false,
scm: scmGit(
gitTool: gitTool,
- branches: [[name: 'main']],
+ branches: [[name: mainBranchName]],
extensions: [
cloneOption(
reference: referenceRepo + '/aocc-devops.git'
@@ -383,29 +384,47 @@ try {
Map allTasks = [
failFast: false,
]
- List<String> downstreamSuites = ['GFortran', 'NAGLLVM']
+ String fujitsuSuiteName = 'Fujitsu'
+ String gfortranSuiteName = 'GFortran'
+ List<String> downstreamSuites = [gfortranSuiteName, 'NAGLLVM']
if (timerTrigger) {
- downstreamSuites.addAll(['Fujitsu', 'Polyhedron'])
+ downstreamSuites.addAll([fujitsuSuiteName, 'Polyhedron'])
}
for (suite in downstreamSuites) {
String suiteName = suite
+ List suiteParams = [
+ string(
+ name: 'CUT',
+ value: env.BUILD_URL + 'artifact/' + compilerTar
+ ),
+ string(name: 'BRANCH_CONTEXT', value: actualTarget),
+ string(name: 'CHANGE_ID', value: env.CHANGE_ID ?: ''),
+ string(name: gitCommitEnv, value: gitVars.GIT_COMMIT ?: '')
+ ]
+ if (suite == gfortranSuiteName) {
+ String sBr = mainBranchName
+ if (actualTarget == 'aocc_llvm21') {
+ /*
+ * Thirumalai notes
+ * "21.x had some issues with tests.py (LLVM-LIT), so I switched to 22.x,
+ * and there were no issues there with LIT."
+ */
+ sBr = 'release/22.x'
+ }
+ suiteParams += string(
+ name: 'SUITE_BRANCH',
+ value: sBr
+ )
+ }
allTasks[suiteName] = {
stage('downstream-suite-' + suiteName) {
def result = build( // groovylint-disable-line NoDef,VariableTypeRequired
propagate: false,
wait: true,
job: 'AOCC-Workloads/TestSuites/' + suiteName,
- parameters: [
- string(
- name: 'CUT',
- value: env.BUILD_URL + 'artifact/' + compilerTar
- ),
- string(name: 'BRANCH_CONTEXT', value: actualTarget),
- string(name: 'CHANGE_ID', value: env.CHANGE_ID ?: ''),
- string(name: gitCommitEnv, value: gitVars.GIT_COMMIT ?: '')
- ]
+ parameters: suiteParams
)
- handleBuildResult(result, true)
+ handleBuildResult(result, suite != fujitsuSuiteName)
}
}
}
diff --git a/.amd-ci/upstream/run.sh b/.amd-ci/upstream/run.sh
index ccf1e600a88542..bbf2b80590f781 100755
--- a/.amd-ci/upstream/run.sh
+++ b/.amd-ci/upstream/run.sh
@@ -32,13 +32,6 @@ else
fc=LLVM
fi
-if test -n "${CHANGE_TARGET}"
-then
- actual_target="${CHANGE_TARGET}"
-else
- actual_target="${BRANCH_NAME}"
-fi
-
build_args=(
--build_mode=All
--fc="${fc}"
@@ -52,7 +45,7 @@ then
build_args+=(--branch="${BRANCH_NAME}")
fi
fi
-if test "${actual_target}" != "amd-staging" -a "${actual_target}" != "upstream-main"
+if test "${LLVM_VERSION_MAJOR}" -le 21
then
build_args+=(--enable_how=PROJECTS)
fi
diff --git a/.amd-ci/upstream/upstream_jenkins_excludes.txt b/.amd-ci/upstream/upstream_jenkins_excludes.txt
index 771210e0aa04b8..a500dcfae89200 100644
--- a/.amd-ci/upstream/upstream_jenkins_excludes.txt
+++ b/.amd-ci/upstream/upstream_jenkins_excludes.txt
@@ -16,6 +16,7 @@
^prj-essentials/devo/aocc/CODEOWNERS\.AOCC\.m4
^\.github/\.ai_pr_platform/
^\.github/copilot-instructions\.md
+^\.github/instructions/
^\.github/workflows/amd-.*\.yml
^\.github/workflows/amd-.*\.yaml
^CODEOWNERS
>From fd2ca3ddd14671ae39993e663a66515089da4022 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Wed, 18 Mar 2026 15:55:15 +0000
Subject: [PATCH 44/72] CPUPC-7979: CI materials synced from aocc_llvm21.
Change-Id: Id2b8876dcd8cd9c4eb8e86bb200900fc2685c21a
---
.amd-ci/upstream/Jenkinsfile | 49 ++++++++++++++++++++++++++++++------
1 file changed, 42 insertions(+), 7 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index 698c590ba00765..5358639ee3ca52 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -359,16 +359,36 @@ try {
}
currentBuild.result = successResultStr
} finally {
- def compilerZips = findFiles( // groovylint-disable-line NoDef,VariableTypeRequired
- glob: "*-${env.BUILD_NUMBER}*.tar.xz"
- )
+ String cmakeBuildDir = findBuildDir()
+ def compilerZips // groovylint-disable-line NoDef,VariableTypeRequired
+ if (cmakeBuildDir) {
+ compilerZips = findFiles(
+ glob: "${cmakeBuildDir}/*-${env.BUILD_NUMBER}*.tar.xz"
+ )
+ archiveArtifacts(
+ allowEmptyArchive: true,
+ artifacts: (
+ "${cmakeBuildDir}/*_logs/**," +
+ "${cmakeBuildDir}/*.tar.xz," +
+ "${cmakeBuildDir}/*.txt," +
+ '*.txt'
+ )
+ )
+ } else {
+ compilerZips = findFiles(
+ glob: "*-${env.BUILD_NUMBER}*.tar.xz"
+ )
+ archiveArtifacts(
+ allowEmptyArchive: true,
+ artifacts: '*_logs/**,*.tar.xz,*.txt'
+ )
+ }
if (compilerZips) {
compilerTar = compilerZips[zero].path
+ echo('Found built compiler ' + compilerTar)
+ } else {
+ echo('No built compiler tar was found.')
}
- archiveArtifacts(
- allowEmptyArchive: true,
- artifacts: '*_logs/**,*.tar.xz,*.txt'
- )
cleanWs(
deleteDirs: true,
patterns: cleanExcludes
@@ -525,3 +545,18 @@ void handleBuildResult(Object result, Boolean blocking) {
throw new RuntimeException('Unexpected downstream result: ' + resultStr) // groovylint-disable-line LineLength,ThrowRuntimeException
}
}
+
+/*
+ * Code smell: this method is also in the main AOCC Build class.
+ */
+String findBuildDir() {
+ Integer zero = 0 // groovylint-disable DuplicateNumberLiteral
+ List<String> buildDirs = findFiles()
+ .findAll { f -> f.directory && f.name ==~ /.*_build$/ }*.name.sort()
+ echo("Found out-of-tree build dirs: ${buildDirs}")
+ if (buildDirs) {
+ assert buildDirs.size() == 1
+ return buildDirs[zero]
+ }
+ return null
+}
>From 5f1ebc8a3db3d908eeb61927d090c6c92674608a Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Tue, 24 Mar 2026 08:31:02 +0000
Subject: [PATCH 45/72] CPUPC-7979: Need to use closure suite name to control
blocking behaviour.
Change-Id: Ib970057fec724c25aec2dda5e209c3e6df3d68e2
---
.amd-ci/upstream/Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index 5358639ee3ca52..faca15935b8004 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -444,7 +444,7 @@ try {
job: 'AOCC-Workloads/TestSuites/' + suiteName,
parameters: suiteParams
)
- handleBuildResult(result, suite != fujitsuSuiteName)
+ handleBuildResult(result, suiteName != fujitsuSuiteName)
}
}
}
>From 099e072ed9caedbd9c73a5f54708a23b2c14d093 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Mon, 13 Apr 2026 07:35:48 +0000
Subject: [PATCH 46/72] CPUPC-7979: Synced in some pipeline structure changes
from aocc_llvm21.
Change-Id: I5413dd19cc8adccb209673f70ff74028a6ce137b
---
.amd-ci/upstream/Jenkinsfile | 40 +++++-------------------------------
1 file changed, 5 insertions(+), 35 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index faca15935b8004..00ecfcef580df9 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -17,6 +17,8 @@ Boolean dualFlangBuild = actualTarget != upstreamBranch && actualTarget != stagi
String abortedResultStr = Result.ABORTED, failureResultStr = Result.FAILURE
String notBuiltResultStr = Result.NOT_BUILT, successResultStr = Result.SUCCESS
+Boolean isAmdBranch = (env.BRANCH_NAME == stagingBranch || env.BRANCH_NAME.startsWith(releaseBranchPrefix))
+
if (
!(actualTarget in [stagingBranch, upstreamBranch]) &&
!targetIsRelBranch
@@ -57,11 +59,7 @@ String buildTypeStaging = 'STAGING' // groovylint-disable-line UnusedVariable
// buildType is processed during branch creation:
String buildType = (isPrBranch ? buildTypePresub : buildTypeRelease)
-if (
- !isPrBranch &&
- env.BRANCH_NAME != stagingBranch &&
- !env.BRANCH_NAME.startsWith(releaseBranchPrefix)
-) {
+if (!isPrBranch && !isAmdBranch) {
// Treat it as 'presub'.
buildType = buildTypePresub
}
@@ -113,7 +111,7 @@ String skipStr = 'Skipping build.', contStr = 'Continuing build.'
String contTimerReason = 'Timer trigger.' + space + contStr
List propsList = []
-if (isPrBranch) {
+if (isPrBranch) { // Sic; don't want postsub on upstream-main to go through this block.
propsList.add(
disableConcurrentBuilds(abortPrevious: true)
)
@@ -243,8 +241,7 @@ try {
browser: github(theUrl),
extensions: scm.extensions + [
cloneOption(
- depth: 2, // To compute the changelog.
- honorRefspec: true, noTags: true, shallow: true,
+ honorRefspec: true, noTags: true,
reference: referenceRepo + slash + llvmProjRepo
),
firstBuildChangelog()
@@ -466,33 +463,6 @@ try {
throw e
}
-/*
- * For when work is skipped.
- * Code smell: this method is also in the main AOCC CommitCheck class.
- */
-void setStatusToLastCompleted() {
- def previousBuild = currentBuild.previousBuild // groovylint-disable-line NoDef,VariableTypeRequired
- // Default fallback:
- String previousResult = 'SUCCESS' // Keep as a literal string because of scoping.
- String nBStr = 'NOT_BUILT' // Keep as a literal string because of scoping.
-
- while (
- previousBuild &&
- (!(previousBuild.result) || previousBuild.result == nBStr)
- ) {
- previousBuild = previousBuild.previousBuild
- }
-
- if (previousBuild && previousBuild.result) {
- previousResult = previousBuild.result
- } else {
- previousResult = nBStr
- }
-
- echo('Setting build result to ' + previousResult + ' from a previous build.')
- currentBuild.result = previousResult
-}
-
/*
* Using build(propagate: false, ...) and the following function
* supplies better information back to GitHub Checks than if
>From 99817da07411c635b314933f12e9a46eeac81ea7 Mon Sep 17 00:00:00 2001
From: "Kallesh, Vijay-teekinavar" <Vijay-teekinavar.Kallesh at amd.com>
Date: Tue, 5 May 2026 09:56:01 +0000
Subject: [PATCH 47/72] CPUPC-17496 Refactor upstream run.sh build flow helpers
Extract shared helper functions for version parsing, build-arg construction, and build execution in .amd-ci/upstream/run.sh without introducing PR dual-build behavior.
Co-authored-by: Cursor <cursoragent at cursor.com>
---
.amd-ci/upstream/run.sh | 112 +++++++++++++++++++++++-----------------
1 file changed, 65 insertions(+), 47 deletions(-)
diff --git a/.amd-ci/upstream/run.sh b/.amd-ci/upstream/run.sh
index bbf2b80590f781..062827cabfb821 100755
--- a/.amd-ci/upstream/run.sh
+++ b/.amd-ci/upstream/run.sh
@@ -7,62 +7,80 @@ else
ess_dir=aocc-essentials
fi
-_ver_file=llvm-project/cmake/Modules/LLVMVersion.cmake
-LLVM_VERSION_MAJOR=$(grep -w "set(LLVM_VERSION_MAJOR" "${_ver_file}" | awk -F' ' '{print $NF}' | tr -d ')')
-LLVM_VERSION_MINOR=$(grep -w "set(LLVM_VERSION_MINOR" "${_ver_file}" | awk -F' ' '{print $NF}' | tr -d ')')
-LLVM_VERSION_PATCH=$(grep -w "set(LLVM_VERSION_PATCH" "${_ver_file}" | awk -F' ' '{print $NF}' | tr -d ')')
+LLVM_GIT_DIR=llvm-project
mod_cmd=". ${ess_dir}/build_essentials/linux/aocc_env.sh"
echo "${mod_cmd}"
${mod_cmd}
-CLANG_VERSION=$LLVM_VERSION_MAJOR.$LLVM_VERSION_MINOR.$LLVM_VERSION_PATCH
-MAIN_COMMIT_HASH=$(git -C llvm-project rev-parse HEAD)
-{
- echo "CLANG_VERSION value is - $CLANG_VERSION"
- echo "$MAIN_COMMIT_HASH"
-} > VERSION_AND_COMMIT_HASH_OF_BUILD_"${BUILD_NUMBER}".txt
+export AOCC_LLVM_FLANG_PKG_NAME="true"
-dual_flang_build="${AOCC_DUAL_FLANG_BUILD:-false}"
+# Parse the LLVM version from the in-tree cmake module.
+get_llvm_version() {
+ local _ver_file=llvm-project/cmake/Modules/LLVMVersion.cmake
+ LLVM_VERSION_MAJOR=$(grep -w "set(LLVM_VERSION_MAJOR" "${_ver_file}" | awk -F' ' '{print $NF}' | tr -d ')')
+ LLVM_VERSION_MINOR=$(grep -w "set(LLVM_VERSION_MINOR" "${_ver_file}" | awk -F' ' '{print $NF}' | tr -d ')')
+ LLVM_VERSION_PATCH=$(grep -w "set(LLVM_VERSION_PATCH" "${_ver_file}" | awk -F' ' '{print $NF}' | tr -d ')')
+}
-if test "${dual_flang_build}" = "true"
-then
- fc=LLVM_then_Classic
-else
- fc=LLVM
-fi
+# Build the argv array passed to aocc_build.py. Single source of truth.
+construct_build_args() {
+ local fc=$1
+ build_args=(
+ --build_mode=All
+ --fc="${fc}"
+ --verbose
+ )
+ if test -n "${BUILD_TYPE:-}"
+ then
+ build_args+=(--aocc_build_type="${BUILD_TYPE}")
+ if test "${BUILD_TYPE}" = "RELEASE" || test "${BUILD_TYPE}" = "STAGING"
+ then
+ build_args+=(--branch="${BRANCH_NAME}")
+ fi
+ fi
+ if test "${LLVM_VERSION_MAJOR}" -le 21
+ then
+ build_args+=(--enable_how=PROJECTS)
+ fi
+ if test -n "${REL_MODE:-}"
+ then
+ build_args+=(--release_mode="${REL_MODE}")
+ fi
+ if test -n "${STAGE_BUILD_NUM:-}"
+ then
+ build_args+=(--stage_build_num="${STAGE_BUILD_NUM}")
+ fi
+ if test -n "${VERSION_VAL:-}"
+ then
+ build_args+=(--version_val="${VERSION_VAL}")
+ fi
+}
-build_args=(
- --build_mode=All
- --fc="${fc}"
- --verbose
-)
-if test -n "${BUILD_TYPE:-}"
-then
- build_args+=(--aocc_build_type="${BUILD_TYPE}")
- if test "${BUILD_TYPE}" = "RELEASE" -o "${BUILD_TYPE}" = "STAGING"
+# Run a complete LLVM build.
+execute_build() {
+ get_llvm_version
+
+ local clang_version=$LLVM_VERSION_MAJOR.$LLVM_VERSION_MINOR.$LLVM_VERSION_PATCH
+ local main_commit_hash
+ main_commit_hash=$(git -C "${LLVM_GIT_DIR}" rev-parse HEAD)
+
+ {
+ echo "CLANG_VERSION value is - ${clang_version}"
+ echo "${main_commit_hash}"
+ } > VERSION_AND_COMMIT_HASH_OF_BUILD_"${BUILD_NUMBER}".txt
+
+ local dual_flang_build="${AOCC_DUAL_FLANG_BUILD:-false}"
+ local fc=LLVM
+ if test "${dual_flang_build}" = "true"
then
- build_args+=(--branch="${BRANCH_NAME}")
+ fc=LLVM_then_Classic
fi
-fi
-if test "${LLVM_VERSION_MAJOR}" -le 21
-then
- build_args+=(--enable_how=PROJECTS)
-fi
-if test -n "${REL_MODE:-}"
-then
- build_args+=(--release_mode="${REL_MODE}")
-fi
-if test -n "${STAGE_BUILD_NUM:-}"
-then
- build_args+=(--stage_build_num="${STAGE_BUILD_NUM}")
-fi
-if test -n "${VERSION_VAL:-}"
-then
- build_args+=(--version_val="${VERSION_VAL}")
-fi
-export AOCC_LLVM_FLANG_PKG_NAME="true"
+ construct_build_args "${fc}"
+
+ echo python3 -u "${ess_dir}/build_essentials/aocc_build.py" "${build_args[@]}"
+ python3 -u "${ess_dir}/build_essentials/aocc_build.py" "${build_args[@]}"
+}
-echo python3 -u "${ess_dir}/build_essentials/aocc_build.py" "${build_args[@]}"
-python3 -u "${ess_dir}/build_essentials/aocc_build.py" "${build_args[@]}"
+execute_build
>From f7c38964fcaaf5c16dc0d98f1df2d9730b491f26 Mon Sep 17 00:00:00 2001
From: "Kallesh, Vijay-teekinavar" <Vijay-teekinavar.Kallesh at amd.com>
Date: Thu, 7 May 2026 07:24:08 +0000
Subject: [PATCH 48/72] CPUPC-17496 Wire PR commit metadata into upstream
container build flow
Add Jenkins and apptainer plumbing to pass PR base/latest commit SHAs into upstream run.sh execution for the second-phase dual-build flow.
Co-authored-by: Cursor <cursoragent at cursor.com>
---
.amd-ci/upstream/Jenkinsfile | 32 +++++++++++++++++++++++++++++--
.amd-ci/upstream/apptainer_run.sh | 10 +++++++++-
2 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index 00ecfcef580df9..6dbd10601b42b6 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -167,6 +167,7 @@ if (postsub && targetIsRelBranch) {
}
def gitVars // groovylint-disable-line NoDef,VariableTypeRequired
+String prBaseCommit = '', prLatestCommit = ''
Integer fullTimeoutH = 15
@@ -259,6 +260,27 @@ try {
)
)
assert gitVars.GIT_COMMIT
+ if (isPrBranch) {
+ prLatestCommit = gitVars.GIT_COMMIT
+ withEnv([gitPathEnv]) {
+ withCredentials([
+ gitUsernamePassword(
+ credentialsId: gitHubAppCredsId,
+ gitToolName: gitTool
+ )
+ ]) {
+ prBaseCommit = sh(
+ label: 'pr-merge-base-commit',
+ script: (
+ 'git fetch origin +refs/heads/' + actualTarget +
+ ':refs/remotes/origin/' + actualTarget + ' && ' +
+ 'git merge-base HEAD origin/' + actualTarget
+ ),
+ returnStdout: true
+ ).trim()
+ }
+ }
+ }
Integer activeStat = successStat
withEnv([gitPathEnv]) {
if (
@@ -343,7 +365,7 @@ try {
}
stage('run') {
try {
- withEnv([
+ List<String> runEnv = [
'PATH=' + linuxBasePath,
'JOB_NAME=' + jobName,
'AOCC_DUAL_FLANG_BUILD=' + dualFlangBuild,
@@ -351,7 +373,13 @@ try {
'VERSION_VAL=' + versionVal,
'REL_MODE=' + relMode,
'BUILD_TYPE=' + buildType
- ]) {
+ ]
+ if (isPrBranch) {
+ runEnv.add('IS_PR_BUILD=true')
+ runEnv.add('PR_BASE_COMMIT=' + prBaseCommit)
+ runEnv.add('PR_LATEST_COMMIT=' + prLatestCommit)
+ }
+ withEnv(runEnv) {
sh 'llvm-project/.amd-ci/upstream/apptainer_run.sh'
}
currentBuild.result = successResultStr
diff --git a/.amd-ci/upstream/apptainer_run.sh b/.amd-ci/upstream/apptainer_run.sh
index daf8f683fbd6e1..46a1de88704e46 100755
--- a/.amd-ci/upstream/apptainer_run.sh
+++ b/.amd-ci/upstream/apptainer_run.sh
@@ -18,6 +18,14 @@ envs=(
--env CI="${CI:-false}"
--env JOB_NAME="${JOB_NAME:-NoSuchJobName}"
)
+if test "${IS_PR_BUILD:-false}" = "true"
+then
+ envs+=(
+ --env IS_PR_BUILD=true
+ --env PR_BASE_COMMIT="${PR_BASE_COMMIT}"
+ --env PR_LATEST_COMMIT="${PR_LATEST_COMMIT}"
+ )
+fi
if test -n "${BUILD_TYPE:-}"
then
envs+=(--env BUILD_TYPE="${BUILD_TYPE}")
@@ -48,4 +56,4 @@ apptainer exec \
"${envs[@]}" \
--bind "${binds}" \
${image_path} \
- bash -c "cd ${bind_point} && ${_script_dir}/run.sh"
+ bash -c "cd ${bind_point} && bash ${_script_dir}/run.sh"
>From 9cdbd3561c9a7cdabfa1438bef7c67b9492d3f34 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Sat, 9 May 2026 08:43:11 +0000
Subject: [PATCH 49/72] CPUPC-7979: Try full (deferred) wipeout to handle
thinlto-unicode-module-paths.test.tmp unicode paths.
Change-Id: I7443d3b2953d0e8a72acd5e4ea70c011c05f77d7
---
.amd-ci/upstream/Jenkinsfile | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index 6dbd10601b42b6..d3b4f2561ad571 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -178,15 +178,9 @@ try {
timeout(time: fullTimeoutH, unit: 'HOURS') {
node('atl && apptainer') {
skipDefaultCheckout()
- List cleanExcludes = [
- [pattern: 'llvm-project/.git/**', type: 'EXCLUDE']
- ]
stage('prepare') {
String referenceRepo = env.JENKINS_REMOTE_GIT_CACHE ?: 'NoSuchReferenceRepo'
- cleanWs(
- deleteDirs: true,
- patterns: cleanExcludes
- )
+ cleanWs()
String essDir
if (actualTarget == upstreamBranch) {
dir('aocc-devops') {
@@ -357,10 +351,7 @@ try {
}
}
if (isSkippableMerge || !hasSourceChanges) {
- cleanWs(
- deleteDirs: true,
- patterns: cleanExcludes
- )
+ cleanWs()
return // From node
}
stage('run') {
@@ -414,10 +405,7 @@ try {
} else {
echo('No built compiler tar was found.')
}
- cleanWs(
- deleteDirs: true,
- patterns: cleanExcludes
- )
+ cleanWs()
}
}
}
>From 91f5c356897b1a1b0673d5fde258677bdf4c274e Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Wed, 27 May 2026 10:50:59 +0000
Subject: [PATCH 50/72] CPUPC-7979: Use standard AMDLLVM naming form.
Change-Id: I40cf9e531e482240d968d3531de4aee38785fd3c
---
.amd-ci/upstream/Jenkinsfile | 8 ++++++--
.amd-ci/upstream/run.sh | 2 --
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index d3b4f2561ad571..385d5bfc9cbd3d 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -60,8 +60,12 @@ String buildTypeStaging = 'STAGING' // groovylint-disable-line UnusedVariable
String buildType = (isPrBranch ? buildTypePresub : buildTypeRelease)
if (!isPrBranch && !isAmdBranch) {
- // Treat it as 'presub'.
- buildType = buildTypePresub
+ if (actualTarget == upstreamBranch && actualHead == upstreamBranch) {
+ buildType = buildTypeStaging
+ } else {
+ // Treat it as 'presub'.
+ buildType = buildTypePresub
+ }
}
Boolean postsub = (
diff --git a/.amd-ci/upstream/run.sh b/.amd-ci/upstream/run.sh
index 062827cabfb821..3243cdf55ad20c 100755
--- a/.amd-ci/upstream/run.sh
+++ b/.amd-ci/upstream/run.sh
@@ -13,8 +13,6 @@ mod_cmd=". ${ess_dir}/build_essentials/linux/aocc_env.sh"
echo "${mod_cmd}"
${mod_cmd}
-export AOCC_LLVM_FLANG_PKG_NAME="true"
-
# Parse the LLVM version from the in-tree cmake module.
get_llvm_version() {
local _ver_file=llvm-project/cmake/Modules/LLVMVersion.cmake
>From fc5a0651abeaa09130b50bcdd9b4947054bd32e5 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Mon, 22 Jun 2026 12:15:36 +0000
Subject: [PATCH 51/72] CPUPC-7979: Added test suppressions using
LIT_UNSUPPORTED.
Change-Id: I050a8657323c2234d3e1d6cb694f3a5085d0177d
---
.amd-ci/upstream/lit_suppressions.txt | 15 +++++++++++++++
.amd-ci/upstream/run.sh | 12 ++++++++++++
2 files changed, 27 insertions(+)
create mode 100644 .amd-ci/upstream/lit_suppressions.txt
diff --git a/.amd-ci/upstream/lit_suppressions.txt b/.amd-ci/upstream/lit_suppressions.txt
new file mode 100644
index 00000000000000..86dae93d74d9ab
--- /dev/null
+++ b/.amd-ci/upstream/lit_suppressions.txt
@@ -0,0 +1,15 @@
+# Upstream CI test suppressions.
+#
+# Entries use lit full test names (SuiteName :: path_in_suite).
+# Processed by run.sh into the LIT_UNSUPPORTED environment variable;
+# see llvm/utils/lit/lit/main.py mark_unsupported().
+#
+# Source: [AOCC-FLAKY] section of prj-essentials/devo/lit.blacklist.cfg
+
+# clang/test/Driver/sanitizer-ld.c
+Clang :: Driver/sanitizer-ld.c
+
+# compiler-rt/test/asan/TestCases/strcat-overlap.cpp
+# rhel8; i386-linux, i386-linux-dynamic unexpected failure.
+AddressSanitizer-i386-linux :: TestCases/strcat-overlap.cpp
+AddressSanitizer-i386-linux-dynamic :: TestCases/strcat-overlap.cpp
diff --git a/.amd-ci/upstream/run.sh b/.amd-ci/upstream/run.sh
index 3243cdf55ad20c..18be670664160a 100755
--- a/.amd-ci/upstream/run.sh
+++ b/.amd-ci/upstream/run.sh
@@ -81,4 +81,16 @@ execute_build() {
python3 -u "${ess_dir}/build_essentials/aocc_build.py" "${build_args[@]}"
}
+# Apply test suppressions via upstream lit's --unsupported mechanism.
+_suppress_file="${LLVM_GIT_DIR}/.amd-ci/upstream/lit_suppressions.txt"
+if test -f "${_suppress_file}"
+then
+ LIT_UNSUPPORTED="$(sed 's/^[[:space:]]*//' "${_suppress_file}" | grep -v '^#' | grep -v '^$' | paste -sd ';')"
+ if test -n "${LIT_UNSUPPORTED}"
+ then
+ export LIT_UNSUPPORTED
+ echo "LIT_UNSUPPORTED=${LIT_UNSUPPORTED}"
+ fi
+fi
+
execute_build
>From 5dc3753d826e40177f8d83614eb115a47ac2f868 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Tue, 23 Jun 2026 07:05:07 +0000
Subject: [PATCH 52/72] CPUPC-7979: libomp :: affinity/kmp-abs-hw-subset.c
suppression imported from amd-staging.
Change-Id: Ia35cc915af28a7dfdbfbe4d6c2498ac03b37b3af
---
.amd-ci/upstream/lit_suppressions.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/.amd-ci/upstream/lit_suppressions.txt b/.amd-ci/upstream/lit_suppressions.txt
index 86dae93d74d9ab..244db189aeb5d8 100644
--- a/.amd-ci/upstream/lit_suppressions.txt
+++ b/.amd-ci/upstream/lit_suppressions.txt
@@ -13,3 +13,8 @@ Clang :: Driver/sanitizer-ld.c
# rhel8; i386-linux, i386-linux-dynamic unexpected failure.
AddressSanitizer-i386-linux :: TestCases/strcat-overlap.cpp
AddressSanitizer-i386-linux-dynamic :: TestCases/strcat-overlap.cpp
+
+# openmp/runtime/test/affinity/kmp-abs-hw-subset.c
+# Intermittent hardware topology detection failure.
+# "KMP_HW_SUBSET ignored: all hardware resources would be filtered"
+libomp :: affinity/kmp-abs-hw-subset.c
>From ae1cea2a6f86de4a6b75a3a092b19bfd2828e441 Mon Sep 17 00:00:00 2001
From: anprabhu <Anantha.Prabhu at amd.com>
Date: Tue, 23 Jun 2026 14:54:46 +0530
Subject: [PATCH 53/72] Include Downstream SPEC runs
Change-Id: If046d8fcae97033db199d25ff10a789b4e3d9c20
---
.amd-ci/upstream/Jenkinsfile | 1015 +++++++++++++++++++++++++++++++++-
1 file changed, 997 insertions(+), 18 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index 385d5bfc9cbd3d..705be6480a1470 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -133,6 +133,244 @@ if (postsub) {
pipelineTriggers([cron('TZ=Asia/Kolkata\nH 0 * * *')])
)
}
+
+// ===========================================================================
+// Parallel SPEC Build CI parameters
+// Mirrors gcc/.amd-ci/upstream/Jenkinsfile parameter set, adapted for LLVM/AOCC.
+// ===========================================================================
+String specSepStyle = 'background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);' +
+ 'color:white;padding:15px;border-radius:8px;font-size:18px;font-weight:bold;' +
+ 'margin:20px 0 10px 0;box-shadow:0 4px 6px rgba(0,0,0,0.1);'
+
+String defaultJemallocUrl = 'https://atlartifactory.amd.com:8443/artifactory/SW-AOCC-REL-LOCAL/jemalloc/5.3.0/jemalloc-5.3.0-build-1.tar.xz'
+String defaultLibmUrl = 'https://atlartifactory.amd.com:8443/artifactory/SW-AOCC-REL-LOCAL/libm/5.2.rc3/libm-5.2.rc3.tar'
+String defaultAmdallocUrl = 'https://atlartifactory.amd.com:8443/artifactory/SW-AOCC-REL-LOCAL/amdalloc/1.0.4/amdalloc-1.0.4.tar'
+String defaultSsmallocUrl = 'https://atlartifactory.amd.com:8443/artifactory/SW-AOCC-REL-LOCAL/ssmalloc/1.0.16/ssmalloc-1.0.16.tar'
+// SPEC cfgs git repo (mirrors gcc/.amd-ci/upstream/Jenkinsfile). Cloned into
+// the workspace, staged as SPEC_perf_cfgs/, and archived as a directory
+// tree; the Jenkins on-the-fly '*zip*/SPEC_perf_cfgs.zip' URL is forwarded
+// downstream as SPECCPU_CFGDIR when USE_SPEC_CONFIGS_REPO=true.
+String defaultSpecConfigsRepoUrl = 'https://github.amd.com/cpu-compilers/spec-configs.git'
+String defaultSpecConfigsBranch = 'main'
+
+propsList.add(
+ parameters([
+ // ---------- Using Prebuilt CUT ----------
+ separator(name: 'sep_prebuilt_cut', sectionHeader: 'Using Prebuilt CUT',
+ sectionHeaderStyle: specSepStyle),
+ booleanParam(
+ name: 'USE_PREBUILT_CUT',
+ defaultValue: false,
+ description: '''Skip build stages and use prebuilt artifacts.<br><br>
+<b>Required:</b> at least one of PREBUILT_BASE_CUT_URL_PATH or PREBUILT_LATEST_CUT_URL_PATH must be provided.<br>
+<b>Behavior:</b> SPEC tests will run once if only one parameter is provided, or twice if both are provided.'''
+ ),
+ string(
+ name: 'PREBUILT_BASE_CUT_URL_PATH',
+ defaultValue: '',
+ description: 'Prebuilt BASE artifact (URL or filesystem path) of an AOCC compiler tar.xz.'
+ ),
+ string(
+ name: 'PREBUILT_LATEST_CUT_URL_PATH',
+ defaultValue: '',
+ description: 'Prebuilt LATEST artifact (URL or filesystem path). Optional. If both BASE and LATEST are set, SPEC tests run twice.'
+ ),
+ string(
+ name: 'SPECCPU_CFGDIR',
+ defaultValue: '/proj/perfcompilerdevops/AOCC/aocc_p/aocc_llvm21/lin/973/SPEC_perf_cfgs',
+ description: '''<b>Required for SPEC stages</b> when <code>USE_SPEC_CONFIGS_REPO=false</code>.<br>
+URL or filesystem path of the SPEC cfgs (zip or directory) forwarded downstream as
+<code>SPECCPU_CFGDIR</code>.<br>
+Default is the shared aocc-devops cfgs directory; override with an artifact URL such as
+<code>http://<host>:8080/job/<job>/<build>/artifact/SPEC_perf_cfgs/*zip*/SPEC_perf_cfgs.zip</code>
+or a custom filesystem path.<br>
+<b>Note:</b> when <code>USE_SPEC_CONFIGS_REPO=true</code> (default), this value is
+<i>ignored</i> and the freshly cloned <code>spec-configs</code> repo is staged as
+<code>SPEC_perf_cfgs/</code>, archived as a directory tree, and Jenkins'
+on-the-fly <code>*zip*/SPEC_perf_cfgs.zip</code> URL for that artifact is
+forwarded instead. Set <code>USE_SPEC_CONFIGS_REPO=false</code> to fall back to this value.<br>
+Downstream <code>AOCC-Workloads/SPEC/*</code> errors with "No cfgs location supplied" if empty.'''
+ ),
+
+ // ---------- SPEC CPU2017 ----------
+ separator(name: 'sep_cpu2017', sectionHeader: 'SPEC CPU2017',
+ sectionHeaderStyle: specSepStyle),
+ booleanParam(
+ name: 'ENABLE_CPU2017',
+ defaultValue: true,
+ description: 'Enable CPU2017 SPEC testing stages.'
+ ),
+ string(
+ name: 'CPU2017_BENCHMARK_LIST',
+ defaultValue: '500.perlbench_r, 502.gcc_r, 503.bwaves_r, 505.mcf_r, 507.cactuBSSN_r, 508.namd_r, 510.parest_r, 511.povray_r, 519.lbm_r, 520.omnetpp_r, 521.wrf_r, 523.xalancbmk_r, 525.x264_r, 526.blender_r, 527.cam4_r, 531.deepsjeng_r, 538.imagick_r, 541.leela_r, 544.nab_r, 548.exchange2_r, 549.fotonik3d_r, 554.roms_r, 557.xz_r',
+ description: 'Comma-separated list of CPU2017 benchmarks. For dev iterations consider a subset such as 505.mcf_r.'
+ ),
+ string(
+ name: 'CPU2017_EXTRA_RUNCPU_ARGS',
+ defaultValue: '--define march=native --define flto',
+ description: '''Extra args appended to runcpu via <code>--extra_runcpu_args</code>.<br>
+Default matches the AOCC-LLVM21 baseline (<code>--define march=native --define flto</code>).'''
+ ),
+
+ // ---------- SPEC CPU2026 ----------
+ separator(name: 'sep_cpu2026', sectionHeader: 'SPEC CPU2026',
+ sectionHeaderStyle: specSepStyle),
+ booleanParam(
+ name: 'ENABLE_CPU2026',
+ defaultValue: true,
+ description: 'Enable CPU2026 SPEC testing stages.'
+ ),
+ string(
+ name: 'CPU2026_BENCHMARK_LIST',
+ defaultValue: '706.stockfish_r, 707.ntest_r, 708.sqlite_r, 709.cactus_r, 710.omnetpp_r, 714.cpython_r, 721.gcc_r, 722.palm_r, 723.llvm_r, 727.cppcheck_r, 729.abc_r, 731.astcenc_r, 734.vpr_r, 735.gem5_r, 736.ocio_r, 737.gmsh_r, 748.flightdm_r, 749.fotonik3d_r, 750.sealcrypto_r, 753.ns3_r, 765.roms_r, 766.femflow_r, 767.nest_r, 772.marian_r, 777.zstd_r, 782.lbm_r',
+ description: 'Comma-separated list of CPU2026 benchmarks.'
+ ),
+ string(
+ name: 'CPU2026_EXTRA_RUNCPU_ARGS',
+ defaultValue: '--define march=native --define flto',
+ description: '''Extra args appended to CPU2026 runcpu via <code>--extra_runcpu_args</code>.<br>
+Default matches the AOCC-LLVM21 baseline (<code>--define march=native --define flto</code>).'''
+ ),
+
+ // ---------- Configuration files (shared CPU2017 & CPU2026) ----------
+ separator(name: 'sep_cfg_files', sectionHeader: 'Configuration Files',
+ sectionHeaderStyle: specSepStyle),
+ text(
+ name: 'CFG_FILES',
+ defaultValue: 'cpu2017_amd_linux_znver5_llvm_rate_bestmined.cfg, cpu2017_amd_linux_znver5_llvm_speed_bestmined.cfg, cpu2026_amd_linux_znver5_llvm_rate_bestmined.cfg, cpu2026_amd_linux_znver5_llvm_speed_bestmined.cfg',
+ description: 'Comma-separated list of cfg file names (cpu2017_*.cfg and/or cpu2026_*.cfg).'
+ ),
+ booleanParam(
+ name: 'USE_SPEC_CONFIGS_REPO',
+ defaultValue: true,
+ description: '''Clone the <code>spec-configs</code> git repo into this build, stage it as
+<code>SPEC_perf_cfgs/</code>, archive that directory tree, and forward Jenkins'
+on-the-fly directory-zip URL
+(<code>artifact/SPEC_perf_cfgs/*zip*/SPEC_perf_cfgs.zip</code>) as
+<code>SPECCPU_CFGDIR</code> to downstream SPEC jobs. When <b>true</b> (default),
+<code>SPECCPU_CFGDIR</code> above is ignored. When <b>false</b>, the clone is
+skipped and <code>SPECCPU_CFGDIR</code> is forwarded verbatim.'''
+ ),
+ string(
+ name: 'SPEC_CONFIGS_REPO_URL',
+ defaultValue: defaultSpecConfigsRepoUrl,
+ description: 'Git URL of the <code>spec-configs</code> repo (used when <code>USE_SPEC_CONFIGS_REPO=true</code>).'
+ ),
+ string(
+ name: 'SPEC_CONFIGS_BRANCH',
+ defaultValue: defaultSpecConfigsBranch,
+ description: 'Branch / ref of <code>spec-configs</code> to check out.'
+ ),
+ booleanParam(
+ name: 'SANITIZE_SPEC_CFGS_FOR_LLVM21',
+ defaultValue: true,
+ description: '''Strip pre-LLVM21 clang flags from every <code>*.cfg</code> in the cloned
+<code>spec-configs/</code> tree before it is archived as <code>SPEC_perf_cfgs.zip</code>.
+A <code>.cfg.orig</code> backup is kept beside each modified file and the diffs are
+logged. Disable only when targeting a pre-LLVM21 compiler.'''
+ ),
+
+ // ---------- Build / run time limits ----------
+ separator(name: 'sep_build_runtime_limit', sectionHeader: 'Build and Run Time Limit',
+ sectionHeaderStyle: specSepStyle),
+ string(name: 'build_time', defaultValue: '4:00:00',
+ description: 'Maximum build time forwarded as --build_time.'),
+ string(name: 'run_time', defaultValue: '4:00:00',
+ description: 'Maximum run time forwarded as --run_time.'),
+
+ // ---------- Two-Stage SPEC Validation ----------
+ separator(name: 'sep_two_stage_spec', sectionHeader: 'Two-Stage SPEC Validation (copies)',
+ sectionHeaderStyle: specSepStyle),
+ booleanParam(
+ name: 'ENABLE_STAGE_BUILD',
+ defaultValue: true,
+ description: '''When true (default): SPEC CPU2017 + CPU2026 are built once via downstream jobs in
+SPEC_BUILD_OR_RUN=build mode (csg_specslurm --build_only); the produced
+spec_<SUITE>_<BUILD_TYPE>_exes.tar.xz is reused by Stage 1 and Stage 2 in
+SPEC_BUILD_OR_RUN=run mode. When false: legacy build+run per stage.'''
+ ),
+ string(name: 'STAGE1_SPEC_COPIES', defaultValue: '1',
+ description: 'Stage 1 SPEC --copies (basic / functional validation).'),
+ string(name: 'STAGE2_SPEC_COPIES', defaultValue: '512',
+ description: 'Stage 2 SPEC --copies (full validation, gated on Stage 1 passing).'),
+ booleanParam(name: 'ENABLE_STAGE2', defaultValue: false,
+ description: 'Run Stage 2 (full performance validation, e.g. 512 copies). Disabled by default; Stage 1 single-copy functional is the default for both CPU2017 and CPU2026.'),
+ choice(name: 'STAGE1_SPEC_VALIDATION', choices: ['functional', 'performance'],
+ description: 'Stage 1 SPEC_VALIDATION (csg_specslurm forces copies=1 under functional).'),
+ choice(name: 'STAGE2_SPEC_VALIDATION', choices: ['performance', 'functional'],
+ description: 'Stage 2 SPEC_VALIDATION (use performance so STAGE2_SPEC_COPIES is honored).'),
+
+ // ---------- Libraries ----------
+ separator(name: 'sep_libraries', sectionHeader: 'Libraries',
+ sectionHeaderStyle: specSepStyle),
+ string(name: 'jemalloc_url', defaultValue: defaultJemallocUrl,
+ description: 'jemalloc package URL passed downstream.'),
+ string(name: 'libm_url', defaultValue: defaultLibmUrl,
+ description: 'libm package URL passed downstream.'),
+ string(name: 'amdalloc_url', defaultValue: defaultAmdallocUrl,
+ description: 'amdalloc package URL passed downstream.'),
+ string(name: 'ssmalloc_url', defaultValue: defaultSsmallocUrl,
+ description: 'ssmalloc package URL passed downstream.'),
+
+ // ---------- mlce / runcpu tuning (forwarded to downstream csg_specslurm) ----------
+ separator(name: 'sep_mlce', sectionHeader: 'mlce / runcpu Tuning',
+ sectionHeaderStyle: specSepStyle),
+ string(name: 'SPEC_TUNE', defaultValue: 'base',
+ description: 'mlce <code>--tune</code> (e.g. <code>base</code>, <code>peak</code>).'),
+ booleanParam(name: 'SPEC_QUIET', defaultValue: true,
+ description: 'mlce <code>--quiet</code>: suppress runcpu progress chatter.'),
+ booleanParam(name: 'SPEC_SKIP_SUDO', defaultValue: true,
+ description: 'mlce <code>--skip_sudo</code>: skip system-tuning sudo steps on runners.'),
+ booleanParam(name: 'SPEC_ADD_TO_DATABASE', defaultValue: true,
+ description: 'mlce <code>--add_to_database</code>: publish results to the perf database.'),
+ booleanParam(name: 'SPEC_OOB', defaultValue: true,
+ description: 'mlce <code>--oob</code>: out-of-box (generic-cfg) run mode.'),
+ booleanParam(name: 'SPEC_REBUILD', defaultValue: true,
+ description: 'mlce <code>--rebuild</code>: force a rebuild of SPEC binaries.'),
+ booleanParam(name: 'SPEC_USE_JEMALLOC', defaultValue: true,
+ description: 'mlce <code>--jemalloc</code>: enable jemalloc allocator preload.'),
+ string(name: 'SPEC_JEMALLOC_VERSION', defaultValue: '5.3.0',
+ description: 'mlce <code>--adr.jemalloc.version</code>.'),
+ string(name: 'SPEC_JEMALLOC_TAGS', defaultValue: '_-lg-quantum.3',
+ description: 'mlce <code>--adr.jemalloc.tags</code>.'),
+ string(name: 'SPEC_EMAIL', defaultValue: '',
+ description: 'mlce <code>--email</code>: comma-separated recipients for SPEC run notifications. Leave empty to disable.'),
+ string(name: 'SPEC_SLURM_RUN_PARTITION', defaultValue: 'zen5_512c',
+ description: 'mlce <code>--slurm_run_partition</code>: SLURM partition for run jobs.'),
+ string(name: 'SPEC_FPRATE_COPIES', defaultValue: '256',
+ description: 'mlce <code>--fprate_copies</code>: copies for the fprate sub-suite (typically half of <code>--copies</code>).'),
+ string(name: 'SPEC_OUTDIR', defaultValue: '.',
+ description: 'mlce <code>--outdir</code>: results output directory.'),
+ string(name: 'SPEC_AOCC_STAGING_BRANCH', defaultValue: '',
+ description: 'mlce <code>--aocc_staging_branch</code>. Leave empty to default to the upstream <code>JOB_NAME</code> at runtime.'),
+ string(name: 'SPEC_AOCC_STAGING_BUILD', defaultValue: '',
+ description: 'mlce <code>--aocc_staging_build</code>. Leave empty to default to the upstream <code>BUILD_NUMBER</code> at runtime.'),
+
+ // ---------- Other settings ----------
+ separator(name: 'sep_others', sectionHeader: 'Other Settings',
+ sectionHeaderStyle: specSepStyle),
+ booleanParam(
+ name: 'FORCE_SPEC',
+ defaultValue: false,
+ description: 'Force SPEC stages to run even when no compiler tar was produced (requires USE_PREBUILT_CUT).'
+ ),
+ string(name: 'COMPILER_VERSION', defaultValue: 'llvm',
+ description: 'Compiler version label forwarded downstream (e.g. llvm, aocc, aocc5).'),
+ choice(
+ name: 'SPEC_COMPILER_ID',
+ choices: ['llvm', 'aocc', 'aocc-llvm', 'amdclang', 'gcc', 'oneapi'],
+ description: '''Compiler family forwarded downstream to AOCC-Workloads/SPEC/* as
+<code>SPEC_COMPILER_ID</code>. Choose <code>llvm</code> to pick the
+<code>.../znver5/llvm/...</code> cfgs, or <code>aocc</code> for the
+<code>.../znver5/aocc/...</code> cfgs.'''
+ ),
+ string(name: 'ZNVER', defaultValue: '5_512c',
+ description: 'Zen architecture version (e.g. 5, 5_512c, 5_384c, 4_dvt).'),
+ string(name: 'GIT_COMMIT_OVERRIDE', defaultValue: '',
+ description: 'Optional override for GIT_COMMIT forwarded downstream.')
+ ])
+)
+
properties(propsList)
String linuxBasePath = '/usr/sbin:/usr/bin:/bin'
@@ -358,26 +596,79 @@ try {
cleanWs()
return // From node
}
+ // ----------------------------------------------------------------
+ // Clone the spec-configs git repo into the workspace (mirrors
+ // gcc/.amd-ci/upstream/Jenkinsfile). The clone lives at workspace
+ // root (NOT inside ${llvmProj}/) so aocc_build.py's "Checkout is
+ // dirty" guard on the llvm-project working tree stays clean.
+ // The cfg tree is archived as SPEC_perf_cfgs.zip below in the run
+ // stage's finally block; that artifact URL is then forwarded
+ // downstream as SPECCPU_CFGDIR.
+ // ----------------------------------------------------------------
+ Boolean shouldCloneSpecConfigs = (
+ params.USE_SPEC_CONFIGS_REPO &&
+ !postsub &&
+ (params.ENABLE_CPU2017 || params.ENABLE_CPU2026)
+ )
+ if (shouldCloneSpecConfigs) {
+ stage('clone-spec-configs') {
+ cloneSpecConfigs(
+ params.SPEC_CONFIGS_REPO_URL?.trim() ?: 'https://github.amd.com/cpu-compilers/spec-configs.git',
+ params.SPEC_CONFIGS_BRANCH?.trim() ?: 'main',
+ gitHubAppCredsId, gitTool
+ )
+ }
+ }
+ // Download the SPEC dependency libraries (jemalloc, libm, amdalloc,
+ // ssmalloc) on the agent using the orequest pw_file method (mirrors
+ // gcc/.amd-ci/upstream/Jenkinsfile 'Download Dependencies'). The
+ // tars land in spec_libs/, which is bind-mounted into the build
+ // container so run.sh can bundle them into the compiler package.
+ // Done on the agent because the apptainer build container may lack
+ // artifactory access. Skipped for prebuilt-CUT runs (no fresh tar
+ // to inject into).
+ Boolean shouldDownloadSpecLibs = (
+ !params.USE_PREBUILT_CUT &&
+ !postsub &&
+ (params.ENABLE_CPU2017 || params.ENABLE_CPU2026)
+ )
+ if (shouldDownloadSpecLibs) {
+ stage('download-spec-libs') {
+ downloadSpecLibraries(
+ params.jemalloc_url, params.libm_url,
+ params.amdalloc_url, params.ssmalloc_url
+ )
+ }
+ }
stage('run') {
try {
- List<String> runEnv = [
- 'PATH=' + linuxBasePath,
- 'JOB_NAME=' + jobName,
- 'AOCC_DUAL_FLANG_BUILD=' + dualFlangBuild,
- 'STAGE_BUILD_NUM=' + stageBuildNum,
- 'VERSION_VAL=' + versionVal,
- 'REL_MODE=' + relMode,
- 'BUILD_TYPE=' + buildType
- ]
- if (isPrBranch) {
- runEnv.add('IS_PR_BUILD=true')
- runEnv.add('PR_BASE_COMMIT=' + prBaseCommit)
- runEnv.add('PR_LATEST_COMMIT=' + prLatestCommit)
- }
- withEnv(runEnv) {
- sh 'llvm-project/.amd-ci/upstream/apptainer_run.sh'
+ if (params.USE_PREBUILT_CUT) {
+ echo 'Skipping compiler build script (apptainer_run.sh): ' +
+ 'USE_PREBUILT_CUT=true; using prebuilt CUT artifacts ' +
+ '(PREBUILT_BASE_CUT_URL_PATH / PREBUILT_LATEST_CUT_URL_PATH).'
+ currentBuild.result = successResultStr
+ } else {
+ List<String> runEnv = [
+ 'PATH=' + linuxBasePath,
+ 'JOB_NAME=' + jobName,
+ 'AOCC_DUAL_FLANG_BUILD=' + dualFlangBuild,
+ 'STAGE_BUILD_NUM=' + stageBuildNum,
+ 'VERSION_VAL=' + versionVal,
+ 'REL_MODE=' + relMode,
+ 'BUILD_TYPE=' + buildType,
+ 'SPEC_LIBS_DIR=spec_libs',
+ 'AMDALLOC_URL=' + (params.amdalloc_url ?: '')
+ ]
+ if (isPrBranch) {
+ runEnv.add('IS_PR_BUILD=true')
+ runEnv.add('PR_BASE_COMMIT=' + prBaseCommit)
+ runEnv.add('PR_LATEST_COMMIT=' + prLatestCommit)
+ }
+ withEnv(runEnv) {
+ sh 'llvm-project/.amd-ci/upstream/apptainer_run.sh'
+ }
+ currentBuild.result = successResultStr
}
- currentBuild.result = successResultStr
} finally {
String cmakeBuildDir = findBuildDir()
def compilerZips // groovylint-disable-line NoDef,VariableTypeRequired
@@ -409,6 +700,11 @@ try {
} else {
echo('No built compiler tar was found.')
}
+ // Archive the cloned spec-configs (if present) as a zip
+ // artifact and stash the artifact URL for downstream
+ // SPEC jobs. Done before cleanWs() so the workspace tree
+ // is still intact.
+ archiveSpecConfigsIfPresent()
cleanWs()
}
}
@@ -416,7 +712,18 @@ try {
if (isSkippableMerge || !hasSourceChanges) {
return // From timeout
}
- if (runDownstream && compilerTar) {
+ if (runDownstream && (compilerTar || params.USE_PREBUILT_CUT || params.FORCE_SPEC)) {
+ // The test-suite tasks (GFortran/NAGLLVM/...) consume the freshly
+ // built compilerTar via their CUT URL, so they only run when a tar
+ // was produced. SPEC stages below can run off prebuilt CUT artifacts.
+ //
+ // The test-suite group and the SPEC group are each collected as a
+ // closure in downstreamParallel and launched together below, so the
+ // suites (Fujitsu / GFortran / NAGLLVM / ...) and the SPEC builds
+ // run concurrently instead of the suites blocking the SPEC stages.
+ Map downstreamParallel = [:]
+ if (compilerTar) {
+ downstreamParallel['TestSuites'] = {
stage('downstream-tasks') {
Map allTasks = [
failFast: false,
@@ -467,6 +774,102 @@ try {
}
parallel(allTasks)
}
+ } // end downstreamParallel['TestSuites'] closure
+ } // end if (compilerTar) for non-SPEC downstream test suites
+
+ // ================================================================
+ // Two-Stage Parallel SPEC Testing
+ // Stage Build (build-only) -> Stage 1 (basic) -> Stage 2 (full).
+ // Skipped on postsub branches; gated on compilerTar / USE_PREBUILT_CUT.
+ // ================================================================
+ Boolean canRunSpec = (compilerTar != null) || params.USE_PREBUILT_CUT || params.FORCE_SPEC
+ if (!postsub && canRunSpec) {
+ downstreamParallel['SPEC'] = {
+ Boolean stage1Passed = true
+ Boolean stageBuildPassed = false
+ String prebuiltExesEnvPrefix = 'STAGE_BUILD_'
+ String stage1Copies = (params.STAGE1_SPEC_COPIES?.trim() ?: '1')
+ String stage2Copies = (params.STAGE2_SPEC_COPIES?.trim() ?: '512')
+ String stage1Validation = (params.STAGE1_SPEC_VALIDATION?.trim() ?: 'functional')
+ String stage2Validation = (params.STAGE2_SPEC_VALIDATION?.trim() ?: 'performance')
+ String resolvedGitCommit = (gitVars?.GIT_COMMIT ?: '')
+ String effectiveZnver = (params.ZNVER?.trim() ?: '5_512c')
+
+ stage('Stage Build: Parallel SPEC Build') {
+ if (!params.ENABLE_STAGE_BUILD) {
+ echo 'Skipping Stage Build: ENABLE_STAGE_BUILD=false (Stage 1/2 will build+run)'
+ return
+ }
+ if (!params.ENABLE_CPU2017 && !params.ENABLE_CPU2026) {
+ echo 'Skipping Stage Build: both ENABLE_CPU2017 and ENABLE_CPU2026 are false'
+ return
+ }
+ echo 'Running Stage Build (CPU2017 + CPU2026 build-only pass; csg_specslurm --build_only)'
+ stageBuildPassed = runParallelSpecTesting(
+ 'Stage Build', prebuiltExesEnvPrefix, '1', 'functional',
+ resolvedGitCommit, effectiveZnver, compilerTar,
+ 'build', prebuiltExesEnvPrefix
+ )
+ echo "Stage Build result: ${stageBuildPassed ? 'PASSED' : 'FAILED'}"
+ ['CPU2017_BASE', 'CPU2017_LATEST', 'CPU2017_SINGLE',
+ 'CPU2026_BASE', 'CPU2026_LATEST', 'CPU2026_SINGLE'].each { suffix ->
+ String key = "${prebuiltExesEnvPrefix}${suffix}_EXES_URL"
+ if (env."${key}") {
+ echo " ${key}=${env."${key}"}"
+ }
+ }
+ }
+
+ Boolean useStageBuildExes = params.ENABLE_STAGE_BUILD && stageBuildPassed
+ String runStagesMode = useStageBuildExes ? 'run' : 'both'
+ String runStagesPrefix = useStageBuildExes ? prebuiltExesEnvPrefix : ''
+ if (params.ENABLE_STAGE_BUILD && !stageBuildPassed) {
+ echo 'WARNING: Stage Build did not pass; Stage 1 / Stage 2 will fall back to legacy build+run.'
+ }
+
+ stage('Stage 1: Parallel SPEC Testing (Basic Validation)') {
+ echo "Running Stage 1 with SPEC_COPIES=${stage1Copies}, SPEC_VALIDATION=${stage1Validation}, SPEC_BUILD_OR_RUN=${runStagesMode}"
+ stage1Passed = runParallelSpecTesting(
+ 'Stage 1', '', stage1Copies, stage1Validation,
+ resolvedGitCommit, effectiveZnver, compilerTar,
+ runStagesMode, runStagesPrefix
+ )
+ echo "Stage 1 result: ${stage1Passed ? 'PASSED' : 'FAILED'}"
+ }
+
+ stage('Stage 2: Parallel SPEC Testing (Full Validation)') {
+ if (!params.ENABLE_STAGE2) {
+ echo 'Skipping Stage 2: ENABLE_STAGE2=false'
+ return
+ }
+ if (!stage1Passed) {
+ echo 'Skipping Stage 2: Stage 1 had failures (gated on Stage 1 passing)'
+ return
+ }
+ echo "Running Stage 2 with SPEC_COPIES=${stage2Copies}, SPEC_VALIDATION=${stage2Validation}, SPEC_BUILD_OR_RUN=${runStagesMode}"
+ Boolean stage2Passed = runParallelSpecTesting(
+ 'Stage 2', 'STAGE2_', stage2Copies, stage2Validation,
+ resolvedGitCommit, effectiveZnver, compilerTar,
+ runStagesMode, runStagesPrefix
+ )
+ echo "Stage 2 result: ${stage2Passed ? 'PASSED' : 'FAILED'}"
+ }
+ } // end downstreamParallel['SPEC'] closure
+ } else if (postsub) {
+ echo 'Skipping Parallel SPEC Testing on postsub branch.'
+ } else {
+ echo 'Skipping Parallel SPEC Testing: no compiler tar and USE_PREBUILT_CUT/FORCE_SPEC not set.'
+ }
+
+ // Launch the test-suite group and the SPEC group together so they
+ // run in parallel (Fujitsu / GFortran / NAGLLVM / ... alongside the
+ // SPEC builds). failFast=false keeps a failure in one group from
+ // aborting the other, preserving the previous sequential semantics
+ // where SPEC ran regardless of the test-suite outcome.
+ if (downstreamParallel) {
+ downstreamParallel.failFast = false
+ parallel(downstreamParallel)
+ }
}
}
} catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
@@ -550,3 +953,579 @@ String findBuildDir() {
}
return null
}
+
+/* ==========================================================================
+ * Parallel SPEC Build CI helpers (mirrors gcc/.amd-ci/upstream/Jenkinsfile).
+ *
+ * Top-level def methods so each compiles to its own WorkflowScript method,
+ * keeping the Jenkins CPS compiler from packing everything into one
+ * 64KB+ ___cps___NNNNN method ("Method too large: ...CpsFunction").
+ *
+ * Flow:
+ * runParallelSpecTesting(...)
+ * parallel { runCpu2017Stage(...) ; runCpu2026Stage(...) }
+ *
+ * SPEC_BUILD_OR_RUN: 'both' (build+run, default) | 'build' (csg_specslurm
+ * --build_only; archives spec_<SUITE>_<TYPE>_exes.tar.xz) | 'run'
+ * (csg_specslurm --nobuild; consumes PREBUILT_EXES_TAR_URL).
+ * ========================================================================== */
+
+/**
+ * Build types available for SPEC testing.
+ * - USE_PREBUILT_CUT: derived from PREBUILT_BASE/LATEST URL params.
+ * - Fresh-build mode: a single compiler tar is produced upstream, so a
+ * single empty-suffix entry is returned.
+ */
+List<String> getAvailableBuildTypes(String compilerTar) {
+ if (params.USE_PREBUILT_CUT) {
+ boolean hasBase = params.PREBUILT_BASE_CUT_URL_PATH?.trim()
+ boolean hasLatest = params.PREBUILT_LATEST_CUT_URL_PATH?.trim()
+ if (hasBase && hasLatest) { echo 'Detected two build types: base and latest'; return ['base', 'latest'] }
+ if (hasBase) { echo 'Detected single build type: base'; return ['base'] }
+ if (hasLatest) { echo 'Detected single build type: latest'; return ['latest'] }
+ error('USE_PREBUILT_CUT is true but no PREBUILT_*_CUT_URL_PATH was provided')
+ }
+ if (!compilerTar) {
+ error('No compiler tar available for SPEC testing (upstream build did not produce a tar.xz)')
+ }
+ echo "Detected single build mode (fresh build): ${compilerTar}"
+ return ['']
+}
+
+/**
+ * Download the SPEC dependency libraries (jemalloc, libm, amdalloc, ssmalloc)
+ * into <workspace>/spec_libs using the orequest artifactory pw_file method
+ * (mirrors the parallel 'Download Dependencies' stage in
+ * gcc/.amd-ci/upstream/Jenkinsfile). Each URL may also be a local filesystem
+ * path. Runs on the Jenkins agent (which has /proj and artifactory access);
+ * run.sh later bundles these tars into the freshly built compiler package.
+ */
+void downloadSpecLibraries(String jemallocUrl, String libmUrl,
+ String amdallocUrl, String ssmallocUrl) {
+ withEnv([
+ 'JEMALLOC_URL=' + (jemallocUrl ?: ''),
+ 'LIBM_URL=' + (libmUrl ?: ''),
+ 'AMDALLOC_URL=' + (amdallocUrl ?: ''),
+ 'SSMALLOC_URL=' + (ssmallocUrl ?: '')
+ ]) {
+ sh(label: 'download-spec-libs', script: '''set -e
+pw_file="${ARTIFACTORY_PW_FILE:-/proj/csse_jenkins2/swtools/.safe-secrets/orequest-AMD-Artifactory}"
+mkdir -p spec_libs
+
+download_one() {
+ url="$1"
+ if [ -z "${url}" ]; then
+ return 0
+ fi
+ if [ -f "${url}" ]; then
+ echo "[+] Using local library tar ${url}"
+ cp -v "${url}" spec_libs/
+ return 0
+ fi
+ out="spec_libs/${url##*/}"
+ echo "[+] Downloading ${url}"
+ if [ -f "${pw_file}" ]; then
+ pw=$(head -1 "${pw_file}" | tr -d '\\n\\r')
+ wget --user=orequest --password="${pw}" --auth-no-challenge -q "${url}" -O "${out}"
+ else
+ echo "WARNING: pw_file ${pw_file} not found; attempting anonymous download."
+ wget -q "${url}" -O "${out}" || curl -fSL --connect-timeout 30 --retry 3 -o "${out}" "${url}"
+ fi
+ echo "[+] Downloaded ${out}"
+}
+
+download_one "${JEMALLOC_URL}"
+download_one "${LIBM_URL}"
+download_one "${AMDALLOC_URL}"
+download_one "${SSMALLOC_URL}"
+
+echo "[+] SPEC dependency libraries staged in spec_libs/:"
+ls -l spec_libs/ || true
+''')
+ }
+}
+
+/**
+ * Clone the spec-configs git repo into <workspace>/spec-configs (mirrors the
+ * 'spec-configs' branch of the parallel Download Dependencies stage in
+ * gcc/.amd-ci/upstream/Jenkinsfile).
+ *
+ * IMPORTANT: clones at workspace root, NOT inside the llvm-project checkout,
+ * because aocc_build.py validates the llvm-project working tree with
+ * 'git status' and aborts with "Checkout is dirty." on any untracked files.
+ */
+void cloneSpecConfigs(String repoUrl, String branch, String credentialsId, String gitTool) {
+ echo "[+] Cloning spec-configs (${repoUrl}, branch ${branch}) into spec-configs/"
+ dir('spec-configs') {
+ checkout(
+ changelog: false,
+ scm: scmGit(
+ gitTool: gitTool,
+ branches: [[name: branch]],
+ extensions: [
+ [$class: 'CloneOption', shallow: true, depth: 1, noTags: true]
+ ],
+ userRemoteConfigs: [
+ [
+ credentialsId: credentialsId,
+ url: repoUrl
+ ]
+ ]
+ )
+ )
+ }
+ echo '[+] Clone of spec-configs completed'
+ sh(label: 'spec-configs-summary',
+ script: '''set -e
+ls -1 spec-configs | head -n 50
+echo "[+] cfg files matching cpu2017_*/cpu2026_*:"
+find spec-configs -maxdepth 3 -type f \\( -name 'cpu2017_*.cfg' -o -name 'cpu2026_*.cfg' \\) | head -n 50
+''')
+ if (params.SANITIZE_SPEC_CFGS_FOR_LLVM21) {
+ sanitizeSpecCfgsForLlvm21()
+ }
+}
+
+// Strip pre-LLVM21 clang flags (-fstruct-layout=<n>, -fremap-arrays,
+// -fstrip-mining, -zopt) from every *.cfg under spec-configs/. These flags
+// are hardcoded in legacy AOCC cfg files (e.g. perlbench tune block in
+// cpu2017_amd_linux_x86-64_aocc_oob_generic.cfg) and cause the LLVM21
+// clang to abort with "unknown argument". A .cfg.orig backup is kept
+// alongside each modified file so the originals are still recoverable.
+void sanitizeSpecCfgsForLlvm21() {
+ sh(label: 'sanitize-spec-cfgs-for-llvm21',
+ script: '''set -e
+root=spec-configs
+if [ ! -d "$root" ]; then
+ echo "[sanitize] $root not present; nothing to do"
+ exit 0
+fi
+list=$(mktemp)
+trap 'rm -f "$list"' EXIT
+find "$root" -type f -name '*.cfg' > "$list"
+scanned=$(wc -l < "$list" | tr -d ' ')
+modified=0
+while IFS= read -r f; do
+ cp "$f" "$f.orig"
+ sed -i -E \
+ -e 's/[[:space:]]+-fstruct-layout=[^[:space:]]+//g' \
+ -e 's/[[:space:]]+-fremap-arrays\\b//g' \
+ -e 's/[[:space:]]+-fstrip-mining\\b//g' \
+ -e 's/[[:space:]]+-zopt\\b//g' \
+ -e 's/[[:space:]]+$//' \
+ "$f"
+ if ! cmp -s "$f" "$f.orig"; then
+ modified=$((modified+1))
+ echo "[sanitize] modified: $f"
+ diff -u "$f.orig" "$f" | sed -n '1,40p' || true
+ else
+ rm -f "$f.orig"
+ fi
+done < "$list"
+echo "[sanitize] scanned=$scanned modified=$modified (pre-LLVM21 flags stripped)"
+''')
+}
+
+// Stage <workspace>/spec-configs/ into <workspace>/SPEC_perf_cfgs/ so the
+// archived directory tree has the name the downstream csg_specclone expects
+// (mirrors gcc/.amd-ci/upstream/Jenkinsfile, which rsyncs spec-configs/ into
+// lin/main_build/SPEC_perf_cfgs/). Archive the directory rather than a
+// pre-zipped file: downstream consumers fetch via Jenkins' on-the-fly
+// *zip*/SPEC_perf_cfgs.zip URL, whose top-level entry inside the resulting
+// zip is SPEC_perf_cfgs/ -- if we archived spec-configs/ instead, the
+// downstream extraction would land in the wrong directory and csg_specclone
+// would print "Please populate SPEC_perf_cfgs".
+//
+// Stash the resulting URL in env.SPEC_CONFIGS_ARTIFACT_URL for
+// getSpecCfgDirValue() to forward downstream as SPECCPU_CFGDIR. No-op if
+// the spec-configs clone never happened (USE_SPEC_CONFIGS_REPO=false or
+// postsub run).
+void archiveSpecConfigsIfPresent() {
+ if (!fileExists('spec-configs')) {
+ return
+ }
+ sh(label: 'stage-spec-configs',
+ script: '''set -e
+rm -rf SPEC_perf_cfgs
+mkdir -p SPEC_perf_cfgs
+rsync -a spec-configs/ SPEC_perf_cfgs/
+echo "[+] Staged spec-configs/ into SPEC_perf_cfgs/ (top-level entries:)"
+ls -1 SPEC_perf_cfgs | head -n 50
+''')
+ archiveArtifacts(allowEmptyArchive: true, artifacts: 'SPEC_perf_cfgs/**')
+ // Use Jenkins' built-in on-the-fly directory-zip URL so the downloaded
+ // zip's top-level dir is 'SPEC_perf_cfgs/' (matches gcc Jenkinsfile).
+ // Force the FQDN: env.BUILD_URL on the controller is
+ // 'http://atlvjksapp01:8080/...', but downstream slaves can't resolve
+ // the short hostname and silently 0-byte the download.
+ String url = env.BUILD_URL
+ .replace('http://atlvjksapp01:8080', 'http://atlvjksapp01.amd.com:8080') +
+ 'artifact/SPEC_perf_cfgs/*zip*/SPEC_perf_cfgs.zip'
+ env.SPEC_CONFIGS_ARTIFACT_URL = url
+ echo "[+] Archived spec-configs as ${url}"
+}
+
+/**
+ * Resolve the prebuilt CUT URL for a given build type (USE_PREBUILT_CUT mode).
+ */
+String resolvePrebuiltArtifact(String buildType) {
+ if (buildType == 'base') { return params.PREBUILT_BASE_CUT_URL_PATH?.trim() }
+ if (buildType == 'latest') { return params.PREBUILT_LATEST_CUT_URL_PATH?.trim() ?: params.PREBUILT_BASE_CUT_URL_PATH?.trim() }
+ return params.PREBUILT_BASE_CUT_URL_PATH?.trim() ?: params.PREBUILT_LATEST_CUT_URL_PATH?.trim()
+}
+
+/**
+ * Get CUT URL for one (buildType, specType) combo.
+ */
+String getCutValue(String buildType, String specType, String compilerTar) {
+ if (params.USE_PREBUILT_CUT) {
+ String cutValue = resolvePrebuiltArtifact(buildType)
+ if (!cutValue) {
+ error("USE_PREBUILT_CUT is true but no artifact specified for ${buildType ?: 'single'} build")
+ }
+ echo "Using prebuilt CUT for ${specType} ${buildType ?: 'single'}: ${cutValue}"
+ return cutValue
+ }
+ if (!compilerTar) {
+ error("No compiler tar available to build CUT URL for ${specType} ${buildType ?: 'single'}")
+ }
+ String cutValue = env.BUILD_URL + 'artifact/' + compilerTar
+ echo "Using fresh-build CUT for ${specType} ${buildType ?: 'single'}: ${cutValue}"
+ return cutValue
+}
+
+/**
+ * Get SPECCPU_CFGDIR forwarded downstream. Downstream errors out with
+ * "No cfgs location supplied" if this is empty (see SpecBase.groovy), so
+ * fail fast here with an actionable message rather than after a multi-minute
+ * CUT download/unpack on the slave.
+ *
+ * Resolution order:
+ * 1. If USE_SPEC_CONFIGS_REPO=true and the spec-configs zip was archived on
+ * this build (env.SPEC_CONFIGS_ARTIFACT_URL set), use that artifact URL.
+ * 2. Otherwise fall back to params.SPECCPU_CFGDIR (NFS path / explicit URL).
+ */
+String getSpecCfgDirValue() {
+ if (params.USE_SPEC_CONFIGS_REPO) {
+ String autoUrl = env.SPEC_CONFIGS_ARTIFACT_URL ?: ''
+ if (autoUrl) {
+ echo "Using cloned spec-configs artifact for SPECCPU_CFGDIR: ${autoUrl}"
+ return autoUrl
+ }
+ echo 'WARNING: USE_SPEC_CONFIGS_REPO=true but SPEC_CONFIGS_ARTIFACT_URL is unset; ' +
+ 'falling back to params.SPECCPU_CFGDIR.'
+ }
+ String cfgDir = params.SPECCPU_CFGDIR?.trim() ?: ''
+ if (!cfgDir) {
+ error('SPECCPU_CFGDIR is required: provide a URL or filesystem path to the SPEC cfgs ' +
+ '(zip or directory), or enable USE_SPEC_CONFIGS_REPO. Downstream AOCC-Workloads/SPEC/* ' +
+ 'fails with "No cfgs location supplied" otherwise.')
+ }
+ return cfgDir
+}
+
+/**
+ * Parse and filter CFG_FILES.
+ */
+List<String> getCfgFilesList(String filterPrefix = null) {
+ if (!params.CFG_FILES?.trim()) {
+ error('CFG_FILES parameter is required.')
+ }
+ List<String> cfgFiles = params.CFG_FILES.split(',').collect { it.trim() }.findAll { it }
+ if (filterPrefix) {
+ cfgFiles = cfgFiles.findAll { it.startsWith(filterPrefix) }
+ if (cfgFiles.isEmpty()) {
+ echo "Warning: No cfg files match prefix '${filterPrefix}'"
+ return []
+ }
+ }
+ return cfgFiles
+}
+
+/**
+ * Parameters forwarded to AOCC-Workloads/SPEC/* that map onto mlce / csg_specslurm flags:
+ * SPEC_TUNE -> --tune
+ * SPEC_QUIET -> --quiet
+ * SPEC_SKIP_SUDO -> --skip_sudo
+ * SPEC_ADD_TO_DATABASE -> --add_to_database
+ * SPEC_OOB -> --oob
+ * SPEC_REBUILD -> --rebuild
+ * SPEC_USE_JEMALLOC -> --jemalloc
+ * SPEC_JEMALLOC_VERSION -> --adr.jemalloc.version
+ * SPEC_JEMALLOC_TAGS -> --adr.jemalloc.tags
+ * SPEC_EMAIL -> --email
+ * SPEC_SLURM_RUN_PARTITION -> --slurm_run_partition
+ * SPEC_FPRATE_COPIES -> --fprate_copies
+ * SPEC_OUTDIR -> --outdir
+ * SPEC_AOCC_STAGING_BRANCH -> --aocc_staging_branch (empty -> upstream JOB_NAME)
+ * SPEC_AOCC_STAGING_BUILD -> --aocc_staging_build (empty -> upstream BUILD_NUMBER)
+ */
+List getMlceTuningParams() {
+ String stagingBranch = (params.SPEC_AOCC_STAGING_BRANCH?.trim() ?: (env.JOB_NAME ?: ''))
+ String stagingBuild = (params.SPEC_AOCC_STAGING_BUILD?.trim() ?: (env.BUILD_NUMBER ?: ''))
+ return [
+ string(name: 'SPEC_TUNE', value: params.SPEC_TUNE ?: 'base'),
+ booleanParam(name: 'SPEC_QUIET', value: (params.SPEC_QUIET ?: false) as boolean),
+ booleanParam(name: 'SPEC_SKIP_SUDO', value: (params.SPEC_SKIP_SUDO ?: false) as boolean),
+ booleanParam(name: 'SPEC_ADD_TO_DATABASE', value: (params.SPEC_ADD_TO_DATABASE ?: false) as boolean),
+ booleanParam(name: 'SPEC_OOB', value: (params.SPEC_OOB ?: false) as boolean),
+ booleanParam(name: 'SPEC_REBUILD', value: (params.SPEC_REBUILD ?: false) as boolean),
+ booleanParam(name: 'SPEC_USE_JEMALLOC', value: (params.SPEC_USE_JEMALLOC ?: false) as boolean),
+ string(name: 'SPEC_JEMALLOC_VERSION', value: params.SPEC_JEMALLOC_VERSION ?: ''),
+ string(name: 'SPEC_JEMALLOC_TAGS', value: params.SPEC_JEMALLOC_TAGS ?: ''),
+ string(name: 'SPEC_EMAIL', value: params.SPEC_EMAIL ?: ''),
+ string(name: 'SPEC_SLURM_RUN_PARTITION', value: params.SPEC_SLURM_RUN_PARTITION ?: ''),
+ string(name: 'SPEC_FPRATE_COPIES', value: params.SPEC_FPRATE_COPIES ?: ''),
+ string(name: 'SPEC_OUTDIR', value: params.SPEC_OUTDIR ?: '.'),
+ string(name: 'SPEC_AOCC_STAGING_BRANCH', value: stagingBranch),
+ string(name: 'SPEC_AOCC_STAGING_BUILD', value: stagingBuild)
+ ]
+}
+
+/**
+ * SPEC CPU2017 branch of one stage. Returns true if every triggered downstream build SUCCEEDED.
+ */
+Boolean runCpu2017Stage(String stageLabel, String envPrefix, String specCopies,
+ String specValidation, String gitCommitValue, String znverValue,
+ String compilerTar,
+ String specBuildOrRun = 'both',
+ String prebuiltExesEnvPrefix = '') {
+ if (!params.ENABLE_CPU2017) { return true }
+
+ List<String> cfgFilesList = getCfgFilesList('cpu2017')
+ if (cfgFilesList.isEmpty()) {
+ echo "[${stageLabel}] Skipping SPEC2017: No cpu2017 cfg files found"
+ return true
+ }
+ String combinedCfgFiles = cfgFilesList.join(', ')
+ echo "[${stageLabel}] Testing CPU2017 (SPEC_COPIES=${specCopies}, SPEC_BUILD_OR_RUN=${specBuildOrRun}) with configs: ${combinedCfgFiles}"
+
+ def buildResults = [:]
+ String specCfgDirValue = getSpecCfgDirValue()
+ List<String> availableBuildTypes = getAvailableBuildTypes(compilerTar)
+
+ availableBuildTypes.each { buildType ->
+ String buildTypeLabel = buildType ?: 'single'
+ String exesUrlEnvKey = prebuiltExesEnvPrefix ?
+ "${prebuiltExesEnvPrefix}CPU2017_${(buildType ?: 'single').toUpperCase()}_EXES_URL" : ''
+ echo "\n========== [${stageLabel}] CPU2017 ${buildTypeLabel} (copies=${specCopies}, mode=${specBuildOrRun}) =========="
+ String cutValue = getCutValue(buildType, 'CPU2017', compilerTar)
+
+ String prebuiltExesUrl = ''
+ if (specBuildOrRun == 'run' && exesUrlEnvKey) {
+ prebuiltExesUrl = env."${exesUrlEnvKey}" ?: ''
+ if (prebuiltExesUrl) {
+ echo "[${stageLabel}] CPU2017 ${buildTypeLabel}: reusing prebuilt exes via ${exesUrlEnvKey}=${prebuiltExesUrl}"
+ } else {
+ echo "[${stageLabel}] WARNING: env.${exesUrlEnvKey} is empty; downstream will fail or rebuild."
+ }
+ }
+
+ try {
+ def buildParams = [
+ string(name: 'CUT', value: cutValue),
+ string(name: 'SPECCPU_CFGDIR', value: specCfgDirValue),
+ string(name: 'CHANGE_ID', value: env.CHANGE_ID ?: ''),
+ string(name: 'GIT_COMMIT', value: (params.GIT_COMMIT_OVERRIDE ?: (gitCommitValue ?: ''))),
+ string(name: 'COMPILER_TYPE', value: 'aocc'),
+ string(name: 'COMPILER_VERSION', value: params.COMPILER_VERSION ?: 'aocc'),
+ string(name: 'SPEC_COMPILER_ID', value: params.SPEC_COMPILER_ID ?: 'llvm'),
+ string(name: 'CFG_FILENAME', value: combinedCfgFiles),
+ string(name: 'ZNVER', value: znverValue),
+ string(name: 'BENCHMARK_LIST', value: params.CPU2017_BENCHMARK_LIST ?: ''),
+ string(name: 'SPEC_VALIDATION', value: specValidation),
+ string(name: 'SPEC_COPIES', value: specCopies),
+ string(name: 'build_time', value: params.build_time ?: '4:00:00'),
+ string(name: 'run_time', value: params.run_time ?: '4:00:00'),
+ string(name: 'BUILD_TYPE_SUFFIX', value: buildType),
+ string(name: 'SPEC_BUILD_OR_RUN', value: specBuildOrRun),
+ string(name: 'PREBUILT_EXES_TAR_URL', value: prebuiltExesUrl),
+ string(name: 'jemalloc_url', value: params.jemalloc_url ?: ''),
+ string(name: 'libm_url', value: params.libm_url ?: ''),
+ string(name: 'amdalloc_url', value: params.amdalloc_url ?: ''),
+ string(name: 'ssmalloc_url', value: params.ssmalloc_url ?: '')
+ ]
+ buildParams.addAll(getMlceTuningParams())
+ if (params.CPU2017_EXTRA_RUNCPU_ARGS?.trim()) {
+ buildParams.add(string(name: 'EXTRA_RUNCPU_ARGS', value: params.CPU2017_EXTRA_RUNCPU_ARGS))
+ }
+
+ def buildResult = build(
+ propagate: false, wait: true,
+ job: 'AOCC-Workloads/SPEC/CPU2017',
+ parameters: buildParams
+ )
+ String resultKey = buildType ? "CPU2017-${buildType}" : 'CPU2017-single'
+ buildResults[resultKey] = buildResult.result
+
+ if (buildType == 'base' || buildType == '') {
+ env."${envPrefix}CPU2017_BASE_BUILD_NUMBER" = buildResult.number
+ } else {
+ env."${envPrefix}CPU2017_LATEST_BUILD_NUMBER" = buildResult.number
+ }
+
+ if (specBuildOrRun == 'build' && exesUrlEnvKey && buildResult.result == 'SUCCESS') {
+ String exesTarBasename = "spec_CPU2017${buildType ? '_' + buildType : ''}_exes.tar.xz"
+ String exesUrl = "${buildResult.absoluteUrl}artifact/lin/${exesTarBasename}"
+ env."${exesUrlEnvKey}" = exesUrl
+ echo "[${stageLabel}] Captured prebuilt exes URL: ${exesUrlEnvKey}=${exesUrl}"
+ }
+ echo "[${stageLabel}] CPU2017 ${buildTypeLabel}: ${buildResult.result} (Build #${buildResult.number})"
+ } catch (Exception e) {
+ String resultKey = buildType ? "CPU2017-${buildType}" : 'CPU2017-single'
+ buildResults[resultKey] = 'FAILED'
+ echo "[${stageLabel}] CPU2017 ${buildTypeLabel} failed with exception: ${e.message}"
+ }
+ }
+
+ echo "\n========== [${stageLabel}] CPU2017 SUMMARY (copies=${specCopies}) =========="
+ buildResults.each { k, v -> echo " ${k}: ${v}" }
+ echo '========================================\n'
+
+ def failedBuilds = buildResults.findAll { k, v -> v != 'SUCCESS' }
+ if (failedBuilds) {
+ echo "ERROR: [${stageLabel}] CPU2017 build(s) had failures: ${failedBuilds.keySet().join(', ')}"
+ catchError(buildResult: 'FAILURE', stageResult: 'FAILURE',
+ message: "[${stageLabel}] CPU2017 tests failed: ${failedBuilds.keySet().join(', ')}") {
+ error("[${stageLabel}] CPU2017 SPEC tests failed")
+ }
+ return false
+ }
+ return true
+}
+
+/**
+ * SPEC CPU2026 branch of one stage. Returns true if every triggered downstream build SUCCEEDED.
+ */
+Boolean runCpu2026Stage(String stageLabel, String envPrefix, String specCopies,
+ String specValidation, String gitCommitValue, String znverValue,
+ String compilerTar,
+ String specBuildOrRun = 'both',
+ String prebuiltExesEnvPrefix = '') {
+ if (!params.ENABLE_CPU2026) { return true }
+
+ List<String> cfgFilesList = getCfgFilesList('cpu2026')
+ if (cfgFilesList.isEmpty()) {
+ echo "[${stageLabel}] Skipping SPEC-CPU2026: No cpu2026 cfg files found"
+ return true
+ }
+ String combinedCfgFiles = cfgFilesList.join(', ')
+ echo "[${stageLabel}] Testing CPU2026 (SPEC_COPIES=${specCopies}, SPEC_BUILD_OR_RUN=${specBuildOrRun}) with configs: ${combinedCfgFiles}"
+
+ def buildResults = [:]
+ String specCfgDirValue = getSpecCfgDirValue()
+ List<String> availableBuildTypes = getAvailableBuildTypes(compilerTar)
+
+ availableBuildTypes.each { buildType ->
+ String buildTypeLabel = buildType ?: 'single'
+ String exesUrlEnvKey = prebuiltExesEnvPrefix ?
+ "${prebuiltExesEnvPrefix}CPU2026_${(buildType ?: 'single').toUpperCase()}_EXES_URL" : ''
+ echo "\n========== [${stageLabel}] CPU2026 ${buildTypeLabel} (copies=${specCopies}, mode=${specBuildOrRun}) =========="
+ String cutValue = getCutValue(buildType, 'CPU2026', compilerTar)
+
+ String prebuiltExesUrl = ''
+ if (specBuildOrRun == 'run' && exesUrlEnvKey) {
+ prebuiltExesUrl = env."${exesUrlEnvKey}" ?: ''
+ if (prebuiltExesUrl) {
+ echo "[${stageLabel}] CPU2026 ${buildTypeLabel}: reusing prebuilt exes via ${exesUrlEnvKey}=${prebuiltExesUrl}"
+ } else {
+ echo "[${stageLabel}] WARNING: env.${exesUrlEnvKey} is empty; downstream will fail or rebuild."
+ }
+ }
+
+ try {
+ def buildParams = [
+ string(name: 'CUT', value: cutValue),
+ string(name: 'SPECCPU_CFGDIR', value: specCfgDirValue),
+ string(name: 'CHANGE_ID', value: env.CHANGE_ID ?: ''),
+ string(name: 'GIT_COMMIT', value: (params.GIT_COMMIT_OVERRIDE ?: (gitCommitValue ?: ''))),
+ string(name: 'COMPILER_TYPE', value: 'aocc'),
+ string(name: 'COMPILER_VERSION', value: params.COMPILER_VERSION ?: 'aocc'),
+ string(name: 'SPEC_COMPILER_ID', value: params.SPEC_COMPILER_ID ?: 'llvm'),
+ string(name: 'CFG_FILENAME', value: combinedCfgFiles),
+ string(name: 'ZNVER', value: znverValue),
+ string(name: 'BENCHMARK_LIST', value: params.CPU2026_BENCHMARK_LIST ?: ''),
+ string(name: 'SPEC_VALIDATION', value: specValidation),
+ string(name: 'SPEC_COPIES', value: specCopies),
+ string(name: 'build_time', value: params.build_time ?: '4:00:00'),
+ string(name: 'run_time', value: params.run_time ?: '4:00:00'),
+ string(name: 'BUILD_TYPE_SUFFIX', value: buildType),
+ string(name: 'SPEC_BUILD_OR_RUN', value: specBuildOrRun),
+ string(name: 'PREBUILT_EXES_TAR_URL', value: prebuiltExesUrl),
+ string(name: 'jemalloc_url', value: params.jemalloc_url ?: ''),
+ string(name: 'libm_url', value: params.libm_url ?: ''),
+ string(name: 'amdalloc_url', value: params.amdalloc_url ?: ''),
+ string(name: 'ssmalloc_url', value: params.ssmalloc_url ?: '')
+ ]
+ buildParams.addAll(getMlceTuningParams())
+ if (params.CPU2026_EXTRA_RUNCPU_ARGS?.trim()) {
+ buildParams.add(string(name: 'EXTRA_RUNCPU_ARGS', value: params.CPU2026_EXTRA_RUNCPU_ARGS))
+ }
+
+ def buildResult = build(
+ propagate: false, wait: true,
+ job: 'AOCC-Workloads/SPEC/CPU2026',
+ parameters: buildParams
+ )
+ String resultKey = buildType ? "CPU2026-${buildType}" : 'CPU2026-single'
+ buildResults[resultKey] = buildResult.result
+
+ if (buildType == 'base' || buildType == '') {
+ env."${envPrefix}CPU2026_BASE_BUILD_NUMBER" = buildResult.number
+ } else {
+ env."${envPrefix}CPU2026_LATEST_BUILD_NUMBER" = buildResult.number
+ }
+
+ if (specBuildOrRun == 'build' && exesUrlEnvKey && buildResult.result == 'SUCCESS') {
+ String exesTarBasename = "spec_CPU2026${buildType ? '_' + buildType : ''}_exes.tar.xz"
+ String exesUrl = "${buildResult.absoluteUrl}artifact/lin/${exesTarBasename}"
+ env."${exesUrlEnvKey}" = exesUrl
+ echo "[${stageLabel}] Captured prebuilt exes URL: ${exesUrlEnvKey}=${exesUrl}"
+ }
+ echo "[${stageLabel}] CPU2026 ${buildTypeLabel}: ${buildResult.result} (Build #${buildResult.number})"
+ } catch (Exception e) {
+ String resultKey = buildType ? "CPU2026-${buildType}" : 'CPU2026-single'
+ buildResults[resultKey] = 'FAILED'
+ echo "[${stageLabel}] CPU2026 ${buildTypeLabel} failed with exception: ${e.message}"
+ }
+ }
+
+ echo "\n========== [${stageLabel}] CPU2026 SUMMARY (copies=${specCopies}) =========="
+ buildResults.each { k, v -> echo " ${k}: ${v}" }
+ echo '========================================\n'
+
+ def failedBuilds = buildResults.findAll { k, v -> v != 'SUCCESS' }
+ if (failedBuilds) {
+ echo "ERROR: [${stageLabel}] CPU2026 build(s) had failures: ${failedBuilds.keySet().join(', ')}"
+ catchError(buildResult: 'FAILURE', stageResult: 'FAILURE',
+ message: "[${stageLabel}] CPU2026 tests failed: ${failedBuilds.keySet().join(', ')}") {
+ error("[${stageLabel}] CPU2026 SPEC tests failed")
+ }
+ return false
+ }
+ return true
+}
+
+/**
+ * Run one parallel SPEC stage (CPU2017 + CPU2026). Returns true if all branches passed.
+ */
+Boolean runParallelSpecTesting(String stageLabel, String envPrefix, String specCopies,
+ String specValidation, String gitCommitValue, String znverValue,
+ String compilerTar,
+ String specBuildOrRun = 'both',
+ String prebuiltExesEnvPrefix = '') {
+ Map<String, Boolean> branchPassed = ['SPEC2017': true, 'SPEC-CPU2026': true]
+ parallel(
+ 'SPEC2017': {
+ branchPassed['SPEC2017'] = runCpu2017Stage(stageLabel, envPrefix, specCopies,
+ specValidation, gitCommitValue, znverValue,
+ compilerTar, specBuildOrRun, prebuiltExesEnvPrefix)
+ },
+ 'SPEC-CPU2026': {
+ branchPassed['SPEC-CPU2026'] = runCpu2026Stage(stageLabel, envPrefix, specCopies,
+ specValidation, gitCommitValue, znverValue,
+ compilerTar, specBuildOrRun, prebuiltExesEnvPrefix)
+ }
+ )
+ return branchPassed.values().every { it }
+}
>From d215685eeb1a9fd50dbe86b1da1ae8028160e6a6 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Tue, 23 Jun 2026 10:55:22 +0000
Subject: [PATCH 54/72] CPUPC-7979:
std/time/time.zone/time.zone.timezone/time.zone.members/sys_info.zdump.pass.cpp
suppression imported from amd-staging.
Change-Id: I4b2cf897afdf9c30c22ce4941dc954a8c4cdf10f
---
.amd-ci/upstream/lit_suppressions.txt | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/.amd-ci/upstream/lit_suppressions.txt b/.amd-ci/upstream/lit_suppressions.txt
index 244db189aeb5d8..107d130818dfa1 100644
--- a/.amd-ci/upstream/lit_suppressions.txt
+++ b/.amd-ci/upstream/lit_suppressions.txt
@@ -18,3 +18,7 @@ AddressSanitizer-i386-linux-dynamic :: TestCases/strcat-overlap.cpp
# Intermittent hardware topology detection failure.
# "KMP_HW_SUBSET ignored: all hardware resources would be filtered"
libomp :: affinity/kmp-abs-hw-subset.c
+
+# libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/sys_info.zdump.pass.cpp
+# System timezone database inconsistencies (RHEL8).
+llvm-libc++-shared.cfg.in :: std/time/time.zone/time.zone.timezone/time.zone.members/sys_info.zdump.pass.cpp
>From fc58d4b001c8e58039edc41cef83115462943a61 Mon Sep 17 00:00:00 2001
From: "Prabhu, Anantha" <Anantha.Prabhu at amd.com>
Date: Tue, 23 Jun 2026 19:31:21 +0530
Subject: [PATCH 55/72] Update lit_suppressions.txt
---
.amd-ci/upstream/lit_suppressions.txt | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/.amd-ci/upstream/lit_suppressions.txt b/.amd-ci/upstream/lit_suppressions.txt
index 86dae93d74d9ab..107d130818dfa1 100644
--- a/.amd-ci/upstream/lit_suppressions.txt
+++ b/.amd-ci/upstream/lit_suppressions.txt
@@ -13,3 +13,12 @@ Clang :: Driver/sanitizer-ld.c
# rhel8; i386-linux, i386-linux-dynamic unexpected failure.
AddressSanitizer-i386-linux :: TestCases/strcat-overlap.cpp
AddressSanitizer-i386-linux-dynamic :: TestCases/strcat-overlap.cpp
+
+# openmp/runtime/test/affinity/kmp-abs-hw-subset.c
+# Intermittent hardware topology detection failure.
+# "KMP_HW_SUBSET ignored: all hardware resources would be filtered"
+libomp :: affinity/kmp-abs-hw-subset.c
+
+# libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/sys_info.zdump.pass.cpp
+# System timezone database inconsistencies (RHEL8).
+llvm-libc++-shared.cfg.in :: std/time/time.zone/time.zone.timezone/time.zone.members/sys_info.zdump.pass.cpp
>From a5bc600fdb70cfaec40b2aec4c232a67b055fb7e Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Wed, 24 Jun 2026 06:23:39 +0000
Subject: [PATCH 56/72] CPUPC-7979: More time.zone suppressions imported from
amd-staging.
Change-Id: I2e099282dddbaa72ce7fb3bea071e2ebc39e4284
---
.amd-ci/upstream/lit_suppressions.txt | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/.amd-ci/upstream/lit_suppressions.txt b/.amd-ci/upstream/lit_suppressions.txt
index 107d130818dfa1..43ba4a4e3d7aa9 100644
--- a/.amd-ci/upstream/lit_suppressions.txt
+++ b/.amd-ci/upstream/lit_suppressions.txt
@@ -19,6 +19,7 @@ AddressSanitizer-i386-linux-dynamic :: TestCases/strcat-overlap.cpp
# "KMP_HW_SUBSET ignored: all hardware resources would be filtered"
libomp :: affinity/kmp-abs-hw-subset.c
-# libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/sys_info.zdump.pass.cpp
-# System timezone database inconsistencies (RHEL8).
+# libcxx/test/std/time/time.zone/... - System timezone database inconsistencies (RHEL8).
llvm-libc++-shared.cfg.in :: std/time/time.zone/time.zone.timezone/time.zone.members/sys_info.zdump.pass.cpp
+llvm-libc++-shared.cfg.in :: std/time/time.zone/time.zone.db/time.zone.db.access/current_zone.pass.cpp
+llvm-libc++-shared.cfg.in :: std/time/time.zone/time.zone.db/time.zone.db.tzdb/current_zone.pass.cpp
>From 78d343703368b04e3bace5600bcfd79d9e5f9185 Mon Sep 17 00:00:00 2001
From: "Prabhu, Anantha" <Anantha.Prabhu at amd.com>
Date: Wed, 24 Jun 2026 14:23:20 +0530
Subject: [PATCH 57/72] Update lit_suppressions.txt
---
.amd-ci/upstream/lit_suppressions.txt | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/.amd-ci/upstream/lit_suppressions.txt b/.amd-ci/upstream/lit_suppressions.txt
index 107d130818dfa1..43ba4a4e3d7aa9 100644
--- a/.amd-ci/upstream/lit_suppressions.txt
+++ b/.amd-ci/upstream/lit_suppressions.txt
@@ -19,6 +19,7 @@ AddressSanitizer-i386-linux-dynamic :: TestCases/strcat-overlap.cpp
# "KMP_HW_SUBSET ignored: all hardware resources would be filtered"
libomp :: affinity/kmp-abs-hw-subset.c
-# libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/sys_info.zdump.pass.cpp
-# System timezone database inconsistencies (RHEL8).
+# libcxx/test/std/time/time.zone/... - System timezone database inconsistencies (RHEL8).
llvm-libc++-shared.cfg.in :: std/time/time.zone/time.zone.timezone/time.zone.members/sys_info.zdump.pass.cpp
+llvm-libc++-shared.cfg.in :: std/time/time.zone/time.zone.db/time.zone.db.access/current_zone.pass.cpp
+llvm-libc++-shared.cfg.in :: std/time/time.zone/time.zone.db/time.zone.db.tzdb/current_zone.pass.cpp
>From 2077afac8072f02b743903d220020d27a0068473 Mon Sep 17 00:00:00 2001
From: Vishnu Vardhan <Vishnu.VardhanB at amd.com>
Date: Mon, 29 Jun 2026 12:45:06 +0530
Subject: [PATCH 58/72] Bundle SPEC dependency libs and add driver config for
libamdalloc
Bring the amdalloc fix from amdPR/upstream_main_pipeline_update onto this
branch by merging the SPEC library bundling and clang/clang++/flang driver
config logic into .amd-ci/upstream/run.sh, while keeping this branch's lit
suppressions block.
On Linux the SPEC harness invokes a bare "clang" with empty -L paths, so
ld.lld cannot find the bundled -lamdalloc and binaries cannot load
libamdalloc.so.2 at runtime. bundle_spec_libs_into_cut injects the
dependency libs into the compiler package's lib/, and
write_compiler_link_config drops <driver>.cfg files adding <compiler>/lib
to the link search path (-L) and runtime rpath.
Squashes the equivalent of:
eed396c157fa Bundle SPEC dependency libraries into the compiler package
218371fd1a8c Add clang driver config so SPEC link finds bundled libamdalloc
Co-authored-by: Cursor <cursoragent at cursor.com>
---
.amd-ci/upstream/run.sh | 173 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 173 insertions(+)
diff --git a/.amd-ci/upstream/run.sh b/.amd-ci/upstream/run.sh
index 18be670664160a..2d8c0891128ef4 100755
--- a/.amd-ci/upstream/run.sh
+++ b/.amd-ci/upstream/run.sh
@@ -93,4 +93,177 @@ then
fi
fi
+# Directory (relative to the workspace) holding the SPEC dependency library
+# tars (jemalloc, libm, amdalloc, ssmalloc) pre-downloaded on the Jenkins agent
+# by the Jenkinsfile 'download-spec-libs' stage using the orequest pw_file
+# method. Bind-mounted into the container at ${bind_point}/spec_libs.
+SPEC_LIBS_DIR_DEFAULT='spec_libs'
+
+# Artifactory password file (orequest). /proj is bind-mounted read-only into the
+# container, so this is readable here too and used only as a fallback when the
+# pre-downloaded tars are not present.
+ARTIFACTORY_PW_FILE_DEFAULT='/proj/csse_jenkins2/swtools/.safe-secrets/orequest-AMD-Artifactory'
+
+# Download a single artifactory tar using the orequest pw_file method (mirrors
+# gcc/.amd-ci/upstream/Jenkinsfile). Used only as a fallback; the primary path
+# is the pre-downloaded tars under ${SPEC_LIBS_DIR}.
+fetch_artifactory_tar() {
+ local url="$1" out="$2"
+ if test -z "${url}"
+ then
+ return 1
+ fi
+ if test -f "${url}"
+ then
+ cp -v "${url}" "${out}"
+ return 0
+ fi
+ local pw_file="${ARTIFACTORY_PW_FILE:-${ARTIFACTORY_PW_FILE_DEFAULT}}"
+ if test -f "${pw_file}"
+ then
+ local pw
+ pw=$(head -1 "${pw_file}" | tr -d '\n\r')
+ wget --user=orequest --password="${pw}" --auth-no-challenge -q "${url}" -O "${out}"
+ else
+ echo "WARNING: pw_file ${pw_file} not found; attempting anonymous download of ${url}"
+ wget -q "${url}" -O "${out}" || curl -fSL --connect-timeout 30 --retry 3 -o "${out}" "${url}"
+ fi
+}
+
+# Write clang/clang++/flang config files into the compiler's bin/ so that every
+# driver invocation automatically adds <compiler>/lib to the linker search path
+# and to the runtime rpath. This is required because on Linux the SPEC harness
+# (aocc-devops spec_par.sh do_runcpu) does NOT pass --define <id>_dir=... to
+# runcpu, so the cfg's %{..._dir} macros are undefined and it invokes the
+# compiler as a bare "clang" on PATH with empty -L paths. Without this, the
+# bundled libs in lib/ are invisible to ld.lld and the link fails with
+# "ld.lld: error: unable to find library -lamdalloc". <CFGDIR> keeps the path
+# relocatable (expands to the directory containing the config file, i.e. bin/).
+write_compiler_link_config() {
+ local comp_root="$1"
+ local cfg_body=$'-L<CFGDIR>/../lib\n-Wl,-rpath,<CFGDIR>/../lib\n'
+ local drv
+ for drv in clang clang++ flang
+ do
+ printf '%s' "${cfg_body}" > "${comp_root}/bin/${drv}.cfg"
+ done
+ echo "Wrote driver config files (-L/-rpath <compiler>/lib) to ${comp_root}/bin/:"
+ ls -l "${comp_root}/bin"/{clang,clang++,flang}.cfg 2>/dev/null || true
+}
+
+# Bundle the SPEC dependency libraries (jemalloc, libm, amdalloc, ssmalloc) into
+# the freshly built compiler package. SPEC cfgs such as
+# cpu2017_amd_linux_znver5_llvm_*_bestmined.cfg link -lamdalloc / -lamdalloc-ext,
+# so the libs must live in the compiler's lib/ AND that dir must be on the
+# linker search path. We place the libs in lib/ here and, via
+# write_compiler_link_config, add a driver config that puts lib/ on the -L and
+# rpath search paths (the cfg itself cannot, since <id>_dir is undefined on
+# Linux -- see write_compiler_link_config).
+bundle_spec_libs_into_cut() {
+ local libs_dir="${SPEC_LIBS_DIR:-${SPEC_LIBS_DIR_DEFAULT}}"
+
+ local work
+ work=$(mktemp -d)
+ # shellcheck disable=2064
+ trap "rm -rf '${work}'" RETURN
+
+ # Gather the dependency tars. Prefer the ones pre-downloaded on the agent
+ # (pw_file method, in ${libs_dir}); fall back to fetching here if absent.
+ local -a tars=()
+ if test -d "${libs_dir}"
+ then
+ local t
+ for t in "${libs_dir}"/*.tar "${libs_dir}"/*.tar.xz "${libs_dir}"/*.tar.gz
+ do
+ test -f "${t}" && tars+=("$(readlink -f "${t}")")
+ done
+ fi
+ if test "${#tars[@]}" -eq 0
+ then
+ echo "No pre-downloaded SPEC library tars in ${libs_dir}; trying pw_file fallback for amdalloc."
+ local fb="${work}/amdalloc.tar"
+ if fetch_artifactory_tar "${AMDALLOC_URL:-https://atlartifactory.amd.com:8443/artifactory/SW-AOCC-REL-LOCAL/amdalloc/1.0.4/amdalloc-1.0.4.tar}" "${fb}"
+ then
+ tars+=("${fb}")
+ fi
+ fi
+ if test "${#tars[@]}" -eq 0
+ then
+ echo "ERROR: no SPEC dependency libraries available to bundle into the compiler."
+ return 1
+ fi
+
+ # Locate the compiler tar produced by aocc_build.py (inside the *_build dir).
+ local cut_tar
+ cut_tar=$(find . -path '*_build/*' -name "*-${BUILD_NUMBER:-}*.tar.xz" 2>/dev/null | sort -V | tail -1)
+ if test -z "${cut_tar}"
+ then
+ cut_tar=$(find . -maxdepth 1 -name "*-${BUILD_NUMBER:-}*.tar.xz" 2>/dev/null | sort -V | tail -1)
+ fi
+ if test -z "${cut_tar}"
+ then
+ echo "ERROR: no compiler tar matching *-${BUILD_NUMBER:-}*.tar.xz found; cannot bundle libraries."
+ return 1
+ fi
+ local cut_tar_abs
+ cut_tar_abs=$(readlink -f "${cut_tar}")
+ echo "Bundling SPEC libraries into compiler package: ${cut_tar_abs}"
+
+ # Unpack the compiler tar so we can inject libs into its lib/.
+ local stage="${work}/cut"
+ mkdir -p "${stage}"
+ ( cd "${stage}" && tar -xf "${cut_tar_abs}" )
+ local comp_root
+ comp_root=$(find "${stage}" -mindepth 1 -maxdepth 1 -type d | head -1)
+ if test -z "${comp_root}" || test ! -d "${comp_root}/lib"
+ then
+ echo "ERROR: unpacked compiler tree has no lib/ dir under ${stage}."
+ return 1
+ fi
+
+ # Extract each dependency tar and copy its 64-bit libs into the compiler lib/.
+ # cp -a preserves the lib*.so -> lib*.so.N symlinks. 32-bit (lib32/) libs are
+ # intentionally skipped for this x86-64 compiler.
+ local t ed
+ for t in "${tars[@]}"
+ do
+ ed="${work}/$(basename "${t}").x"
+ mkdir -p "${ed}"
+ if ! tar -xf "${t}" -C "${ed}" --strip-components=1
+ then
+ echo "WARNING: failed to extract ${t}; skipping."
+ continue
+ fi
+ if test -d "${ed}/lib"
+ then
+ cp -a "${ed}/lib/." "${comp_root}/lib/" 2>/dev/null || true
+ fi
+ # Some packages keep the libraries at the top level rather than under lib/.
+ find "${ed}" -maxdepth 1 -type f \( -name '*.so' -o -name '*.so.*' -o -name '*.a' \) \
+ -exec cp -a {} "${comp_root}/lib/" \; 2>/dev/null || true
+ echo "Bundled libraries from $(basename "${t}")."
+ done
+
+ if ls "${comp_root}/lib"/libamdalloc.so* >/dev/null 2>&1
+ then
+ echo "amdalloc libs now present in compiler lib/:"
+ ls -l "${comp_root}/lib"/libamdalloc* || true
+ else
+ echo "WARNING: libamdalloc.so* not found in compiler lib/ after bundling; SPEC -lamdalloc may still fail."
+ fi
+
+ # Make <compiler>/lib discoverable by the linker/loader for every driver
+ # invocation (the SPEC cfg cannot add -L on Linux; see the function comment).
+ write_compiler_link_config "${comp_root}"
+
+ # Repack to the same path so downstream consumers see no structural change.
+ local comp_dir
+ comp_dir=$(basename "${comp_root}")
+ local repacked="${work}/repacked.tar.xz"
+ ( cd "${stage}" && env XZ_OPT="-T0" tar -cJf "${repacked}" "${comp_dir}" )
+ mv -f "${repacked}" "${cut_tar_abs}"
+ echo "Repacked compiler package with SPEC libraries bundled: ${cut_tar_abs}"
+}
+
execute_build
+bundle_spec_libs_into_cut || { echo "SPEC library bundling failed."; exit 1; }
>From 472f5f28a3504287824c52097476b26595207849 Mon Sep 17 00:00:00 2001
From: anprabhu <Anantha.Prabhu at amd.com>
Date: Mon, 29 Jun 2026 19:41:54 +0530
Subject: [PATCH 59/72] Run Fujitsu and Polyhedron in parallel
Change-Id: Ic7b3f83cb58e5bc6d22cbf8c7f946eca1c2d16b4
---
.amd-ci/upstream/Jenkinsfile | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index 705be6480a1470..bab94f1f125457 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -730,10 +730,9 @@ try {
]
String fujitsuSuiteName = 'Fujitsu'
String gfortranSuiteName = 'GFortran'
- List<String> downstreamSuites = [gfortranSuiteName, 'NAGLLVM']
- if (timerTrigger) {
- downstreamSuites.addAll([fujitsuSuiteName, 'Polyhedron'])
- }
+ List<String> downstreamSuites = [
+ gfortranSuiteName, 'NAGLLVM', fujitsuSuiteName, 'Polyhedron'
+ ]
for (suite in downstreamSuites) {
String suiteName = suite
List suiteParams = [
>From a29de391ae0c712a9a57ceb955e6b78c205c6222 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Tue, 30 Jun 2026 14:12:43 +0000
Subject: [PATCH 60/72] CPUPC-7979: PR-branch cleanup action for this branch.
Change-Id: I07fa0724ee7c06a5900b2260d1c7e8b59b6874f9
---
.github/workflows/amd-delete-pr-branches.yaml | 98 +++++++++++++++++++
1 file changed, 98 insertions(+)
create mode 100644 .github/workflows/amd-delete-pr-branches.yaml
diff --git a/.github/workflows/amd-delete-pr-branches.yaml b/.github/workflows/amd-delete-pr-branches.yaml
new file mode 100644
index 00000000000000..77c2928cf6b6fb
--- /dev/null
+++ b/.github/workflows/amd-delete-pr-branches.yaml
@@ -0,0 +1,98 @@
+# GitHub Actions workflow to automatically delete amdPR/* branches after PR closure
+# This workflow helps maintain repository cleanliness by removing temporary branches
+name: AMD - Delete amdPR/* Branches After Merge and Notify
+
+# Trigger this workflow when a pull request is merged
+on:
+ pull_request:
+ types: [closed]
+
+# Define minimum required permissions for security
+permissions:
+ contents: read
+
+# Set default shell to bash for all steps
+defaults:
+ run:
+ shell: bash
+
+jobs:
+ # Main job to handle branch deletion logic
+ delete-branch:
+ # Job runs only if the pull request was merged (merged == true)
+ # If the PR was just closed without merging, this job is skipped
+ if: github.event.pull_request.merged == true
+ runs-on: amd_linux
+ # Define outputs that can be consumed by dependent jobs
+ outputs:
+ delete_status: ${{ steps.delete_branch.outputs.delete_status }}
+ branch_name: ${{ steps.check_branch.outputs.branch_name }}
+ steps:
+ # Step 1: Check if the source branch follows the amdPR/* naming pattern
+ - name: Check if source branch matches amdPR/*
+ id: check_branch
+ run: |
+ # Get the branch name from the pull request event
+ BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
+ echo "Processing branch: $BRANCH_NAME"
+
+ # Convert branch name to lowercase for case-insensitive comparison
+ BRANCH_NAME_LOWER=$(echo "$BRANCH_NAME" | tr '[:upper:]' '[:lower:]')
+
+ # Check if branch name starts with 'amdpr/'
+ if [[ "$BRANCH_NAME_LOWER" == amdpr/* ]]; then
+ echo "Branch matches AOCC PR branch convention - will proceed with deletion"
+ echo "delete_branch=true" >> $GITHUB_OUTPUT
+ echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
+ else
+ echo "Branch does not match amdPR/* pattern - skipping deletion"
+ echo "delete_branch=false" >> $GITHUB_OUTPUT
+ fi
+
+ # Step 2: Delete the branch using GitHub Enterprise API (only if it matches pattern)
+ - name: Delete branch via GitHub Enterprise API
+ if: steps.check_branch.outputs.delete_branch == 'true'
+ id: delete_branch
+ run: |
+ # Get the branch name from the previous step
+ BRANCH_NAME="${{ steps.check_branch.outputs.branch_name }}"
+ echo "Attempting to delete branch: $BRANCH_NAME"
+
+ # Make API call to delete the branch and capture HTTP status code
+ STATUS_CODE=$(curl -s -o /dev/null -w "%{http_code}" -X DELETE -H "Authorization: token ${{ secrets.OREQUEST_GH_TOKEN }}" -H "Accept: application/vnd.github.v3+json" https://github.amd.com/api/v3/repos/${{ github.repository }}/git/refs/heads/$BRANCH_NAME)
+
+ echo "API response status code: $STATUS_CODE"
+ echo "status_code=$STATUS_CODE" >> $GITHUB_OUTPUT
+
+ # Determine success/failure based on HTTP status code (204 = success)
+ if [[ "$STATUS_CODE" == "204" ]]; then
+ echo "Branch deletion successful"
+ echo "delete_status=success" >> $GITHUB_OUTPUT
+ else
+ echo "Branch deletion failed"
+ echo "delete_status=failure" >> $GITHUB_OUTPUT
+ fi
+
+ # Notification job to report the outcome of branch deletion
+ notify:
+ needs: delete-branch
+ runs-on: amd_linux
+ # Run this job regardless of whether the previous job succeeded or failed
+ if: always()
+ steps:
+ # Step 1: Send appropriate notification based on deletion outcome
+ - name: Send notification
+ run: |
+ # Get the deletion status from the previous job
+ DELETE_STATUS="${{ needs.delete-branch.outputs.delete_status }}"
+ BRANCH_NAME="${{ needs.delete-branch.outputs.branch_name }}"
+
+ # Send different notifications based on the outcome
+ if [[ "$DELETE_STATUS" == "success" ]]; then
+ echo "✅ Branch '$BRANCH_NAME' deletion successful for PR #${{ github.event.pull_request.number }}"
+ elif [[ "$DELETE_STATUS" == "failure" ]]; then
+ echo "Branch '$BRANCH_NAME' deletion failed for PR #${{ github.event.pull_request.number }}"
+ else
+ echo "No branch deletion attempted for PR #${{ github.event.pull_request.number }} (branch doesn't match amdPR/* pattern)"
+ fi
+
>From 0647d9edd528f1bf2fc0fff54a352ca599e30325 Mon Sep 17 00:00:00 2001
From: "Prabhu, Anantha" <Anantha.Prabhu at amd.com>
Date: Wed, 1 Jul 2026 19:22:36 +0530
Subject: [PATCH 61/72] Update Jenkinsfile
SPEC now runs for postsub under the same conditions as TestSuites. I removed the !postsub gating in the four SPEC-related spots
---
.amd-ci/upstream/Jenkinsfile | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index bab94f1f125457..2f281a4db9c15f 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -607,7 +607,6 @@ try {
// ----------------------------------------------------------------
Boolean shouldCloneSpecConfigs = (
params.USE_SPEC_CONFIGS_REPO &&
- !postsub &&
(params.ENABLE_CPU2017 || params.ENABLE_CPU2026)
)
if (shouldCloneSpecConfigs) {
@@ -629,7 +628,6 @@ try {
// to inject into).
Boolean shouldDownloadSpecLibs = (
!params.USE_PREBUILT_CUT &&
- !postsub &&
(params.ENABLE_CPU2017 || params.ENABLE_CPU2026)
)
if (shouldDownloadSpecLibs) {
@@ -779,10 +777,10 @@ try {
// ================================================================
// Two-Stage Parallel SPEC Testing
// Stage Build (build-only) -> Stage 1 (basic) -> Stage 2 (full).
- // Skipped on postsub branches; gated on compilerTar / USE_PREBUILT_CUT.
+ // Runs for presub and postsub; gated on compilerTar / USE_PREBUILT_CUT.
// ================================================================
Boolean canRunSpec = (compilerTar != null) || params.USE_PREBUILT_CUT || params.FORCE_SPEC
- if (!postsub && canRunSpec) {
+ if (canRunSpec) {
downstreamParallel['SPEC'] = {
Boolean stage1Passed = true
Boolean stageBuildPassed = false
@@ -854,8 +852,6 @@ try {
echo "Stage 2 result: ${stage2Passed ? 'PASSED' : 'FAILED'}"
}
} // end downstreamParallel['SPEC'] closure
- } else if (postsub) {
- echo 'Skipping Parallel SPEC Testing on postsub branch.'
} else {
echo 'Skipping Parallel SPEC Testing: no compiler tar and USE_PREBUILT_CUT/FORCE_SPEC not set.'
}
@@ -1137,8 +1133,7 @@ echo "[sanitize] scanned=$scanned modified=$modified (pre-LLVM21 flags stripped)
//
// Stash the resulting URL in env.SPEC_CONFIGS_ARTIFACT_URL for
// getSpecCfgDirValue() to forward downstream as SPECCPU_CFGDIR. No-op if
-// the spec-configs clone never happened (USE_SPEC_CONFIGS_REPO=false or
-// postsub run).
+// the spec-configs clone never happened (USE_SPEC_CONFIGS_REPO=false).
void archiveSpecConfigsIfPresent() {
if (!fileExists('spec-configs')) {
return
>From 439611a7b782b57f90a45a3ba386d6f6ec16ae4a Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Fri, 3 Jul 2026 10:35:45 +0000
Subject: [PATCH 62/72] CPUPC-7979: Use 'PR' partitions for functional runs.
Pass BRANCH_CONTEXT.
Change-Id: I683ce6fc24f0a224aa47d314ddfd5fb888ac3150
---
.amd-ci/upstream/Jenkinsfile | 48 +++++++++++++++++++++++++++---------
1 file changed, 36 insertions(+), 12 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index 2f281a4db9c15f..aaa38487a65fc1 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -805,7 +805,7 @@ try {
stageBuildPassed = runParallelSpecTesting(
'Stage Build', prebuiltExesEnvPrefix, '1', 'functional',
resolvedGitCommit, effectiveZnver, compilerTar,
- 'build', prebuiltExesEnvPrefix
+ actualTarget, 'build', prebuiltExesEnvPrefix
)
echo "Stage Build result: ${stageBuildPassed ? 'PASSED' : 'FAILED'}"
['CPU2017_BASE', 'CPU2017_LATEST', 'CPU2017_SINGLE',
@@ -829,7 +829,7 @@ try {
stage1Passed = runParallelSpecTesting(
'Stage 1', '', stage1Copies, stage1Validation,
resolvedGitCommit, effectiveZnver, compilerTar,
- runStagesMode, runStagesPrefix
+ actualTarget, runStagesMode, runStagesPrefix
)
echo "Stage 1 result: ${stage1Passed ? 'PASSED' : 'FAILED'}"
}
@@ -847,7 +847,7 @@ try {
Boolean stage2Passed = runParallelSpecTesting(
'Stage 2', 'STAGE2_', stage2Copies, stage2Validation,
resolvedGitCommit, effectiveZnver, compilerTar,
- runStagesMode, runStagesPrefix
+ actualTarget, runStagesMode, runStagesPrefix
)
echo "Stage 2 result: ${stage2Passed ? 'PASSED' : 'FAILED'}"
}
@@ -949,6 +949,24 @@ String findBuildDir() {
return null
}
+/**
+ * Resolve the ZNVER / SLURM partition for a given SPEC suite and validation
+ * mode. Mirrors CommitCheck.groovy specFunctionalPartitions /
+ * specPerformancePartitions maps.
+ *
+ * functional: cpu2017 -> '5_512c_dvt' cpu2026 -> '5_384c'
+ * performance: cpu2017 -> '5_512c' cpu2026 -> '5_512c'
+ */
+String getSpecPartition(String suite, String validationMode) {
+ if (validationMode == 'performance') {
+ return '5_512c'
+ }
+ if (suite == 'cpu2017') {
+ return '5_512c_dvt'
+ }
+ return '5_384c'
+}
+
/* ==========================================================================
* Parallel SPEC Build CI helpers (mirrors gcc/.amd-ci/upstream/Jenkinsfile).
*
@@ -1281,7 +1299,7 @@ List getMlceTuningParams() {
*/
Boolean runCpu2017Stage(String stageLabel, String envPrefix, String specCopies,
String specValidation, String gitCommitValue, String znverValue,
- String compilerTar,
+ String compilerTar, String branchContext,
String specBuildOrRun = 'both',
String prebuiltExesEnvPrefix = '') {
if (!params.ENABLE_CPU2017) { return true }
@@ -1292,7 +1310,9 @@ Boolean runCpu2017Stage(String stageLabel, String envPrefix, String specCopies,
return true
}
String combinedCfgFiles = cfgFilesList.join(', ')
- echo "[${stageLabel}] Testing CPU2017 (SPEC_COPIES=${specCopies}, SPEC_BUILD_OR_RUN=${specBuildOrRun}) with configs: ${combinedCfgFiles}"
+ String defaultZnver = '5_512c'
+ String resolvedZnver = (znverValue != defaultZnver) ? znverValue : getSpecPartition('cpu2017', specValidation)
+ echo "[${stageLabel}] Testing CPU2017 (SPEC_COPIES=${specCopies}, SPEC_BUILD_OR_RUN=${specBuildOrRun}, ZNVER=${resolvedZnver}) with configs: ${combinedCfgFiles}"
def buildResults = [:]
String specCfgDirValue = getSpecCfgDirValue()
@@ -1325,7 +1345,7 @@ Boolean runCpu2017Stage(String stageLabel, String envPrefix, String specCopies,
string(name: 'COMPILER_VERSION', value: params.COMPILER_VERSION ?: 'aocc'),
string(name: 'SPEC_COMPILER_ID', value: params.SPEC_COMPILER_ID ?: 'llvm'),
string(name: 'CFG_FILENAME', value: combinedCfgFiles),
- string(name: 'ZNVER', value: znverValue),
+ string(name: 'ZNVER', value: resolvedZnver),
string(name: 'BENCHMARK_LIST', value: params.CPU2017_BENCHMARK_LIST ?: ''),
string(name: 'SPEC_VALIDATION', value: specValidation),
string(name: 'SPEC_COPIES', value: specCopies),
@@ -1334,6 +1354,7 @@ Boolean runCpu2017Stage(String stageLabel, String envPrefix, String specCopies,
string(name: 'BUILD_TYPE_SUFFIX', value: buildType),
string(name: 'SPEC_BUILD_OR_RUN', value: specBuildOrRun),
string(name: 'PREBUILT_EXES_TAR_URL', value: prebuiltExesUrl),
+ string(name: 'BRANCH_CONTEXT', value: branchContext),
string(name: 'jemalloc_url', value: params.jemalloc_url ?: ''),
string(name: 'libm_url', value: params.libm_url ?: ''),
string(name: 'amdalloc_url', value: params.amdalloc_url ?: ''),
@@ -1393,7 +1414,7 @@ Boolean runCpu2017Stage(String stageLabel, String envPrefix, String specCopies,
*/
Boolean runCpu2026Stage(String stageLabel, String envPrefix, String specCopies,
String specValidation, String gitCommitValue, String znverValue,
- String compilerTar,
+ String compilerTar, String branchContext,
String specBuildOrRun = 'both',
String prebuiltExesEnvPrefix = '') {
if (!params.ENABLE_CPU2026) { return true }
@@ -1404,7 +1425,9 @@ Boolean runCpu2026Stage(String stageLabel, String envPrefix, String specCopies,
return true
}
String combinedCfgFiles = cfgFilesList.join(', ')
- echo "[${stageLabel}] Testing CPU2026 (SPEC_COPIES=${specCopies}, SPEC_BUILD_OR_RUN=${specBuildOrRun}) with configs: ${combinedCfgFiles}"
+ String defaultZnver = '5_512c'
+ String resolvedZnver = (znverValue != defaultZnver) ? znverValue : getSpecPartition('cpu2026', specValidation)
+ echo "[${stageLabel}] Testing CPU2026 (SPEC_COPIES=${specCopies}, SPEC_BUILD_OR_RUN=${specBuildOrRun}, ZNVER=${resolvedZnver}) with configs: ${combinedCfgFiles}"
def buildResults = [:]
String specCfgDirValue = getSpecCfgDirValue()
@@ -1437,7 +1460,7 @@ Boolean runCpu2026Stage(String stageLabel, String envPrefix, String specCopies,
string(name: 'COMPILER_VERSION', value: params.COMPILER_VERSION ?: 'aocc'),
string(name: 'SPEC_COMPILER_ID', value: params.SPEC_COMPILER_ID ?: 'llvm'),
string(name: 'CFG_FILENAME', value: combinedCfgFiles),
- string(name: 'ZNVER', value: znverValue),
+ string(name: 'ZNVER', value: resolvedZnver),
string(name: 'BENCHMARK_LIST', value: params.CPU2026_BENCHMARK_LIST ?: ''),
string(name: 'SPEC_VALIDATION', value: specValidation),
string(name: 'SPEC_COPIES', value: specCopies),
@@ -1446,6 +1469,7 @@ Boolean runCpu2026Stage(String stageLabel, String envPrefix, String specCopies,
string(name: 'BUILD_TYPE_SUFFIX', value: buildType),
string(name: 'SPEC_BUILD_OR_RUN', value: specBuildOrRun),
string(name: 'PREBUILT_EXES_TAR_URL', value: prebuiltExesUrl),
+ string(name: 'BRANCH_CONTEXT', value: branchContext),
string(name: 'jemalloc_url', value: params.jemalloc_url ?: ''),
string(name: 'libm_url', value: params.libm_url ?: ''),
string(name: 'amdalloc_url', value: params.amdalloc_url ?: ''),
@@ -1505,7 +1529,7 @@ Boolean runCpu2026Stage(String stageLabel, String envPrefix, String specCopies,
*/
Boolean runParallelSpecTesting(String stageLabel, String envPrefix, String specCopies,
String specValidation, String gitCommitValue, String znverValue,
- String compilerTar,
+ String compilerTar, String branchContext,
String specBuildOrRun = 'both',
String prebuiltExesEnvPrefix = '') {
Map<String, Boolean> branchPassed = ['SPEC2017': true, 'SPEC-CPU2026': true]
@@ -1513,12 +1537,12 @@ Boolean runParallelSpecTesting(String stageLabel, String envPrefix, String specC
'SPEC2017': {
branchPassed['SPEC2017'] = runCpu2017Stage(stageLabel, envPrefix, specCopies,
specValidation, gitCommitValue, znverValue,
- compilerTar, specBuildOrRun, prebuiltExesEnvPrefix)
+ compilerTar, branchContext, specBuildOrRun, prebuiltExesEnvPrefix)
},
'SPEC-CPU2026': {
branchPassed['SPEC-CPU2026'] = runCpu2026Stage(stageLabel, envPrefix, specCopies,
specValidation, gitCommitValue, znverValue,
- compilerTar, specBuildOrRun, prebuiltExesEnvPrefix)
+ compilerTar, branchContext, specBuildOrRun, prebuiltExesEnvPrefix)
}
)
return branchPassed.values().every { it }
>From d8f3b42e7176d515a649e9afc2cd3d135edb6695 Mon Sep 17 00:00:00 2001
From: anprabhu <Anantha.Prabhu at amd.com>
Date: Tue, 7 Jul 2026 11:53:34 +0530
Subject: [PATCH 63/72] CPUPC-7979: Git commit build description
Change-Id: Ie0ad161c68e76675a7ab4ea55948a781ceb9c82e
---
.amd-ci/upstream/Jenkinsfile | 40 +++++++++++++++++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index aaa38487a65fc1..ee24df5a9f810e 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -496,6 +496,9 @@ try {
)
)
assert gitVars.GIT_COMMIT
+ // Record the llvm-project commit in the build description
+ // once the clone completes.
+ addCommitToBuildDescr(gitVars.GIT_URL, gitVars.GIT_COMMIT, llvmProj)
if (isPrBranch) {
prLatestCommit = gitVars.GIT_COMMIT
withEnv([gitPathEnv]) {
@@ -881,6 +884,35 @@ try {
throw e
}
+/*
+ * Append a line to the build description (HTML, <br>-separated), matching the
+ * convention used by aocc-essentials CommitCheck.
+ */
+void appendDescription(String text) {
+ if (currentBuild.description) {
+ currentBuild.description += '<br>' + text
+ } else {
+ currentBuild.description = text
+ }
+}
+
+/*
+ * Record a repo's GIT_COMMIT in the build description as a clickable link:
+ * GIT_COMMIT (<repo>): <a href='<url>/commit/<full-sha>'><short-sha></a>
+ */
+void addCommitToBuildDescr(String gitUrl, String gitCommit, String gitRepo) {
+ String ourUrl = gitUrl
+ if (ourUrl.endsWith('.git')) {
+ ourUrl = ourUrl[0..ourUrl.length() - 5]
+ }
+ String commitDescrip = (
+ 'GIT_COMMIT (' + gitRepo + "): <a href='" +
+ ourUrl + '/commit/' + gitCommit + "'>" +
+ gitCommit[0..7] + '</a>'
+ )
+ appendDescription(commitDescrip)
+}
+
/*
* Using build(propagate: false, ...) and the following function
* supplies better information back to GitHub Checks than if
@@ -1069,8 +1101,9 @@ ls -l spec_libs/ || true
*/
void cloneSpecConfigs(String repoUrl, String branch, String credentialsId, String gitTool) {
echo "[+] Cloning spec-configs (${repoUrl}, branch ${branch}) into spec-configs/"
+ def specScmVars // groovylint-disable-line NoDef,VariableTypeRequired
dir('spec-configs') {
- checkout(
+ specScmVars = checkout(
changelog: false,
scm: scmGit(
gitTool: gitTool,
@@ -1088,6 +1121,11 @@ void cloneSpecConfigs(String repoUrl, String branch, String credentialsId, Strin
)
}
echo '[+] Clone of spec-configs completed'
+ // Record the spec-configs commit in the build description once the clone
+ // completes.
+ if (specScmVars?.GIT_COMMIT) {
+ addCommitToBuildDescr(specScmVars.GIT_URL ?: repoUrl, specScmVars.GIT_COMMIT, 'spec-configs')
+ }
sh(label: 'spec-configs-summary',
script: '''set -e
ls -1 spec-configs | head -n 50
>From 65eaa9fd0c81c61fb46cf879edfc1015c36fcb81 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Tue, 7 Jul 2026 10:36:37 +0000
Subject: [PATCH 64/72] CPUPC-7979: Factoring out common utils into new
aocc-devops utils lib.
Change-Id: Idefa5bf14b0431799eb0f81ae11a74645c9d0fcf
---
.amd-ci/upstream/Jenkinsfile | 355 ++++++++++++++---------------------
1 file changed, 138 insertions(+), 217 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index ee24df5a9f810e..42ef9c796e1d7c 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -1,5 +1,23 @@
+import groovy.transform.Field
import hudson.model.Result
+// Load aocc-devops shared library for PipelineUtils.
+String devopsLibPin = 'ffe541d'
+Object devopsLib = library(
+ changelog: false,
+ identifier: 'aoccDevopsUtils@' + devopsLibPin,
+ retriever: modernSCM(
+ scm: [
+ $class: 'GitSCMSource',
+ remote: 'git at github.amd.com:cpu-compilers/aocc-devops.git',
+ credentialsId: 'Jenkins-AOCC-nonER-SSH'
+ ],
+ libraryPath: 'groovy_lib'
+ )
+)
+ at Field Object putils
+putils = devopsLib.com.aocc.pipeline.PipelineUtils.new(this)
+
/* groovylint-disable-next-line CompileStatic */
String actualTarget = env.CHANGE_TARGET ?: env.BRANCH_NAME
String upstreamBranch = 'upstream-main', stagingBranch = 'amd-staging'
@@ -498,7 +516,7 @@ try {
assert gitVars.GIT_COMMIT
// Record the llvm-project commit in the build description
// once the clone completes.
- addCommitToBuildDescr(gitVars.GIT_URL, gitVars.GIT_COMMIT, llvmProj)
+ putils.addCommitToBuildDescr(gitVars.GIT_URL, gitVars.GIT_COMMIT, llvmProj)
if (isPrBranch) {
prLatestCommit = gitVars.GIT_COMMIT
withEnv([gitPathEnv]) {
@@ -671,7 +689,7 @@ try {
currentBuild.result = successResultStr
}
} finally {
- String cmakeBuildDir = findBuildDir()
+ String cmakeBuildDir = putils.findBuildDir()
def compilerZips // groovylint-disable-line NoDef,VariableTypeRequired
if (cmakeBuildDir) {
compilerZips = findFiles(
@@ -724,57 +742,57 @@ try {
// run concurrently instead of the suites blocking the SPEC stages.
Map downstreamParallel = [:]
if (compilerTar) {
- downstreamParallel['TestSuites'] = {
- stage('downstream-tasks') {
- Map allTasks = [
- failFast: false,
- ]
- String fujitsuSuiteName = 'Fujitsu'
- String gfortranSuiteName = 'GFortran'
- List<String> downstreamSuites = [
- gfortranSuiteName, 'NAGLLVM', fujitsuSuiteName, 'Polyhedron'
- ]
- for (suite in downstreamSuites) {
- String suiteName = suite
- List suiteParams = [
- string(
- name: 'CUT',
- value: env.BUILD_URL + 'artifact/' + compilerTar
- ),
- string(name: 'BRANCH_CONTEXT', value: actualTarget),
- string(name: 'CHANGE_ID', value: env.CHANGE_ID ?: ''),
- string(name: gitCommitEnv, value: gitVars.GIT_COMMIT ?: '')
- ]
- if (suite == gfortranSuiteName) {
- String sBr = mainBranchName
- if (actualTarget == 'aocc_llvm21') {
- /*
- * Thirumalai notes
- * "21.x had some issues with tests.py (LLVM-LIT), so I switched to 22.x,
- * and there were no issues there with LIT."
- */
- sBr = 'release/22.x'
- }
- suiteParams += string(
- name: 'SUITE_BRANCH',
- value: sBr
- )
- }
- allTasks[suiteName] = {
- stage('downstream-suite-' + suiteName) {
- def result = build( // groovylint-disable-line NoDef,VariableTypeRequired
- propagate: false,
- wait: true,
- job: 'AOCC-Workloads/TestSuites/' + suiteName,
- parameters: suiteParams
- )
- handleBuildResult(result, suiteName != fujitsuSuiteName)
+ downstreamParallel['TestSuites'] = {
+ stage('downstream-tasks') {
+ Map allTasks = [
+ failFast: false,
+ ]
+ String fujitsuSuiteName = 'Fujitsu'
+ String gfortranSuiteName = 'GFortran'
+ List<String> downstreamSuites = [
+ gfortranSuiteName, 'NAGLLVM', fujitsuSuiteName, 'Polyhedron'
+ ]
+ for (suite in downstreamSuites) {
+ String suiteName = suite
+ List suiteParams = [
+ string(
+ name: 'CUT',
+ value: env.BUILD_URL + 'artifact/' + compilerTar
+ ),
+ string(name: 'BRANCH_CONTEXT', value: actualTarget),
+ string(name: 'CHANGE_ID', value: env.CHANGE_ID ?: ''),
+ string(name: gitCommitEnv, value: gitVars.GIT_COMMIT ?: '')
+ ]
+ if (suite == gfortranSuiteName) {
+ String sBr = mainBranchName
+ if (actualTarget == 'aocc_llvm21') {
+ /*
+ * Thirumalai notes
+ * "21.x had some issues with tests.py (LLVM-LIT), so I switched to 22.x,
+ * and there were no issues there with LIT."
+ */
+ sBr = 'release/22.x'
+ }
+ suiteParams += string(
+ name: 'SUITE_BRANCH',
+ value: sBr
+ )
+ }
+ allTasks[suiteName] = {
+ stage('downstream-suite-' + suiteName) {
+ def result = build( // groovylint-disable-line NoDef,VariableTypeRequired
+ propagate: false,
+ wait: true,
+ job: 'AOCC-Workloads/TestSuites/' + suiteName,
+ parameters: suiteParams
+ )
+ putils.handleBuildResult(result, suiteName != fujitsuSuiteName)
+ }
+ }
}
+ parallel(allTasks)
}
- }
- parallel(allTasks)
- }
- } // end downstreamParallel['TestSuites'] closure
+ } // end downstreamParallel['TestSuites'] closure
} // end if (compilerTar) for non-SPEC downstream test suites
// ================================================================
@@ -785,75 +803,75 @@ try {
Boolean canRunSpec = (compilerTar != null) || params.USE_PREBUILT_CUT || params.FORCE_SPEC
if (canRunSpec) {
downstreamParallel['SPEC'] = {
- Boolean stage1Passed = true
- Boolean stageBuildPassed = false
- String prebuiltExesEnvPrefix = 'STAGE_BUILD_'
- String stage1Copies = (params.STAGE1_SPEC_COPIES?.trim() ?: '1')
- String stage2Copies = (params.STAGE2_SPEC_COPIES?.trim() ?: '512')
- String stage1Validation = (params.STAGE1_SPEC_VALIDATION?.trim() ?: 'functional')
- String stage2Validation = (params.STAGE2_SPEC_VALIDATION?.trim() ?: 'performance')
- String resolvedGitCommit = (gitVars?.GIT_COMMIT ?: '')
- String effectiveZnver = (params.ZNVER?.trim() ?: '5_512c')
-
- stage('Stage Build: Parallel SPEC Build') {
- if (!params.ENABLE_STAGE_BUILD) {
- echo 'Skipping Stage Build: ENABLE_STAGE_BUILD=false (Stage 1/2 will build+run)'
- return
- }
- if (!params.ENABLE_CPU2017 && !params.ENABLE_CPU2026) {
- echo 'Skipping Stage Build: both ENABLE_CPU2017 and ENABLE_CPU2026 are false'
- return
- }
- echo 'Running Stage Build (CPU2017 + CPU2026 build-only pass; csg_specslurm --build_only)'
- stageBuildPassed = runParallelSpecTesting(
- 'Stage Build', prebuiltExesEnvPrefix, '1', 'functional',
- resolvedGitCommit, effectiveZnver, compilerTar,
- actualTarget, 'build', prebuiltExesEnvPrefix
- )
- echo "Stage Build result: ${stageBuildPassed ? 'PASSED' : 'FAILED'}"
- ['CPU2017_BASE', 'CPU2017_LATEST', 'CPU2017_SINGLE',
- 'CPU2026_BASE', 'CPU2026_LATEST', 'CPU2026_SINGLE'].each { suffix ->
- String key = "${prebuiltExesEnvPrefix}${suffix}_EXES_URL"
- if (env."${key}") {
- echo " ${key}=${env."${key}"}"
+ Boolean stage1Passed = true
+ Boolean stageBuildPassed = false
+ String prebuiltExesEnvPrefix = 'STAGE_BUILD_'
+ String stage1Copies = (params.STAGE1_SPEC_COPIES?.trim() ?: '1')
+ String stage2Copies = (params.STAGE2_SPEC_COPIES?.trim() ?: '512')
+ String stage1Validation = (params.STAGE1_SPEC_VALIDATION?.trim() ?: 'functional')
+ String stage2Validation = (params.STAGE2_SPEC_VALIDATION?.trim() ?: 'performance')
+ String resolvedGitCommit = (gitVars?.GIT_COMMIT ?: '')
+ String effectiveZnver = (params.ZNVER?.trim() ?: '5_512c')
+
+ stage('Stage Build: Parallel SPEC Build') {
+ if (!params.ENABLE_STAGE_BUILD) {
+ echo 'Skipping Stage Build: ENABLE_STAGE_BUILD=false (Stage 1/2 will build+run)'
+ return
+ }
+ if (!params.ENABLE_CPU2017 && !params.ENABLE_CPU2026) {
+ echo 'Skipping Stage Build: both ENABLE_CPU2017 and ENABLE_CPU2026 are false'
+ return
+ }
+ echo 'Running Stage Build (CPU2017 + CPU2026 build-only pass; csg_specslurm --build_only)'
+ stageBuildPassed = runParallelSpecTesting(
+ 'Stage Build', prebuiltExesEnvPrefix, '1', 'functional',
+ resolvedGitCommit, effectiveZnver, compilerTar,
+ actualTarget, 'build', prebuiltExesEnvPrefix
+ )
+ echo "Stage Build result: ${stageBuildPassed ? 'PASSED' : 'FAILED'}"
+ ['CPU2017_BASE', 'CPU2017_LATEST', 'CPU2017_SINGLE',
+ 'CPU2026_BASE', 'CPU2026_LATEST', 'CPU2026_SINGLE'].each { suffix ->
+ String key = "${prebuiltExesEnvPrefix}${suffix}_EXES_URL"
+ if (env."${key}") {
+ echo " ${key}=${env."${key}"}"
+ }
}
}
- }
- Boolean useStageBuildExes = params.ENABLE_STAGE_BUILD && stageBuildPassed
- String runStagesMode = useStageBuildExes ? 'run' : 'both'
- String runStagesPrefix = useStageBuildExes ? prebuiltExesEnvPrefix : ''
- if (params.ENABLE_STAGE_BUILD && !stageBuildPassed) {
- echo 'WARNING: Stage Build did not pass; Stage 1 / Stage 2 will fall back to legacy build+run.'
- }
-
- stage('Stage 1: Parallel SPEC Testing (Basic Validation)') {
- echo "Running Stage 1 with SPEC_COPIES=${stage1Copies}, SPEC_VALIDATION=${stage1Validation}, SPEC_BUILD_OR_RUN=${runStagesMode}"
- stage1Passed = runParallelSpecTesting(
- 'Stage 1', '', stage1Copies, stage1Validation,
- resolvedGitCommit, effectiveZnver, compilerTar,
- actualTarget, runStagesMode, runStagesPrefix
- )
- echo "Stage 1 result: ${stage1Passed ? 'PASSED' : 'FAILED'}"
- }
+ Boolean useStageBuildExes = params.ENABLE_STAGE_BUILD && stageBuildPassed
+ String runStagesMode = useStageBuildExes ? 'run' : 'both'
+ String runStagesPrefix = useStageBuildExes ? prebuiltExesEnvPrefix : ''
+ if (params.ENABLE_STAGE_BUILD && !stageBuildPassed) {
+ echo 'WARNING: Stage Build did not pass; Stage 1 / Stage 2 will fall back to legacy build+run.'
+ }
- stage('Stage 2: Parallel SPEC Testing (Full Validation)') {
- if (!params.ENABLE_STAGE2) {
- echo 'Skipping Stage 2: ENABLE_STAGE2=false'
- return
+ stage('Stage 1: Parallel SPEC Testing (Basic Validation)') {
+ echo "Running Stage 1 with SPEC_COPIES=${stage1Copies}, SPEC_VALIDATION=${stage1Validation}, SPEC_BUILD_OR_RUN=${runStagesMode}"
+ stage1Passed = runParallelSpecTesting(
+ 'Stage 1', '', stage1Copies, stage1Validation,
+ resolvedGitCommit, effectiveZnver, compilerTar,
+ actualTarget, runStagesMode, runStagesPrefix
+ )
+ echo "Stage 1 result: ${stage1Passed ? 'PASSED' : 'FAILED'}"
}
- if (!stage1Passed) {
- echo 'Skipping Stage 2: Stage 1 had failures (gated on Stage 1 passing)'
- return
+
+ stage('Stage 2: Parallel SPEC Testing (Full Validation)') {
+ if (!params.ENABLE_STAGE2) {
+ echo 'Skipping Stage 2: ENABLE_STAGE2=false'
+ return
+ }
+ if (!stage1Passed) {
+ echo 'Skipping Stage 2: Stage 1 had failures (gated on Stage 1 passing)'
+ return
+ }
+ echo "Running Stage 2 with SPEC_COPIES=${stage2Copies}, SPEC_VALIDATION=${stage2Validation}, SPEC_BUILD_OR_RUN=${runStagesMode}"
+ Boolean stage2Passed = runParallelSpecTesting(
+ 'Stage 2', 'STAGE2_', stage2Copies, stage2Validation,
+ resolvedGitCommit, effectiveZnver, compilerTar,
+ actualTarget, runStagesMode, runStagesPrefix
+ )
+ echo "Stage 2 result: ${stage2Passed ? 'PASSED' : 'FAILED'}"
}
- echo "Running Stage 2 with SPEC_COPIES=${stage2Copies}, SPEC_VALIDATION=${stage2Validation}, SPEC_BUILD_OR_RUN=${runStagesMode}"
- Boolean stage2Passed = runParallelSpecTesting(
- 'Stage 2', 'STAGE2_', stage2Copies, stage2Validation,
- resolvedGitCommit, effectiveZnver, compilerTar,
- actualTarget, runStagesMode, runStagesPrefix
- )
- echo "Stage 2 result: ${stage2Passed ? 'PASSED' : 'FAILED'}"
- }
} // end downstreamParallel['SPEC'] closure
} else {
echo 'Skipping Parallel SPEC Testing: no compiler tar and USE_PREBUILT_CUT/FORCE_SPEC not set.'
@@ -884,103 +902,6 @@ try {
throw e
}
-/*
- * Append a line to the build description (HTML, <br>-separated), matching the
- * convention used by aocc-essentials CommitCheck.
- */
-void appendDescription(String text) {
- if (currentBuild.description) {
- currentBuild.description += '<br>' + text
- } else {
- currentBuild.description = text
- }
-}
-
-/*
- * Record a repo's GIT_COMMIT in the build description as a clickable link:
- * GIT_COMMIT (<repo>): <a href='<url>/commit/<full-sha>'><short-sha></a>
- */
-void addCommitToBuildDescr(String gitUrl, String gitCommit, String gitRepo) {
- String ourUrl = gitUrl
- if (ourUrl.endsWith('.git')) {
- ourUrl = ourUrl[0..ourUrl.length() - 5]
- }
- String commitDescrip = (
- 'GIT_COMMIT (' + gitRepo + "): <a href='" +
- ourUrl + '/commit/' + gitCommit + "'>" +
- gitCommit[0..7] + '</a>'
- )
- appendDescription(commitDescrip)
-}
-
-/*
- * Using build(propagate: false, ...) and the following function
- * supplies better information back to GitHub Checks than if
- * we leave it to 'propagate: true'.
- * Code smell: this method is also in the main AOCC CommitCheck class.
- */
-void handleBuildResult(Object result, Boolean blocking) {
- // groovylint-disable DuplicateStringLiteral,UnnecessaryGetter
- String squote = "'", space = ' ', dot = '.'
- String closeAnchor = '</a>', closeChevron = '>', closeTag = closeChevron
- String downUrl = (
- "Downstream job <a href='" +
- result.getAbsoluteUrl() +
- 'console' + squote + closeTag +
- result.getFullDisplayName() + closeAnchor
- )
- String downMsg = 'Downstream job ' + result.getFullDisplayName()
- String resultStr = result.result
- switch (resultStr) {
- case 'SUCCESS':
- break
- case 'UNSTABLE':
- // Code smell: might want to downgrade currentBuild result here?
- break
- case 'ABORTED':
- // No whitelisted way to throw FlowInterruptedException explicitly:
- String theStat = 'aborted.'
- catchError(
- buildResult: resultStr,
- stageResult: resultStr,
- message: downMsg + space + theStat
- ) {
- error(downUrl + space + theStat)
- }
- case 'FAILURE':
- String theStat = 'failed'
- if (blocking) {
- catchError(
- buildResult: resultStr,
- stageResult: resultStr,
- message: downMsg + space + theStat
- ) {
- error(downUrl + space + theStat + dot)
- }
- } else {
- echo(downUrl + space + theStat + ' but non-blocking was requested.')
- }
- break
- default:
- throw new RuntimeException('Unexpected downstream result: ' + resultStr) // groovylint-disable-line LineLength,ThrowRuntimeException
- }
-}
-
-/*
- * Code smell: this method is also in the main AOCC Build class.
- */
-String findBuildDir() {
- Integer zero = 0 // groovylint-disable DuplicateNumberLiteral
- List<String> buildDirs = findFiles()
- .findAll { f -> f.directory && f.name ==~ /.*_build$/ }*.name.sort()
- echo("Found out-of-tree build dirs: ${buildDirs}")
- if (buildDirs) {
- assert buildDirs.size() == 1
- return buildDirs[zero]
- }
- return null
-}
-
/**
* Resolve the ZNVER / SLURM partition for a given SPEC suite and validation
* mode. Mirrors CommitCheck.groovy specFunctionalPartitions /
@@ -1124,7 +1045,7 @@ void cloneSpecConfigs(String repoUrl, String branch, String credentialsId, Strin
// Record the spec-configs commit in the build description once the clone
// completes.
if (specScmVars?.GIT_COMMIT) {
- addCommitToBuildDescr(specScmVars.GIT_URL ?: repoUrl, specScmVars.GIT_COMMIT, 'spec-configs')
+ putils.addCommitToBuildDescr(specScmVars.GIT_URL ?: repoUrl, specScmVars.GIT_COMMIT, 'spec-configs')
}
sh(label: 'spec-configs-summary',
script: '''set -e
@@ -1263,7 +1184,7 @@ String getSpecCfgDirValue() {
return autoUrl
}
echo 'WARNING: USE_SPEC_CONFIGS_REPO=true but SPEC_CONFIGS_ARTIFACT_URL is unset; ' +
- 'falling back to params.SPECCPU_CFGDIR.'
+ 'falling back to params.SPECCPU_CFGDIR.'
}
String cfgDir = params.SPECCPU_CFGDIR?.trim() ?: ''
if (!cfgDir) {
@@ -1574,13 +1495,13 @@ Boolean runParallelSpecTesting(String stageLabel, String envPrefix, String specC
parallel(
'SPEC2017': {
branchPassed['SPEC2017'] = runCpu2017Stage(stageLabel, envPrefix, specCopies,
- specValidation, gitCommitValue, znverValue,
- compilerTar, branchContext, specBuildOrRun, prebuiltExesEnvPrefix)
+ specValidation, gitCommitValue, znverValue,
+ compilerTar, branchContext, specBuildOrRun, prebuiltExesEnvPrefix)
},
'SPEC-CPU2026': {
branchPassed['SPEC-CPU2026'] = runCpu2026Stage(stageLabel, envPrefix, specCopies,
- specValidation, gitCommitValue, znverValue,
- compilerTar, branchContext, specBuildOrRun, prebuiltExesEnvPrefix)
+ specValidation, gitCommitValue, znverValue,
+ compilerTar, branchContext, specBuildOrRun, prebuiltExesEnvPrefix)
}
)
return branchPassed.values().every { it }
>From 06465cfe3ae596c2493a14f6756416ce2b1a5de1 Mon Sep 17 00:00:00 2001
From: anprabhu <Anantha.Prabhu at amd.com>
Date: Thu, 9 Jul 2026 15:14:59 +0530
Subject: [PATCH 65/72] CPUPC-7979 : Removed the daily cron trigger, Trigger
only for SCM
Change-Id: Ifbcb7d4b1cafe97a45cee187eee2e26e06b1b624
---
.amd-ci/upstream/Jenkinsfile | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index 42ef9c796e1d7c..bf0ec80c6c0755 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -146,11 +146,9 @@ if (isPrBranch) { // Sic; don't want postsub on upstream-main to go through this
)
)
}
-if (postsub) {
- propsList.add(
- pipelineTriggers([cron('TZ=Asia/Kolkata\nH 0 * * *')])
- )
-}
+// Timer (cron) trigger disabled: this job now runs on push events only.
+// Previously postsub added a daily cron ('TZ=Asia/Kolkata\nH 0 * * *') which
+// caused a second daily run alongside the push-to-upstream-main build.
// ===========================================================================
// Parallel SPEC Build CI parameters
>From fd18b7d57d9378dd4b5f03c08212e44fd11a8be0 Mon Sep 17 00:00:00 2001
From: anprabhu <Anantha.Prabhu at amd.com>
Date: Thu, 9 Jul 2026 15:37:18 +0530
Subject: [PATCH 66/72] Remove the timerTrigger declaration and its guard
Change-Id: I93098242693492f8dc93f2182973b427d588d4ed
---
.amd-ci/upstream/Jenkinsfile | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index bf0ec80c6c0755..c416a51d20b80f 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -105,18 +105,19 @@ if (
}
Boolean disableStaging = false, disableRelease = true
-Boolean timerTrigger = currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause')
+// Timer (cron) trigger removed (see the note above the properties block), so a
+// timer-triggered run is no longer possible and the former '!timerTrigger'
+// guard has been dropped from this condition.
if (
((disableStaging &&
actualTarget == stagingBranch) ||
(disableRelease &&
targetIsRelBranch)) &&
- !currentBuild.getBuildCauses(manualCause) &&
- !timerTrigger
+ !currentBuild.getBuildCauses(manualCause)
) {
String cause = currentBuild.getBuildCauses().shortDescription // groovylint-disable-line UnnecessaryGetter
echo 'Pipeline for base ' + actualTarget + ' not built for cause ' + cause
- echo 'Pipeline only runs if manually or timer triggered.'
+ echo 'Pipeline only runs if manually triggered.'
currentBuild.result = notBuiltResultStr
return this
}
@@ -129,8 +130,7 @@ Boolean runDownstream = (
String space = ' ', andChain = '&&', underScore = '_', slash = '/', dash = '-'
String gitCommitEnv = 'GIT_COMMIT', bashCmd = 'bash'
-String skipStr = 'Skipping build.', contStr = 'Continuing build.'
-String contTimerReason = 'Timer trigger.' + space + contStr
+String skipStr = 'Skipping build.'
List propsList = []
if (isPrBranch) { // Sic; don't want postsub on upstream-main to go through this block.
@@ -146,9 +146,13 @@ if (isPrBranch) { // Sic; don't want postsub on upstream-main to go through this
)
)
}
-// Timer (cron) trigger disabled: this job now runs on push events only.
+// Timer (cron) trigger disabled: this job now runs on push/merge events only.
// Previously postsub added a daily cron ('TZ=Asia/Kolkata\nH 0 * * *') which
-// caused a second daily run alongside the push-to-upstream-main build.
+// caused a second daily run alongside the push-to-upstream-main build (the
+// upstream-main branch already receives a daily merge from the llvm_sync job).
+//
+// Restore the timerTrigger detection, the '!timerTrigger' guard,
+// and the merge-status override that were removed alongside this block.
// ===========================================================================
// Parallel SPEC Build CI parameters
@@ -601,13 +605,9 @@ try {
}
if (mstat && mstat != 'None') {
echo('Merge status is ' + mstat)
- if (timerTrigger) {
- echo(contTimerReason)
- } else {
- echo(skipStr)
- isSkippableMerge = true
- return // From stage
- }
+ echo(skipStr)
+ isSkippableMerge = true
+ return // From stage
}
}
}
>From 0f7bf086579c10688f3c8faf236d8073d34cacc8 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Mon, 10 Aug 2026 13:00:44 +0000
Subject: [PATCH 67/72] CPUPC-7979: Use getSpecPartition from aocc-devops utils
Change-Id: Iee21d2748e1300e28cade23946905925a694b833
---
.amd-ci/upstream/Jenkinsfile | 24 +++---------------------
1 file changed, 3 insertions(+), 21 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index c416a51d20b80f..f45337b05a3a76 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -2,7 +2,7 @@ import groovy.transform.Field
import hudson.model.Result
// Load aocc-devops shared library for PipelineUtils.
-String devopsLibPin = 'ffe541d'
+String devopsLibPin = 'cede91d'
Object devopsLib = library(
changelog: false,
identifier: 'aoccDevopsUtils@' + devopsLibPin,
@@ -900,24 +900,6 @@ try {
throw e
}
-/**
- * Resolve the ZNVER / SLURM partition for a given SPEC suite and validation
- * mode. Mirrors CommitCheck.groovy specFunctionalPartitions /
- * specPerformancePartitions maps.
- *
- * functional: cpu2017 -> '5_512c_dvt' cpu2026 -> '5_384c'
- * performance: cpu2017 -> '5_512c' cpu2026 -> '5_512c'
- */
-String getSpecPartition(String suite, String validationMode) {
- if (validationMode == 'performance') {
- return '5_512c'
- }
- if (suite == 'cpu2017') {
- return '5_512c_dvt'
- }
- return '5_384c'
-}
-
/* ==========================================================================
* Parallel SPEC Build CI helpers (mirrors gcc/.amd-ci/upstream/Jenkinsfile).
*
@@ -1268,7 +1250,7 @@ Boolean runCpu2017Stage(String stageLabel, String envPrefix, String specCopies,
}
String combinedCfgFiles = cfgFilesList.join(', ')
String defaultZnver = '5_512c'
- String resolvedZnver = (znverValue != defaultZnver) ? znverValue : getSpecPartition('cpu2017', specValidation)
+ String resolvedZnver = (znverValue != defaultZnver) ? znverValue : putils.getSpecPartition('cpu2017', specValidation)
echo "[${stageLabel}] Testing CPU2017 (SPEC_COPIES=${specCopies}, SPEC_BUILD_OR_RUN=${specBuildOrRun}, ZNVER=${resolvedZnver}) with configs: ${combinedCfgFiles}"
def buildResults = [:]
@@ -1383,7 +1365,7 @@ Boolean runCpu2026Stage(String stageLabel, String envPrefix, String specCopies,
}
String combinedCfgFiles = cfgFilesList.join(', ')
String defaultZnver = '5_512c'
- String resolvedZnver = (znverValue != defaultZnver) ? znverValue : getSpecPartition('cpu2026', specValidation)
+ String resolvedZnver = (znverValue != defaultZnver) ? znverValue : putils.getSpecPartition('cpu2026', specValidation)
echo "[${stageLabel}] Testing CPU2026 (SPEC_COPIES=${specCopies}, SPEC_BUILD_OR_RUN=${specBuildOrRun}, ZNVER=${resolvedZnver}) with configs: ${combinedCfgFiles}"
def buildResults = [:]
>From 793baf78ab625d7d3d25e3df933647f14af761c6 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Wed, 12 Aug 2026 14:36:53 +0000
Subject: [PATCH 68/72] CPUPC-7979: Merged patch-coverage pipeline
Change-Id: I114f08fe2b469069e26c66cb42098d44829166ae
---
.amd-ci/coverage/Jenkinsfile | 239 ++++++++++++++++++
.../llvm_coverage_files_AddClang.cmake | 7 +
.../llvm_coverage_files_AddFlang.cmake | 7 +
.../llvm_coverage_files_AddLLVM.cmake | 14 +
.../upstream/upstream_jenkins_excludes.txt | 15 +-
5 files changed, 269 insertions(+), 13 deletions(-)
create mode 100644 .amd-ci/coverage/Jenkinsfile
create mode 100644 .amd-ci/coverage/llvm_coverage_files_AddClang.cmake
create mode 100644 .amd-ci/coverage/llvm_coverage_files_AddFlang.cmake
create mode 100644 .amd-ci/coverage/llvm_coverage_files_AddLLVM.cmake
diff --git a/.amd-ci/coverage/Jenkinsfile b/.amd-ci/coverage/Jenkinsfile
new file mode 100644
index 00000000000000..2a4359325d18fc
--- /dev/null
+++ b/.amd-ci/coverage/Jenkinsfile
@@ -0,0 +1,239 @@
+// AOCC Coverage Pipeline
+//
+// Purpose: Build instrumented AOCC compiler for code coverage analysis
+// Approach: Two-stage build (Stage 1 bootstraps Stage 2)
+//
+// Currently only compiler/tools are instrumented; runtimes (compiler-rt, openmp,
+// flang-rt) are built as a separate CMake sub-project and don't inherit coverage
+// flags — extending to runtimes is future work.
+
+import hudson.model.Result
+
+/* groovylint-disable-next-line CompileStatic */
+String actualHead = env.CHANGE_BRANCH ?: env.BRANCH_NAME
+String githubUrl = 'https://github.amd.com/cpu-compilers/llvm-project'
+Boolean isPrBranch = env.CHANGE_BRANCH != null
+
+String abortedResultStr = Result.ABORTED, failureResultStr = Result.FAILURE
+String successResultStr = Result.SUCCESS, notBuiltResultStr = Result.NOT_BUILT
+String oneStr = '1'
+String instrumentationScript = 'aocc-essentials/build_essentials/llvm_instrumentation.sh'
+String reportIndex = 'index.html'
+
+List propsList = [
+ disableConcurrentBuilds(abortPrevious: true),
+ buildDiscarder(
+ logRotator(
+ daysToKeepStr: '7',
+ numToKeepStr: '10',
+ artifactDaysToKeepStr: oneStr,
+ artifactNumToKeepStr: oneStr
+ )
+ )
+]
+
+// Only set cron trigger for non-PR branches
+if (!isPrBranch) {
+ propsList.add(pipelineTriggers([cron('TZ=Asia/Kolkata\nH 0 * * *')]))
+}
+
+properties(propsList)
+
+// Coverage builds are expensive (~4-5 h, heavy disk I/O) and run nightly on
+// long-lived branches only. PR branches are unconditionally blocked — add the
+// "run-coverage" label to the PR, or run locally:
+// bash llvm-project/aocc-essentials/build_essentials/llvm_instrumentation.sh --patch_coverage
+String manualCause = 'hudson.model.Cause$UserIdCause'
+String timerCause = 'hudson.triggers.TimerTrigger$TimerTriggerCause'
+if (isPrBranch) {
+ echo 'The nightly coverage pipeline is disabled for PR branches.'
+ echo 'For patch coverage, add the "run-coverage" label to your PR,'
+ echo 'or run locally: llvm_instrumentation.sh --patch_coverage'
+ currentBuild.result = notBuiltResultStr
+ return this
+}
+
+// Only run on timer or manual trigger
+if (
+ !currentBuild.getBuildCauses(manualCause) &&
+ !currentBuild.getBuildCauses(timerCause)
+) {
+ currentBuild.result = notBuiltResultStr
+ echo 'Pipeline only runs if manually or timer triggered.'
+ return this
+}
+
+timeout(time: 6, unit: 'HOURS') {
+ String compilerZip = null
+ Boolean hasSourceChanges = true
+
+ node('atl && apptainer') {
+ try {
+ skipDefaultCheckout()
+
+ stage('clone') {
+ String referenceRepo = env.JENKINS_REMOTE_GIT_CACHE ?: 'NoSuchReferenceRepo'
+ cleanWs(deleteDirs: true)
+
+ // groovylint-disable-next-line NoDef, VariableTypeRequired
+ def gitVars = null
+ dir('llvm-project') {
+ gitVars = checkout(
+ changelog: true,
+ scm: scmGit(
+ gitTool: 'LinuxGit2.45',
+ branches: [[name: actualHead]],
+ browser: github(githubUrl),
+ extensions: [
+ cloneOption(
+ honorRefspec: true,
+ noTags: true,
+ reference: referenceRepo + '/llvm-project.git'
+ )
+ ],
+ userRemoteConfigs: [
+ [
+ credentialsId: 'Jenkins-AOCC-nonER',
+ refspec: (
+ '+refs/heads/' + actualHead + ':' +
+ 'refs/remotes/origin/' + actualHead
+ ),
+ url: githubUrl
+ ]
+ ]
+ )
+ )
+ }
+
+ // For timer builds, check if there have been any changes since last successful build
+ if (
+ currentBuild.getBuildCauses(timerCause) &&
+ gitVars.GIT_PREVIOUS_SUCCESSFUL_COMMIT &&
+ gitVars.GIT_PREVIOUS_SUCCESSFUL_COMMIT == gitVars.GIT_COMMIT
+ ) {
+ echo 'No changes since last successful build at ' + gitVars.GIT_COMMIT
+ echo 'Skipping timer-triggered build to avoid stagnation.'
+ hasSourceChanges = false
+ }
+ }
+
+ if (!hasSourceChanges) {
+ currentBuild.result = notBuiltResultStr
+ cleanWs(deleteDirs: true)
+ return // from try, to finally
+ }
+
+ // Resolve aocc-essentials path
+ // In-tree on amd-staging branches; cloned separately on upstream-main
+ String inTreeScript = 'llvm-project/' + instrumentationScript
+ String essScript
+ if (fileExists(inTreeScript)) {
+ essScript = inTreeScript
+ } else if (fileExists(instrumentationScript)) {
+ essScript = instrumentationScript
+ } else {
+ error 'aocc-essentials not found in llvm-project/ or workspace root'
+ }
+
+ stage('dual-boot-build') {
+ // llvm_instrumentation.sh handles:
+ // - Apptainer invocation via container_aocc_build.sh
+ // - Stage 1 build (bootstrap compiler, C/C++ only)
+ // - Stage 2 build (full compiler using Stage 1, with coverage)
+ // - Stage 2 test (check-clang generates .profraw files)
+ // - Hello World validation + profraw verification
+ // - Coverage report generation (profdata merge + HTML report)
+ //
+ // Model A: Parameterized script, specialized pipelines
+ sh(
+ label: 'dual-boot-build-sh',
+ script: 'bash ' + essScript + ' --coverage'
+ )
+ }
+
+ stage('coverage-report') {
+ // Publish coverage reports generated by llvm_instrumentation.sh --coverage
+ // Nightly produces two reports: AOCC-modified (primary) and Full (secondary).
+ // Patch coverage (--report_patch) is local-only — not published here.
+
+ // AOCC-modified: aocc/ dirs + upstream files with AOCC extensions (primary)
+ publishHTML(target: [
+ allowMissing: true,
+ alwaysLinkToLastBuild: true,
+ keepAll: false,
+ reportDir: 'Release_build_s2/coverage_report_aocc_modified',
+ reportFiles: reportIndex,
+ reportName: 'AOCC Modified Coverage',
+ useWrapperFileDirectly: true
+ ])
+
+ // Full: all clang + LLVM source (secondary, broad context)
+ publishHTML(target: [
+ allowMissing: true,
+ alwaysLinkToLastBuild: true,
+ keepAll: false,
+ reportDir: 'Release_build_s2/coverage_report',
+ reportFiles: reportIndex,
+ reportName: 'Full Coverage Report (all sources)',
+ useWrapperFileDirectly: true
+ ])
+ }
+ } catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
+ currentBuild.result = abortedResultStr
+ echo e.toString()
+ throw e
+ } catch (Exception e) {
+ currentBuild.result = failureResultStr
+ echo e.toString()
+ throw e
+ } finally {
+ stage('archive') {
+ // Skip archiving if build was skipped (workspace was cleaned)
+ if (hasSourceChanges) {
+ // Archive artifacts from BOTH stages, even if build failed
+ // This allows debugging of failed builds
+
+ // Find Stage 2 compiler tarball (may not exist if build failed)
+ // groovylint-disable-next-line NoDef, VariableTypeRequired
+ def foundZips = findFiles(glob: 'Release_build_s2/aocc-compiler-*.tar.xz')
+ if (foundZips) {
+ compilerZip = foundZips[0].path
+ currentBuild.description = 'Stage 2: ' + compilerZip.split('/').last()
+ }
+
+ // Archive whatever artifacts we have (allowEmptyArchive handles missing files)
+ // NOTE: Globs are intentionally specific to avoid archiving
+ // Release_build_s2/profraw/ (coverage data, potentially multi-GB)
+ // and Release_build_s2/coverage_report/ (HTML, published via publishHTML)
+ archiveArtifacts(
+ allowEmptyArchive: true,
+ artifacts: (
+ // Stage 2 artifacts
+ 'Release_build_s2/aocc-compiler-*.tar.xz,' +
+ 'Release_build_s2/*.txt,' +
+ 'Release_build_s2/config_logs/*,' +
+ 'Release_build_s2/ninja_logs/*,' +
+ // Coverage summaries (small text files)
+ 'Release_build_s2/coverage_report/summary.txt,' +
+ 'Release_build_s2/coverage_report_aocc_modified/summary.txt,' +
+ // Stage 1 artifacts (for diagnostics)
+ 'Release_build_s1/*.txt,' +
+ 'Release_build_s1/config_logs/*,' +
+ 'Release_build_s1/ninja_logs/*'
+ )
+ )
+
+ cleanWs(deleteDirs: true)
+ } else {
+ echo 'Skipping archiving - build was skipped'
+ }
+ }
+ }
+ }
+
+ // Only mark SUCCESS when the build stages actually ran; a stagnation
+ // skip sets NOT_BUILT earlier and must not be overwritten.
+ if (hasSourceChanges) {
+ currentBuild.result = successResultStr
+ }
+}
diff --git a/.amd-ci/coverage/llvm_coverage_files_AddClang.cmake b/.amd-ci/coverage/llvm_coverage_files_AddClang.cmake
new file mode 100644
index 00000000000000..13dad8657aba97
--- /dev/null
+++ b/.amd-ci/coverage/llvm_coverage_files_AddClang.cmake
@@ -0,0 +1,7 @@
+ # AOCC selective LLVM source-based coverage (link flag)
+ # Injected by llvm_instrumentation.sh for --patch_coverage on upstream branches
+ string(LENGTH "${LLVM_COVERAGE_FILES}" _lcf_len)
+ if (${_lcf_len} GREATER 0)
+ set_property(TARGET ${name} APPEND_STRING PROPERTY
+ LINK_FLAGS " -fprofile-instr-generate")
+ endif()
diff --git a/.amd-ci/coverage/llvm_coverage_files_AddFlang.cmake b/.amd-ci/coverage/llvm_coverage_files_AddFlang.cmake
new file mode 100644
index 00000000000000..13dad8657aba97
--- /dev/null
+++ b/.amd-ci/coverage/llvm_coverage_files_AddFlang.cmake
@@ -0,0 +1,7 @@
+ # AOCC selective LLVM source-based coverage (link flag)
+ # Injected by llvm_instrumentation.sh for --patch_coverage on upstream branches
+ string(LENGTH "${LLVM_COVERAGE_FILES}" _lcf_len)
+ if (${_lcf_len} GREATER 0)
+ set_property(TARGET ${name} APPEND_STRING PROPERTY
+ LINK_FLAGS " -fprofile-instr-generate")
+ endif()
diff --git a/.amd-ci/coverage/llvm_coverage_files_AddLLVM.cmake b/.amd-ci/coverage/llvm_coverage_files_AddLLVM.cmake
new file mode 100644
index 00000000000000..5ce43203155dff
--- /dev/null
+++ b/.amd-ci/coverage/llvm_coverage_files_AddLLVM.cmake
@@ -0,0 +1,14 @@
+ # AOCC selective LLVM source-based coverage (per-file instrumentation)
+ # Injected by llvm_instrumentation.sh for --patch_coverage on upstream branches
+ get_property(_lcf_sources TARGET ${name} PROPERTY SOURCES)
+ foreach(_lcf_fn ${_lcf_sources})
+ get_filename_component(_lcf_abs ${_lcf_fn} ABSOLUTE)
+ get_filename_component(_lcf_adir ${PROJECT_SOURCE_DIR} DIRECTORY)
+ string(REPLACE ${_lcf_adir}/ "" _lcf_cf ${_lcf_abs})
+ if(${_lcf_cf} IN_LIST LLVM_COVERAGE_FILES)
+ set_property(SOURCE ${_lcf_fn} APPEND_STRING PROPERTY
+ COMPILE_FLAGS " -fprofile-instr-generate -fcoverage-mapping")
+ set_property(TARGET ${name} APPEND_STRING PROPERTY
+ LINK_FLAGS " -fprofile-instr-generate")
+ endif()
+ endforeach()
diff --git a/.amd-ci/upstream/upstream_jenkins_excludes.txt b/.amd-ci/upstream/upstream_jenkins_excludes.txt
index a500dcfae89200..809a3861a01d57 100644
--- a/.amd-ci/upstream/upstream_jenkins_excludes.txt
+++ b/.amd-ci/upstream/upstream_jenkins_excludes.txt
@@ -1,19 +1,8 @@
-# Extended regexp patterns of files to exclude from the AOCC 'upstream' pipeline.
-^.*aocc-essentials/notes/
+# Extended regexp patterns of files to exclude from the LLVM 'upstream' pipeline.
^.*_jenkins_excludes.txt
-^.*/bump_aocc_ver.sh
-^.*/bump_llvm_ver.sh
-^.*/create_rel_branch.sh
# Other pipelines or their test materials:
-^aocc-essentials/build_essentials/Jenkinsfile.*
-^aocc-essentials/build_essentials/groovy_lib/test/
-^aocc-essentials/build_essentials/groovy_lib/src/test/
-^.*aocc-essentials/build_essentials/groovy_lib/Jenkinsfile.GitHub
-^.*aocc-essentials/build_essentials/groovy_lib/build.gradle
-^.*aocc-essentials/build_essentials/groovy_lib/test.sh
+^.amd-ci/coverage/
#
-^.*prj-essentials/devo/aocc/merge/
-^prj-essentials/devo/aocc/CODEOWNERS\.AOCC\.m4
^\.github/\.ai_pr_platform/
^\.github/copilot-instructions\.md
^\.github/instructions/
>From 77e35392b8b9237b32ea5ba74c2a8bdddc3763dc Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Fri, 14 Aug 2026 10:53:07 +0000
Subject: [PATCH 69/72] CPUPC-7979: Essentials clone
Change-Id: Id0ae3807c86ccfe4316511dec9ebdcb5ad2daf30
---
.amd-ci/coverage/Jenkinsfile | 61 ++++++++++++++++++++++++++++++++++--
1 file changed, 58 insertions(+), 3 deletions(-)
diff --git a/.amd-ci/coverage/Jenkinsfile b/.amd-ci/coverage/Jenkinsfile
index 2a4359325d18fc..e9dc407ba75ac1 100644
--- a/.amd-ci/coverage/Jenkinsfile
+++ b/.amd-ci/coverage/Jenkinsfile
@@ -13,12 +13,22 @@ import hudson.model.Result
String actualHead = env.CHANGE_BRANCH ?: env.BRANCH_NAME
String githubUrl = 'https://github.amd.com/cpu-compilers/llvm-project'
Boolean isPrBranch = env.CHANGE_BRANCH != null
+String upstreamBranch = 'upstream-main'
+String stagingBranch = 'amd-staging'
+String actualTarget = env.CHANGE_TARGET ?: env.BRANCH_NAME
String abortedResultStr = Result.ABORTED, failureResultStr = Result.FAILURE
String successResultStr = Result.SUCCESS, notBuiltResultStr = Result.NOT_BUILT
String oneStr = '1'
String instrumentationScript = 'aocc-essentials/build_essentials/llvm_instrumentation.sh'
String reportIndex = 'index.html'
+String gitHubAppCredsId = 'Jenkins-AOCC-nonER'
+String gitTool = 'LinuxGit2.45'
+String gitPathEnv = (
+ 'PATH=/proj/csse_jenkins2/swtools/c/rhel7-gcc8.3.1/git-2.45.2-ilh23rcg/bin:' +
+ '/usr/sbin:/usr/bin:/bin'
+)
+String mainBranchName = 'main'
List propsList = [
disableConcurrentBuilds(abortPrevious: true),
@@ -75,13 +85,58 @@ timeout(time: 6, unit: 'HOURS') {
String referenceRepo = env.JENKINS_REMOTE_GIT_CACHE ?: 'NoSuchReferenceRepo'
cleanWs(deleteDirs: true)
+ // On upstream-main, aocc-essentials is not in-tree; sparse-clone
+ // it from amd-staging via aocc-devops before the main checkout
+ // (mirrors .amd-ci/upstream/Jenkinsfile prepare stage).
+ if (actualTarget == upstreamBranch) {
+ dir('aocc-devops') {
+ checkout(
+ changelog: false,
+ scm: scmGit(
+ gitTool: gitTool,
+ branches: [[name: mainBranchName]],
+ extensions: [
+ cloneOption(
+ reference: referenceRepo + '/aocc-devops.git'
+ )
+ ],
+ userRemoteConfigs: [
+ [
+ credentialsId: gitHubAppCredsId,
+ url: 'https://github.amd.com/cpu-compilers/aocc-devops.git'
+ ]
+ ]
+ )
+ )
+ }
+ withCredentials([
+ gitUsernamePassword(
+ credentialsId: gitHubAppCredsId,
+ gitToolName: gitTool
+ )
+ ]) {
+ withEnv([gitPathEnv]) {
+ sh(
+ label: 'clone-essentials',
+ script: (
+ 'set +x; . aocc-devops/utils.sh && ' +
+ 'export BRANCH_NAME=' + stagingBranch + ' && ' +
+ 'sparse_clone_essentials && ' +
+ 'mv llvm-project/aocc-essentials . && ' +
+ 'rm -rf llvm-project'
+ )
+ )
+ }
+ }
+ }
+
// groovylint-disable-next-line NoDef, VariableTypeRequired
def gitVars = null
dir('llvm-project') {
gitVars = checkout(
changelog: true,
scm: scmGit(
- gitTool: 'LinuxGit2.45',
+ gitTool: gitTool,
branches: [[name: actualHead]],
browser: github(githubUrl),
extensions: [
@@ -93,7 +148,7 @@ timeout(time: 6, unit: 'HOURS') {
],
userRemoteConfigs: [
[
- credentialsId: 'Jenkins-AOCC-nonER',
+ credentialsId: gitHubAppCredsId,
refspec: (
'+refs/heads/' + actualHead + ':' +
'refs/remotes/origin/' + actualHead
@@ -124,7 +179,7 @@ timeout(time: 6, unit: 'HOURS') {
}
// Resolve aocc-essentials path
- // In-tree on amd-staging branches; cloned separately on upstream-main
+ // In-tree on amd-staging branches; at workspace root on upstream-main
String inTreeScript = 'llvm-project/' + instrumentationScript
String essScript
if (fileExists(inTreeScript)) {
>From 15038dddcdae974bc6bdeb5b86d72cfdc905bc53 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Mon, 17 Aug 2026 06:37:43 +0000
Subject: [PATCH 70/72] CPUPC-7979: Guard archiving to avoid unsightly
non-fatal errors
Change-Id: Iaa1cba3e836d454e374e22568a33a94bb36e943c
---
.amd-ci/coverage/Jenkinsfile | 47 ++++++++++++++++++++++--------------
1 file changed, 29 insertions(+), 18 deletions(-)
diff --git a/.amd-ci/coverage/Jenkinsfile b/.amd-ci/coverage/Jenkinsfile
index e9dc407ba75ac1..e34b3c29d46dd2 100644
--- a/.amd-ci/coverage/Jenkinsfile
+++ b/.amd-ci/coverage/Jenkinsfile
@@ -212,26 +212,37 @@ timeout(time: 6, unit: 'HOURS') {
// Patch coverage (--report_patch) is local-only — not published here.
// AOCC-modified: aocc/ dirs + upstream files with AOCC extensions (primary)
- publishHTML(target: [
- allowMissing: true,
- alwaysLinkToLastBuild: true,
- keepAll: false,
- reportDir: 'Release_build_s2/coverage_report_aocc_modified',
- reportFiles: reportIndex,
- reportName: 'AOCC Modified Coverage',
- useWrapperFileDirectly: true
- ])
+ // Skipped on upstream branches (no AOCC markers to scan for).
+ String aoccReportDir = 'Release_build_s2/coverage_report_aocc_modified'
+ if (fileExists(aoccReportDir)) {
+ publishHTML(target: [
+ allowMissing: true,
+ alwaysLinkToLastBuild: true,
+ keepAll: false,
+ reportDir: aoccReportDir,
+ reportFiles: reportIndex,
+ reportName: 'AOCC Modified Coverage',
+ useWrapperFileDirectly: true
+ ])
+ } else {
+ echo 'AOCC Modified report not produced (upstream branch) -- skipping publish.'
+ }
// Full: all clang + LLVM source (secondary, broad context)
- publishHTML(target: [
- allowMissing: true,
- alwaysLinkToLastBuild: true,
- keepAll: false,
- reportDir: 'Release_build_s2/coverage_report',
- reportFiles: reportIndex,
- reportName: 'Full Coverage Report (all sources)',
- useWrapperFileDirectly: true
- ])
+ String fullReportDir = 'Release_build_s2/coverage_report'
+ if (fileExists(fullReportDir)) {
+ publishHTML(target: [
+ allowMissing: true,
+ alwaysLinkToLastBuild: true,
+ keepAll: false,
+ reportDir: fullReportDir,
+ reportFiles: reportIndex,
+ reportName: 'Full Coverage Report (all sources)',
+ useWrapperFileDirectly: true
+ ])
+ } else {
+ echo 'Full coverage report not produced -- skipping publish.'
+ }
}
} catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
currentBuild.result = abortedResultStr
>From 977343caa752d15b201cbb6862ccd4874af171b5 Mon Sep 17 00:00:00 2001
From: Mat Cross <mat.cross at amd.com>
Date: Mon, 24 Aug 2026 08:27:56 +0000
Subject: [PATCH 71/72] CPUPC-7979: Using util for extracting LLVM version
Also, use ver prefix AMDLLVM on this branch.
Change-Id: I3baef1205ed56ba261eb02643985403825039f24
---
.amd-ci/upstream/Jenkinsfile | 42 +++++++++++++++++++-----------------
1 file changed, 22 insertions(+), 20 deletions(-)
diff --git a/.amd-ci/upstream/Jenkinsfile b/.amd-ci/upstream/Jenkinsfile
index f45337b05a3a76..63eadf82135892 100644
--- a/.amd-ci/upstream/Jenkinsfile
+++ b/.amd-ci/upstream/Jenkinsfile
@@ -2,7 +2,7 @@ import groovy.transform.Field
import hudson.model.Result
// Load aocc-devops shared library for PipelineUtils.
-String devopsLibPin = 'cede91d'
+String devopsLibPin = 'a8e58b3'
Object devopsLib = library(
changelog: false,
identifier: 'aoccDevopsUtils@' + devopsLibPin,
@@ -405,29 +405,11 @@ String theUrl
Boolean hasSourceChanges = true, isSkippableMerge = false
Integer zero = 0, successStat = zero
-// llvmVer is processed by automation:
-String llvmVer = '23.0.0'
-// stageBuildNum is processed during branch creation:
String stageBuildNum = env.BUILD_NUMBER
-// versionVal is processed during branch creation:
-String versionVal = 'AOCC_' + llvmVer + dash + (buildType == buildTypePresub ? 'Presub' : 'Stage')
-// relMode should be changed to 'CANDIDATE' when the release is close to readiness:
+// relMode is always 'PRE' since AMD does not release from this branch:
String relMode = 'PRE'
-String jobName
-if (postsub && targetIsRelBranch) {
- jobName = 'aocc-compiler-llvm-flang-rel' + dash + llvmVer + dash + stageBuildNum
-} else {
- jobName = (
- (isPrBranch ? 'presub' : 'update') + underScore +
- (env.CHANGE_TARGET ?: (env.BRANCH_NAME ?: 'NoSuchBranchName'))
- )
- if (env.CHANGE_BRANCH) {
- jobName += underScore + env.BRANCH_NAME // Sic, the PR-<n> string.
- }
-}
-
def gitVars // groovylint-disable-line NoDef,VariableTypeRequired
String prBaseCommit = '', prLatestCommit = ''
@@ -615,6 +597,26 @@ try {
cleanWs()
return // From node
}
+ // Compute LLVM version from the checked-out cmake file.
+ String llvmVer = putils.extractLlvmVersionString(
+ this, llvmProj + '/cmake/Modules/LLVMVersion.cmake'
+ )
+ String versionVal = (
+ 'AMDLLVM_' + llvmVer + dash +
+ (buildType == buildTypePresub ? 'Presub' : 'Stage')
+ )
+ String jobName
+ if (postsub && targetIsRelBranch) {
+ jobName = 'aocc-compiler-llvm-flang-rel' + dash + llvmVer + dash + stageBuildNum
+ } else {
+ jobName = (
+ (isPrBranch ? 'presub' : 'update') + underScore +
+ (env.CHANGE_TARGET ?: (env.BRANCH_NAME ?: 'NoSuchBranchName'))
+ )
+ if (env.CHANGE_BRANCH) {
+ jobName += underScore + env.BRANCH_NAME // Sic, the PR-<n> string.
+ }
+ }
// ----------------------------------------------------------------
// Clone the spec-configs git repo into the workspace (mirrors
// gcc/.amd-ci/upstream/Jenkinsfile). The clone lives at workspace
>From 77512c5fac8adbfaa1d822ac3c2b43f852008986 Mon Sep 17 00:00:00 2001
From: nsachdev <nishant.sachdeva at amd.com>
Date: Thu, 10 Sep 2026 15:47:25 +0530
Subject: [PATCH 72/72] [X86][NFC] Share isDispOrCDisp8 between the encoder and
CompressEVEX
The disp8 / compressed-disp8*N size rule was written twice: as a static
helper in X86MCCodeEmitter.cpp and re-inlined in the CompressEVEX size
veto (hasShorterEVEXViaCDisp8), kept in sync only by a comment. Hoist it
into X86II::isDispOrCDisp8 in X86BaseInfo.h (ImmOffset now optional) and
call it from both, so the size model cannot drift from what the encoder
emits. No functional change.
Change-Id: I3a04fbe71c3b9192aa14ebbcea9fb6882a22bc12
---
.../lib/Target/X86/MCTargetDesc/X86BaseInfo.h | 28 ++++++++++++++++++
.../X86/MCTargetDesc/X86MCCodeEmitter.cpp | 29 ++-----------------
llvm/lib/Target/X86/X86CompressEVEX.cpp | 19 ++----------
3 files changed, 32 insertions(+), 44 deletions(-)
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h b/llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h
index 8ed4da0e223a1f..49cd0703b8024c 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h
@@ -1165,6 +1165,34 @@ inline int getMemoryOperandIdx(const MCInstrDesc &Desc) {
return MemRefIdx + getOperandBias(Desc);
}
+/// Return true if displacement \p Value fits one byte: a plain disp8, or a
+/// compressed disp8*N for a CDisp8-capable EVEX form (per \p TSFlags). On
+/// success, if \p ImmOffset is non-null it receives the offset to add to
+/// \p Value to leave just the encoded byte (see emitImmediate).
+inline bool isDispOrCDisp8(uint64_t TSFlags, int64_t Value,
+ int *ImmOffset = nullptr) {
+ bool HasEVEX = (TSFlags & X86II::EncodingMask) == X86II::EVEX;
+
+ unsigned CD8_Scale =
+ (TSFlags & X86II::CD8_Scale_Mask) >> X86II::CD8_Scale_Shift;
+ CD8_Scale = CD8_Scale ? 1U << (CD8_Scale - 1) : 0U;
+ if (!HasEVEX || !CD8_Scale)
+ return isInt<8>(Value);
+
+ assert(isPowerOf2_32(CD8_Scale) && "Unexpected CD8 scale!");
+ if (Value & (CD8_Scale - 1)) // Unaligned offset
+ return false;
+
+ int64_t CDisp8 = Value / static_cast<int64_t>(CD8_Scale);
+ if (!isInt<8>(CDisp8))
+ return false;
+
+ // ImmOffset will be added to Value in emitImmediate leaving just CDisp8.
+ if (ImmOffset)
+ *ImmOffset = CDisp8 - Value;
+ return true;
+}
+
/// \returns true if the register is a XMM.
inline bool isXMMReg(MCRegister Reg) {
static_assert(X86::XMM15 - X86::XMM0 == 15,
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
index d4e24f52bb895f..ab535c81dbf42c 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
@@ -410,31 +410,6 @@ static void emitConstant(uint64_t Val, unsigned Size,
}
}
-/// Determine if this immediate can fit in a disp8 or a compressed disp8 for
-/// EVEX instructions. \p will be set to the value to pass to the ImmOffset
-/// parameter of emitImmediate.
-static bool isDispOrCDisp8(uint64_t TSFlags, int Value, int &ImmOffset) {
- bool HasEVEX = (TSFlags & X86II::EncodingMask) == X86II::EVEX;
-
- unsigned CD8_Scale =
- (TSFlags & X86II::CD8_Scale_Mask) >> X86II::CD8_Scale_Shift;
- CD8_Scale = CD8_Scale ? 1U << (CD8_Scale - 1) : 0U;
- if (!HasEVEX || !CD8_Scale)
- return isInt<8>(Value);
-
- assert(isPowerOf2_32(CD8_Scale) && "Unexpected CD8 scale!");
- if (Value & (CD8_Scale - 1)) // Unaligned offset
- return false;
-
- int CDisp8 = Value / static_cast<int>(CD8_Scale);
- if (!isInt<8>(CDisp8))
- return false;
-
- // ImmOffset will be added to Value in emitImmediate leaving just CDisp8.
- ImmOffset = CDisp8 - Value;
- return true;
-}
-
/// \returns the appropriate fixup kind to use for an immediate in an
/// instruction with the specified TSFlags.
static MCFixupKind getImmFixupKind(uint64_t TSFlags) {
@@ -813,7 +788,7 @@ void X86MCCodeEmitter::emitMemModRMByte(
// can't use disp8 if the {disp32} pseudo prefix is present.
if (Disp.isImm() && AllowDisp8) {
int ImmOffset = 0;
- if (isDispOrCDisp8(TSFlags, Disp.getImm(), ImmOffset)) {
+ if (X86II::isDispOrCDisp8(TSFlags, Disp.getImm(), &ImmOffset)) {
emitByte(modRMByte(1, RegOpcodeField, BaseRegNo), CB);
emitImmediate(Disp, MI.getLoc(), FK_Data_1, false, StartByte, CB,
Fixups, ImmOffset);
@@ -855,7 +830,7 @@ void X86MCCodeEmitter::emitMemModRMByte(
// Emit no displacement ModR/M byte
emitByte(modRMByte(0, RegOpcodeField, 4), CB);
} else if (Disp.isImm() && AllowDisp8 &&
- isDispOrCDisp8(TSFlags, Disp.getImm(), ImmOffset)) {
+ X86II::isDispOrCDisp8(TSFlags, Disp.getImm(), &ImmOffset)) {
// Displacement fits in a byte or matches an EVEX compressed disp8, use
// disp8 encoding. This also handles EBP/R13/R21/R29 base with 0
// displacement unless {disp32} pseudo prefix was used.
diff --git a/llvm/lib/Target/X86/X86CompressEVEX.cpp b/llvm/lib/Target/X86/X86CompressEVEX.cpp
index 1ba74571e1ca54..d4562d2108c506 100644
--- a/llvm/lib/Target/X86/X86CompressEVEX.cpp
+++ b/llvm/lib/Target/X86/X86CompressEVEX.cpp
@@ -124,16 +124,8 @@ static bool usesExtendedRegister(const MachineInstr &MI) {
// a compressed disp8*N (1 byte) while the VEX/legacy twin would be forced to
// spend a full disp32 (4 bytes). In that window the EVEX encoding is strictly
// shorter overall, despite its 1-2 byte larger prefix, so compressing it to
-// VEX would grow code size. Mirrors isDispOrCDisp8 in X86MCCodeEmitter.cpp.
+// VEX would grow code size.
static bool hasShorterEVEXViaCDisp8(const MachineInstr &MI) {
- uint64_t TSFlags = MI.getDesc().TSFlags;
- unsigned CD8_Scale =
- (TSFlags & X86II::CD8_Scale_Mask) >> X86II::CD8_Scale_Shift;
- CD8_Scale = CD8_Scale ? 1U << (CD8_Scale - 1) : 0U;
- // Without a CD8 scale > 1 there is no displacement advantage over VEX.
- if (CD8_Scale <= 1)
- return false;
-
int MemOpIdx = X86::getFirstAddrOperandIdx(MI);
if (MemOpIdx < 0)
return false;
@@ -145,14 +137,7 @@ static bool hasShorterEVEXViaCDisp8(const MachineInstr &MI) {
return false;
int64_t Val = Disp.getImm();
- // VEX can already use a disp8 in this range, so EVEX offers no saving.
- if (isInt<8>(Val))
- return false;
- // EVEX can use disp8*N only when the value is a multiple of N and the scaled
- // value fits in a signed byte.
- if (Val % static_cast<int64_t>(CD8_Scale) != 0)
- return false;
- return isInt<8>(Val / static_cast<int64_t>(CD8_Scale));
+ return X86II::isDispOrCDisp8(MI.getDesc().TSFlags, Val) && !isInt<8>(Val);
}
// Do any custom cleanup needed to finalize the conversion.
More information about the llvm-commits
mailing list