Scale Anthropic FLT compilation with memory-aware scheduling and DAG caches - #613
Open
johnchandlerburnham wants to merge 3 commits into
Open
Scale Anthropic FLT compilation with memory-aware scheduling and DAG caches#613johnchandlerburnham wants to merge 3 commits into
johnchandlerburnham wants to merge 3 commits into
Conversation
Add --no-build for compiler retries, pin mimalloc 3.5.1, and log memory and active-block progress. Preserve expression DAG sharing during validation and main-stage auxiliary generation. Adapt validation and main-block admission to memory headroom, swap pressure, and recent growth; distinguish resource exhaustion from invalid proofs. Cover scheduler backoff, expression equivalence, worker-count determinism, and CLI/FFI behavior with tests.
Fold graph setup into chunk-local accumulators and preserve DAG sharing across Lean/kernel conversion, expression interning, and source-name restoration. Keep memoization pass-local and use exact structural hint keys, with differential, collision, and output-parity regression tests.
arthurpaulino
approved these changes
Sep 6, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Sep 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add the Anthropic Fermat's Last Theorem artifact as an on-demand benchmark,
and make the Ix compilation pipeline practical for its large expression DAGs.
The changes cover cached-artifact retries, allocation diagnostics, adaptive
admission, and eliminating repeated traversal of shared subexpressions.
Changes
CompileAnthropicFLT.leanand register theAnthropicFLTbenchmark.Pin the upstream proof artifact and retain the workspace's Mathlib pin.
ix compile --no-buildto reuse existing import artifacts withoutrerunning the target's Lake build/cache step. The input file is still
elaborated; callers must ensure the imports are present and up to date.
allocation failure encountered during the FLT runs.
Report active work and time since the last completion without implying that
a long-running block is deadlocked.
pressure to control admission to validation and main compilation.
The pool-size ceiling remains fixed; the number of admitted jobs changes.
Cancelled validation attempts discard scratch state and retry alone.
Main compiler blocks are not cancelled because they publish shared state.
map allocations while preserving graph, grounding, and group results.
kernel expression/universe interner, preserving sharing and metadata.
using exact shallow structural identities, avoiding repeated temporary
kernel-expression construction and unchecked 64-bit hash equality.
tests, forced-collision tests, and opt-in synthetic benchmarks.
Correctness boundaries
conversion context. Pointer-keyed caches retain their original input roots
and never use rebuilt temporaries as input identities.
It does not retain lookups across calls or claim an atomic snapshot of all
shared compiler state.
Restoration starts after collection finishes. Eligibility remains App/Proj
with no bound-variable node anywhere, including underneath binders.
enter serialized output. Restoration caches distinguish metadata-bearing
occurrences even when their anonymous content is equal.
One large allocation or block can still exhaust memory. Resource exhaustion
is reported separately from invalid-proof errors.
Measurements
Measured on Linux with 64 logical CPUs, approximately 495 GiB RAM, cached
import artifacts, and the same adaptive admission settings before/after the
source-name cache. These are Ix recompilation measurements, not cold builds
of the Lean libraries.
Both sides already include the DAG-aware interner. Peak RSS was
138.8 GiB before and 146.5 GiB afterward. It compiles 1,930,038 source
constants and writes 30,113,168,066 bytes (28.0 GiB).
and 20.2 GiB afterward; it compiled 771,129 source constants. The controlled
comparison used the immediately preceding implementation, not the older
September 1 artifact, which uses a different
.ixeformat version.byte-identical, but cache warmth differed, so this is not a controlled
measurement of the interner alone.
took about 176 ms versus 25 microseconds with caching. This isolates a
pathological shared-DAG case, not general compiler throughput.
Validation
(700 kernel and 288 compiler; manual benchmarks remain ignored).
lake build ix IxTests, FFI tests, and CLI tests passed.byte-identical, including metadata.
universe normalization, first-hint-wins ordering, changing address
resolution between passes, deliberate hash collisions, and shared DAGs.
The remote integration checks used the existing cached workspace with this
compiler/kernel patch set. They were not a fresh build of every dependency
on the latest main branch. Local validation targets the kernel/compiler
crates; the full workspace has a separate Rust toolchain requirement.
Reproduce a cached run
From the repository root, after building the benchmark's import artifacts:
export LEAN_NUM_THREADS=64 RAYON_NUM_THREADS=64 IX_COMPILE_WORKERS=64 lake exe ix compile Benchmarks/Compile/CompileAnthropicFLT.lean \ --no-build --verbose --out anthropic-flt-cached.ixe lake exe ix compile Benchmarks/Compile/CompileMathlib.lean \ --no-build --verbose --out mathlib-cached.ixeOptional diagnostics:
IX_MEMORY_DIAG=1andIX_LOG_IND_GROUPS=1.Worker ceilings and memory-budget controls are documented in
Benchmarks/Compile/README.md.Deferred
Whole-block cancellation/parking and more aggressive initial admission ramps
remain follow-up work. This PR does not introduce unsafe worker suspension,
active-block preemption, or an aggressive ramp based on the final FLT peak.