From 78aa37a42be1d5c6b145f1c1579bebef1366c269 Mon Sep 17 00:00:00 2001 From: asantagata Date: Tue, 21 Oct 2025 10:00:25 -0700 Subject: [PATCH 1/4] Port to Clang 20 --- src/c/host-configs/tuo-main.cmake | 19 ++++++++++++++++ src/c/weaver/weave/perfflow_weave_common.cpp | 22 +++++++++---------- .../weaver/weave/perfflow_weave_new_pass.cpp | 3 +-- 3 files changed, 31 insertions(+), 13 deletions(-) create mode 100644 src/c/host-configs/tuo-main.cmake diff --git a/src/c/host-configs/tuo-main.cmake b/src/c/host-configs/tuo-main.cmake new file mode 100644 index 00000000..ce3fc30d --- /dev/null +++ b/src/c/host-configs/tuo-main.cmake @@ -0,0 +1,19 @@ +############################################################## +# Copyright 2021 Lawrence Livermore National Security, LLC +# (c.f. AUTHORS, NOTICE.LLNS, COPYING) +# +# This file is part of the Flux resource manager framework. +# For details, see https://github.com/flux-framework. +# +# SPDX-License-Identifier: LGPL-3.0 +############################################################## + +set(CMAKE_C_COMPILER "/opt/rocm-7.0.0/lib/llvm/bin/amdclang" CACHE PATH "") +set(CMAKE_CXX_COMPILER "/opt/rocm-7.0.0/lib/llvm/bin/amdclang++" CACHE PATH "") + +set(PERFFLOWASPECT_WITH_CUDA "OFF" CACHE BOOL "") + +# To enable fine-grained profiling with Caliper, utilize the below options. +# Caliper should be built with the same compilers as the PerfFlowAspect. +# set(PERFFLOWASPECT_WITH_CALIPER ON CACHE BOOL "") +# set(caliper_DIR "path-to-caliper-install-directory" CACHE PATH "") diff --git a/src/c/weaver/weave/perfflow_weave_common.cpp b/src/c/weaver/weave/perfflow_weave_common.cpp index 4e638300..de4116aa 100644 --- a/src/c/weaver/weave/perfflow_weave_common.cpp +++ b/src/c/weaver/weave/perfflow_weave_common.cpp @@ -169,11 +169,11 @@ bool weave_ns::WeaveCommon::insertAfter(Module &m, Function &f, StringRef &a, if (valid) { IRBuilder<> builder(inst); - Value *v1 = builder.CreateGlobalStringPtr(m.getName(), "str"); - Value *v2 = builder.CreateGlobalStringPtr(f.getName(), "str"); - Value *v3 = builder.CreateGlobalStringPtr(StringRef(scope), "str"); - Value *v4 = builder.CreateGlobalStringPtr(StringRef(flow), "str"); - Value *v5 = builder.CreateGlobalStringPtr(StringRef(pcut), "str"); + Value *v1 = builder.CreateGlobalString(m.getName(), "str"); + Value *v2 = builder.CreateGlobalString(f.getName(), "str"); + Value *v3 = builder.CreateGlobalString(StringRef(scope), "str"); + Value *v4 = builder.CreateGlobalString(StringRef(flow), "str"); + Value *v5 = builder.CreateGlobalString(StringRef(pcut), "str"); std::vector args; args.push_back(ConstantInt::get(Type::getInt32Ty(context), async)); args.push_back(v1); @@ -216,11 +216,11 @@ bool weave_ns::WeaveCommon::insertBefore(Module &m, Function &f, StringRef &a, // weaveFuncTy); auto &entry = f.getEntryBlock(); IRBuilder<> builder(&entry); - Value *v1 = builder.CreateGlobalStringPtr(m.getName(), "str"); - Value *v2 = builder.CreateGlobalStringPtr(f.getName(), "str"); - Value *v3 = builder.CreateGlobalStringPtr(StringRef(scope), "str"); - Value *v4 = builder.CreateGlobalStringPtr(StringRef(flow), "str"); - Value *v5 = builder.CreateGlobalStringPtr(StringRef(pcut), "str"); + Value *v1 = builder.CreateGlobalString(m.getName(), "str"); + Value *v2 = builder.CreateGlobalString(f.getName(), "str"); + Value *v3 = builder.CreateGlobalString(StringRef(scope), "str"); + Value *v4 = builder.CreateGlobalString(StringRef(flow), "str"); + Value *v5 = builder.CreateGlobalString(StringRef(pcut), "str"); builder.SetInsertPoint(&entry, entry.begin()); std::vector args; args.push_back(ConstantInt::get(Type::getInt32Ty(context), async)); @@ -243,7 +243,7 @@ bool weave_ns::WeaveCommon::instrumentCaliper(Module &M, Function &F) IRB.SetInsertPoint(Entry.getTerminator()); std::string FunctionName = F.getName().str(); - auto *FnStr = IRB.CreateGlobalStringPtr(FunctionName); + auto *FnStr = IRB.CreateGlobalString(FunctionName); IRB.CreateCall(CaliBeginRegion, {FnStr}); bool RetFound = false; diff --git a/src/c/weaver/weave/perfflow_weave_new_pass.cpp b/src/c/weaver/weave/perfflow_weave_new_pass.cpp index faa86eb0..287ddcaa 100644 --- a/src/c/weaver/weave/perfflow_weave_new_pass.cpp +++ b/src/c/weaver/weave/perfflow_weave_new_pass.cpp @@ -61,10 +61,9 @@ PassPluginLibraryInfo getNewWeavingPassPluginInfo() const auto pass_callback = [](PassBuilder & PB) { PB.registerPipelineEarlySimplificationEPCallback( - [&](ModulePassManager & MPM, auto) + [&](ModulePassManager & MPM, OptimizationLevel OL, ThinOrFullLTOPhase TOFLTOP) { MPM.addPass(NewWeavingPass()); - return true; } ); }; From 7dc06b55519ecd452c82a66dc4364d06ef5af5ce Mon Sep 17 00:00:00 2001 From: asantagata Date: Wed, 29 Oct 2025 07:30:19 -0700 Subject: [PATCH 2/4] update github-actions and cmakelists --- src/c/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/c/CMakeLists.txt b/src/c/CMakeLists.txt index 8fe5976b..57225b41 100644 --- a/src/c/CMakeLists.txt +++ b/src/c/CMakeLists.txt @@ -5,13 +5,13 @@ project(PerfFlowAspect VERSION "0.1.0") # Higher-level build options. option(PERFFLOWASPECT_WITH_CALIPER "Build with Caliper support" OFF) -# Fail if using Clang < 18.0 +# Fail if using Clang < 20.0 if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0) - message(FATAL_ERROR "Clang++ version must be equal to 18.0!") + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 20.0) + message(FATAL_ERROR "Clang++ version must be equal to 20.0!") endif() else() - message(FATAL_ERROR "Unsupported CXX compiler: please use Clang == 18.0") + message(FATAL_ERROR "Unsupported CXX compiler: please use Clang == 20.0") endif() include(cmake/CMakeBasics.cmake) From 93ce8b0864cc93181c1f6698184c8dd67d666fea Mon Sep 17 00:00:00 2001 From: Tapasya Patki Date: Wed, 29 Oct 2025 15:01:40 -0700 Subject: [PATCH 3/4] Update llvm_dir to sync with clang 20 --- .github/workflows/github-actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 8560ebc4..5bc9bf26 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -84,7 +84,7 @@ jobs: cd src/c mkdir build install cd build - export CMAKE_OPTS="-DCMAKE_CXX_COMPILER=clang++ -DLLVM_DIR=/usr/lib/llvm-18/cmake -DCMAKE_INSTALL_PREFIX=../install" + export CMAKE_OPTS="-DCMAKE_CXX_COMPILER=clang++ -DLLVM_DIR=/usr/lib/llvm-20/cmake -DCMAKE_INSTALL_PREFIX=../install" export CMAKE_OPTS="${CMAKE_OPTS} -DCMAKE_BUILD_TYPE=${{matrix.CMAKE_BUILD_TYPE}}" export CMAKE_OPTS="${CMAKE_OPTS} -DPERFFLOWASPECT_WITH_CUDA=${{matrix.PERFFLOWASPECT_WITH_CUDA}}" export CMAKE_OPTS="${CMAKE_OPTS} -DPERFFLOWASPECT_WITH_MPI=${{matrix.PERFFLOWASPECT_WITH_MPI}}" From 1c5b078f52ac01b3b4e30f43d744ab78fba108c8 Mon Sep 17 00:00:00 2001 From: Tapasya Patki Date: Wed, 29 Oct 2025 15:18:30 -0700 Subject: [PATCH 4/4] Try clang++-20 explicitly --- .github/workflows/github-actions.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 5bc9bf26..77733a5e 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -62,7 +62,7 @@ jobs: run: | sudo apt-get update sudo apt install clang-20 llvm-dev libjansson-dev libssl-dev bison flex make cmake mpich pybind11-dev - clang++ --version + clang++-20 --version - name: Clone Caliper uses: actions/checkout@v2 @@ -84,7 +84,7 @@ jobs: cd src/c mkdir build install cd build - export CMAKE_OPTS="-DCMAKE_CXX_COMPILER=clang++ -DLLVM_DIR=/usr/lib/llvm-20/cmake -DCMAKE_INSTALL_PREFIX=../install" + export CMAKE_OPTS="-DCMAKE_CXX_COMPILER=clang++-20 -DLLVM_DIR=/usr/lib/llvm-20/cmake -DCMAKE_INSTALL_PREFIX=../install" export CMAKE_OPTS="${CMAKE_OPTS} -DCMAKE_BUILD_TYPE=${{matrix.CMAKE_BUILD_TYPE}}" export CMAKE_OPTS="${CMAKE_OPTS} -DPERFFLOWASPECT_WITH_CUDA=${{matrix.PERFFLOWASPECT_WITH_CUDA}}" export CMAKE_OPTS="${CMAKE_OPTS} -DPERFFLOWASPECT_WITH_MPI=${{matrix.PERFFLOWASPECT_WITH_MPI}}"