Skip to content

feat(speculation): add best-first speculation path generator - #516

Closed
sbalabanov wants to merge 1 commit into
mainfrom
sergeyb/speculation-generator
Closed

feat(speculation): add best-first speculation path generator#516
sbalabanov wants to merge 1 commit into
mainfrom
sergeyb/speculation-generator

Conversation

@sbalabanov

Copy link
Copy Markdown
Contributor

Summary

Implements the Generator seam of the standard Speculator (see
doc/rfc/submitqueue/speculation.md): a pull-based stream of candidate
speculation paths over one queue snapshot, consumed by the Allocator.

  • generator: the Generator/PathIterator contract — lazy, snapshot-scoped,
    ctx-aborted; candidates never repeat and never contradict resolved facts.
  • generator/bestfirst: prices every path by the probability that all of its
    dependency assumptions hold — resolved deps pinned as facts,
    Merging/Cancelling priced as modal certainties, undecided deps scored via
    the injected scorer (once per batch per run) — and yields candidates in
    exact non-increasing price order through lazy add/shift enumeration merged
    across heads by one max-heap. Dependencies are normalized into canonical
    queue order so path IDs stay stable across runs; ties are deterministic.
  • doc/rfc/submitqueue/speculation-generator.md: design doc with the pricing
    model, enumeration scheme, a step-by-step two-run worked example, and
    future refinements (relaxation, unblocking weight, sensitivity pruning).

Also regenerates storage/mock/request_batch_store_mock.go, whose committed
header predated generation via 'make mocks' and kept check-mocks red.

Co-Authored-By: Claude Fable 5 noreply@anthropic.com

Test Plan

Issues

Implements the Generator seam of the standard Speculator (see
doc/rfc/submitqueue/speculation.md): a pull-based stream of candidate
speculation paths over one queue snapshot, consumed by the Allocator.

- generator: the Generator/PathIterator contract — lazy, snapshot-scoped,
  ctx-aborted; candidates never repeat and never contradict resolved facts.
- generator/bestfirst: prices every path by the probability that all of its
  dependency assumptions hold — resolved deps pinned as facts,
  Merging/Cancelling priced as modal certainties, undecided deps scored via
  the injected scorer (once per batch per run) — and yields candidates in
  exact non-increasing price order through lazy add/shift enumeration merged
  across heads by one max-heap. Dependencies are normalized into canonical
  queue order so path IDs stay stable across runs; ties are deterministic.
- doc/rfc/submitqueue/speculation-generator.md: design doc with the pricing
  model, enumeration scheme, a step-by-step two-run worked example, and
  future refinements (relaxation, unblocking weight, sensitivity pruning).

Also regenerates storage/mock/request_batch_store_mock.go, whose committed
header predated generation via 'make mocks' and kept check-mocks red.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants