repositories / smith

smith

There are many coding harnesses - but this one is fast

owned by bugabinga

ci: unprivileged jobs; toolchain default linker, valgrind built from source and cached; budgets re-pinned for the CI image

6684ede5309dfaff493d5486faeadfac126d2c9e

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (9)

+37 / −46 text lines

Diff layout

.cargo/config.toml

Modified

+3 / −3 text lines

5757[registries.crates-io]
5858protocol = "sparse"
60# mold is a build prerequisite on this target; `cargo x check` verifies it.
61[target.x86_64-unknown-linux-gnu]
62rustflags = ["-C", "link-arg=-fuse-ld=mold"]
60# Linker choice is a machine preference (e.g. mold via ~/.cargo/config.toml
61# target tables, which compose with the universal table above); the repo
62# links with the toolchain default so any image builds it.
6464# Native Termux ARM64: vendored LuaJIT needs compiler-rt for __clear_cache.
6565# `latest` is Termux's stable symlink to the installed Clang resource version.

.ci/check.kdl

Modified

+0 / −1 text lines

55 branch "trunk"
66 }
77 }
8 run "apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq mold"
98 run "rustup component add rustfmt clippy"
109 run "cargo run -p xtask -- ci"

.ci/e2e.kdl

Modified

+0 / −1 text lines

55 branch "trunk"
66 }
77 }
8 run "apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq mold"
98 run "rustup component add rustfmt clippy"
109 run "cargo run -p xtask -- bootstrap"
1110 run "cargo run -p xtask -- e2e"

.ci/nightly.kdl

Modified

+8 / −2 text lines

33 trigger {
44 schedule "0 3 * * *"
55 }
6 run "apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq mold valgrind"
76 run "rustup component add rustfmt clippy llvm-tools"
7 cache "valgrind" {
8 path "target/tools/valgrind"
9 key {
10 file ".ci/nightly.kdl"
11 }
12 }
13 run "V=$PWD/target/tools/valgrind; test -x $V/bin/valgrind || (mkdir -p target/tools/src && curl -sSL https://sourceware.org/pub/valgrind/valgrind-3.25.1.tar.bz2 | tar -xj -C target/tools/src && cd target/tools/src/valgrind-3.25.1 && ./configure -q --prefix=$V >/dev/null && make -s -j$(nproc) >/dev/null && make -s install >/dev/null)"
814 run "cargo run -p xtask -- bootstrap"
915 run "cargo run -p xtask -- mutants || echo 'missed mutants recorded in the report'"
10 run "cargo run -p xtask -- report"
16 run "PATH=$PWD/target/tools/valgrind/bin:$PATH cargo run -p xtask -- report"
1117 publish "site" {
1218 from "target/report"
1319 to "smith/nightly/${rev}"

.ci/perf.kdl

Modified

+8 / −2 text lines

55 branch "trunk"
66 }
77 }
8 run "apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq mold valgrind"
8 cache "valgrind" {
9 path "target/tools/valgrind"
10 key {
11 file ".ci/perf.kdl"
12 }
13 }
14 run "V=$PWD/target/tools/valgrind; test -x $V/bin/valgrind || (mkdir -p target/tools/src && curl -sSL https://sourceware.org/pub/valgrind/valgrind-3.25.1.tar.bz2 | tar -xj -C target/tools/src && cd target/tools/src/valgrind-3.25.1 && ./configure -q --prefix=$V >/dev/null && make -s -j$(nproc) >/dev/null && make -s install >/dev/null)"
915 run "cargo run -p xtask -- bootstrap"
10 run "cargo run -p xtask -- perf"
16 run "PATH=$PWD/target/tools/valgrind/bin:$PATH cargo run -p xtask -- perf"

.ci/report.kdl

Modified

+8 / −2 text lines

11job "report" {
22 image "docker.io/library/rust:latest"
3 run "apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq mold valgrind"
43 run "rustup component add rustfmt clippy llvm-tools"
4 cache "valgrind" {
5 path "target/tools/valgrind"
6 key {
7 file ".ci/report.kdl"
8 }
9 }
10 run "V=$PWD/target/tools/valgrind; test -x $V/bin/valgrind || (mkdir -p target/tools/src && curl -sSL https://sourceware.org/pub/valgrind/valgrind-3.25.1.tar.bz2 | tar -xj -C target/tools/src && cd target/tools/src/valgrind-3.25.1 && ./configure -q --prefix=$V >/dev/null && make -s -j$(nproc) >/dev/null && make -s install >/dev/null)"
511 run "cargo run -p xtask -- bootstrap"
6 run "cargo run -p xtask -- report"
12 run "PATH=$PWD/target/tools/valgrind/bin:$PATH cargo run -p xtask -- report"
713 publish "site" {
814 from "target/report"
915 to "smith/report/${rev}"

.system/research/SMH-RESEARCH-UPU3A0HO-benchmarking/index.md

Modified

+1 / −1 text lines

116116Startup counts include the dynamic loader; every bench includes libc `malloc` and `memcpy`, whose implementations differ per glibc release.
117117Consequence: pins carry the platform (`# Pinned with <rustc> | glibc <v>`); the gate applies only on that platform, other hosts only report; pins are taken inside the CI image.
118118Inside the container `setarch` cannot disable ASLR, so the runner always gets `--allow-aslr=true`; with cache simulation off the counts stayed within band across repeated container runs.
119The CI image also lacks `mold`, which `.cargo/config.toml` requires; every job installs `mold` (and `valgrind` where callgrind runs) first.
119Luci job containers are unprivileged: no `apt-get`. The repo therefore links with the toolchain default (mold stays a machine preference in `~/.cargo/config.toml`, whose target table composes with the repo's universal table), and the callgrind jobs build valgrind 3.25.1 from source into `target/tools/valgrind` (≈ 3 min, Luci-cached on the job file). Pins were re-taken with that exact setup; linker choice shifts counts, so pins never move without the platform line.

smith-bench/budgets.toml

Modified

+9 / −9 text lines

33# Pinned with rustc 1.98.1 (48a229cea 2026-09-01) | glibc 2.41.
55[budgets]
6"instructions::agent::run_turn::history_1000_masked" = { ir = 11384108 }
7"instructions::providers::sse::anthropic" = { ir = 119257 }
8"instructions::providers::sse::gemini" = { ir = 52389 }
9"instructions::providers::sse::openai" = { ir = 89745 }
10"instructions::rpc::handle_line::ping" = { ir = 8428 }
11"instructions::session::canonical_json::nested" = { ir = 1122300 }
6"instructions::agent::run_turn::history_1000_masked" = { ir = 11353714 }
7"instructions::providers::sse::anthropic" = { ir = 119117 }
8"instructions::providers::sse::gemini" = { ir = 52409 }
9"instructions::providers::sse::openai" = { ir = 89657 }
10"instructions::rpc::handle_line::ping" = { ir = 8421 }
11"instructions::session::canonical_json::nested" = { ir = 1121818 }
1212"instructions::session::decode::linear_1000" = { ir = 11152010 }
1313"instructions::session::decode::tool_calls_1000" = { ir = 10396988 }
1414"instructions::session::encode::linear_1000" = { ir = 5674199 }
1515"instructions::session::encode::tool_calls_1000" = { ir = 5302087 }
1616"instructions::session::fork_at::linear_1000" = { ir = 233231 }
17"instructions::session::from_frames::linear_1000" = { ir = 1388558 }
18"startup::cli::smith::eval_mock" = { ir = 1196624 }
19"startup::cli::smith::help" = { ir = 707441 }
17"instructions::session::from_frames::linear_1000" = { ir = 1389238 }
18"startup::cli::smith::eval_mock" = { ir = 1043098 }
19"startup::cli::smith::help" = { ir = 553679 }

xtask/src/main.rs

Modified

+0 / −25 text lines

105105fn check(extra: &[OsString]) -> ExitCode {
106106 sequence(
107107 &[
108 ensure_mold,
109108 cargo_fmt_step,
110109 cargo_clippy,
111110 arch,
10051004 run("cargo-machete", &[])
1008/// mold is a build prerequisite on linux-gnu `x86_64`; xtask verifies it, the
1009/// system package manager installs it.
1010fn ensure_mold(_extra: &[OsString]) -> ExitCode {
1011 if cfg!(all(
1012 target_arch = "x86_64",
1013 target_os = "linux",
1014 target_env = "gnu"
1015 )) {
1016 match Command::new("mold")
1017 .arg("--version")
1018 .stdout(std::process::Stdio::null())
1019 .stderr(std::process::Stdio::null())
1020 .status()
1021 {
1022 Ok(status) if status.success() => ExitCode::SUCCESS,
1023 _ => fail(
1024 "mold linker missing: install it with the system package manager (e.g. pacman -S mold)\n",
1025 ),
1026 }
1027 } else {
1028 ExitCode::SUCCESS
1029 }
10321007/// Install the external gate tools that Cargo cannot ship.
10331008///
10341009/// `cargo-nextest` arrives as a prebuilt binary through `cargo-binstall`.