Runner backend and conditional optimization review

Copy Markdown View Source

The current backend starts a fresh Lynx runner for each cache-policy group with ready modules. Within a request, Lynx verifies ready independent modules in parallel and returns reports in input order. Shared checked artifacts, preparation coordination and the per-VM admission budget remain in use. Reusable sessions and additional scheduling across requests require separate evidence; assessment output does not select a new backend or change defaults.

What the pinned backend supports

The locked Lynx Hex version is 0.2.0. ReductionBounds.Translation holds proof blocks outside Lynx's Core translator. ReductionBounds.Runner renders source modules with public imports and axiom audits, and maps diagnostics back to the original proof locations. Internal ProofCache fingerprints control eligibility and preparation coordination; they are stripped from the wire request. Lynx computes persistent artifact keys.

The adapter uses the pinned version 1.0 verification protocol. It partitions consecutive modules by cache eligibility and uses one process per group with ready modules, under the same admitted callback. In shared-only mode, checked compiled artifacts pass between groups through a temporary directory in the child process's LEAN_PATH. The parent environment is unchanged. Empty input launches no runner. The public Lynx.Commands.runner!/2 and verify!/3 wrappers also use one-shot processes; a reusable session is not integrated by ReductionBounds.

The Lean executable can read successive requests and retain immutable runtime imports, but requests are handled in order. Request-local declarations and artifact maps are not automatically retained for arbitrary subsequent requests. Within each request, modules start after their prerequisites verify; independent ready modules may overlap, and failed prerequisites block their consumers.

Preparation coordination coalesces overlapping internal shared keys before job admission. It is separate from Lynx's scheduler inside a request. Warm closures are still supplied in deterministic dependency order. LEAN_NUM_THREADS affects Lean worker capacity independently of the VM callback budget.

Implementation references for Lynx 0.2.0:

The recorded Issue 8 measurements used the earlier sequential backend, including Lynx d74890ac7a446d57b762d0e4fcd3c848146b2ff6. Their source revisions, configuration and raw logs remain historical evidence. They do not measure the current module scheduler or establish its speedup, memory use or optimal job budget. Recalibrate representative workloads after a backend change.

Correct timing attribution

The legacy runner_non_module_wall_ms subtracts module time from the entire post-assembly request interval, including preparation coordination and admission waiting. It is not a startup measurement. Increasing concurrency can inflate this field even while command wall time decreases.

optimization_evidence pairs actual job.runner_call_wall_ms with module reports from the same callback, excluding preparation/admission waits. With additive timings, its residual still includes dispatch, Lake/process startup, runtime imports, protocol and teardown; it is not isolated startup.

Current events identify module_schedule: "dependency_ready_parallel". Multi-module requests have no additive residual, even when their cumulative module time happens to be below call time. Such requests are counted as parallel_timing_requests, not as inconsistent measurements. Their raw call and module timings remain available. The event's legacy runner_non_module_wall_ms is null for these requests, and its aggregate is unavailable if any completed request lacks an additive residual.

Legacy events without scheduling metadata retain the earlier arithmetic calculation for comparison; this alone does not establish that they were sequential. Missing/nonnegative timing checks still apply. For legacy or zero/single-module requests, a module-time sum exceeding call time is excluded as inconsistent. Counts distinguish valid, missing, parallel and inconsistent pairs. Concurrent request sums overlap and are not a partition of suite time.

Per-module time_ms already includes imports, decoding/rendering, elaboration, audits and artifact publication. It is not pure proof-elaboration time. Cached modules still have loading costs. Empty theorem timing arrays do not prove that proof work was free.

Cache-state evidence

New event module reports include an observational cacheable flag from the final input's key eligibility. This field is added only to event reports; public proof results are unchanged. It identifies eligibility, not a guarantee of a hit.

The summary distinguishes fully cached accepted requests, accepted requests with cacheable shared misses, target/other misses, work without cache keys or with caching bypassed, legacy unknown policy, empty probes, and unsuccessful requests. Shared-module counters include accepted requests only. An uncached report without policy information cannot establish a cacheable cold miss: bypass and unknown-import cases also recheck modules. Legacy hits remain recognizable as hits, but legacy miss policy remains unknown. Module-time sums for eligible misses are diagnostic work, not time that can be saved by parallel execution or an estimate of DAG speedup. Deliberately cold regression cases can contribute misses too; specify whether the goal is test throughput or application cold starts and measure representative workloads for that goal.

Negative proof reports, skipped dependents and unfinished requests are not successful optimization samples. A suite may intentionally exercise them; use its exit status and assertions to distinguish expected rejection from failure.

Reviewing existing logs

mix reduction_bounds.assess docs/baselines/issue8-heavy-full.json \
  --output _build/heavy-optimization-review.json

This reads the adjacent issue8-heavy-full_artifacts event files and writes JSON and Markdown. It never invokes Lean, starts sessions, changes configuration or modifies the source benchmark. Saved absolute paths are not followed after a report is moved. Missing adjacent events produce an incomplete report and a nonzero task exit; choose a new output path when retrying. Existing outputs are not overwritten. Complete means that event artifacts were available, not that the benchmark passed or either optimization was approved.

For new evidence, use ordinary benchmark runs with a clean committed source, fixed source/toolchain/seed/case/job/thread settings, isolated cold/warm caches, repeated samples and CPU/memory recording. Run the existing empty and trivial boundary probes separately from representative named workflows. The current empty probe skips the runner entirely; it cannot isolate Lake or runtime initialization. Older empty probes did launch Lynx. Separate probe differences across backend revisions are not an initialization breakdown. Warm benchmark attempts use fresh VMs and cached artifacts, not persistent runner sessions.

Gates before implementation

CandidateEvidence and integration required
Runner reuseComplete controlled job/thread calibration on the target workload; repeatable material call residuals after waiting is separated; upstream attribution or a supported session prototype that measures initialization savings; representative whole-command improvement at acceptable memory cost.
Additional scheduling across requestsMeasurements of the existing parallel Lynx scheduler first; repeatable material cacheable shared misses, ready-frontier/critical-path attribution, and the cost of extra launches/imports; a supported integration with lower command wall time under the same job/thread budget and memory envelope.

Choose practical acceptance targets before a prototype comparison. A large sum of request residuals, many runner launches, many cold modules, or a static graph with independent nodes does not by itself satisfy either gate. Current evidence does not isolate startup, measure a cold critical path or demonstrate either backend's throughput benefit for a new session or scheduling layer. Keep the current backend while those requirements remain unmet. The reference-Mac comparison passed all four full-suite commands on the earlier backend and supported an initial profile of 4 jobs with 2 Lean threads. Remeasure that profile on the current backend. It does not measure either proposed backend's benefit. The portable fallback of 2 remains provisional on unmeasured machines; public deadlines are unchanged. See verification defaults.

If a supported session prototype is justified, preserve separate environments, artifact maps, target association, ordered results, diagnostics and transitive axiom audits. One owner must drain each port through its terminal response. On timeout, cancellation, crash or protocol failure, retire the worker and replace it before assigning another request. Restart sessions when effective runtime or toolchain identity changes. Validate success/failure in both orders, repeated declaration names across requests, interruption, cleanup and shutdown.

A scheduling prototype should first measure the parallelism already provided by Lynx and identify work left waiting across requests. Reimplementing the existing within-request scheduler is not an unimplemented prerequisite.

Any additional scheduler must retain cache invalidation and atomic publication, verified source/callee replay, deterministic reports and failure propagation. Dependents must not start before their prerequisites are checked; waiting must not consume capacity needed by preparation. Preserve deadline scope and cancellation while queued. Integrate only through supported Lynx interfaces and retain the current one-shot path as a comparison until the alternative meets the gates.

The recorded conditional review includes legacy-log reassessment, new probes and native cache-policy validation.