Chunk 14.0

This chunk focused entirely on analyzing, designing, and specifying a new memory management architecture for the cuzk GPU proving engine. The work began with a deep forensic audit of the entire memory lifecycle for 32 GiB PoRep proofs, tracing every allocation and deallocation point across SRS loading (~44 GiB pinned), PCE caching (~26 GiB heap), per-partition synthesis (~13.6 GiB for a/b/c/aux), GPU proving, and asynchronous deallocation. A critical finding was that the existing `working_memory_budget` config option was entirely dead code—never enforced—leaving the static `partition_workers` semaphore as the only throttle, which is memory-unaware and fragile. Through iterative Q&A, the user and assistant collaboratively refined a comprehensive solution. Key design decisions included: a single unified memory budget auto-detected from system RAM, LRU eviction for SRS and PCE with a 5-minute minimum idle time triggered under memory pressure, two-phase working memory release (a/b/c freed immediately after GPU prove start, remainder after proof finalization), and the removal of configurable preload and `partition_workers` in favor of on-demand loading and budget-based admission. The assistant confirmed that `synthesis_concurrency` should remain as a separate CPU contention knob. The final deliverable was the detailed `cuzk-memory-manager.md` specification, written to be directly actionable for implementation. This document defines the new `MemoryBudget`/`MemoryReservation` core types, the evictable `PceCache` replacing the static `OnceLock` globals, budget-gated SRS loading, streamlined configuration, and exact integration points in the engine's partition dispatch and GPU worker loops. The outcome is a fully designed architecture that replaces a fragile static concurrency limit with a robust, memory-aware admission control system, solving the risks of OOM, unbounded baseline memory growth, and configuration complexity.

From Forensic Audit to Specification: Designing a Memory-Aware Admission Control System for the cuzk GPU Proving Engine 2339 words

Message Articles

Subagent Sessions