build: update frozen toolchain to Fedora 41 with clang 19

Update from clang 18 to clang 19. perf-simple-query reports:

clang 18

278102.35 tps ( 63.1 allocs/op,   0.0 logallocs/op,  14.1 tasks/op,   36056 insns/op,   16560 cycles/op,        0 errors)
288801.19 tps ( 63.0 allocs/op,   0.0 logallocs/op,  14.1 tasks/op,   36018 insns/op,   16004 cycles/op,        0 errors)
287795.23 tps ( 63.0 allocs/op,   0.0 logallocs/op,  14.1 tasks/op,   36039 insns/op,   15995 cycles/op,        0 errors)
290495.86 tps ( 63.0 allocs/op,   0.0 logallocs/op,  14.1 tasks/op,   36027 insns/op,   15939 cycles/op,        0 errors)
293116.10 tps ( 63.0 allocs/op,   0.0 logallocs/op,  14.1 tasks/op,   36020 insns/op,   15780 cycles/op,        0 errors)

clang 19

284742.08 tps ( 63.1 allocs/op,   0.0 logallocs/op,  14.1 tasks/op,   35517 insns/op,   16419 cycles/op,        0 errors)
297974.97 tps ( 63.0 allocs/op,   0.0 logallocs/op,  14.1 tasks/op,   35497 insns/op,   15926 cycles/op,        0 errors)
279527.99 tps ( 63.0 allocs/op,   0.0 logallocs/op,  14.1 tasks/op,   35513 insns/op,   16724 cycles/op,        0 errors)
298229.61 tps ( 63.0 allocs/op,   0.0 logallocs/op,  14.1 tasks/op,   35494 insns/op,   15892 cycles/op,        0 errors)
297982.67 tps ( 63.0 allocs/op,   0.0 logallocs/op,  14.1 tasks/op,   35494 insns/op,   15819 cycles/op,        0 errors)

So the update delivers a nice performance improvement.

Optimized clang regenerated and stored in

  https://devpkg.scylladb.com/clang/clang-19.1.7-Fedora-41-aarch64.tar.gz
  https://devpkg.scylladb.com/clang/clang-19.1.7-Fedora-41-x86_64.tar.gz

Script to prepare optimized clang updated, and upstreamed patch
dropped.

Closes scylladb/scylladb#22380
This commit is contained in:
Avi Kivity
2025-01-17 13:25:22 -05:00
parent 5a266926e5
commit d3b8c9f5ef
5 changed files with 5 additions and 98 deletions

View File

@@ -112,7 +112,7 @@ fedora_packages=(
rust rust
cargo cargo
rapidxml-devel rapidxml-devel
rust-std-static-wasm32-wasi rust-std-static-wasm32-wasip1
wabt wabt
binaryen binaryen
lcov lcov

View File

@@ -1,90 +0,0 @@
From 46a4132e167aa44d8ec7776262ce2a0e6d47de59 Mon Sep 17 00:00:00 2001
From: Avi Kivity <avi@scylladb.com>
Date: Mon, 26 Aug 2024 17:56:45 +0300
Subject: [PATCH] [Instrumentation] Fix EdgeCounts vector size in
SetBranchWeights (#99064)
---
---
.../Instrumentation/PGOInstrumentation.cpp | 14 +++++--
.../Coroutines/coro-pgo-setbranchweights.ll | 42 +++++++++++++++++++
2 files changed, 52 insertions(+), 4 deletions(-)
create mode 100644 test/Transforms/Coroutines/coro-pgo-setbranchweights.ll
diff --git a/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
index c20fc942e..41025b296 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -1571,11 +1571,17 @@ void PGOUseFunc::setBranchWeights() {
// We have a non-zero Branch BB.
const PGOUseBBInfo &BBCountInfo = getBBInfo(&BB);
- unsigned Size = BBCountInfo.OutEdges.size();
- SmallVector<uint64_t, 2> EdgeCounts(Size, 0);
+
+ // SuccessorCount can be greater than OutEdgesCount, because
+ // removed edges don't appear in OutEdges.
+ unsigned OutEdgesCount = BBCountInfo.OutEdges.size();
+ unsigned SuccessorCount = BB.getTerminator()->getNumSuccessors();
+ assert(OutEdgesCount <= SuccessorCount);
+
+ SmallVector<uint64_t, 2> EdgeCounts(SuccessorCount, 0);
uint64_t MaxCount = 0;
- for (unsigned s = 0; s < Size; s++) {
- const PGOUseEdge *E = BBCountInfo.OutEdges[s];
+ for (unsigned It = 0; It < OutEdgesCount; It++) {
+ const PGOUseEdge *E = BBCountInfo.OutEdges[It];
const BasicBlock *SrcBB = E->SrcBB;
const BasicBlock *DestBB = E->DestBB;
if (DestBB == nullptr)
diff --git a/test/Transforms/Coroutines/coro-pgo-setbranchweights.ll b/test/Transforms/Coroutines/coro-pgo-setbranchweights.ll
new file mode 100644
index 000000000..4f5f93660
--- /dev/null
+++ b/test/Transforms/Coroutines/coro-pgo-setbranchweights.ll
@@ -0,0 +1,42 @@
+; RUN: rm -rf %t && split-file %s %t
+
+; RUN: llvm-profdata merge %t/a.proftext -o %t/a.profdata
+; RUN: opt < %t/a.ll --passes=pgo-instr-use -pgo-test-profile-file=%t/a.profdata
+
+;--- a.ll
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-redhat-linux-gnu"
+
+define void @_bar() presplitcoroutine personality ptr null {
+ %1 = call token @llvm.coro.save(ptr null)
+ %2 = call i8 @llvm.coro.suspend(token none, i1 false)
+ switch i8 %2, label %5 [
+ i8 0, label %3
+ i8 1, label %4
+ ]
+
+3: ; preds = %0
+ ret void
+
+4: ; preds = %0
+ ret void
+
+5: ; preds = %0
+ ret void
+}
+
+declare token @llvm.coro.save(ptr)
+
+declare i8 @llvm.coro.suspend(token, i1)
+
+;--- a.proftext
+# IR level Instrumentation Flag
+:ir
+
+_bar
+# Func Hash:
+1063705160175073211
+# Num Counters:
+2
+1
+0
--
2.46.0

View File

@@ -1,4 +1,4 @@
FROM docker.io/fedora:40 FROM docker.io/fedora:41
ARG CLANG_BUILD="SKIP" ARG CLANG_BUILD="SKIP"
ARG CLANG_ARCHIVES ARG CLANG_ARCHIVES

View File

@@ -1 +1 @@
docker.io/scylladb/scylla-toolchain:fedora-40-20241219 docker.io/scylladb/scylla-toolchain:fedora-41-20250205

View File

@@ -63,8 +63,8 @@ SCYLLA_BUILD_DIR_FULLPATH="${SCYLLA_DIR}"/"${SCYLLA_BUILD_DIR}"
SCYLLA_NINJA_FILE_FULLPATH="${SCYLLA_DIR}"/"${SCYLLA_NINJA_FILE}" SCYLLA_NINJA_FILE_FULLPATH="${SCYLLA_DIR}"/"${SCYLLA_NINJA_FILE}"
# Which LLVM release to build in order to compile Scylla # Which LLVM release to build in order to compile Scylla
LLVM_CLANG_TAG=18.1.8 LLVM_CLANG_TAG=19.1.7
CLANG_SUFFIX=18 CLANG_SUFFIX=19
CLANG_ARCHIVE=$(cd "${SCYLLA_DIR}" && realpath -m "${CLANG_ARCHIVE}") CLANG_ARCHIVE=$(cd "${SCYLLA_DIR}" && realpath -m "${CLANG_ARCHIVE}")
@@ -130,11 +130,8 @@ if [[ "${CLANG_BUILD}" = "INSTALL" ]]; then
rm -rf "${CLANG_SYSROOT_DIR}" rm -rf "${CLANG_SYSROOT_DIR}"
git clone https://github.com/llvm/llvm-project --branch llvmorg-"${LLVM_CLANG_TAG}" --depth=1 "${CLANG_BUILD_DIR}" git clone https://github.com/llvm/llvm-project --branch llvmorg-"${LLVM_CLANG_TAG}" --depth=1 "${CLANG_BUILD_DIR}"
patch="$PWD/tools/toolchain/0001-Instrumentation-Fix-EdgeCounts-vector-size-in-SetBra.patch"
echo "[clang-stage1] build the compiler for collecting PGO profile" echo "[clang-stage1] build the compiler for collecting PGO profile"
cd "${CLANG_BUILD_DIR}" cd "${CLANG_BUILD_DIR}"
git apply "$patch"
rm -rf build rm -rf build
cmake -B build -S llvm "${CLANG_OPTS[@]}" -DLLVM_BUILD_INSTRUMENTED=IR cmake -B build -S llvm "${CLANG_OPTS[@]}" -DLLVM_BUILD_INSTRUMENTED=IR