Segment 15

In this sub-session, the core of the new memory manager for cuzk was implemented following the specification in cuzk-memory-manager.md. A new memory.rs module was created containing MemoryBudget, MemoryReservation, detect_system_memory(), and estimation constants for all proof types. The config.rs was updated 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), including a parse_duration helper and deprecation warnings. The srs_manager.rs was rewritten 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, the four static OnceLock<PreCompiledCircuit<Fr>> globals were replaced with a new PceCache struct supporting eviction and budget integration, and all four extract_and_cache_pce_from_* functions were updated to accept &PceCache, while synthesize_auto was updated to take an optional &PceCache parameter with all 9 call sites updated. Finally, engine.rs was partially modified, adding the reservation field to SynthesizedJob and wiring the budget into SrsManager in Engine::new, with the remaining engine.rs changes (startup, partition dispatch, GPU worker loop, evictor wiring) left pending.

Create memory.rs module with MemoryBudget, MemoryReservation, detect_system_memory, and estimation constantsUpdate config.rs with unified budget fields and deprecation warnings for old fieldsRewrite SrsManager for budget-aware loading with last_used tracking and evictionReplace static OnceLock PCE caches with PceCache struct in pipeline.rsUpdate extract_and_cache_pce_from_* and synthesize_auto to use PceCachePartially modify engine.rs to add reservation field and wire budget into SrsManager

From Fragmented Caches to Unified Control: Implementing the cuzk Memory Manager 2768 words

Chunks