Skip to content

ci: Measure's score cache hits again (shell scripts, SHA-pinned runs, the side it restores, ifc_common's siblings()), a run that names no scorers skips the samples' schema checks, and the shards never cached are cut finer - #1704

Merged
DrunkOnJava merged 7 commits into
mainfrom
ci/score-cache-warm
Nov 11, 2026

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

An unfiltered Measure took 28.9 minutes and the score cache missed all 4,548 of its lookups. This makes the cache hit again and cuts the time a run spends on what it caches: with the same refs and flags, a run whose cache is warm takes 10.2 minutes (25.6 cold under the old key, 28.9 for the last unfiltered run), 3,996 of its 3,996 cacheable lookups on the side that ran hit, and every result file equals the cold run's. Four things kept the cache from hitting, and a fifth made a probe run pay for checks it did not ask for.

Motivation

Griffin asked where Measure's time goes. From the job and step logs of ten runs of today and the per-model timings.log of 42980660819 (28.9 min): a run is its longest shard (the builds take 3.3 min, 26 shards start within a minute of each other, Compare takes 30 s), every shard is CPU-bound (88 to 98% busy on the 4-vCPU runner), and the work is the score cache's. What kept it from skipping that work, found one at a time as each proof run was read:

  1. The key hashed shell scripts. measure-cache.py put every non-Python file of tools/re and tools/ci in every key, and 25 of the last 153 commits of main (72 hours) changed one (scrub-holdout-results.sh 14 times, measure-reference-models.sh 8), each resetting every entry.
  2. A run that pins its commits saved nothing. The cache was saved only by a run dispatched from main whose base was empty or main; every comparison pins SHAs.
  3. Both sides restored whichever side saved last. Head and base export different files wherever the change reaches, so an entry of the other side hits only for the models both write alike: a second run read 8% of its lookups as misses for that reason alone (91.7% and 89.9% hits, run 42990521699).
  4. ifc_common made every body scorer uncacheable. feat(ifc)!: write the openings a cabinet and a door cut in a wall, and a curtain wall's where nothing trims it (#1165) (RE-338) #1400 moved siblings() into tools/re/ifc_common.py on 2026-11-05. It splits a path and lists a directory; the cache allowed ifc_common the listing (for the mesh cache) but not the split, so every scorer that imports it was refused as reads dirname: on a warm run in which every lookup hit, 8,244 s of scorer time per side still ran (saved_meshes_vs_ifc 1,585 s, box_bodies_vs_ifc 795, wall_bodies_vs_ifc 704, 20 more). 102 of the 207 Python files in tools/re could be keyed.
  5. A probe run, or scorers=none, still ran every sample's schema checks. measure_sample called schema unconditionally, 170 to 220 s of IfcOpenShell's EXPRESS rules on a large MEP sample: samples-2024-2099 took 1,223 s in a run that asked for no scorer.

Rows were registered on this PR before each run: #1704 (comment), #1704 (comment), #1704 (comment) and #1704 (comment), and the results are read against them in the comments after each.

Changes

  • tools/ci/measure-cache.py: the key no longer hashes shell scripts (1); ifc_common may split a path, and a closure that calls siblings() is refused unless EXTRA_INPUTS hashes the files it lists, which psets_vs_ifc and unfilled_openings_vs_ifc now do (their declaration finds the function in the closure) (4). 158 of the 207 files in tools/re key, from 102.
  • .github/workflows/measure.yml: the plan job asks the compare API whether the head and the base are on main's history (head_on_main, base_on_main), and a side whose commit is on it saves the score cache (2); a side restores the newest entry of its own side first, then the other side's, then main's in the same order (3); the held-out shards are cut in three (offices, rvt-holdout-[0-9]*, the rest) and racadv in three, as they are never cached.
  • tools/ci/measure-reference-models.sh: a sample's schema checks run when the run's scorers include schema (5), as a reference model's do.
  • docs/maintaining.md: the key, where the cache is saved and restored, and the siblings rule.

Testing

Measured on the Measure runner (workflow and CI scripts only; no local build). Same refs and flags throughout (ref 1641128, base 5f928b4, every flag), each pair with a cache name of its own (score_cache=warm1, warm2) so a pair is not helped by another:

run what wall lookups per side hits
42980660819 the last unfiltered run, main's workflow 28.9 min 2,274 0
42986562320 cold, fixes 1 and 2 25.6 min 2,274 0
42990521699 warm, before fix 3 12.0 min 2,274 2,086 and 2,044
42992706693 warm, fix 3 10.7 min 2,274 2,274 (100%)
42995189344 cold under fix 4 19.6 min 3,996 0
42997978043 warm, fix 4 (head side; the base side reused the cold run's saved results) 10.2 min 3,996 3,996 (100%)
  • Replay is exact: all 5,810 result files of the third run equal the cold run's, none differs and none is missing; the 2,905 result files of the second pair's warm head side, among them the scorers fix 4 made cacheable (saved_meshes_vs_ifc, box_bodies_vs_ifc, wall_bodies_vs_ifc, mesh_bodies_vs_ifc, door_bodies_vs_ifc, layer_sets_vs_ifc), equal the cold run's, none differs.
  • Fix 5, 42990655084 (head only, samples=true, scorers=none): samples-2024-2099's Measure step takes 116 s (1,223 s), samples-2008-2023's 46 s (258 s), ifc.sha256 equal to the reference run's on 58 of 58 samples, no schema.txt on any.
  • A sibling export edited on dummy files moves the keys of psets_vs_ifc and unfilled_openings_vs_ifc and no other (checked with make_key).
  • tools/check-local.sh: workflow and CI script only; the PR's own CI runs env config lint
  • The unfiltered run of this PR's head against main: 43000996895 (head ab86d603 against its merge base 16411282, every flag, score_cache=warm2): its same-project gates verdict and the scorer diff are read on the PR

Audit-honesty checklist

  • The docs say what ships (docs/maintaining.md)
  • Limitations stated: the steps that read a directory of their own (the probe-path scorers, space_profiles_vs_ifc) stay uncached, and so do rvt-gltf and mcp_answers_vs_ifc; the held-out models, BIMcollab, spent-* and racadv-* are never cached by design
  • No emojis, no private paths
  • No user-visible change

Legal and contribution hygiene

  • Apache-2.0; no Autodesk proprietary source or NDA'd SDK content

Breaking changes

None. The first run after this lands starts a cold cache (the key's helper hash changes).

Related issues

Refs #1694 (the wall-time work it began with). #1400 is where siblings() moved.

…y commit on main's history, so it stops missing every lookup

Run 42980660819 (29 minutes, the unfiltered Measure of a pull request) missed
all 4,548 of its score-cache lookups, and 97% of its CPU time was in the steps
the cache keeps: schema-validate-rules alone was 4,727 of 17,113 seconds on the
head side. Two causes. The key hashed every non-Python file of tools/ci and
tools/re, shell scripts included, and 25 of the last 153 commits of main
changed one (the scrub script 14 times, the Measure script 8), which reset every
entry. And the cache was saved only by a run that left base empty or named it
main, so a run that pins its base and head to SHAs, as every comparison of two
commits does, never saved: the plan job now asks the compare API whether each
commit is main's tip or an ancestor of it, and a side on main's history saves.
…ed, in three each

Beside shards that hit the score cache (3 to 5 minutes) the held-out shard took
770 seconds and racadv 899 on the head side of run 42980660819, and a run is as
long as its longest shard. The held-out models split by name into the offices,
the rvt-holdout house and the rest (which also takes any model added to the
lists), racadv-2015 to 2020 into three of two.
…eave schema out, as the reference models do

A probe run or scorers=none still ran arity, IfcOpenShell's EXPRESS rules and the property sets on every sample export: 170 to 220 s of a large MEP sample, which set the longest shard of such a run at about 1,000 s (run 42987216721). The models already gate the step with wanted schema; the samples now do too. ifc.sha256, the stage counts and the wall-rule counts are kept.
@DrunkOnJava

Copy link
Copy Markdown
Owner Author

Rows registered before the proof run (the second run of the pair, score_cache=warm1), against the cold run 42986562320 (the branch at 3a06a1b, ref 1641128, base 5f928b4, every flag).

The cold run read 0 hits on 2,274 cacheable lookups per side (4,278 more per side are never cached by design: held-out, BIMcollab, spent and racadv) and saved under measure-scores-v2-x-warm1-<shard>.; it took 25.6 min, the base side's samples-2024-2099 shard 23.9 min and the head side's 12.1.

The second run is dispatched from the branch's current head (95b9099: two workflow commits and one shell script after the cold run's commit), with the same ref, base and flags, so every export is byte-identical to the first run's. It must hit, because the key now ignores shell scripts and workflows.

  1. Hits. At least 95% of the 2,274 cacheable lookups per side hit (2,160 or more); the misses it does have are named by step.
  2. Replay is exact. Every *.txt scorer output of the second run equals the first run's for the same side and model, byte for byte except the lines that carry a time or a path (ifc.sha256 equal on all 126 models each side). A hit that replays a different line than the computation wrote is a defect in the cache, not in the run.
  3. Wall time. The run takes 14 min or less (25.6 cold; 28.9 for the last unfiltered run, 42980660819), and no cacheable shard's Measure step takes longer than the exports, rvt-gltf and rvt-info it still runs (about 6 min on samples-2024-2099). The held-out and racadv shards, which are never cached, are cut in three each by this branch, so neither sets the run's length.
  4. Nothing else moves. same-project gates pass; the Compare job lists no scorer difference between the two sides beyond what the cold run listed.

A miss on 1 names the step whose key changed; a miss on 2 stops this PR.

@DrunkOnJava

Copy link
Copy Markdown
Owner Author

Rows registered before the gate's run (95b9099: the samples' schema checks run only when the run's scorers include schema).

42987216721 (scorers=none, nordic and samples, timing) left Measure head samples-2024-2099 at 1,223 s and Measure base samples-2024-2099 at 1,179 s, against 60 to 324 s for every other measure shard of that run: with no scorer asked, a sample still ran arity, IfcOpenShell's EXPRESS rules (170 to 220 s on a large MEP sample) and the property sets. The new run: head only, ref 1641128, samples=true, scorers=none, score_cache=off.

  1. samples-2024-2099's Measure step takes 300 s or less (1,223 s), and samples-2008-2023's 150 s or less (258 s on the head side of the same run).
  2. ifc.sha256 is written for every sample of both shards, and each equals the one in 42987216721 for the same sample (the gate removes a check, not an export).
  3. No schema.txt is written for a sample of this run, and element_stage_counts.txt and wall_rules.txt still are.

The default run (no scorers) keeps the checks: the cold and warm pair above run them.

@DrunkOnJava

Copy link
Copy Markdown
Owner Author

Result of the gate's run 42990655084 against the rows above: all three held.

  1. Held. samples-2024-2099's Measure step took 116 s (300 s or less asked; its job 1,223 s in 42987216721), samples-2008-2023's 46 s (150 s or less asked; 258 s). The whole run took 5.8 min, with Build head at 18 s (23.4 min for 42987216721, whose long pole was these two shards).
  2. Held. ifc.sha256 is written for all 58 samples of both shards and equals the one in 42987216721 on 58 of 58.
  3. Held. No schema.txt is written for any of the 58 samples (42987216721 wrote 58), and element_stage_counts.txt, wall_rules.txt and timings.log are written for all 58.

So a scorers=none or probe run no longer pays arity, IfcOpenShell's EXPRESS rules and the property sets on every sample. The pair of runs for the cache itself (42986562320 cold, 42990521699 warm) is still the proof of the other half of this PR.

…irst, then the other side's

Head and base export different files wherever the measured change reaches, so an entry of the other side hits only for the models both write alike. The second run of the proof pair restored whichever side had saved last and read 8% of its 4,548 cacheable lookups as misses for that reason alone (run 42990521699: 91.7% and 89.9% hits, 5,810 result files equal to the cold run's).
@DrunkOnJava

Copy link
Copy Markdown
Owner Author

Result of the warm run 42990521699 against the first four rows: 2 and 4 held, 3 held on the wall time and not on the shard bound, 1 missed. The miss has one cause, now fixed, and the rows for a third run are registered at the end.

  1. Missed. Hits were 2,086 of 2,274 on the base side (91.7%) and 2,044 of 2,274 on the head side (89.9%); 2,160 or more asked. The 188 and 230 misses are whole models: 4 on each side, 44 lookups each (nordic-housing-timber-as-built, the timber office as built and the two terrain housing files on the base side; the housing concrete as built and permit, the housing timber permit and the timber office permit on the head side), and the samples rac_advanced, rst_basic and Snowdon Structural, each 6. Those are the models whose export differs between head (main 1641128) and base (5f928b4): feat(ifc): a beam's six base quantities are the sums of the prism its saved mesh is, and its body does not change (#1693) (RE-423) #1699 moved them. The restore asked for <prefix><shard>. and so took whichever side had saved last in the cold run, and a side restoring the other's entry hits only the models both write alike.
  2. Held. 5,810 result files of the warm run (every scorer output, ifc.sha256, the schema file and the rest, both sides) are byte-identical to the cold run's; none differs and none is missing. The recomputed misses wrote what the cold run wrote.
  3. Held on the wall time, not on the shard bound. The run took 12.0 min (14 asked; 25.6 cold; 28.9 for 42980660819). samples-2024-2099's Measure step took 627 s on the head side (about 6 min asked): its misses were the rac_advanced, rst_basic and Structural exports, whose schema checks ran again. The held-out and racadv shards cut in three each are no longer the long ones.
  4. Held. same-project gates and Compare passed.

The fix (3fd9b9a): a side restores the newest entry of its own side first (<prefix><shard>.<side>-), then the other side's, then main's in the same order. Docs in docs/maintaining.md.

Rows for the third run (same refs and flags, score_cache=warm1, dispatched from 3fd9b9a; its restore finds the entries the first two runs saved for each side):

  1. At least 99% of the 2,274 cacheable lookups per side hit (2,251 or more).
  2. Every result file equals the cold run's again (5,810 of 5,810).
  3. The run takes 10 min or less, and samples-2024-2099's Measure step 360 s or less on both sides.

…iblings() made every importer read dirname since #1400

siblings() moved into tools/re/ifc_common.py on 2026-11-05 (#1400) and uses os.path.split and os.listdir. The cache allowed ifc_common to list a directory (the mesh cache) but not to split a path, so every scorer that imports ifc_common was refused as reading dirname: on a warm run in which every lookup it made hit (42992706693), about 8,200 s of scorer time per side still ran, saved_meshes_vs_ifc alone 1,585 s. The split is allowed there now, a closure that calls siblings() is refused unless EXTRA_INPUTS hashes the files it lists, and psets_vs_ifc declares them as unfilled_openings_vs_ifc does (whose declaration had stopped finding the function). 102 of tools/re's scorers keyed before, 158 do now.
@DrunkOnJava

DrunkOnJava commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner Author

Result of the third run 42992706693 (3fd9b9a, side-first restore) against its rows: 1 and 2 held, 3 missed by 43 s and 0.7 min. What it also shows is the larger finding of this PR, and the rows for the pair that tests it.

  1. Held. 2,274 of 2,274 cacheable lookups hit on each side (100.0%; 2,251 asked), no model misses.
  2. Held. 5,810 of 5,810 result files equal the cold run's.
  3. Missed. The run took 10.7 min (10 asked; 12.0 for the second run, 25.6 cold) and samples-2024-2099's Measure step took 403 s on the head side (360 asked) and 301 s on the base side.

Why a run in which every lookup hits still takes 10.7 min. The lookups it makes are the light ones. On the 41 models that are not held out, 23 steps are never looked up, because the cache refuses them with reads dirname: saved_meshes_vs_ifc (1,585 s of scorer time per side), box_bodies_vs_ifc (795), wall_bodies_vs_ifc (704), space_overlaps_vs_ifc (682), layer_sets_vs_ifc (586), door_bodies_vs_ifc (521) and 17 more, 8,244 s in all, against about 700 s of scorer time that hit. In tools/re/ifc_common.py, siblings(path) splits a path and lists a directory; #1400 moved it there on 2026-11-05; the cache allows ifc_common to list a directory (the mesh cache) but not to split a path, so every scorer that imports ifc_common has read dirname since, and no body scorer has been cached for six days. unfilled_openings_vs_ifc was refused for a second reason, that its declared inputs read a siblings() the scorer no longer has. Of the 207 Python files in tools/re (ifc_common apart), 102 could be keyed.

The fix (294c4c0): ifc_common may split a path; a closure that calls siblings() is refused unless EXTRA_INPUTS hashes the files it lists, which psets_vs_ifc and unfilled_openings_vs_ifc now do (the declaration finds the function in the closure). 158 of the 207 key now; editing a sibling export moves only the keys of those two (checked on dummy files).

Rows for the next pair (same refs and flags, score_cache=warm2, from 294c4c0: the cache's own source is in every key, so the first run is cold, and the second restores what it saved):

  1. In the second run at least 3,000 lookups per side are cacheable (2,274 before), and at least 99% of them hit.
  2. All result files of the second run equal the first's, and the files of the steps that were already cached equal the 5,810 of the cold run before.
  3. The second run takes 8 min or less, and no shard that is not held out has a Measure step over 5 min.

… its own

With the body scorers cached the longest shard of a warm run is the held-out remainder, 454 s on the base side of run 42997978043 (10.2 min in all), and the flowbim.ee house (63.6 MB, against 4 MB for the other models of the shard but the BIM-Speed pairs) is the largest model in it.
@DrunkOnJava

DrunkOnJava commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner Author

Result of the second pair (42995189344 cold, 42997978043 warm, score_cache=warm2, 294c4c0) against the rows above: 1 and 2 held, 3 missed on both counts.

The cold run made 3,996 lookups per side (2,274 before the fix of ifc_common), all misses, and took 19.6 min.

  1. Held, on the side that ran. The warm run's head side hit 3,996 of 3,996 (100%; 3,000 lookups and 99% asked). Its base side did not run: "Results this base commit already has" restored the cold run's scrubbed base results (the measure-results-v1-<base>-<hash> entry the cold run saved, which an earlier pair could not use because the tooling hash in its key had changed between its runs), so the base logs in its artifacts are the cold run's, all misses. A comparison that pins a base now pays for its base side once.
  2. Held. The 2,905 result files of the head side (the scorers that were uncached before the fix among them: saved_meshes_vs_ifc, box_bodies_vs_ifc, wall_bodies_vs_ifc, mesh_bodies_vs_ifc, door_bodies_vs_ifc, layer_sets_vs_ifc, 82 hits each) equal the cold run's, computed, file for file; none differs, none is missing. They also equal the first pair's cold run's.
  3. Missed. The run took 10.2 min (8 or less asked) and samples-2024-2099's Measure step 335 s on the head side (300 or less asked). What moved: the office shards, whose Measure steps took 345 to 511 s in the third run of the first pair, now take 75 to 113 s (86 s for the timber office at permit, 90 s for the concrete office at permit), rest 164 s. What sets the 10.2 minutes now: held-out 454 s (base) and 328 s (head), samples-2024-2099 335 s, racadv and racadv-2015-2016 296 and 289 s, all never cached except the samples. The held-out remainder holds the 64 MB flowbim.ee house, which ab86d60 measures in a shard of its own (workflow only, 18 shards a side). The samples shard's remaining time is the exports and the cross-save check, bodies_across_saves, which reads a directory of its own and stays uncached.

So a warm run that pins its base costs the head side only: exports, rvt-gltf, mcp_answers_vs_ifc (both run binaries, not cached), the held-out models, racadv and the samples' cross-save check. The gates run of this PR's head follows.

@DrunkOnJava DrunkOnJava changed the title ci: Measure's score cache hits again (it hashed shell scripts, and saved nothing for a run that pins SHAs), and the shards that are never cached are cut in three ci: Measure's score cache hits again (shell scripts, SHA-pinned runs, the side it restores, ifc_common's siblings()), a run that names no scorers skips the samples' schema checks, and the shards never cached are cut finer Nov 11, 2026
@DrunkOnJava
DrunkOnJava marked this pull request as ready for review November 11, 2026 10:19
@DrunkOnJava
DrunkOnJava merged commit 0572f26 into main Nov 11, 2026
180 checks passed
@DrunkOnJava
DrunkOnJava deleted the ci/score-cache-warm branch November 11, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant