Skip to content

tools: share t0 test setup and optimize placement tests - #752

Merged
juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:tools-t0-time
Oct 23, 2026
Merged

juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:tools-t0-time

Conversation

@juliankang4

Copy link
Copy Markdown
Collaborator

t0 검사에서 같은 일을 되풀이하던 부분을 줄여, 검사 범위는 그대로 두고 전체 시간을 단축합니다.

What and why

just contrib-check --tier t0 spends most of its time in two checks: test-bloomery-placement and check-recipes. This PR removes repeated work in both without dropping any test, assertion or gate.

  • Cargo.toml: the placement test profile now uses opt-level = 1. Debug assertions, overflow checks and debug info stay on. The placement tests are compute-bound, so most of their run time was unoptimized code.
  • tools/gate-batch.sh: part 13 called gate-batch --tier fixture --classes three times on the same real tree. It now runs it once and the three existing checks read that output. The tests that change a copy of the table and expect an error still run.
  • tools/recipes.py: self_test computes Graph.inputs and Reach.gate_files for every gate before it forks, so the child processes inherit the results instead of each recomputing them.

Release notes: Under the hood: the t0 tier runs the same checks in less time by doing the placement tests with light optimization and computing shared gate analysis once.

Code shape

  • No second copy. The change adds no function, type or cache format. It reuses the existing Graph.inputs and Reach.gate_files.
  • Model code holds only architecture facts. No model file is touched.
  • Dead code is gone. Nothing was made unused.
  • No silent failure. The exit code of the real-tree classes call is still checked.
  • Comments state what is true now. The one added comment says the children inherit the memos.
  • No relaxed gate. No band, tolerance or lint moved.
  • cargo fmt and cargo clippy: cargo fmt and the other t0 static checks ran inside the t0 runs below. I did not run cargo clippy separately; the change touches no Rust source.

Duplication found or removed: the three identical real-tree --classes calls in tools/gate-batch.sh are now one.

What I ran

Each arm ran the whole just contrib-check --tier t0 once, in this order on one machine: main, this branch, main, this branch. The first pair started from an empty Cargo build folder, the second pair reused each side's build output.

Cache condition main this branch Reduction
Initially empty build folder 455.44 s 358.03 s 97.41 s (21.39%)
Reused build output 399.97 s 291.06 s 108.91 s (27.23%)

The reduction is (main - branch) / main. Each condition has one pair, so these are single observations with no significance claim.

Per-check time from the contrib-check output:

Check main, empty branch, empty main, reused branch, reused
test-bloomery-placement 96 s 42 s 94 s 34 s
check-recipes 189 s 144 s 190 s 143 s

Inside check-recipes, the gate-batch part 13 block took 173.6 s, 78.6 s, 174.4 s and 78.0 s in the same four runs. The recipes.py self-test block took 105.6 s, 100.3 s, 107.3 s and 100.0 s, so its gain is small and most of the t0 gain comes from placement and part 13.

Coverage is unchanged. All four runs ended with DONE tier=t0 total=38 red=0, ran the same 38 checks, the same 177 placement tests (177 passed; 0 failed; 0 ignored) and all 145 recipes blocks with no green-key skips. For the placement profile, Cargo's unit graph for the branch shows opt_level=1 debug_assertions=true overflow_checks=true debuginfo=2 for the test, build and doctest units; main has opt_level=0 with the same debug settings.

To reproduce:

LC_ALL=C just contrib-check --tier t0

Run it on main and on this branch, alternating, with the same build-folder state.

Hardware

Linux 7.0.0-38-generic, x86_64, AMD Ryzen 5 PRO 6650H, 12 logical CPUs, 12186 MiB memory, rustc 1.100.0-nightly (e457a7b0d 2026-08-27), RUSTFLAGS='-C target-cpu=x86-64-v3', CARGO_BUILD_JOBS=4, RAYON_NUM_THREADS=4. The change touches no GPU code, so no GPU gate ran.

What I ran into

This does not block the PR. The slowest check-recipes blocks on this branch are cardtests and lease, at 109 s and 102 s in the first branch run; this PR does not change them. I did not measure the GitHub Actions job time after this change, so the numbers above are not a CI estimate.

AI help

AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.

@github-actions github-actions Bot added the tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo label Oct 23, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: CLEAN: The shared setup preserves the assertions and propagates command failures.

Checked

Duplicates: 0 new functions, types or constants; the existing Graph.inputs and Reach.gate_files owners are reused. No dryer pairs were produced.
Complexity: self_test gains one cache-warming loop. No Rust function changed.
Silent failure: 1 producer-status path followed through check, bad and the final exit. A nonzero producer exit remains red even with valid output.
Tests: by inspection, changing F to D in placement's balanced return at tools/gate-batch.sh:5264 fails the retained DS41 and Nemotron assertions. Cache warming precedes the fork and uses the existing per-tree memos.
Gates: no threshold, tolerance, lint or assertion was removed or relaxed. The profile changes only placement's test optimization level.
Escape catalog: C1–C4 checked; none matched. The original classes call still checks its exit status before its output is reused.

Notes

dryer and crapper did not run because no Rust file changed.
Validation used static inspection; the full t0 suite was not rerun.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

@juliankang4

Copy link
Copy Markdown
Collaborator Author

The review is done and the contribution check passed, so I'm merging this.

@juliankang4
juliankang4 merged commit 501db04 into midagedev:main Oct 23, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant