Files
MobileGL/docs/archive/notes/p1/p1-results/core-v3.md
T

12 KiB
Raw Blame History

P1 package A (p1-core) — rework round 3 (v3)

Tree ~/w7/p1-core, branch p1/core, base feat/disaggregated @ 087685d1, contract bf86b1ed (tag p1/contract). v2 HEAD was d9f4698d (reviewed in core-review-v2.md: 1 major, 5 minors). Four new commits on top; nothing pushed; working tree clean apart from the three untracked build directories. core-v1.md records c2..c6 and core-v2.md the round-2 rework; this file records round 3 and the full re-verification on the new HEAD.

Commits (oldest first, on top of d9f4698d)

sha subject review item
30d72c5b [Fix] (Pipe): refuse a stamp of 0 as fresh on both branches - a read before the first fill is Fatal{UnmigratedPipeInput, "<Field>@<none>"}, not default storage M1
d0ff6475 [Fix] (Pipe): re-arm the verify comparator when any of its three knobs changes, not only when PipeVerify does minor 2
12b57055 [Docs] (Pipe): record why the forwarders carry no poison check, the InHook re-entry guard, and the Index slot no FillPoints.def row can fill minors 1, 3, 5
44ffafb2 [Test] (Pipe): pin the pre-fill window - every stamp of 0 is stale at serial 0, a read before any fill aborts naming "<none>", and the FATAL=0 child leaves through std::exit so the teardown summary is observed M1, minor 4

git diff --stat d9f4698d..HEAD: 6 files, +102/-15 — scripts/gen_pipe.py (+6/-2), MobileGL/MG_Pipe/generated/PipeFilled.inc (+6/-2, regenerated), MobileGL/MG_Impl/Pipe/PipeFill.cpp (+38/-11), MobileGL/MG_Backend/MGPipe/PipeInputs.h (+6), MobileGL/MG_Test/Pipe/PipeCatalogueTest.cpp (+6), MobileGL/MG_Test/Pipe/PipeInputsTest.cpp (+40/-2). All inside A's C.5 rows; no B/C/E file, no fixture. One generated file changed and is committed (gen_pipe --check clean). No signature B/C/E code against changed: MGB_CTX, MGP_FILL, the 63 accessors, the knob names and every log line are as in the contract; the only behavioural change visible to a backend is that a read before the first MGP_FILL is now the D6 Fatal instead of default storage.

What was done per review item

  • M1 (serial-0 window read as fresh) — gen_pipe.py gen_filled now emits, and PipeFilled.inc carries:
    const Uint64 gen = state.FilledGen[index];
    if (gen == 0) return false;
    return kMGPipeInputFieldSticky[index] || gen == state.CurrentVerbSerial;
    
    i.e. a stamp of 0 is "never filled" on both branches (the review's FilledGen != 0 && in the non-sticky arm, written once for both). Proof, three layers: (1) the reviewer's own prefill.cpp recompiled and relinked against the rebuilt build-verify with the same ninja commands (~/w7/p1-core-v3-prefill/): before-first-fill: serial=0 gen[GetLineWidth]=0 fresh=0 live=1, rc=134 (SIGABRT), log Fatal{UnmigratedPipeInput, "GetLineWidth@<none>"} — both plain and with Features.PipeVerify = true before the read (v2 was fresh=1, stored=0 live=7, rc=0, no log line); (2) PipeCatalogue.PipeInputFieldsStartUnfilled asserts every one of the 63 fields (sticky included) stale on a value-initialised MGPipeFilledState at serial 0, before its existing serial-1/serial-2 assertions; (3) the fork case PipeInputsTest.ReadingBeforeAnyFillAbortsNamingNoVerb: a live context with SetLineWidth(7), no fill in the process (a visible GTEST_SKIP if another case of the same process already filled — gtest_discover_tests runs each case alone, so it never skips in ctest), the child reads gPipeInputs.GetLineWidth(); the parent asserts SIGABRT, exactly Fatal{UnmigratedPipeInput, "GetLineWidth@<none>"}, no PipeVerifyDiffer, no verify armed. In a verify build the child sets Features.PipeVerify = true first (the lane's shape). The read hook's arming-at-first-fill is left as is: MGP_INPUT_CHECK precedes MGP_INPUT_VERIFY_READ in every accessor and a verify build always defines MOBILEGL_PIPE_POISON (PipeInputs.h:21-23), so a pre-fill read is the poison's Fatal before the hook could matter; a static_assert(MOBILEGL_PIPE_POISON, ...) next to the hook in PipeFill.cpp pins that dependency so a future change to the POISON definition fails to compile rather than reopening the window. The comment at the serial bump now states the rule.
  • Minor 1 (forwarders carry no MGP_INPUT_CHECK) — behaviour kept (correct per the review); the exception is now declared in the header above the seven forwarders (why: a forward is a live call, InvalidateCompileEnv is reached from backend initialisation before any fill and would be Fatal{...@<none>} on every start; the sticky stamp is consulted by no accessor and pinned only through MGPipeInputFieldIsFresh in tests), and recorded as deviation 19 below and in the integrator notes so P2's tracker does not "fix" it.
  • Minor 2 (ArmVerify re-armed only on a PipeVerify change) — fixed rather than only recorded: VerifyState gained CorruptKnob (the last-parsed PipeVerifyCorrupt string) and the latch keys on all three values (PipeVerify, PipeVerifyFatal, PipeVerifyCorrupt). Lane behaviour unchanged (Features loaded before the first fill → one arm per process); cost two Bool compares and one String compare per fill in verify builds only. Deviation 14 is restated below to say exactly this; 878db2c4's subject is now true for all three verify knobs.
  • Minor 3 (GetBufferBindingSlot(Index)) — no code change (the null-by-design Index slot and its poison Fatal are D6's rule); the CopyField comment now says why no FillPoints.def row can fill it (GLContext derives it through the bound VAO's element-buffer slot, Core.cpp:98-106) and that no backend reads it today. MEASUREMENTS.md is integrator-owned (C.5): the one-line record for both this and IsCapabilityEnabledIndexed is under "Records for the integrator" below.
  • Minor 4 (VerifyFatalOffLogsTheDivergenceAndContinues never saw the summary) — the child now leaves through std::exit(0) instead of _exit(0), so VerifyState::~VerifyState runs in the child, and the parent asserts MGPipe: verify summary - 2 divergence(s) survived MOBILEGL_PIPE_VERIFY_FATAL=0 in the log delta. Passes in build-verify (the child's static destructors run against the forked copy of a fake context; stdio was flushed before the fork, so nothing is printed twice). The lane-level summary=1 is still re-run below.
  • Minor 5 (hook re-reads the whole field; InHook guard) — comment at the site: the per-read cost (GetRenderStateParameters re-copies and compares the struct, GetProgramForDraw re-joins the link) as a thing to keep in mind when reading the verify lane's wall time, and what InHook prevents (a GetProgramForDraw-triggered backend re-entry reaching another accessor becomes a plain load, never a second hook, never a report against a half-copied scratch). Recorded for D.3 below.

Verification (WSL, ~/w7/p1-core, HEAD 44ffafb2; logs ~/w7/p1-core-v3-*.log, summary ~/w7/p1-core-v3-summary.txt, build/prefill log ~/w7/p1-core-v3-build.log)

Builds: cmake --build {build-linux,build-push,build-verify} -j 12 after the patch, all rc=0 (CCACHE_BASEDIR=/home/swung/w7); the verification pass re-ran them (ninja: no work to do × 3).

VERIFICATION_TABLE

Not run (unchanged from v1/v2): the 40-trace retrace under verify and the integration-verify lane (E's files, D.3 on the integrated tree). Not built per intermediate commit: the split of PipeFill.cpp between 30d72c5b / d0ff6475 / 12b57055 was checked hunk by hunk (each commit's hunks are self-contained: the static_assert and comments in A, the CorruptKnob member and its uses together in B, comments only in C); only the final tree was compiled.

Deviations from the brief (with reasons) — additions/restatements to v1's 1-13 and v2's 14-18

  1. (restated) The knob latches key on the value, not "once per process": ParsePoisonOmissionKnob on Features.PipePoisonOmit; ArmVerify on all three of Features.PipeVerify, PipeVerifyFatal, PipeVerifyCorrupt (as of d0ff6475; v2 keyed on PipeVerify alone and latched the other two). Reason and cost as in v2.
  2. The seven F-class forwarders carry no MGP_INPUT_CHECK / MGP_INPUT_VERIFY_READ (D4: "every accessor body"). Reason: a forward is a live call with no stored value; InvalidateCompileEnv is reached from backend initialisation (BackendObject_DirectVulkan.cpp:388-390,786-788) before any verb fills, where a check would be Fatal{InvalidateCompileEnv@<none>} on every start. Consequence: the sticky stamp (FilledGen = 1 on the first live fill) and the Sticky → FilledGen != 0 branch are consulted by no accessor; they are pinned only by PipeCatalogue.PipeInputFieldsStartUnfilled / StickyFieldsAreExactlyTheSeven and PipeInputsTest.OmittingOneField... / EveryVerbFills... through MGPipeInputFieldIsFresh directly. Declared in the header (12b57055).
  3. MGPipeInputFieldIsFresh refuses a stamp of 0 on the sticky branch too (D6 words the sticky branch as FilledGen != 0, which it still is; the non-sticky arm gained the same guard). No semantic change to the sticky branch.
  4. The read hook still arms at the first fill (D8: "Arming, once, at the first fill under verify" — unchanged); the pre-fill window is covered by the poison, and static_assert(MOBILEGL_PIPE_POISON) in the verify block makes that dependency a build-time fact. The review's alternative (arm inside the hook when !Parsed) was not taken: in every build that compiles the hook the poison is on, so it would be dead code.
  5. PipeInputsTest has 12 cases (v2: 11; brief: 5): ReadingBeforeAnyFillAbortsNamingNoVerb added.
  6. VerifyFatalOffLogsTheDivergenceAndContinues's child exits via std::exit(0), the one child in the file that runs static destructors on purpose (to observe the summary line); every other child still _exits.

Where the tree contradicted the brief's numbers

Unchanged from v1/v2 (GL_Drawing.cpp:906 vs 907; RenderStateParameters 65 members not 67; CapabilityInput 35 not 37; c5 regenerates 1 file not 7; integration-gpu 868 entries; the ctest -N regex needs the padded form). New in this round: none. One brief sentence that the tree did not honour before this round and does now: D6's "starts at 1 so FilledGen == 0 means never filled" — true of the stamp values since c2, true of the read predicate only since 30d72c5b.

Records for the integrator (not A's code)

  • MEASUREMENTS.md one-liner for the two accessors where "add the row" does not apply: GetBufferBindingSlot(BufferTarget::Index) (polymorphic on GLContext — the bound VAO's element-buffer slot, Core.cpp:98-106; null in the block by design) and IsCapabilityEnabledIndexed(cap ∉ {Blend, ScissorTest}) (the block carries only those two indexed caps) are push-arm Fatal{UnmigratedPipeInput, ...} that no FillPoints.def row can repair; both unreachable today (every backend slot read is DrawIndirect/DispatchIndirect/Parameter/PixelPack; VulkanRenderer.cpp asks Blend only). A future backend read of either adds a field, not a row.
  • D.3 gains a failure mode (the review's section 5, now real): any backend read reached from EGL/init before the first verb is Fatal{UnmigratedPipeInput, "<Field>@<none>"} in the verify lane. Per E's risk table the answer is a fill point at that boundary (an EGL virtual), never a sticky flag or a FillPoints.def row. The scout catalogue finds no such read on this tree (the two out-of-verb pulls are the forwarded, unchecked InvalidateCompileEnv calls), so no lane is expected to trip today.
  • D.3 wall-time reading: the compare-at-read hook re-reads and compares the whole field per backend accessor call (GetRenderStateParameters = a struct copy + 65-member compare per read; GetProgramForDraw = a link join per read); within the 5-10× verify budget by design, but the verify lane's time is not the poison's cost.
  • The forwarders' missing check is deliberate (deviation 19): P2's tracker should not add one.
  • The v2 records stand: the vacuous -R 'DirectGLES\.Verify\..*Mipmap' CI regex (grep the lane log for the exact Fatal instead), the GIT@ stamp refresh at reconfigure.

Unfinished

Nothing in A's scope. M1 is fixed with the three proofs above; minors 1, 3, 5 are recorded in code comments and here (the MEASUREMENTS.md line is the integrator's file); minors 2 and 4 are fixed in code and covered by tests.