Skip to content

feat(tasks): #408 increment 4 — seeded scheduling strategy (task_sched_seed)#484

Merged
InauguralPhysicist merged 1 commit into
mainfrom
tasks-408-seeded-scheduling
Jul 8, 2026
Merged

feat(tasks): #408 increment 4 — seeded scheduling strategy (task_sched_seed)#484
InauguralPhysicist merged 1 commit into
mainfrom
tasks-408-seeded-scheduling

Conversation

@InauguralPhysicist

Copy link
Copy Markdown
Collaborator

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 n switches the cooperative scheduler from FIFO round-robin to picking the next ready task from a seeded, platform-independent PRNG (splitmix64, pure integer arithmetic).

  • Same seed ⇒ same interleaving on every run and under EIGS_REPLAY, recording zero tape N records (the pick is a pure function of the seed + program order — no wall clock, no nondeterminism).
  • A different seed ⇒ a different ordering. This is the lever a DST (liferaft) uses to search the interleaving space while keeping every failure it finds byte-for-byte reproducible.

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

  • 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), tiny, 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 TRACE_NONDET wrapping), two POD TaskScheduler fields, no opcode/AST/CallFrame/JIT-helper sites.

Gates

  • Release suite 2620/2620; ASan (detect_leaks=1) 2620/2620, leak tally 0, no sanitizer errors.
  • New determinism gate: the seeded schedule is identical across two fresh processes, replays byte-identically, records zero tape N records, 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 in tests/test_tasks.eigs (seed 42 and seed 7 pinned byte-exact).

Refs #408.

🤖 Generated with Claude Code

…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>
@InauguralPhysicist InauguralPhysicist merged commit ae16796 into main Jul 8, 2026
17 checks passed
@InauguralPhysicist InauguralPhysicist deleted the tasks-408-seeded-scheduling branch July 8, 2026 22:54
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.

1 participant