lockstep: the wasm leg's soft diffs are fold count drift, not a race

The comments and the "SOFT(timing-race)" label said the wasm leg's E
lines and SDRAM digests differ because the emscripten main loop
interleaves with the vCPU thread. They differ because the page's fold
counts instructions the native plugin does not (TB-start exits, DSP
blocks), so from 66,976 instructions on the two legs sample different
instructions; dense windows align the guests through 200M. The label now
reads "SOFT(fold count drift)". Which kinds are soft is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xda8d7rfJjkFSmKVQtcBGh
This commit is contained in:
Konstantin Pereiaslov 2026-11-14 12:49:11 -06:00
parent 29483d8d7e
commit 038582c981
2 changed files with 7 additions and 6 deletions

View file

@ -463,7 +463,8 @@ const worker = async (wi) => {
continue;
}
// HARD: config, serial, internal-SRAM (range 0). SOFT (opts below):
// register E-lines + the SDRAM slice — the emscripten threading race.
// register E-lines + the SDRAM slice, sampled at other instructions on
// the wasm leg (doc/performance.md, "What lockstep-wasm compares").
const cmp = compareDigestLogs(a.log, b.log, { soft: ["epoch", "mem-sdram"] });
const serialFail = runRes.serialIdentical !== true;
runRes.cmp = { commonEpochs: cmp.commonEpochs, commonSram: cmp.commonSram,
@ -505,7 +506,7 @@ const worker = async (wi) => {
log(` HARD ok: ${cmp.commonSram} internal-SRAM digests + serial identical` +
(cmp.commonSdram != null ? ` ; ${cmp.commonSdram} SDRAM identical` : "")
+ (cmp.commonEpochs ? ` ; ${cmp.commonEpochs} epochs regs identical` : "")
+ (softN ? ` ; SOFT(timing-race): ${softN} E/SDRAM diffs` : "")
+ (softN ? ` ; SOFT(fold count drift): ${softN} E/SDRAM diffs` : "")
+ (cmp.truncated ? " (tail truncated by stop point)" : ""));
}
results.push(runRes);

View file

@ -259,10 +259,10 @@ function readLogLines(file) {
// Compare the two lockstep logs. Strict by default (the native gate:
// every E/M divergence is real). opts.soft = ["epoch", "mem-sdram"]
// downgrades those kinds to diagnostics-only for the wasm gate, where
// the emscripten leg is not wall-clock deterministic (the main loop
// interleaves with the vCPU thread differently run-to-run, so a few
// SDRAM bytes / the transient register vector differ even though the
// firmware's visible behaviour — serial, CPU-local SRAM — is identical).
// the page's fold counts instructions the plugin does not (TB-start
// exits, DSP blocks), so its samples drift onto other instructions from
// the first such exit on (doc/performance.md, "What lockstep-wasm
// compares").
export function compareDigestLogs(aFile, bFile, opts = {}) {
const soft = new Set(opts.soft || []);
const A = readLogLines(aFile), B = readLogLines(bFile);