Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions changelog.d/415-floor-headroom.added.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,30 @@
`hardBudget=` and `queuedRelief=` on the `[plan-vs-actual]` line. The
floor is the cheapest plan the summaries held allow, head and tail
included, whatever the folding strategy picked; a compile refuses once its
plan passes `hardBudget`, so `hardBudget - floorTokens` is how far the store
is from its first refusal. `queuedReliefTokens` is what the queued L1s and
plan passes `hardBudget`, and every plan does once the floor does, so
`hardBudget - floorTokens` is how far the store is from the point where
every compile refuses. `queuedReliefTokens` is what the queued L1s and
merges are expected to take off the floor once they land. Work tick won't
turn into a summary counts as zero: a chunk the compression quarantine
holds or deferred for the host's tools, every chunk from the first a
compression hold reaches, a merge holding a source a hold or a
merge-quarantine record keeps out, and every merge from the first a hold
blocks. A floor that can't be computed leaves the fields out and is said
once per cause, as `[autobiographical] floor not computed`.
blocks. Under `kv-unified` the floor takes that solver's own constraints,
locks included, and is exact. The other folding strategies give pins
precedence over locks in ways those constraints don't follow, so there the
floor counts no lock. Outside `kv-unified` the floor is a lower bound: a
floor over `hardBudget` means every compile refuses, and one at or under it
doesn't promise a plan fits. A floor that can't be computed leaves the
fields out and is said once per cause, and once more by each load that
meets it, as `[autobiographical] floor not computed`.
- `OverBudgetDiagnostics` gains `floorTokens` and `queuedReliefTokens` on
adaptive refusals, and the refusal's message ends with `floor=` and
`queued relief=`. A floor at or under the budget means the refusal isn't
for want of summaries, since a plan that fits exists; a floor still over
the budget once the queued relief is taken off means draining the queue
alone won't clear it.
the adaptive refusals that come once the plan is made, when its floor was
computed, and the refusal's message then names them as `floor=` and
`queued relief=`. The refusal for a head and tail that alone exceed the
budget comes before the plan, so it carries neither. Under `kv-unified`,
a floor at or under the budget means the refusal isn't for want of
summaries, since a plan that fits exists. Outside `kv-unified` the floor is
a lower bound: a floor over `hardBudget` means every compile refuses, and
one at or under it doesn't promise a plan fits. A floor still over
`hardBudget` once the queued relief is taken off means draining the queue
alone isn't expected to clear it, the relief being an estimate.
19 changes: 14 additions & 5 deletions src/adaptive/picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,25 @@ export interface OverBudgetDiagnostics {
rawPins?: { tokens: number; pins: readonly OverBudgetRawPin[] };
/**
* Under adaptive resolution, the cheapest plan the summaries held allow,
* head and tail included (#415). At or under the budget, a plan that could
* fit wasn't picked; over it, only new summaries, a larger budget or a
* smaller tail clear the refusal. Absent where it couldn't be computed.
* head and tail included (#415). Under kv-unified, at or under the budget a
* plan that fits exists, so the refusal isn't for want of summaries.
* Outside kv-unified the floor counts no lock and is a lower bound: a floor
* over `hardBudget` (`inputBudget` with `overBudgetGraceRatio` added, the
* plan size above which a compile refuses, as `RenderStats` reports it)
* means every compile refuses, and one at or under it doesn't promise a
* plan fits. Over `hardBudget`, no plan fits until the floor drops under it
* or the budget rises, as new summaries, a smaller tail, fewer messages, or
* a released pin or lock that kept a message from its cheapest form can
* bring about. Absent where it couldn't
* be computed, and on a refusal that comes before the plan, as the head
* and tail reservation's does.
*/
floorTokens?: number;
/**
* Under adaptive resolution, what the queued compression work is expected
* to take off `floorTokens` once it lands (RenderStats' `queuedReliefTokens`).
* A floor that stays over the budget less this much won't be cleared by
* draining the queue alone.
* It's an estimate, so a floor that stays over `hardBudget` less this much
* isn't expected to be cleared by draining the queue alone.
*/
queuedReliefTokens?: number;
}
Expand Down
18 changes: 13 additions & 5 deletions src/strategies/autobiographical.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3088,6 +3088,7 @@ export class AutobiographicalStrategy implements ResettableStrategy {
// failure only an earlier one met. A host that moves the store's branch
// itself leaves this load in place until the manager initializes it again.
this.namedDroppedQuarantineKeys.clear();
this.floorFailure = undefined;
this.namedUnlistedQuarantineState.clear();
this.compressionDebtFailureLogged = null;

Expand Down Expand Up @@ -6379,17 +6380,24 @@ export class AutobiographicalStrategy implements ResettableStrategy {
* The floor (#415): the cheapest plan the summaries held allow for these
* inputs, head and tail included, in the plan's units. An adaptive compile
* refuses once it passes the hard budget, whatever the folding strategy
* picks, so the distance between the two is how near the store is to its
* first refusal. Null where the forest can't be built for these inputs;
* the figure is a report and never fails a compile.
* picks, and every plan does once the floor does, so the distance between
* the two is how near the store is to the point where every compile
* refuses. Under kv-unified it takes that solver's own constraints, locks
* included. The other folding strategies give pins precedence over locks
* in ways these constraints don't follow, so there it counts no lock, and
* is a lower bound. Null where the forest can't be built for these inputs or
* the computation fails; the figure is a report and never fails a compile.
*/
private floorTokens(inputs: PickerInputs): number | null {
try {
const kv = this.config.foldingStrategy === 'kv-unified' ? this.config.kvUnified : undefined;
const reused = kv ? this.kvUnifiedReuse.forest : undefined;
const forest = reused?.builtFrom(inputs)
const floorInputs = this.config.foldingStrategy === 'kv-unified'
? inputs
: { ...inputs, chunks: inputs.chunks.map((chunk) => chunk.lockedByAgent ? { ...chunk, lockedByAgent: false } : chunk) };
const forest = reused?.builtFrom(floorInputs)
? reused
: new CanonicalSummaryForest(inputs, {
: new CanonicalSummaryForest(floorInputs, {
treeifyNonContiguousSummaries: kv?.treeifyNonContiguousSummaries,
preserveGapBearingSummaries: kv?.preserveGapBearingSummaries,
});
Expand Down
12 changes: 8 additions & 4 deletions src/types/strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1143,10 +1143,14 @@ export interface RenderStats {
/** The floor (#415): the cheapest plan the summaries held allow for this
* compile's inputs, head and tail included, in the plan's units, whatever
* the folding strategy picked. A compile refuses once its plan passes
* `hardBudget`, so `hardBudget - floorTokens` is how far the store is
* from its first refusal: it shrinks as history arrives and grows as
* L1s and merges land. Absent where the forest couldn't be built
* (`floor=` on the plan line). */
* `hardBudget`, and every plan does once the floor does, so
* `hardBudget - floorTokens` is how far the store is from the point
* where every compile refuses: it usually shrinks as history arrives and
* grows as L1s and merges land. Under kv-unified it takes that solver's
* own constraints, locks included; under the other folding strategies,
* which give pins precedence over locks, it counts no lock, and is a
* lower bound. Absent where the forest couldn't be built or its computation
* fails (`floor=` on the plan line). */
floorTokens?: number;
/** The plan size above which this compile refuses: the input budget with
* `overBudgetGraceRatio` added (`hardBudget=`). Set with `floorTokens`. */
Expand Down
Loading
Loading