Files
StarForth/capsules/per-isa-doe.4th
T
Robert Allan JamesandClaude Sonnet 5 51940f49d0
Build / build-amd64-iso (push) Canceled after 0s
Build / build-aarch64-iso (push) Canceled after 0s
Build / build-riscv64-img (push) Canceled after 0s
Add per-slot CRC + campaign crash-resume (DOE-RESUME-COUNT)
FABRIC-3.md §XXXV.12: closes two real gaps found by walking the disk-to-
PDF pipeline end to end. (1) doe_trial_slot_t had no integrity check of
its own -- 64 slots share one devblock via a read-modify-write, so a
crash mid-write to any slot could silently corrupt its siblings with
nothing to catch it. Added an 8-byte CRC (same discipline the control
header already had), computed/verified the same way. (2) The campaign
itself had no crash-resume -- a reboot always restarted the whole
18-trial loop from index 0 even with good persisted data already on
disk. Since the trial matrix is fully deterministic from (seed, n-reps),
resuming needs no persisted "which trials ran" state, just a count:
DOE-RESUME-COUNT (new kernel primitive, same pattern as
DOE-PERSIST-TRIAL) walks the ring counting CRC-valid records for a given
ISA; MU-EXEC-CAMPAIGN's signature changes to accept a start-idx and seeds
MU-RUN-ID/the DO loop from it. Each RUN-*-CAMPAIGN entry word now calls
DOE-RESUME-COUNT before launching. Both block-namespace-checked to fit
existing headroom before committing to the design -- no new blocks
needed.

Real bug caught by the build, not shipped: an implicit compiler-inserted
alignment byte before slot_crc silently broke the hand-computed trailing
pad size (doe_trial_slot_size_check failed to compile). Fixed with an
explicit alignment field, matching log_slot_t's own zero-implicit-
padding discipline.

extract_doe_region.py now verifies both CRCs with the REAL CRC-64/XZ
algorithm from block_subsystem.c's compute_crc64() (ported and verified
bit-for-bit against a native C reference this session), replacing
§XXXV.11's incorrect guessed implementation.

Verified: clean compile on all 3 ISAs (amd64/aarch64/riscv64 -- amd64
verified via isolated build only, not boot, since the real per-ISA
campaign is currently live on the only QEMU instance this project's own
rule allows), both capsules pass mkcapsule --lint, CRC64 bit-exact via
native reference. Live boot-verification explicitly deferred until that
campaign finishes or is interrupted -- not claimed as tested when it
wasn't. Found (not missed) a real compatibility consequence: the running
campaign's data is in the old pre-CRC format, so it reads as "corrupt"
under the new extractor and DOE-RESUME-COUNT will resume it from 0, not
mid-campaign -- no data loss, cheap redundant re-run of ~1-2 trials.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BWpNjdwPtFLuVLaAq44L9K
2026-09-17 19:17:04 -04:00

52 lines
1.9 KiB
Forth

Block 5117
( per-isa-doe.4th - per-ISA DoE driver. FABRIC-3 SXXXIV.4/ )
( SXXXV.5/.7: 6-cell factorial from multiuser-doe.4th's own )
( MU-EXEC-CAMPAIGN, unchanged. Adds: one fixed seed per ISA, )
( N=3 reps/cell=18 trials/ISA (ratified 2026-09-17, not the )
( N=2 SXXXV.5 recommended). Load multiuser-doe.4th FIRST. )
20260917 CONSTANT AMD64-SEED
20260918 CONSTANT AARCH64-SEED
20260919 CONSTANT RISCV64-SEED
18 CONSTANT PER-ISA-NREPS
CREATE PER-ISA-TAG-BUF 16 ALLOT
VARIABLE PER-ISA-TAG-LEN
: PER-ISA-TAG! ( c-addr u -- )
DUP 16 MIN PER-ISA-TAG-LEN !
PER-ISA-TAG-BUF PER-ISA-TAG-LEN @ CMOVE ;
S" ?" PER-ISA-TAG!
Block 5118
( artemis.img is shared across all 3 ISAs' sequential runs )
( (SXXXV.2 item 2) -- tag each trial so records can be told )
( apart. Redefines MU-EMIT-TRIAL-MARKER (not ACL-pinned in )
( multiuser-doe.4th): same fields, isa= prefixed. )
: MU-EMIT-TRIAL-MARKER ( -- )
." MU-TRIAL isa=" PER-ISA-TAG-BUF PER-ISA-TAG-LEN @ TYPE
." run=" MU-RUN-ID @ .
." cfg=" MU-CFG @ .
." rep=" MU-REP @ .
." nw=" MU-NW @ .
." mode=" MU-MODE @ .
." fail=" MU-FAIL-COUNT @ . CR
MU-RUN-ID @ MU-CFG @ MU-REP @ MU-NW @
MU-MODE @ MU-FAIL-COUNT @
PER-ISA-TAG-BUF PER-ISA-TAG-LEN @ DOE-PERSIST-TRIAL ;
Block 5119
( Per-ISA entry points, single word, no args -- for boot )
( injection or the live console. Run ONE per boot: this repo's )
( one-QEMU-at-a-time rule keeps the 3 ISAs separate, sequential)
( boots, never auto-chained here. )
: RUN-AMD64-CAMPAIGN ( -- )
S" amd64" PER-ISA-TAG!
AMD64-SEED PER-ISA-NREPS
S" amd64" DOE-RESUME-COUNT MU-EXEC-CAMPAIGN ;
: RUN-AARCH64-CAMPAIGN ( -- )
S" aarch64" PER-ISA-TAG!
AARCH64-SEED PER-ISA-NREPS
S" aarch64" DOE-RESUME-COUNT MU-EXEC-CAMPAIGN ;
: RUN-RISCV64-CAMPAIGN ( -- )
S" riscv64" PER-ISA-TAG!
RISCV64-SEED PER-ISA-NREPS
S" riscv64" DOE-RESUME-COUNT MU-EXEC-CAMPAIGN ;