feat(tasks): #408 increment 4 — seeded scheduling strategy (task_sched_seed)#484
Merged
Merged
Conversation
…d_seed) The pluggable scheduling-strategy hook for the deterministic-simulation-tester consumer, the last of the #408 primitives. - `task_sched_seed of n` switches the scheduler from FIFO round-robin to picking the next ready task from a seeded, platform-independent PRNG (splitmix64, pure integer arithmetic). The schedule stays fully deterministic — same seed => same interleaving on every run and under EIGS_REPLAY, recording ZERO tape N records — but a different seed explores a different ordering. This is the lever a DST (liferaft) uses to search the interleaving space while keeping every run reproducible. - The FIFO fast path is untouched: with no seed installed, sched_ready_pop is the same O(1) head pop, so every existing program behaves identically. The seeded pick (O(ready-count), only in DST mode) removes the chosen task and compacts the queue order-preservingly. - task_sched_seed ensures the scheduler exists so the seed sticks even when set before the first task_spawn. Follows eigenscript-extend-vm: one deterministic builtin (no tape wrapping — the pick is a pure function of the seed), two POD TaskScheduler fields, no opcode/AST/CallFrame/JIT-helper sites. Gates: release 2620/2620. New determinism gate: the seeded schedule is identical across two processes, replays byte-identically, records zero tape N records, and differs from the FIFO order (proving the seed reorders). SPEC "Seeded scheduling" section + BUILTINS + examples/task_seeded_schedule.eigs + 5 new assertions in test_tasks.eigs (seed 42 and seed 7 pinned byte-exact). Refs #408. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The pluggable scheduling-strategy hook for the deterministic-simulation-tester consumer — the last of the #408 primitives. Builds on the virtual-time increment (#482).
task_sched_seed of nswitches the cooperative scheduler from FIFO round-robin to picking the next ready task from a seeded, platform-independent PRNG (splitmix64, pure integer arithmetic).EIGS_REPLAY, recording zero tapeNrecords (the pick is a pure function of the seed + program order — no wall clock, no nondeterminism).Why
#408's differential-proof step is migrating liferaft onto the upstream task layer. A DST's whole job is exploring interleavings; without a seam to vary scheduling from a seed it would keep hand-rolling one. This is that seam.
Safety / scope
sched_ready_popis the same O(1) head pop, so every existing program behaves identically. The seeded pick (O(ready-count), tiny, only in DST mode) removes the chosen task and compacts the queue order-preservingly.task_sched_seedensures the scheduler exists so the seed sticks even when set before the firsttask_spawn.eigenscript-extend-vm: one deterministic builtin (noTRACE_NONDETwrapping), two PODTaskSchedulerfields, no opcode/AST/CallFrame/JIT-helper sites.Gates
detect_leaks=1) 2620/2620, leak tally 0, no sanitizer errors.Nrecords, and differs from the FIFO order (proving the seed actually reorders).docs/SPEC.md"Seeded scheduling" section (byte-for-byte doc-example test),docs/BUILTINS.md,examples/task_seeded_schedule.eigs, and 5 new assertions intests/test_tasks.eigs(seed 42 and seed 7 pinned byte-exact).Refs #408.
🤖 Generated with Claude Code