Conversation
S3-FIFOd was an unpublished adaptive variant of S3-FIFO that hill-climbed the small/main split from hit counts on two extra "recently evicted" FIFOs. S4-FIFO supersedes it: same goal of adapting S3-FIFO to the workload, but through named parameters rather than an online feedback loop. S4-FIFO keeps S3-FIFO's three physical queues and turns the constants S3-FIFO hard-codes into five knobs: small-size-ratio rho_S 0.10 ghost-size-ratio rho_G 0.90 skip-ratio kappa 0.00 move-to-main-threshold tau_S 2 ghost-to-main-threshold tau_G 0 Two of these are new machinery rather than exposed constants: - The skip ratio is what makes this "S4". Hits on an object still within the newest kappa fraction of the small queue do not increment its frequency counter, so a burst of correlated references right after insertion cannot buy a promotion to main. That carves a virtual probationary region out of the head of the small queue without a fourth physical queue. Distance from the head is measured in bytes inserted after the object, so the region stays a true fraction of the queue when objects differ in size. - The ghost threshold handles cyclic scans. At tau_G = 0 a ghost hit promotes straight to main, as in S3-FIFO. At tau_G = 1 the first ghost hit only sends the object back through probation; the ghost hit count rides along with the object and is restored into the ghost entry if it is demoted again, so a second ghost hit is what finally promotes it. At the default parameters S4-FIFO reduces exactly to S3-FIFO, which the CLI tests assert by replaying a trace through both and comparing the miss ratios at three sizes; they also assert that each of the five knobs moves the result, so a knob that stops being wired up fails loudly. The unit test pins a non-default configuration (skip-ratio=0.25, ghost-to-main-threshold=1) so the new code paths are covered rather than S3-FIFO's numbers being re-checked under a new name. The paper pairs this heuristic with an offline-trained gradient-boosted tree that picks a configuration per workload from measured features. That model is not included here -- only the heuristic it steers, configured through -e. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JxxSd3ipti1DZc58v543JW
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 06961b4ebc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| cache->get_occupied_byte = S4FIFO_get_occupied_byte; | ||
| cache->can_insert = S4FIFO_can_insert; | ||
|
|
||
| cache->obj_md_size = 0; |
There was a problem hiding this comment.
Charge S4-FIFO metadata when requested
When --consider-obj-metadata=true is used, this unconditional zero means the capacity calculations ignore the newly added per-object small_insert_byte, freq, and ghost_hits fields. Consequently S4-FIFO reports the same effective capacity as metadata-free mode and produces overly optimistic miss ratios for metadata-aware experiments; its resident sub-caches need to account for this policy metadata.
Useful? React with 👍 / 👎.
| // remove from small fifo, but do not update stat | ||
| bool removed = small_fifo->remove(small_fifo, params->req_local->obj_id); | ||
| DEBUG_ASSERT(removed); |
There was a problem hiding this comment.
Record S4-FIFO's actual evictions
In builds with TRACK_EVICTION_V_AGE enabled, the branch that drops an object into the ghost queue removes it without calling record_eviction_age; the analogous terminal branch in S4FIFO_evict_main does the same. Since every real S4-FIFO eviction follows one of these paths, the parent cache's eviction-age histogram remains empty, corrupting eviction-age experiments for this algorithm.
Useful? React with 👍 / 👎.
What does this PR do?
This PR implements the S4-FIFO cache eviction algorithm from "Learning-Augmented Heuristics: Simple, yet Smart, Robust and Interpretable Cache Eviction" and removes the S3FIFOd algorithm.
S4-FIFO extends S3-FIFO by making its hard-coded constants into configurable parameters:
small-size-ratio: fraction of cache held by small queue (default 0.10)ghost-size-ratio: ghost queue size relative to cache size (default 0.90)skip-ratio: head fraction of small queue where hits don't count (default 0.00)move-to-main-threshold: hits needed to promote from small to main (default 2)ghost-to-main-threshold: ghost hits needed to skip probation (default 0)The skip ratio implements a virtual "fourth region" (probationary period) without requiring a fourth physical queue, preventing correlated reference bursts from triggering premature promotion. The ghost threshold handles cyclic scans by allowing multi-hit promotion logic.
At default parameters, S4-FIFO reduces exactly to S3-FIFO.
Type of change
How was it tested?
ctest --test-dir _build --output-on-failurepassestest_evictionAlgo.ctest_cli.shwith S4-FIFO parameter validationChecklist
clang-formatcacheAlgoRegistry.c)https://claude.ai/code/session_01JxxSd3ipti1DZc58v543JW