From ef8417fe9151495b52c41ee985f83c6c07779960 Mon Sep 17 00:00:00 2001 From: "Yaxun (Sam) Liu" Date: Fri, 14 Jun 2024 10:33:44 -0400 Subject: [PATCH 1/2] update clang build script for rocm Changed github repo to https://github.com/ROCm/llvm-project. AMD LLVM trunk branch name changed from amd-stg-open to amd-staging. Since ROCm 6.1, device libs are moved to AMD LLVM repo and the cmake command changes to build device libs and comgr together with LLVM. Enabled assertion in trunk build for catching more issues. --- build/build.sh | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/build/build.sh b/build/build.sh index fcce91d..5fdb0a9 100755 --- a/build/build.sh +++ b/build/build.sh @@ -139,18 +139,30 @@ dascandy-contracts-trunk) LLVM_ENABLE_RUNTIMES+=";libunwind" ;; rocm-*) + ROCM_VERSION=9999 if [[ "${VERSION#rocm-}" == "trunk" ]]; then - BRANCH=amd-stg-open - ROCM_DEVICE_LIBS_BRANCH=${BRANCH} + BRANCH=amd-stging VERSION=rocm-trunk-$(date +%Y%m%d) + CMAKE_EXTRA_ARGS+=("-DLLVM_ENABLE_ASSERTIONS=1") else TAG=${VERSION} + if [[ "${VERSION}" =~ rocm-([0-9]+)\.([0-9]+)\.[^.]+ ]]; then + x=${BASH_REMATCH[1]} + y=${BASH_REMATCH[2]} + ROCM_VERSION=$(( x * 100 + y )) + fi + fi + if (( ROCM_VERSION < 601 )); then ROCM_DEVICE_LIBS_BRANCH=${VERSION} + ROCM_DEVICE_LIBS_URL=https://github.com/ROCm/ROCm-Device-Libs.git + else + CMAKE_EXTRA_ARGS+=( + "-DLLVM_EXTERNAL_PROJECTS=device-libs;comgr" + "-DLLVM_EXTERNAL_DEVICE_LIBS_SOURCE_DIR=${ROOT}/llvm-project/amd/device-libs" + "-DLLVM_EXTERNAL_COMGR_SOURCE_DIR=${ROOT}/llvm-project/amd/comgr" + ) fi - - URL=https://github.com/RadeonOpenCompute/llvm-project.git - ROCM_DEVICE_LIBS_URL=https://github.com/RadeonOpenCompute/ROCm-Device-Libs.git - + URL=https://github.com/ROCm/llvm-project.git LLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra;compiler-rt" CMAKE_EXTRA_ARGS+=("-DLLVM_TARGETS_TO_BUILD=AMDGPU;X86") ;; From 36a8e315ad93cb4c9993819f7c056f7c0301fac1 Mon Sep 17 00:00:00 2001 From: Matt Godbolt Date: Mon, 17 Jun 2024 20:54:37 -0500 Subject: [PATCH 2/2] Clarifying comment --- build/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/build.sh b/build/build.sh index 5fdb0a9..c871bd0 100755 --- a/build/build.sh +++ b/build/build.sh @@ -139,11 +139,11 @@ dascandy-contracts-trunk) LLVM_ENABLE_RUNTIMES+=";libunwind" ;; rocm-*) - ROCM_VERSION=9999 if [[ "${VERSION#rocm-}" == "trunk" ]]; then BRANCH=amd-stging VERSION=rocm-trunk-$(date +%Y%m%d) CMAKE_EXTRA_ARGS+=("-DLLVM_ENABLE_ASSERTIONS=1") + ROCM_VERSION=999999 # trunk builds are "infinitely" far into the future else TAG=${VERSION} if [[ "${VERSION}" =~ rocm-([0-9]+)\.([0-9]+)\.[^.]+ ]]; then