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
171 lines
4.0 KiB
Forth
171 lines
4.0 KiB
Forth
Block 5044
|
|
3 CONSTANT MU-N-CONC
|
|
2 CONSTANT MU-N-MODES
|
|
MU-N-CONC MU-N-MODES * CONSTANT MU-N-CFG
|
|
63 CONSTANT MU-MAX-REPS
|
|
MU-N-CFG MU-MAX-REPS * CONSTANT MU-MAX-RUNS
|
|
CREATE MU-CONC-LEVELS 3 CELLS ALLOT
|
|
2 0 CELLS MU-CONC-LEVELS + !
|
|
4 1 CELLS MU-CONC-LEVELS + !
|
|
8 2 CELLS MU-CONC-LEVELS + !
|
|
: MU-CONC-OF ( cfg -- n ) 2 / CELLS MU-CONC-LEVELS + @ ;
|
|
: MU-MODE-OF ( cfg -- m ) 2 MOD ;
|
|
VARIABLE MU-UNIFORM-WL
|
|
8 MU-UNIFORM-WL !
|
|
|
|
Block 5045
|
|
: WL-CAPSULE ( idx -- c-addr u )
|
|
CASE
|
|
0 OF S" workload-0.4th" ENDOF
|
|
1 OF S" workload-1-lite.4th" ENDOF
|
|
2 OF S" workload-2.4th" ENDOF
|
|
3 OF S" workload-3.4th" ENDOF
|
|
4 OF S" workload-4.4th" ENDOF
|
|
5 OF S" workload-5-lite.4th" ENDOF
|
|
6 OF S" workload-6.4th" ENDOF
|
|
7 OF S" workload-7.4th" ENDOF
|
|
8 OF S" workload-8.4th" ENDOF
|
|
9 OF S" workload-9.4th" ENDOF
|
|
ENDCASE ;
|
|
|
|
Block 5046
|
|
: WL-ENTRY ( idx -- c-addr u )
|
|
CASE
|
|
0 OF S" RUN-TRANSPOSE" ENDOF
|
|
1 OF S" MICRO-BURST" ENDOF
|
|
2 OF S" RUN-SAW" ENDOF
|
|
3 OF S" DUAL-SINE" ENDOF
|
|
4 OF S" RUN-PI" ENDOF
|
|
5 OF S" CHAOS-FIELD" ENDOF
|
|
6 OF S" RUN-OMNI" ENDOF
|
|
7 OF S" RUN-MMUL" ENDOF
|
|
8 OF S" RUN-FIB" ENDOF
|
|
9 OF S" RUN-SAW" ENDOF
|
|
ENDCASE ;
|
|
|
|
Block 5047
|
|
: MU-WORKER-NAME ( n -- c-addr u )
|
|
CASE
|
|
0 OF S" mu0" ENDOF
|
|
1 OF S" mu1" ENDOF
|
|
2 OF S" mu2" ENDOF
|
|
3 OF S" mu3" ENDOF
|
|
4 OF S" mu4" ENDOF
|
|
5 OF S" mu5" ENDOF
|
|
6 OF S" mu6" ENDOF
|
|
7 OF S" mu7" ENDOF
|
|
ENDCASE ;
|
|
VARIABLE MU-TMP-NC
|
|
VARIABLE MU-TMP-NU
|
|
|
|
Block 5048
|
|
: MU-WL-FOR ( mode worker-n -- wl-idx )
|
|
SWAP IF 10 MOD ELSE DROP MU-UNIFORM-WL @ THEN ;
|
|
: MU-BIRTH-WORKER ( wl-idx worker-n -- ok? )
|
|
MU-WORKER-NAME MU-TMP-NU ! MU-TMP-NC !
|
|
WL-CAPSULE
|
|
MU-TMP-NC @ MU-TMP-NU @
|
|
WORKER-BIRTH ;
|
|
: MU-TOUCH-WORKER ( wl-idx worker-n -- )
|
|
MU-WORKER-NAME MU-TMP-NU ! MU-TMP-NC !
|
|
WL-ENTRY
|
|
MU-TMP-NC @ MU-TMP-NU @
|
|
VM-EXEC ;
|
|
|
|
Block 5049
|
|
VARIABLE MU-FAIL-COUNT
|
|
: MU-CHECK-WORKER ( worker-n -- )
|
|
MU-WORKER-NAME VM-ERROR?
|
|
IF MU-FAIL-COUNT @ 1+ MU-FAIL-COUNT ! THEN ;
|
|
: MU-KILL-WORKER ( worker-n -- )
|
|
MU-WORKER-NAME KILL ;
|
|
CREATE MU-RUN-MATRIX MU-MAX-RUNS CELLS ALLOT
|
|
: MU-MATRIX! ( val idx -- ) CELLS MU-RUN-MATRIX + ! ;
|
|
: MU-MATRIX@ ( idx -- val ) CELLS MU-RUN-MATRIX + @ ;
|
|
VARIABLE MU-N-RUNS
|
|
: MU-INIT-MATRIX ( -- ) MU-N-RUNS @ 0 DO I I MU-MATRIX! LOOP ;
|
|
|
|
Block 5050
|
|
VARIABLE MU-SW-I VARIABLE MU-SW-J
|
|
VARIABLE MU-SW-VI VARIABLE MU-SW-VJ
|
|
: MU-SWAP-MTX ( i j -- )
|
|
MU-SW-J ! MU-SW-I !
|
|
MU-SW-I @ MU-MATRIX@ MU-SW-VI !
|
|
MU-SW-J @ MU-MATRIX@ MU-SW-VJ !
|
|
MU-SW-VJ @ MU-SW-I @ MU-MATRIX!
|
|
MU-SW-VI @ MU-SW-J @ MU-MATRIX! ;
|
|
: MU-SHUFFLE ( -- )
|
|
MU-N-RUNS @ 1 - 0 DO
|
|
I MU-N-RUNS @ 1 - RANDOM
|
|
I MU-SWAP-MTX
|
|
LOOP ;
|
|
|
|
Block 5051
|
|
VARIABLE MU-RUN-ID VARIABLE MU-CFG
|
|
VARIABLE MU-REP VARIABLE MU-NW
|
|
VARIABLE MU-MODE VARIABLE MU-NREPS
|
|
: MU-EMIT-TRIAL-MARKER ( -- )
|
|
." MU-TRIAL 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 @ 0 0 DOE-PERSIST-TRIAL ;
|
|
|
|
Block 5052
|
|
: MU-BIRTH-ALL ( -- )
|
|
MU-NW @ 0 DO
|
|
MU-MODE @ I MU-WL-FOR I MU-BIRTH-WORKER DROP
|
|
LOOP ;
|
|
: MU-TOUCH-ALL ( -- )
|
|
MU-NW @ 0 DO
|
|
MU-MODE @ I MU-WL-FOR I MU-TOUCH-WORKER
|
|
LOOP ;
|
|
: MU-CHECK-ALL ( -- )
|
|
MU-NW @ 0 DO
|
|
I MU-CHECK-WORKER
|
|
LOOP ;
|
|
|
|
Block 5053
|
|
: MU-KILL-ALL ( -- )
|
|
MU-NW @ 0 DO
|
|
I MU-KILL-WORKER
|
|
LOOP ;
|
|
: MU-RUN-TRIAL ( cfg rep run-id -- )
|
|
MU-RUN-ID ! MU-REP ! MU-CFG !
|
|
0 MU-FAIL-COUNT !
|
|
MU-CFG @ MU-CONC-OF MU-NW !
|
|
MU-CFG @ MU-MODE-OF MU-MODE !
|
|
MU-BIRTH-ALL
|
|
MU-TOUCH-ALL
|
|
MU-TOUCH-ALL
|
|
MU-CHECK-ALL
|
|
MU-KILL-ALL
|
|
MU-EMIT-TRIAL-MARKER ;
|
|
|
|
Block 5054
|
|
: MU-CAMPAIGN-STEP ( idx -- )
|
|
MU-MATRIX@
|
|
DUP MU-NREPS @ /
|
|
SWAP MU-NREPS @ MOD
|
|
MU-RUN-ID @
|
|
MU-RUN-TRIAL
|
|
MU-RUN-ID @ 1+ MU-RUN-ID ! ;
|
|
|
|
Block 5055
|
|
: MU-EXEC-CAMPAIGN ( seed n-reps start-idx -- )
|
|
>R
|
|
DUP MU-NREPS !
|
|
MU-N-CFG * MU-N-RUNS !
|
|
SEED
|
|
MU-INIT-MATRIX MU-SHUFFLE
|
|
HB-ON
|
|
R@ MU-RUN-ID !
|
|
MU-N-RUNS @ R> DO
|
|
I MU-CAMPAIGN-STEP
|
|
LOOP
|
|
HB-OFF
|
|
." MU-CAMPAIGN: complete" CR ;
|