Files
MobileGL/docs/Disaggregated/notes/p1/p1-results/core-v3.md
T
swung0x48 aba329cc53 [Docs] (Disaggregated): P6's plan and contract draft; the working notes move from a local directory into the repository
Two things land together: the plan and contract draft P6 needs before it starts, and the
working notes that until now existed on exactly one machine.

1. P6's plan and contract draft (neither started; not one line of code)

     docs/Disaggregated/P6-SPAWN-PLAN.md      the package plan
     docs/Disaggregated/P6-CONTRACT-DRAFT.md  the contract draft (moves to
                                              MG_Remote/CONTRACT-P6.md when c6 lands)

   The three findings that mattered, all written into the documents:

   a. P6 is SMALLER than its roadmap cell suggests. The transport primitives are already in
      the tree and already tested: SocketDoorbell including hangup detection and the two
      lost-wakeup fences (Doorbell.cpp:211-360, four cases in FdPassingTest), SCM_RIGHTS fd
      passing, ShmSegment::Adopt, and the SurfaceOp / WindowKind schema already defined in
      protocol.fbs. inproc uses a real second shm mapping rather than an alias, and
      SessionRings.h:22-28 says that was done so today is not the first time it runs. P6 is
      assembly plus a control plane plus a process, not "write a socket transport".

   b. The evidence for "P6 is only a transport swap" has EXPIRED. It was bought by P5c, whose
      audit found 59 direct memory accesses in a tree that already looked clean. P5e changed
      the tree again. So the first package, a6, is a read-only audit that writes no code, and
      every contract row that depends on it is marked PENDING a6 rather than decided in
      advance.

   c. P6 does not get a game running on the phone. ANativeWindow* is meaningless in the child,
      and protocol.fbs:186-196's own comment says Android transfers the window out of band -
      that band is P12. P6 lands pbuffer / surfaceless / offscreen, which is what HeadlessGL,
      the split-equivalent lane and trace replay need, and which is exactly what P6's own exit
      gate measures. A real window reaching the server is a named refusal. This gets its own
      section because "P6 is done" would otherwise read as "the game runs now".

   The contract adds rule G: a role may not name a process-local handle. It extends P5c's
   rule E (a role may not name the other role's memory) from memory to identity - EGLDisplay /
   EGLSurface / EGLContext / ANativeWindow* / fd number / pid / mapped address either cross as
   a token this contract defines or they do not cross, and a descriptor crosses only through
   SCM_RIGHTS, where the kernel renumbers it.

   What P5e left for P6 gets its own section. The latch semantics are already designed
   (ARCHITECTURE.md:504) and are copied unchanged. What is new is that after run-ahead the
   client no longer waits while the peer process can DIE: the client holds records that were
   published and will never be applied, and Android's freezer suspends the child without
   closing anything. So slow and dead must be distinguishable WITHOUT a timeout threshold.
   That is P6's only new design; everything else is carriage. It shares a predicate with E1's
   outstanding re-specification (ID-122), and the two should be designed together.

   Two gates carried over from P5e's lessons: G2 requires integration-spawn's test-name set to
   match integration-split's name for name, because a differing set means the lane is quietly
   running less; and the arm-proof gate requires every entry to record the child pid and
   transport=spawn in its OWN private log - ID-124 established that this kind of false green
   really happens, and a spawn lane that actually ran monolith would pass every other gate.
   S2's shape must be settled before it is written, and the document says why: E1 is the
   cautionary case.

2. The working notes move into the repository (docs/Disaggregated/notes/, 415 .md files)

   ROADMAP / CURRENT_STAGE_PROGRESS / MEASUREMENTS cite ruling numbers, audit line numbers and
   the provenance of gate figures from ~/w7/notes/, a directory that exists on one machine and
   is under no version control. A record cited hundreds of times that lives only locally is not
   a record, so it moves in whole, with its directory structure intact.

   Only .md moves. Scripts, run logs, census and gate result JSON, patches, APKs and nm dumps
   stay where they are: they are evidence DATA rather than documents - large, regenerated per
   run, and mostly carrying absolute paths and device serials that mean something only on the
   machine that produced them. The mapping and this split are written in
   docs/Disaggregated/notes/README.md.

   Two exceptions are recorded there too: P6's BRIEF has been promoted to a first-class
   document and keeps no copy under notes/, so the two cannot drift apart; and recovered/ holds
   material salvaged from failed workflow runs, which may duplicate the like-named phase
   directories and is kept because a few of those were the only complete version at the time.

   CI's citation lint takes docs/Disaggregated/*.md only (non-recursive), and notes/ is
   deliberately outside it: those notes' file:line citations were written against their own
   code heads, and resolving them against today's HEAD would fail wholesale - which is not an
   error, it is their correct state as a historical record. To check one, use the revision it
   declares (--rev).

3. Inconsistencies fixed in passing

   - README.md's status line still said P5e was in progress while the stage table already said
     closed.
   - CURRENT_STAGE_PROGRESS's next-step item 1 still listed the exit gate as pending, though
     (a) and (b) were run in the previous commit; rewritten to closed plus the one item that
     actually remains (E1).
   - ROADMAP's P6 row still had the pre-phase plan in three of its cells; it now carries the
     package order, the scope boundary and the two new gates.

Checked with check_doc_citations.py: 125 citations across docs/Disaggregated/*.md, 0 problems.
2026-09-18 23:31:39 -04:00

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.