Skip to content

Plugin format probe: build havsfunc's Lut2 tables once per process; per-call timings and --budget (task #75) - #233

Merged
StuartCameronCode merged 3 commits into
mainfrom
stuart/75-macos-x64-ci-plugin-format-contracts-tes
Nov 20, 2026
Merged

StuartCameronCode merged 3 commits into
mainfrom
stuart/75-macos-x64-ci-plugin-format-contracts-tes

Conversation

@StuartCameronCode

Copy link
Copy Markdown
Owner

Fixes the macOS x64 push-gate timeout in plugin_format_contracts_test ("quick probe", 15 min) — task #75.

Cause: slow, not hung

havsfunc's LUTDeCrawl and LUTDeRainbow build four std.Lut2(function=lambda x, y: x & y) tables per call. At 10 bits that is 2^20 Python calls per table (~2 s each on an M1, several times that on the Intel runners), rebuilt in every probe cell: 80% of the quick probe. Passing macOS x64 runs took 442–857 s against the 15 min limit; nightly's full probe never finished there (its LUTDeCrawl child passed an hour). No call was stuck, and it is unrelated to Bifrost 4.0 / FFT3DFilter.

Change

  • Scripts/probe-plugin-formats.py
    • Each child evaluates havsfunc's pure Lut2 functions (no closure, defaults, globals or attributes; two arguments) once per process into a lut= list. That list is bit-identical and goes through the same format checks in VapourSynth's own Lut2, so what a call accepts can't change. Everything else passes through. --no-lut-memo runs them as written.
    • One timing line per call as it finishes.
    • --budget N: past N seconds it reports which calls are still running (with their last cell) and which never started, kills the children and exits 3. A child that times out is an ERROR line (exit 2) instead of a crash of the whole probe, and --out won't write a partial table.
    • Largest grids are started first.
  • app/test/support/plugin_probe_runner.dart (new): shared by the quick (push gate) and full (nightly) probe tests. It streams the timing lines into the CI log and passes --budget set 90 s under the test's timeout.
  • New push-gate test: the memo matches the function pixel for pixel, at mixed depths both ways (pinning x + (y << bits_a)) and with keywords and planes. It checks that closures and global-reading functions are not memoised, and that havsfunc's LUTDeCrawl still takes the memo (so the probe can't silently go slow again).
  • Docs: CLAUDE.md, an ENGINEERING_NOTES entry, and the report docs/reports/task-75-quick-probe-timeout/ with its scripts and data.

Testing

  • CI push gate (run 44519306260, before the merge from main): green on all four platforms.
    • Quick probe, macOS x64: 293 s (was 442–857 s with timeouts); arm64 91 s, Windows 108 s, Linux 35 s.
    • The memo test takes about 27 s on macOS x64.
  • Nightly macOS legs: the full probe now finishes on macOS x64, in 2136 s.
    • It still exits 1, on differences already filed as task [REQ] Intermadiate files codecs & presets #81: znedi3 refuses 720x486 4:2:0 on x86, and VFM accepts the 9- and 14-bit documentation rows.
    • The other failing heavy and sweep tests also fail in main's nightly (44562921675). None is new here.
  • Locally, macOS arm64, deps 1.18.0-rc1, after merging main: flutter test test/plugin_format_contracts_test.dart passes all 6 tests. --budget 6 by hand exits 3 with the report and leaves no child processes.
  • Local timing, same cells: the full probe's two LUT calls went from 654 s to 96 s.

Follow-ups

This branch merges main (conflicts in plugin_format_contracts_test.dart, ENGINEERING_NOTES and the reports index; both sides kept).

🤖 Generated with Claude Code

StuartCameronCode and others added 3 commits November 20, 2026 19:23
… and --budget (task #75)

The push gate's quick plugin format probe timed out on macOS x64 (442-857 s
passing, against 15 min), and nightly's full probe never finished there (its
LUTDeCrawl child passed the 3600 s child timeout). Not a hang: havsfunc's
LUTDeCrawl and LUTDeRainbow build four Lut2(function=lambda x, y: x & y)
tables per call, a million Python calls each at 10 bits (1.95 s per table on
an M1), rebuilt in every cell: 80% of the quick probe.

- The probe's children wrap havsfunc's core so a Lut2 whose function reads
  only its arguments is evaluated once per process into a lut= list
  (bit-identical, same format checks). --no-lut-memo runs it as written.
  M1, 1.18.0-rc1: quick probe 86 s -> 33 s wall (205 -> 70 s CPU); full
  LUTDeCrawl 654 s -> 96 s; the same cells in every mode.
- Each call prints one stderr line as it finishes (cells, refused, seconds).
  --budget N reports the calls still running (with their last cell) and the
  ones never started, kills the children and exits 3. A child past
  CHILD_TIMEOUT is one ERROR line naming its call, not a traceback.
- Children run under Popen, registered so the watchdog can kill them; calls
  are submitted largest grid first.
- Both probe tests run through support/plugin_probe_runner.dart, which
  streams those lines into the log and passes --budget 90 s under the test's
  timeout. A push-gate test checks the memo against the functions and that
  havsfunc's own LUTDeCrawl still takes it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t (task #75)

The reference tables are built the slow way (function=), which passed the
default 30 s on the macOS x64 and Windows runners. Mixed 8x10 / 10x8 pins
the index order both ways at a quarter of the cost. Also corrects the
per-cell figure: a cached table still costs ~0.28 s to hand over, so a 10-bit
LUTDeCrawl cell goes 7.7 s -> 1.1 s on an M1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Report with CI timings before and after, per-call and per-cell times, the
Lut2 cost and identity, and the scripts that produced them; engineering note
and index row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@StuartCameronCode
StuartCameronCode force-pushed the stuart/75-macos-x64-ci-plugin-format-contracts-tes branch from 05869cf to f9ee3bf Compare November 20, 2026 08:24
@StuartCameronCode
StuartCameronCode merged commit 69af23c into main Nov 20, 2026
3 of 4 checks passed
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