okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge commit 'b8d604d28' into f-clean-1ab0fc432ed

main
1.4 KiB32 linesraw
1// research/stage-reserve-proposal/proposal.hpp - PROPOSAL, not used by the engine (moved out of
2// include/strata/program/stage_reserve.hpp in cleanup step 4.2; the text of both functions is unchanged).
3// See README.md in this folder.
4#pragma once
5
6#include "strata/program/stage_reserve.hpp"
7
8#include <algorithm>
9#include <cstdint>
10
11namespace strata::program::stage_reserve {
12
13constexpr int64_t kGraphMib = 6;            ///< one window graph, captured on first use (log of #3702: 4, 6, 6)
14constexpr int64_t kInstantiateBurstMib = 48; ///< the largest single step seen (42 MiB in #3702): room kept for one more
15
16/// PROPOSAL, unused: the window term of a later stage when the windows of every size 1..max_window_t can still be
17/// captured after loading: the first window's arena (kWindowMib already holds it), a graph for each further size, and
18/// one burst.
19inline int64_t proposed_window_mib(int max_window_t) {
20    const int64_t sizes = std::max<int64_t>(max_window_t, 1);
21    return kWindowMib + (sizes - 1) * kGraphMib + kInstantiateBurstMib;
22}
23
24/// PROPOSAL, unused: reserve_mib with the proposed window term on a later stage.
25inline int64_t proposed_reserve_mib(const Inputs& in, int max_window_t) {
26    Inputs p = in;
27    int64_t r = reserve_mib(p);
28    if (in.later) r += proposed_window_mib(max_window_t) - kWindowMib;
29    return r;
30}
31
32}  // namespace strata::program::stage_reserve