Files
MobileGL/docs/Disaggregated/notes/p5b/p5b-results/i1-v1.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

19 KiB
Raw Blame History

i1 — image / compute / barrier / copy-image / storage block, v1

Branch p5b/i1, forked from feat/disaggregated @ f5676103 (c0b's head). Worktree ~/w7/p5b-i1. Nothing pushed; nothing merged into the integration branch.

734287ac [Feat] (MG_Remote, P5b): emit i1 seven image/compute/barrier/copy-image/storage-block
         slots as class B and give each ServerVerbSink body the backend call the contract names
b82c63a9 [Feat] (MG_Pipe, DirectGLES, P5b): move GetProgramForDispatch FATAL to BARRIER_PULLED
         now that compute crosses, and skip the copy-image shadow mirror under a non-monolith
         transport
a72a96d8 [Test] (MG_Test, MG_IntegrationTest, P5b): pin i1 seven class-B slots and the served
         compute program, and arm 24 inproc lane entries whose results only exist if the records
         crossed
e352e9a6 [Merge] (P5b, i1): merge feat/disaggregated at 37fc4fdb (x2 via x2m, ID-65) into p5b/i1

Range 734287ac..e352e9a6 (three single-line commits plus the merge). feat/disaggregated moved to 37fc4fdb while i1 ran (x2 via x2m); merged, no conflicts, although x2m also edits EmitTables.cpp (+157) — the merge is textually clean and the whole gate was re-run on the merged head. Working tree clean; the worktree's submodule symlinks are left OFF (git-safe).


1. What landed, per slot

Seven slots moved class C → B: the five the census measured plus the two companions that share their rows. kEmittedSlotsI1 = 0 → 7, MGR_UNMIGRATED_I1_SLOTS is now the empty macro, and UnmigratedSlotCount() is 64 → 57 / ImplementedVerbCount() 5 → 12.

slot (census entries) row (op) emitter sink body proven by
BindImageTexture (138) bind_shader_image (72) EmitBindImageTexture: GL args verbatim, Res from the unit's ImageTextureBinding, Access the GL token OnBindShaderImage → GL.BindImageTexture(Unit, GlName, Level, Layered, Layer, Access, Format) 138 → 0 aborts; 13 UnboundImageDescriptorScenario lane entries
DispatchCompute (49) launch_grid (60) EmitDispatchCompute, b1's hook order kept verbatim from the stub (PushPersistentMapsBeforeVerb(); MarkGpuWritesForDispatch(); then the record) OnLaunchGrid → GL.DispatchCompute(GridX,Y,Z) 49 → 0; 3 AtomicCounterScenario lane entries
DispatchComputeIndirect (companion) launch_grid (60) IsIndirect = 1, IndirectOffset = indirect, IndirectBuffer = the bound GL_DISPATCH_INDIRECT_BUFFER handle OnLaunchGrid → GL.DispatchComputeIndirect(IndirectOffset) unit: the two slots are not one thunk
MemoryBarrier (18) memory_barrier (61) EmitMemoryBarrier, bits verbatim, no client-side lowering OnMemoryBarrier → GL.MemoryBarrier(Bits) 18 → 0
MemoryBarrierByRegion (companion) memory_barrier (61) ByRegion = 1 OnMemoryBarrier → GL.MemoryBarrierByRegion(Bits) unit
CopyImageSubData (30) resource_copy_region (53) EmitCopyImageSubData: handles + the two GL names + the targets verbatim; a renderbuffer endpoint refused by name before emission OnResourceCopyRegion rebuilds two CopyImageEndpoints through the barrier-pulled GetTextureObject(name) and calls GL.CopyImageSubData(...) 30 → 0; 6 CopyImageLayeredScenario lane entries
ShaderStorageBlockBinding (4) set_storage_block_binding (75), kHasBlob EmitShaderStorageBlockBinding: GlName, Binding, ShaderCso, the block name staged strlen + 1 OnSetStorageBlockBinding → GL.ShaderStorageBlockBinding(GlName, name, Binding) 4 → 0; the 2 ProgramPipelineScenario storage-block lane entries

Beside them, the two edits the contract names:

  • FieldOwnership.def, the one row §6.9 grants i1: GetProgramForDispatch FATAL → BARRIER_PULLED, "P7 (Magma), P8 (Espryt)". Without it every migrated dispatch aborts on the backend's own PrepareForCompute (DirectGLES.cpp:5779, VulkanRenderer.cpp:7327). The FATAL block is two rows now, not three; tables regenerated with gen_pipe_field_ownership.py.
  • DirectGLES.cpp, i1's one backend edit (§2 i1, ruling §6.7): the copy-image-shadow-mirror site returns early under a non-monolith transport, behind #if MOBILEGL_BUILD_DISAGGREGATED so the pull build's code does not move (G1 .text +0), and armed on the TRANSPORT and not the build so build-split's monolith lanes still mirror. The pre-existing #if MOBILEGL_PIPE_PUSH MGPipeUnmigratedEmulation call is left where it was, so a push-only build is byte-for-byte unchanged.

Tests: RemoteEmitTable.TheSevenI1SlotsAreClassBAndAreNotTheFatalThunk, RemoteEmitTable.EachI1SlotReachesRequireSessionUnderItsOwnName (five death tests, each asserting Fatal{NoClientSession, "<slot>"} and the ABSENCE of Fatal{UnmigratedVerb), FieldOwnershipTest.TheComputeProgramIsServedUnderADispatchStampFromP5bOn, the retargeted FieldOwnershipTest.AFatalClassReadAbortsEvenWithoutStrictErrors (its old exemplar was the field i1 moved), and 24 integration-split entries. Every one ships its "red once by doing X" line.


2. Acceptance numbers

All on ~/w7/p5b-i1 @ e352e9a6, GLIBC_TUNABLES=glibc.malloc.tcache_count=0. Logs ~/w7/p5b-i1-*.log; census ~/w7/p5b-i1-census-logs/results.json.

2.1 Builds — four for four

build-linux (pull), build-push, build-verify, build-split: configure rc=0, build rc=0, CTestTestfile.cmake confirmed in each.

2.2 G1 — did not move

nm --defined-only build-linux/libMobileGL.so | grep -ic MG_Remote  ->  0
symbol-report vs ~/w7/p5-before-libMobileGL.so, --threshold 0:
  .text 10806611 -> 10806611 (+0, +0.000%)
  27814 -> 27814 defined symbols: 0 added, 0 removed, 0 resized, 0 renamed

Everything i1 adds is either inside MG_Remote (compiled only under MOBILEGL_BUILD_DISAGGREGATED), a .def row whose generated table the pull build never odr-uses, or the one backend site behind #if MOBILEGL_BUILD_DISAGGREGATED.

2.3 Generators and purity

gen_pipe.py --check / --self-test (9 trips), gen_pipe_field_ownership.py --check / --self-test (15 trips, 63 fields, 7 sticky forwards, 9 refusals), gen_pipe_dirty_surface.py --check, check_include_closure.py (4 probes, 0 problems): all green.

2.4 Test lanes

lane c0b baseline i1
ctest -L unit build-linux / push / verify 1817 / 1817 each 1817 / 1817 each, unchanged
ctest -L unit build-split 2084 / 2084 2089 / 2089 (+3 i1 cases, +2 from the x2m merge)
ctest -L integration-split build-split, inproc 22 / 22 46 / 46 (+24 i1 lane entries)
ctest -L integration-gpu build-push, monolith 1128 / 1128 1128 / 1128
G2 pull-vs-push ctest -N, every label 0 diff 0 diff
G14 build-linux names vs p5-before-ctest-names.txt 0 removed, 43 added 0 removed, 43 added — identical to c0b; i1 adds NOTHING to the pull build
G5 p3a_untouched_regions.sh ff2994d9 HEAD rc=0 rc=0
G5 p4a_untouched_regions.sh ff2994d9 HEAD rc=0 rc=0

2.5 The inproc census

~/w7/p5b-c0b-census.sh ~/w7/p5b-i1 ~/w7/p5b-i1-census-logs. The manifest GREW by 24 — i1's lane entries carry integration-gpu as well as integration-split, and the census enumerates that label — so the diff below is over the 1149 entries c0b's baseline and this run share, and the 24 new ones are reported separately (all 24 passed).

status c0b baseline (f5676103) i1, common 1149 i1, all 1173
passed 432 503 527
skipped 185 195 195
subprocess-aborted 505 335 335
ordinary failed 27 116 116

Every transition came out of aborted. There is not one regression:

passed  -> passed   432      aborted -> aborted  335      skipped -> skipped 185
failed  -> failed    27      aborted -> failed    89
                             aborted -> passed    71      aborted -> skipped  10

No entry that passed on c0b's head does anything else on this one, and no entry that failed fails differently.

The census was run twice, before and after the x2m merge, and the two runs are identical — same totals, same transition matrix, same per-slot table. So nothing below is x2m's, and every number is attributable to i1.


3. The gate: my five slots, and where their 239 entries went

All five counts are zero, and so are both companions:

slot c0b i1
BindImageTexture 138 0
DispatchCompute 49 0
CopyImageSubData 30 0
MemoryBarrier 18 0
ShaderStorageBlockBinding 4 0
DispatchComputeIndirect, MemoryBarrierByRegion 0 0

239 entries, not the brief's 235 — the brief's number omits the four ShaderStorageBlockBinding entries. Where each went:

was
BindImageTexture 138 → 30 passed · 10 skipped · 45 Fatal{UnmigratedEmulation, "texture-remint-pull"} · 53 wrong-answer failures (52 of them DirectVulkan)
DispatchCompute 49 → 23 passed · 1 texture-remint-pull · 25 wrong-answer failures (all DirectVulkan)
CopyImageSubData 30 → 16 passed · 9 wrong-answer failures · 3 Fatal{UnmigratedVerb, "ClearBufferfv"} (f1's) · 2 Fatal{UnmigratedVerb, "CopyImageSubData+RENDERBUFFER"} (i1's own named refusal)
MemoryBarrier 18 → 12 Fatal{UnmigratedVerb, "DrawElementsBaseVertex"} · 6 Fatal{UnmigratedVerb, "DrawElements"} (both d1's)
ShaderStorageBlockBinding 4 → 2 passed · 2 wrong-answer failures (DirectVulkan)

The next first blockers, by name

  1. Fatal{UnmigratedEmulation, "texture-remint-pull"} — 46 entries, all DirectGLES. Managers.cpp:5634. Exactly the bounded loss contract §6.7 predicted for the mirror skip. By scenario: ImageTargetKindScenario 22, NonCoreImageFormatScenario 9, ImageFormatQualifierScenario 4, FormatlessImageBakeScenario 3, ImageLoadStoreSsoScenario 2, LayeredTextureReadbackScenario 2, and one each of AdvertisedLimitsScenario, ImageSizeAfterRespecScenario, P4aFinalFixScenario, TextureParamsWithoutASamplerViewScenario.
  2. d1's draw slots — 18 entries, the whole of GuiBatchScenario on both backends: DrawElementsBaseVertex 12, DrawElements 6. GuiBatchScenario was MemoryBarrier's only scenario, and it is now entirely d1's.
  3. f1's ClearBufferfv — 3 entries, the three CopyImagePacked16Scenario.RenderbufferLandsInArrayMipLevelIntact variants.
  4. i1's own named refusal — 2 entries: {DirectGLES,DirectVulkan}.PackedWordReadbackScenario.ACopyThroughARenderbufferReachesAnRgb9E5Destination reach Fatal{UnmigratedVerb, "CopyImageSubData+RENDERBUFFER"}. The refusal is MEASURED now, which is what §6.6 asked for.
  5. 89 wrong-answer failures — §4.2 and §4.3 below. 82 DirectVulkan, 7 DirectGLES.

4. Rulings I made, each with what would overturn it

  1. The handles are LOOKED UP, never minted. MGPImageBind::Res, MGPCopyRegion::Src/Dst, MGPStorageBlockBinding::ShaderCso and MGPGridInfo::IndirectBuffer come from MGPipeSlots().FindByLifetimeId(...), not Acquire(...). Every one of these sinks dispatches on the GL NAME — that is what rule D carries it for — so the handle is for P7. Acquire would MINT a slot at a call site that emits no create record, handing the server an identity it has never seen; a null field is the true statement "no handle published yet". Overturned by P7 dispatching on Res instead of GlName, which needs the minting form plus an ordering guarantee this row does not have.
  2. Only the two dispatch slots carry a pre-verb hook. b1's hooks describe "the work the record is about to start". A bind, a barrier, an image copy and a block rebinding start no shader and read no mapped buffer; the dispatch that later reads the image is the verb that carries both hooks. Running them on all seven would push the same maps several times per dispatch and inflate b1's per-row counters. Overturned by a measured workload whose coherent-map write is read by a copy or a barrier with no dispatch between.
  3. The renderbuffer endpoint is refused on BOTH sides of the wire. The client refuses before emission (ID-57's shape, so the census greps it where the other client refusals are) and the sink refuses a record that names GL_RENDERBUFFER in either target. Overturned by a renderbuffer sticky forward or P7's handle keying.
  4. A copy whose GL name no longer resolves DECLINES, it does not Fatal. OnResourceCopyRegion logs once and returns false — the monolith's own answer in its own words (DirectGLES.cpp:9067, "declining the copy"); the frontend validator is what keeps it unreachable and what reports the INVALID_VALUE the application is owed. Overturned by a measured entry that reaches it, which would mean a pull went stale under the barrier.
  5. The atomic-counter barrier lowering stays in the backend. OnMemoryBarrier forwards Bits untouched. Espryt's "counter bit implies storage bit" is a statement about the driver (DirectGLES.cpp:8837); repeating it client-side would make the split arm and the monolith arm two different calls. Overturned by nothing in P5b.

4.2 The ruling I was asked to make, and the measurement that changes its JUSTIFICATION

Contract §6.7 rules the mirror skipped under split and says "what the skip loses is bounded by two Fatals". I implemented the skip. The bound is half right, and I measured both halves:

  • The texture-remint-pull half is real: 46 entries reach it, by name (§3.1).
  • The glGetTexImage half does not hold, and the skip is not what breaks those entries anyway. I ran the experiment: with the skip compiled out (if (false && …), rebuilt, re-run) the five DirectGLES packed-readback entries — CopyImagePacked16Scenario.{Array,Flat}… ×2, WidenedPacked16 ×2, PackedWordReadbackScenario.ACopiedRgb9E5Word… — fail identically. So i1's mirror skip costs the lane exactly the 46 named aborts and nothing else.
  • What actually breaks those five is glGetTexImage under split: GetTexImage_State (GL_Texture.cpp:5331) rejects with GL_INVALID_OPERATION and returns BEFORE GetTexImage_Backend, so the class-C Fatal{UnmigratedVerb, "GetTexImage"} never fires and the caller keeps its zero-filled buffer. The scenario reads the zeros as texels. A class-C slot that silently answers nothing instead of refusing by name is the one shape ID-47 says a picture comparison cannot see, and it is worth the integrator's attention independently of i1 — it is wave-3 / P9 territory.

What would overturn the skip itself: nothing i1 measured. If the integrator wants the honest alternative anyway, it is one line — delete the #if MOBILEGL_BUILD_DISAGGREGATED early return and those 46 entries go back to aborting Fatal{UnmigratedEmulation, "copy-image-shadow-mirror"} by name instead of proceeding. That trades 46 named aborts for 46 entries that get further.

4.3 The 89 wrong-answer failures, and why i1 does not believe they are i1's

82 of 89 are DirectVulkan (Magma); 7 are DirectGLES (Espryt). The load-bearing observation is that the same scenarios pass on Espryt and fail on Magma from the same wire records — DoublePrecisionScenario 7/7 pass on DirectGLES and 7/7 fail on DirectVulkan, and so do AtomicCounterScenario, SsboArrayLengthScenario, UniformInitializerScenario and ProgramPipelineScenario. The record is backend-agnostic; only the backend differs.

The Magma shape is uniform: the compute dispatch runs, no server-side error is logged, and the SSBO the shader writes reads back all zeros (DirectVulkan.DoublePrecisionScenario.ADoubleUniformKeepsItsDeclaredInitializer: values[0] is 0, 2.5 expected). Magma registers a real DispatchCompute slot, so the sink is calling it; what is missing is inside VulkanRenderer::DispatchCompute's own state resolution under split. Magma's split compute/image path is the next round's package, and it is the single biggest item i1 hands on.

The 7 DirectGLES failures: 5 are the glGetTexImage shape of §4.2; the other two are TextureParamsWithoutASamplerViewScenario.ACopyImageEndpointOnlyTexturesParamsReachTheDriver (a white-box G9 case whose own message diagnoses it: "the record reached the server and the server has not pushed it" — Espryt defers texture-param application to the first sampler view, and a copy-image-only destination never gets one) and one ResourceSubsystemOff.LargeArenaAdoptionScenario… entry that the runner classes failed while its own output says SKIPPED ("runs only in its own lane") — a census-classifier artifact, not a product failure.


5. What I believe the brief or the contract got wrong or left open

  1. The brief says 235 lane entries; it is 239. 138 + 49 + 30 + 18 + 4. The four ShaderStorageBlockBinding entries are missing from the brief's arithmetic.
  2. Contract §6.7's "bounded by two Fatals" does not hold for the glGetTexImage half — §4.2, with the experiment that shows it and the site that causes it.
  3. The census manifest is not a fixed 1149. It is ctest -L integration-gpu on the tree under test, and every package that adds a split lane entry (which also carries integration-gpu) grows it. The four packages will each grow it; the diff has to be taken over the intersection, and c0b's 432/185/505/27 is a baseline for the COMMON entries only.
  4. A DirectGLES.Split. lane entry must emit a record (ScenarioFixture.h:86), so a whole-scenario TEST_FILTER cannot be used for a scenario that has pure state cases: ProgramPipelineScenario has nine of them and they are red for having nothing to say. i1's block filters to *StorageBlock*. A package adding lane entries also has to extend Harness/SplitLogPaths.cmake.in, or SplitLogPaths.PrivateAndDistinct fails for the whole lane — that file's loop is a hard-coded list of TEST_LIST variables and every package needs a line in it.
  5. FieldOwnershipTest runs only in the split unit lane. The three other unit lanes stay at 1817 with an i1 case added to that file; worth knowing before someone expects 1818.

6. Debts, and what the next round starts on

  • Magma's split compute/image path (§4.3) — 82 entries. Biggest single item.
  • glGetTexImage silently answers nothing under split (§4.2) instead of raising its class-C Fatal. Wave 3 / P9 owns the slot; the SILENCE is the part that should not wait for it.
  • texture-remint-pull — 46 entries; ROADMAP P8's client-side mirror retires it.
  • GetProgramForDispatch is now a counted pull (rsp), retired by P7 (Magma) / P8 (Espryt) with GetProgramForDraw.
  • MGPGridInfo::Block* stay 0 and IndirectBuffer travels unread — P7 Magma fills the first from the reflection archive if it needs it.
  • MemoryBarrier has no green lane case of its own: GuiBatchScenario is its only census scenario and it is d1's DrawElements now. AtomicCounterScenario covers the row in the lane; a first-class one has to wait for d1.
  • i1's slots are zero, so the lane's remaining 335 aborts are d1's, t2's and f1's, led by BeginTransformFeedback 95, DrawElements 62, PatchParameteri 43, DrawElementsBaseVertex 16, MultiDrawElementsBaseVertex 18, ClearBufferiv 12, ClearBufferfv 9.