chore: remove domain iteration macros and address backing memory race#20988
chore: remove domain iteration macros and address backing memory race#20988nishatkoti merged 4 commits intomerge-train/barretenbergfrom
Conversation
ledwards2225
left a comment
There was a problem hiding this comment.
LGTM - seems to me the updated alloc logic is safer but still has some minor flaws to be addressed before merging
|
|
||
| // Check if we're under the storage budget | ||
| // Check and update storage usage to enforce budget | ||
| const size_t current_usage = current_storage_usage.fetch_add(required_bytes); |
There was a problem hiding this comment.
I agree this is better than before but I think this still allows "false negatives" no? If multiple threads access this at once, they might see a current_storage_usage that is artificially inflated from a allocation that's ultimately rejected since we increment the value before checking if its valid.
There was a problem hiding this comment.
A possible fix could be the following. Will wait for @johnathan79717 to take a look and confirm.
size_t current_usage = current_storage_usage.load();
while (true) {
if (current_usage + required_bytes > storage_budget) {
return false;
}
if (current_storage_usage.compare_exchange_weak(current_usage, current_usage + required_bytes)) {
break;
}
}
There was a problem hiding this comment.
Sorry somehow missed the notification for this. Taking a look.
There was a problem hiding this comment.
The while loop fix LGTM!
f7216ba to
9d632a4
Compare
…te_over_domain.hpp which becomes unused
…mment (addressed already) in barycentric.hpp
9d632a4 to
d5a5c8d
Compare
…#20988) - Replace `ITERATE_OVER_DOMAIN_START` and `ITERATE_OVER_DOMAIN_END` macros with a `parallel_for` loop in `ifft()` - The macro was only used in `ifft()`. Replacing it with an inline loop makes the control flow clearer and allows removing the unused header. - Delete the now-unused `iterate_over_domain.hpp` - Address race condition in `try_allocate_file_backed` in `backing_memory.hpp` - Remove old improvement note in `barycentric.hpp`, as it is addressed in PR [#20585](#20585)
BEGIN_COMMIT_OVERRIDE fix: add -g0 to zig presets to eliminate 11GB debug info bloat (#21071) fix: resolve flaky p2p_client test race condition on ARM64 (#21088) chore: remove domain iteration macros and address backing memory race (#20988) fix: [ECCVM] added domain separation for the multiset equality check. (#20352) feat: hybrid CRS hash verification — 8MB chunks, parallel, span-based (#21113) chore: unify splitting scalars interface (#20805) chore: add a unique id to each origin tag (#20924) chore: Native curve audit (#20936) chore: Update bootstrap in test vk haven't changed script (#21153) fix: use reduced form in WASM FromMontgomeryForm test (#21164) chore: erase ephemeral secrets from memory in schnorr and aes (#21106) chore: suppress clangd target triple version diagnostic (#21180) feat: Optimise new claim calculation (#21179) docs: add Quick Start build instructions to barretenberg README (#20951) feat: batched chonk verification (#21083) fix: link libc++ instead of libstdc++ for Rust FFI on Linux (#21203) fix: [ECCVM] in the transcript table, no-ops force the next accumulator to be 0. (#20849) fix: resolve merge-train conflict with next (zig wrapper scripts + -g0) (#21201) fix: [ECCVM] rare edge case completeness issue when `z1 == 0` but `z2 != 0` (#20858) fix: use actual data extent for CommitmentKey in HypernovaDeciderProver (#21206) END_COMMIT_OVERRIDE
ITERATE_OVER_DOMAIN_STARTandITERATE_OVER_DOMAIN_ENDmacros with aparallel_forloop inifft()ifft(). Replacing it with an inline loop makes the control flow clearer and allows removing the unused header.iterate_over_domain.hpptry_allocate_file_backedinbacking_memory.hppbarycentric.hpp, as it is addressed in PR #20585