diff options
| author | kawaii-shakal <deusex1998@gmail.com> | 2026-11-25 20:57:43 +0500 |
|---|---|---|
| committer | kawaii-shakal <deusex1998@gmail.com> | 2026-11-25 20:57:43 +0500 |
| commit | e4c413a3a5fe18b99ede727d02b9a561fc8ca56e (patch) | |
| tree | 4c25d5f7ac4b76e96a1887b0c07f5f623dd9a38e /runtime/src | |
| parent | 9f1f5bf9a653d6cd4568a879887b4483f37ad465 (diff) | |
heavy pipeline cache: a write covers what was noted before it started, counted, not timed; teardown keeps fast builds too
GetTickCount64 moves in 10-16 ms steps, so a slow build noted during a write in the write's own tick was taken
as written. The schedule now counts notes. And without an offline seed every build goes to the heavy cache:
fast ones never schedule a write, so teardown writes the cache whenever any build went into it, which is what
pipeline_cache.session.bin used to keep.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src')
| -rw-r--r-- | runtime/src/heavy_pipeline_cache.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/runtime/src/heavy_pipeline_cache.h b/runtime/src/heavy_pipeline_cache.h index d8ca04e2d..f7b55aebc 100644 --- a/runtime/src/heavy_pipeline_cache.h +++ b/runtime/src/heavy_pipeline_cache.h | |||
| @@ -50,6 +50,7 @@ public: | |||
| 50 | if (!dirty_) first_ = now_ms; | 50 | if (!dirty_) first_ = now_ms; |
| 51 | dirty_ = true; | 51 | dirty_ = true; |
| 52 | last_ = now_ms; | 52 | last_ = now_ms; |
| 53 | ++generation_; | ||
| 53 | } | 54 | } |
| 54 | bool dirty() const { return dirty_; } | 55 | bool dirty() const { return dirty_; } |
| 55 | // The time to write at; only meaningful while dirty. | 56 | // The time to write at; only meaningful while dirty. |
| @@ -58,16 +59,18 @@ public: | |||
| 58 | return settled < latest ? settled : latest; | 59 | return settled < latest ? settled : latest; |
| 59 | } | 60 | } |
| 60 | bool due(std::uint64_t now_ms) const { return dirty_ && now_ms >= due_ms(); } | 61 | bool due(std::uint64_t now_ms) const { return dirty_ && now_ms >= due_ms(); } |
| 61 | // A write started at `started_ms` took the cache as it was then: a heavy compile noted later than that keeps | 62 | // Taken when a write starts; the write covers every heavy compile noted up to then. |
| 62 | // the cache dirty for the next write. | 63 | std::uint64_t generation() const { return generation_; } |
| 63 | void written(std::uint64_t started_ms) { | 64 | // A write that started at `generation` and `started_ms` is done. A heavy compile noted after it started, even in |
| 64 | if (last_ <= started_ms) dirty_ = false; | 65 | // the same millisecond tick, keeps the cache dirty for the next write, due as if it were first noted then. |
| 66 | void written(std::uint64_t generation, std::uint64_t started_ms) { | ||
| 67 | if (generation_ == generation) dirty_ = false; | ||
| 65 | else first_ = started_ms; | 68 | else first_ = started_ms; |
| 66 | } | 69 | } |
| 67 | 70 | ||
| 68 | private: | 71 | private: |
| 69 | bool dirty_ = false; | 72 | bool dirty_ = false; |
| 70 | std::uint64_t first_ = 0, last_ = 0; | 73 | std::uint64_t first_ = 0, last_ = 0, generation_ = 0; |
| 71 | }; | 74 | }; |
| 72 | 75 | ||
| 73 | } // namespace leonida::heavy_pipeline_cache | 76 | } // namespace leonida::heavy_pipeline_cache |