Commit a2ebe14
Reduce peak memory during prove by releasing witness shared memory early (#204)
* Add unchecked device memory export, LogUp query count API, lightweight prove, and configurable CPU count
- Add `export_device_memories_unchecked()` for exporting device memories without
state assertion, enabling memory optimization workflows where context is dropped
before proving
- Add `prove_lightweight()` to ExpanderNoOverSubscribe, allowing prove without
holding computation_graph or prover_setup references
- Add `final_check_with_query_count()` to LogUpSingleKeyTable and
LogUpRangeProofTable for hint-free logup verification with externally provided
query counts
- Support `ZKML_NUM_CPUS` env var to override physical CPU detection for MPI
process count
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Reduce peak memory during prove by releasing witness shared memory early
Add witness_ack shared memory signaling between client and server:
- Client resets a 1-byte ack signal before writing witness
- Server signals ack after reading witness into MPI shared memory
- Client polls for ack, then immediately releases witness shared memory
and calls malloc_trim to return memory to OS
- Prove request runs concurrently via tokio async, so witness memory is
freed while proving is in progress
- Skip reading PCS setup from shared memory (return default) since the
client does not need it after setup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Address review feedback: platform-guard malloc_trim, reduce polling interval
- Wrap malloc_trim calls with #[cfg(all(target_os = "linux", target_env = "gnu"))]
to avoid linker errors on non-glibc platforms
- Reduce witness_ack polling interval from 500ms to 10ms for faster response
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Address review: add polling timeout, revert debug label, remove redundant malloc_trim
- Add 5-minute timeout to wait_for_witness_read_complete to prevent
indefinite hang if the server crashes
- Revert timer label from "new setup" back to "setup"
- Remove duplicate malloc_trim inside spawn_blocking (shared memory
is mmap-managed, not glibc heap)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: restore verifier setup from shared memory to fix verify panic
The previous optimization skipped reading PCS setup from shared memory
and returned empty defaults, which caused verify to panic on v_keys
lookup (unwrap on None).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 8f953a2 commit a2ebe14
3 files changed
Lines changed: 93 additions & 2 deletions
File tree
- expander_compiler/src/zkcuda/proving_system/expander_parallelized
Lines changed: 37 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
144 | 148 | | |
145 | 149 | | |
146 | 150 | | |
| |||
152 | 156 | | |
153 | 157 | | |
154 | 158 | | |
| 159 | + | |
| 160 | + | |
155 | 161 | | |
156 | | - | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
157 | 192 | | |
158 | 193 | | |
159 | 194 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
152 | 155 | | |
153 | 156 | | |
154 | 157 | | |
| |||
Lines changed: 53 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
| |||
106 | 109 | | |
107 | 110 | | |
108 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
109 | 162 | | |
110 | 163 | | |
111 | 164 | | |
| |||
0 commit comments