Chunk 15.0

In this chunk, I implemented the core of the new memory manager for cuzk, following the specification in `cuzk-memory-manager.md`. I created the new `memory.rs` module with `MemoryBudget`, `MemoryReservation`, `detect_system_memory()`, and all estimation constants for different proof types (PoRep, SnapDeals, WindowPoSt, WinningPoSt). I updated `config.rs` to replace the old dead-code fields (`pinned_budget`, `working_memory_budget`, `partition_workers`, `preload`) with the new unified budget configuration (`total_budget`, `safety_margin`, `eviction_min_idle`), added a `parse_duration` helper, and implemented deprecation warnings for old config fields. I rewrote `srs_manager.rs` to be budget-aware, adding `last_used` tracking, `evictable_entries()` and `evict()` methods that properly release budget, and a new `ensure_loaded()` that gates loading on budget availability. In `pipeline.rs`, I replaced the four static `OnceLock<PreCompiledCircuit<Fr>>` globals with a new `PceCache` struct that supports eviction and budget integration, updated all four `extract_and_cache_pce_from_*` functions to accept `&PceCache`, and updated `synthesize_auto` to take an optional `&PceCache` parameter with all 9 call sites updated. I also started modifying `engine.rs`, adding the `reservation` field to `SynthesizedJob` and updating `Engine::new()` to wire the budget into `SrsManager`. The remaining engine.rs changes (startup, partition dispatch, GPU worker loop, evictor wiring) are still pending but the foundation is fully laid.

The Unified Memory Manager: A Systematic Refactoring of the cuzk GPU Proving Engine 2214 words

Message Articles