Skip to content

Commit aa6fa1c

Browse files
authored
chore: use the lean-llvm LLVM for benchmarking (#13634)
This PR makes radar use the LLVM that we actually ship to users (stored at https://github.com/leanprover/lean-llvm). In doing so it also makes the lake build compatible with lean-llvm, allowing us to do potential release builds with lake in the future.
1 parent e47636c commit aa6fa1c

5 files changed

Lines changed: 45 additions & 5 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ if(NOT CMAKE_SYSTEM_NAME MATCHES "Emscripten")
5252
# Use same platform flags as for Lean executables, in particular from `prepare-llvm-linux.sh`,
5353
# but not Lean-specific `LEAN_EXTRA_CXX_FLAGS` such as fsanitize.
5454
set(CADICAL_CXXFLAGS "${CMAKE_CXX_FLAGS}")
55-
set(CADICAL_LDFLAGS "-Wl,-rpath=\\$$ORIGIN/../lib")
55+
string(REPLACE "ROOT" "${CMAKE_BINARY_DIR}/stage1" CADICAL_INTERNAL_LINKER_FLAGS "${LEANC_INTERNAL_LINKER_FLAGS}")
56+
set(CADICAL_LDFLAGS "${CADICAL_INTERNAL_LINKER_FLAGS} -Wl,-rpath=\\$$ORIGIN/../lib")
5657
endif()
5758
find_program(CCACHE ccache)
5859
if(CCACHE)

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,7 @@ string(REPLACE "ROOT" "${CMAKE_BINARY_DIR}" LEANC_INTERNAL_FLAGS "${LEANC_INTERN
10751075
string(REPLACE "ROOT" "${CMAKE_BINARY_DIR}" LEANC_INTERNAL_LINKER_FLAGS "${LEANC_INTERNAL_LINKER_FLAGS}")
10761076

10771077
toml_escape("${LEAN_EXTRA_OPTS}" LEAN_EXTRA_OPTS_TOML)
1078+
toml_escape("${LEANC_INTERNAL_FLAGS} ${LEANC_INTERNAL_LINKER_FLAGS}" LEAN_MORE_LEANC_ARGS_TOML)
10781079

10791080
if(CMAKE_BUILD_TYPE MATCHES "Debug|Release|RelWithDebInfo|MinSizeRel")
10801081
set(CMAKE_BUILD_TYPE_TOML "${CMAKE_BUILD_TYPE}")

src/lakefile.toml.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ moreLeanArgs = [${LEAN_EXTRA_OPTS_TOML}]
4646
# Uncomment to limit number of reported errors further in case of overwhelming cmdline output
4747
#weakLeanArgs = ["-DmaxErrors=1"]
4848

49+
moreLeancArgs = [${LEAN_MORE_LEANC_ARGS_TOML}]
50+
4951
${LEAN_EXTRA_LAKEFILE_TOML}
5052

5153
[[lean_lib]]

tests/bench_build.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env nix
2+
#! nix develop ..#oldGlibc --command /usr/bin/env bash
23

34
# This script must be called from the repo root.
45
# The radar environment variables must be provided.
56
# See also the https://github.com/leanprover/radar readme.
67

7-
cmake --preset release -DWFAIL=OFF
8+
LLVM_RELEASE=19.1.2
9+
LLVM_TARBALL="$RADAR_CACHE/llvm/$LLVM_RELEASE.tar.zst"
10+
11+
if [ ! -f "$LLVM_TARBALL" ]; then
12+
mkdir -p "$RADAR_CACHE/llvm"
13+
curl --location -o "$LLVM_TARBALL" "https://github.com/leanprover/lean-llvm/releases/download/$LLVM_RELEASE/lean-llvm-x86_64-linux-gnu.tar.zst"
14+
fi
15+
16+
mkdir -p build/release
17+
cd build/release
18+
eval cmake ../.. \
19+
--preset release $(../../script/prepare-llvm-linux.sh $LLVM_TARBALL) \
20+
-DWFAIL=OFF
21+
rm -rf stage2
22+
cp -r stage1 stage2
23+
rm -rf stage3
24+
cp -r stage1 stage3
25+
cd ../..
826
make -C build/release -j"$(nproc)" bench-part1
927
mv tests/part1.measurements.jsonl "$RADAR_OUT"
1028

tests/bench_other.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env nix
2+
#! nix develop ..#oldGlibc --command /usr/bin/env bash
23

34
# This script must be called from the repo root.
45
# The radar environment variables must be provided.
56
# See also the https://github.com/leanprover/radar readme.
67

7-
cmake --preset release -DWFAIL=OFF
8+
LLVM_RELEASE=19.1.2
9+
LLVM_TARBALL="$RADAR_CACHE/llvm/$LLVM_RELEASE.tar.zst"
10+
11+
if [ ! -f "$LLVM_TARBALL" ]; then
12+
mkdir -p "$RADAR_CACHE/llvm"
13+
curl --location -o "$LLVM_TARBALL" "https://github.com/leanprover/lean-llvm/releases/download/$LLVM_RELEASE/lean-llvm-x86_64-linux-gnu.tar.zst"
14+
fi
15+
16+
mkdir -p build/release
17+
cd build/release
18+
eval cmake ../.. \
19+
--preset release $(../../script/prepare-llvm-linux.sh $LLVM_TARBALL) \
20+
-DWFAIL=OFF
21+
rm -rf stage2
22+
cp -r stage1 stage2
23+
rm -rf stage3
24+
cp -r stage1 stage3
25+
cd ../..
826
make -C build/release -j"$(nproc)" bench-part2
927
mv tests/part2.measurements.jsonl "$RADAR_OUT"

0 commit comments

Comments
 (0)