mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-19 07:51:57 +09:00
[Docs] (.claude/skills, .github/workflows, CMakeLists.txt, docs/archive, docs/Disaggregated, docs/MobileVA, docs/Performance, MG_Backend, MG_Backend/DirectGLES, MG_Backend/DirectVulkan, MG_Backend/Record, MG_Gbm, MG_Impl, MG_Impl/EGLImpl, MG_Impl/GLImpl, MG_Impl/GLXImpl, MG_Impl/Pipe, MG_IntegrationTest, MG_IntegrationTest/Harness, MG_IntegrationTest/Scenarios, MG_Pipe, MG_Pipe/generated, MG_Remote, MG_Remote/Client, MG_Remote/Server, MG_Remote/Transport, MG_Remote/Wire, MG_State/GLState, MG_Test/Pipe, MG_Test/Util, MG_Test/Wire, MobileGL, scripts, scripts/data, tools/device_bench, userguide): archive the planning notes and agent contracts under docs/archive
- DEBTS.md and OPEN-QUESTIONS.md stay maintained, now in docs/Disaggregated.
This commit is contained in:
@@ -0,0 +1,322 @@
|
||||
# BRIEF-P5E — the package plan for retiring the lockstep on the Espryt draw path
|
||||
|
||||
Contract: `CONTRACT-P5E-draft.md` (same directory; becomes `MG_Remote/CONTRACT-P5E.md` at c0e).
|
||||
Base `feat/disaggregated @ 2fde7034`. Paths under `MobileGL/`. Eight packages; seven of them can be
|
||||
implemented in parallel worktrees once c0e and id have landed. Every line-range below is at the
|
||||
base head and names the ONLY region the package may edit in a shared file; a package that needs a
|
||||
line outside its range asks the integrator, who either widens the range or lands the edit in c0e.
|
||||
|
||||
## 0 The shape of the landing, in one paragraph
|
||||
|
||||
Nothing on Minecraft's steady draw path can go fire-and-forget until EVERY per-draw family reads
|
||||
records instead of the frontend: `PrepareForDraw` touches the VAO (vi), the program (pg), the unit
|
||||
textures and samplers (tx2), the bound FBO and its attachment lists (fb) and the UBO points (sb) on
|
||||
every draw, hit or miss. So the smallest first landing that lets the client stop waiting at draws
|
||||
is c0e + id + {vi, sb, pg, tx2, fb} + ra, with the caps bit flipped in ONE integration commit after
|
||||
all of them. What makes it small is what is left barriered and trailing (§5): XFB, client vertex
|
||||
arrays, CopyTex / GetTexImage / readbacks, `set_storage_block_binding`, the texture half of
|
||||
`resource_subdata`, `set_texture_params`' reply — none of which is on the steady path. The
|
||||
contract's barriered predicate (§2.1) is what lets those keep P5C's semantics while draws run
|
||||
ahead, and the unconditional detector (§3.3) is what makes a missed site a named abort instead of
|
||||
a wrong picture.
|
||||
|
||||
## 1 Dependency order
|
||||
|
||||
```
|
||||
c0e (the contract, the wire rows, the knobs; inert) -- lands FIRST, no behaviour change
|
||||
└─ id (registry rekey, by-handle resolvers, the guard) -- lands SECOND, lockstep unchanged
|
||||
├─ vi (VAO / VBO / IBO) ┐
|
||||
├─ sb (set_shader_buffers, binding points) │ parallel worktrees, any order,
|
||||
├─ pg (program twin, archive, bindings) │ each rebased on id
|
||||
├─ tx2 (textures, samplers, unit windows) │
|
||||
└─ fb (FBO, attachments, images, blit) ┘
|
||||
└─ ra (the wait rule, credit, gPipeInputs, flow control) -- parallel from day one on c0e;
|
||||
its LAST commit is the integration
|
||||
commit: kMGPipeP5eRunAheadReady=true
|
||||
```
|
||||
Cross-package couplings that must be known before branching: pg's `BlockBindings` tail is what sb's
|
||||
UBO loop indexes with (`DirectGLES.cpp:5463` vs `:5464`); tx2's `SyncMipmapsToBackendByHandle` /
|
||||
`SyncTextureToBackendByHandle` are what fb's attachment sync and image sync call; fb's reverse
|
||||
index is what tx2's `ScopedDetachedTextureFramebufferAttachments` needs; sb's deletion of the
|
||||
backend GPU-write marks and fb's deletion of `MarkWritableImageBufferTexturesGpuWritten` are one
|
||||
edit split across two files. Each such seam is a declared signature in c0e (a header declaration
|
||||
with a body that asserts "not landed") so both sides compile from day one.
|
||||
|
||||
## 2 Packages
|
||||
|
||||
### c0e — the contract and the wire (integrator; lands first)
|
||||
**Scope.** `MG_Remote/CONTRACT-P5E.md`; `MG_Pipe/PipeCalls.def` (the `WaitClass` column on every row,
|
||||
`SetProgramBindings` opcode 80 appended); `scripts/gen_pipe_wire.py` (or whichever generator emits
|
||||
`PipeWire.inc`) + regenerated `MG_Pipe/generated/*.inc` (`MGPipeWaitClassFor`, the new op's thunk /
|
||||
table slot / codec layout, route row null); `MG_Pipe/MGPipeTypes.h` (`kCapRunAheadApply`,
|
||||
`MGPProgramBindings` + tail PODs, `MGPProgramDesc::LinkStatus`, `kDrawClientArrays`,
|
||||
`kMGPipeMaxBufferBindingPoints`); `MG_Pipe/MGPipeValueTypes.h` (`MGPipeImageAccess` enum, encode/
|
||||
decode); `MG_Pipe/MGPipe.h` (bit 13, default mask `0x3fff`); `MG_Impl/Pipe/SetHashSuppressor.h`
|
||||
(four slots); `MG_Impl/Pipe/Tracker.h:97-99, 204-209` (bits 15-17 → subsystem 13); `Config.h`
|
||||
`IpcTable::RunAhead/PresentCredit`; `ConfigLoader.cpp:356-403`; `MG_Pipe/PipeApply.h` declarations
|
||||
of every cross-package seam (`MGPipeApplierCurrentRecordIsBarriered()`, `MGPipeBarriered(...)`, the
|
||||
sb/pg applier fields, the by-handle sync signatures) with asserting bodies; `MG_Pipe/FieldOwnership.def`
|
||||
re-annotations; `MG_Pipe/Coverage.def` rows; `MG_Test/Pipe/PipeCatalogueTest.cpp` (sizes, opcode
|
||||
80, the null route pins); `MG_Test/Pipe/TrackerTest.cpp:385-387` (bit 13); `docs/Disaggregated/
|
||||
ROADMAP.md` row; `MG_Backend/Init.cpp` (`kMGPipeP5eRunAheadReady = false`, the DirectGLES arm that
|
||||
will publish bit 10). **Red-once.** The ABI fingerprint (`SessionRings.h:498-524`) changes with the
|
||||
new opcode and `PipeCatalogueTest` pins the new sizes; `MagmaPipeIdentityTest` pins no bit 10 on
|
||||
DirectVulkan. **Quick gate.** Unit green; `integration-split` green (nothing behaves differently);
|
||||
G1 0/0/0/0.
|
||||
|
||||
### id — identity (S7's spine; lands second)
|
||||
**Scope.** `MG_Backend/DirectGLES/SlotTables.h` (composite band `m_band`; `ForEachLive` re-typed as
|
||||
`fn(MGPipeHandle, const BackendPtr&)`; the frontend-keyed members kept as monolith glue, each
|
||||
asserting `!MGPipeApplierIsUnbarrieredApply()` in split builds); `Managers.h:309-640` (registry
|
||||
forwarding, `ResolveVaoTwin(handle)` / `ResolveProgramTwin(handle)` / `ResolveTextureTwin(handle)`
|
||||
declarations in the `ResolveSamplerCsoTwin` shape, `AdoptTwinByHandle` as the body);
|
||||
`Managers.cpp:188-372` (teardown, `OnFrontendStateObjectDestroyed` — delete the NoSession hop
|
||||
`:224-246` and the scope at `:256`; `ReleaseTwinsForWireObjectDeath`); `MG_Impl/Pipe/SlotAllocator.{h,cpp}`
|
||||
(the guard: exemption iff scope AND barriered record; `MGPipeFrontendKeyedRegistryScope` kept as a
|
||||
class until the family packages delete their sites; `MGPipeReverseAnnouncementScope` →
|
||||
`MagmaP7AllocatorDebtScope`, backend-kind-keyed); `MG_Backend/DirectVulkan/VulkanRenderer.cpp:4554,
|
||||
4634, 8986` + `MG_Impl/Pipe/ResourceTracker.h:723` (the rename only); `MG_Remote/Server/PipeApplier.cpp`
|
||||
`ApplyOne` sets `CurrentRecordBarriered` from `MGPipeBarriered` (the one line ra also touches —
|
||||
id owns it, ra rebases); `MG_Test/SanityTest.cpp:3499-3960, 4061, 4241, 4378, 4898` (cases moved to
|
||||
the legacy arm or rewritten by handle; new `ACompositeHandleDoesNotGrowTheOrdinaryTable`);
|
||||
`MG_Test/Wire/RemoteClientTest.cpp:1866-1913` (`...IsAllowed` deleted; new
|
||||
`...FromTheApplyThreadIsFatalEvenAtTheOldDebtSites` posting `HandleOf` through `RunOnApplyThread`
|
||||
with the barriered flag forced false by a test hook). **Red-once.** With the hook forcing
|
||||
"unbarriered", `HandleOf` from the apply thread aborts `Fatal{RoleViolation, "MGPipeSlots"}`; put
|
||||
the exemption back → the case is green → red by expectation. **Quick gate.** Unit + `integration-split`
|
||||
green (lockstep behaviour unchanged: every record is barriered until ra). **New names (G2/G14):**
|
||||
`ResolveVaoTwin/ResolveProgramTwin/ResolveTextureTwin(MGPipeHandle)`, `MagmaP7AllocatorDebtScope`,
|
||||
`MGPipeApplierCurrentRecordIsBarriered` — all `MOBILEGL_BUILD_DISAGGREGATED`.
|
||||
|
||||
### vi — VAO / vertex input / index (S1)
|
||||
**Scope.** `DirectGLES.cpp:699-925` (`SyncVaoAttributeBuffersByHandle`, the IBO arm), `:1602-1719`
|
||||
(`ResolveVaoTwin` handle arm, `SyncCurrentVAO`, `SyncCurrentVertexAttributeValues`), `:4770-4776`
|
||||
(the VAO lines of `PrepareForDraw` ONLY), `:6447-6480` (restart helpers), `:6718-6782`
|
||||
(`DrawArrays`/`MultiDrawArrays` arms: monolith-only); `Managers.h:1204-1300` (`ResolvedDrawBuffers`:
|
||||
`frontend` leaves the split arm, `iboSerial` added), `:1286-1290`; `Managers.cpp:4881-4892`, `:5160-5350`
|
||||
(`SyncToBackendFromApplier` — signature only), `:5364-5468` (`SyncClientSideAttributesForDrawArrays`:
|
||||
monolith-only); `MG_Remote/Client/EmitTables.cpp:484-525, 640-690` (`kDrawClientArrays` + the
|
||||
run-ahead refusal beside `CLIENT_INDICES`); `MG_Test/Pipe/VertexInputEmitTest.cpp` + a
|
||||
`SanityTest.cpp` sibling beside `:4083`. Trailing inside vi: `ResolvedDrawBuffers` deletion after a
|
||||
measurement. **Red-once.** (1) Revert `ResolveVaoTwin` to `Find(vao.get())` → `Fatal{RoleViolation,
|
||||
"MGPipeSlots"}` on the first `integration-split` draw once ra flips the bit; before that, the id
|
||||
test hook. (2) Publish `set_vertex_buffers` for A,B, repoint the frontend VAO at C without
|
||||
re-emitting, sync → A,B ensured; the revert ensures C. (3) Same on `set_index_buffer`. (4)
|
||||
`glDrawArrays` with a client array under run-ahead → the named refusal; revert → red under
|
||||
`integration-split-strict` (`DoublePrecisionScenario` if it uses client arrays, else a new scenario).
|
||||
**Quick gate.** Unit + `integration-split` green; `VertexAttribBindingScenario`,
|
||||
`VertexArrayEnableDisableScenario`, `PrimitiveRestartScenario`, `ResidentIndexScenario`,
|
||||
`MultiDrawScenario`, `DrawParametersScenario`, `HandleRecycleScenario`, `ObjectSubsystemControlScenario`
|
||||
(the `0x0ff`/`0x17f` A/B keeps its verdicts). **New names:** `ResolveVaoTwinByHandle` (or the id
|
||||
resolver), `SyncVaoAttributeBuffersByHandle`'s new signature.
|
||||
|
||||
### sb — buffer binding points (S5)
|
||||
**Scope.** `MG_State/GLState/BufferState/BufferState.h:69-75` (bind-point generations, push-only);
|
||||
`MG_Impl/GLImpl/Buffer/GL_Buffer.cpp:1501-1520, 1624-1650` + `SetNamedTransformFeedbackBinding` (the
|
||||
bumps); `MG_Impl/Pipe/Tracker.h:520-560, 630-640` (bits 15/16/17 shutters); new
|
||||
`MG_Impl/Pipe/ShaderBufferEmit.h`; `MG_Impl/Pipe/PipeFill.cpp` (`SubsystemForEmitter` `:1989-2028`
|
||||
row + pairing asserts `:2104-2126`, the validate order `:3225-3233`, the reset list `:3129-3143`,
|
||||
the `kMGPipeMaxBufferBindingPoints`/84 pin); `MG_Pipe/PipeApply.{h,cpp}` (`MGPipeApplySetShaderBuffers`,
|
||||
the applier fields declared by c0e); `MG_Pipe/PipeRoute.{h,cpp}` + `MG_Remote/Client/WireTables.cpp`
|
||||
(route rows for op 38); `MG_Remote/Server/PipeApplier.cpp` (the one sink method `OnSetShaderBuffers`);
|
||||
`DirectGLES.cpp:477-673` (`SyncBufferBindingPointsByRecord`, `MarkShaderStorageBuffersGpuWritten`
|
||||
deleted under transport, `SyncAtomicCounterBuffers`), `:979-990` (call lines), `:5464-5497` (the
|
||||
point half of the UBO loop; `:5463` is pg's); `scripts/gen_pipe_dirty_surface.py:87-90` + `DirtySurface.def`
|
||||
rows; `MG_Test/Pipe/TrackerTest.cpp`, new `ShaderBufferEmitTest.cpp`, `PipeCatalogueTest.cpp:170-171,
|
||||
242-243` (invert); `MG_IntegrationTest` A/B with bit 13 cleared. **Red-once.** (a) Revert the handle
|
||||
walk under a live wire → `Fatal{UnmigratedPipeInput, "GetBufferBindingPoint@DrawVbo"}` on
|
||||
`SsboArrayDynamicIndexScenario` / `StorageBufferRegrowScenario` / `AtomicCounterScenario` under
|
||||
strict. (b) `TrackerTest`: `glBindBufferBase(UNIFORM,1,A); Update(); glBindBufferBase(UNIFORM,1,B);
|
||||
Update()` sets bit 15 on the second update — red against `Tracker.h:636` today. (c)
|
||||
`GetBufferBindingPointCount`'s `rsp` non-zero before, 0 after, on `AtomicCounterScenario`. (d)
|
||||
Delete the backend marks and `ProducerMarkCount(ShaderStorageBinding)` stays non-zero while
|
||||
`SsboArrayLengthScenario`'s readback sees the writes. **Quick gate.** Unit + `integration-split` +
|
||||
strict on the four SSBO/atomic scenarios and the three XFB ones; the bit-13-cleared A/B reproduces
|
||||
today's picture. **New names:** `MGPipeApplySetShaderBuffers`, `MGPipeShaderBufferEmitterInstance`,
|
||||
`SyncBufferBindingPointsByRecord` (file-local), `BufferState::NoteBindPointChanged`.
|
||||
|
||||
### pg — programs (S4)
|
||||
**Scope.** `MG_Impl/Pipe/ProgramEmit.h` (archive encode per link via `ProgramArtifactsCodec` into
|
||||
SEG_STAGE; `EmitProgramBindings`; `LinkStatus`; the failed-relink rule); `MG_State/GLState/ProgramState/
|
||||
ProgramArtifactsCodec.{h,cpp}` (completeness: name `:242`'s skipped member); `MG_Pipe/PipeApply.{h,cpp}`
|
||||
(`MGPipeApplyCreateShaderState` adopts the blobs into record-owned artefacts — the companion
|
||||
pointers go under a transport; `MGPipeApplySetProgramBindings`); `MG_Pipe/PipeRoute.*` +
|
||||
`WireTables.cpp` (op 80 route); `PipeApplier.cpp` (`OnSetProgramBindings`; trailing:
|
||||
`set_storage_block_binding` by `ShaderCso`); `DirectGLES.cpp:4097-4110` (the stash), `:4230-4318`
|
||||
(`ResolveGlobalConstantsRecord(handle)`, `MapUBO` refusal), `:4320-4510` (`SyncCurrentProgram(handle)`
|
||||
incl. the broadcast decline arm `:4383-4404` → Fatal under transport), `:4781` (`PrepareForDraw`'s
|
||||
program line), `:5317-5560` except `:5464-5497` (sb) and `:5561-5632` (tx2), `:5670-5740`
|
||||
(`GetCurrentBackendProgram`), `:6120-6130` (`PrepareForCompute`'s program line), `:10018-10042`
|
||||
(`ShaderStorageBlockBinding`: monolith body kept; trailing handle arm); `Managers.h:2338-2541`;
|
||||
`Managers.cpp:10757-13080` (`SyncToBackend(h, record)`, `CacheResourceLocations`,
|
||||
`ReseedShaderStorageBlockBindings`, the signature); `MG_Test/Pipe/ProgramEmitTest.cpp` (beside `:251`).
|
||||
**Red-once.** (1) Empty the applier's block-binding tail → `UniformInitializerScenario` /
|
||||
`Glsl420DeclarationScenario` wrong pixels + `RefusedObjectCalls`. (2) Leave the blob refs at `Size 0`
|
||||
with the companions removed → `Fatal{ProtocolCorruption}` (`PipeApply.cpp:2858-2871`). (3) Delete
|
||||
the five scopes without re-keying → `Fatal{RoleViolation, "MGPipeSlots"}` (after ra). (4) Strict lane
|
||||
names `GetProgramForDraw@draw_vbo` with the row still pulled; green after. (5) Force bit 12 off
|
||||
under run-ahead → `Fatal{UnmigratedVerb, "set_global_constants"}`. **Quick gate.** Unit +
|
||||
`integration-split`; `RelinkStageSetScenario`, `PostLinkAttachScenario`, `ProgramPipelineScenario`,
|
||||
`AsyncCompileScenario`, `CsoContentAddressingScenario`, `HandleRecycleScenario`; the archive cost
|
||||
measured (links/frame, bytes/link, ms on the GL thread) on MC + a shader pack and reported before
|
||||
the package is declared done. **New names:** `MGPipeApplySetProgramBindings`, `EmitProgramBindings`,
|
||||
`SyncCurrentProgramByHandle`.
|
||||
|
||||
### tx2 — textures and samplers (S2)
|
||||
**Scope.** `DirectGLES.cpp:1723-1806` (`SyncTextureToBackendByHandle`), `:1867-2098` (unit
|
||||
epoch/capture: monolith-only; decline → refusal), `:2127-2140` (`UnitTextureSyncEntry` re-shape,
|
||||
push-only under `#if`), `:2321-2391` (the unit half), `:4834-4948` (`ResolveAndBindUnitTextures`),
|
||||
`:4985-5026`, `:5051-5170` (`BindCurrentUnitSamplers`, decline → refusal), `:5245-5305`
|
||||
(`BindCurrentTextures` with ruling 6's key), `:5561-5632` (the sampler pass; the mint deleted),
|
||||
`:8725-8760` + `:9560-9600` (`GenerateMipmap` by `VerbMipRes`), `:9161, 9216` (mip shape `HandleOf`
|
||||
→ handle), trailing `:9714-9735` (CopyTex endpoint) and `:11884` (`GetTexImage`); `Managers.cpp:5816-5975`
|
||||
(`RequireImageBindableStorage` entry refusal), `:6902-6985`, `:7049-7400` (`SyncMipmapsToBackend(h,
|
||||
rec)`), `:8472-8560`, `:8712-8900`, `:13184-13290` (sampler identity family deleted under
|
||||
transport), `:13457-13486`; `Managers.h:1626-1660` (`IsDrawSyncCleanByRecord`), `:1785-1812`,
|
||||
`:2678-2700`; `MG_Backend/DirectGLES/MipmapStorage.cpp:39-51` (guard list widened);
|
||||
`PipeApplier.cpp` (the window checks at draw/dispatch dispatch — ONE function `CheckUnitWindows(st)`
|
||||
called from `OnDrawVbo`/`OnLaunchGrid`); `MG_Test/Wire/RemoteClientTest.cpp:1938-1978`;
|
||||
`MG_Test/SanityTest.cpp:3075-3144` (+ the ABA sibling); `SampledSetStalenessScenario`,
|
||||
`TextureParamsWithoutASamplerViewScenario` kept. **Red-once.** (1) Revert any handle arm → the
|
||||
widened guard aborts by accessor name. (2) Revert the window arm of `ResolveAndBindUnitTextures` →
|
||||
strict lane `Fatal{UnmigratedPipeInput, "GetTextureUnitObject@DrawVbo"}`. (3) ABA: recycle a slot to
|
||||
`{s, g+1}` while the old entry is in the work list → the twin is re-minted; skip the Gen reset → red.
|
||||
(4) Narrow `SamplerEmit.h:735-737`'s count by one → `Fatal{ProtocolCorruption, "SetSamplerViews.Count"}`.
|
||||
(5) `GenerateMipmap` with the row `kWaitNone` and the unit walk restored → `Fatal{UnmigratedPipeInput,
|
||||
"GetActiveTextureUnit@...}` (`F1WireScenario.GenerateMipmap*Pixels`). **Quick gate.** Unit +
|
||||
`integration-split`; `PipeSlotPeek` asserts zero registry-scope entries per frame for this family.
|
||||
**New names:** `SyncTextureToBackendByHandle`, `SyncMipmapsToBackendByHandle`,
|
||||
`ResolvePushedTextureParams/BuiltinSampler(MGPipeHandle)`, `IsDrawSyncCleanByRecord`.
|
||||
|
||||
### fb — framebuffers, attachments, images, blit (S3)
|
||||
**Scope.** `DirectGLES.cpp:179-241` (the doors), `:2140-2180` (list keys), `:2227-2331`
|
||||
(`SyncReadFramebufferTextureAttachments`), `:2405-2470` (the draw-FBO list), `:2519-2914` (images:
|
||||
`SyncImageTextureBinding(const MGPImageView&)`, `ResolveShaderImageRecord` deleted,
|
||||
`MarkWritableImageBufferTexturesGpuWritten` deleted under transport, the sweep gate), `:3017-3377`
|
||||
(`SyncCurrentFBO*`), `:4514-4754` (`BindCurrentFBO`, `SyncAndBind*`, `ForceBindCurrentFBO`),
|
||||
`:6180-6192` (`Clear`), `:8182-8420` (both blit arms), `:8837-8935` (the detach walk + reverse index),
|
||||
`:9688-9740` (`SyncRenderbufferObjectToBackend` by handle); `Managers.cpp:9395-9405, 9585-9742,
|
||||
9834-9953, 10044-10429, 10847-10850, 13530-13584`; `Managers.h:1857, 1943-1970, 2819-2830`
|
||||
(reverse index texture → FBO slots); `MG_Test/Pipe/FramebufferEmitTest.cpp` (server twin of `:558`),
|
||||
`MG_Test/Pipe/ImageEmitTest.cpp` (beside `:452`: the three constants on both sides), a new
|
||||
default-framebuffer-resize re-emit case. **Red-once.** (1) `SyncAttachmentSurface` takes the
|
||||
frontend attachment again → strict `Fatal{UnmigratedPipeInput, "GetFramebufferBindingSlot"}` on
|
||||
`SnormAttachmentScenario`. (2) The draw-FBO list key back to the pointer compare → `Fatal{RoleViolation,
|
||||
"MGPipeSlots"}` (after ra). (3) `MGPipeDecodeImageAccess` mapped 1↔2 → `FormatlessImageBakeScenario` /
|
||||
`ImageLoadStoreSsoScenario` red + the unit case. (4) The named blit back on the frontend objects →
|
||||
`CopyImageLayeredScenario`, `LayeredAttachmentShapeScenario`. (5) The per-point version memo kept as
|
||||
a second gate → `CrossFrameBufferScenario` / `P4aSeamAuditScenario` F-3 must stay green WITHOUT it.
|
||||
**Quick gate.** Unit + `integration-split` with the framebuffer/sampler bits set; the seam greps
|
||||
(`DirectGLES.cpp:3086-3106, 2607-2610, 2636-2638`) silent; the object A/B re-baselined for
|
||||
`SyncReadFramebufferTextureAttachments`. **New names:** `SyncToBackendByHandle` (RBO/FBO overloads),
|
||||
`MarkBufferGpuWrittenByHandle` (declared; body deleted under transport with sb), the reverse index.
|
||||
|
||||
### ra — the transport mechanics (S6; parallel from day one; lands last)
|
||||
**Scope.** `MG_Remote/Client/ClientSession.{h,cpp}` (`RunAheadArmed`, `EmitAndWaitTails` §2.3,
|
||||
`ReleaseFillPins`, `DrainEventRing` at every park exit, `Finish`, `RefusePipeInputsTouch...` §3.5,
|
||||
the stats line `credit-waits`); `MG_Remote/Client/EmitTables.cpp:977-1053` (`EmitPresent` credit +
|
||||
`FrameSerial`) and the `Finish` slot; `MG_Remote/Client/BackendObject_Remote.cpp` (wait before every
|
||||
`Server*` EGL forwarder); `MG_Remote/Client/WireTables.cpp:332-352` + `MG_Pipe/PipeRoute.h:270-276`
|
||||
(`wantReply` for the buffer half); `MG_Remote/Client/CapsMirror.*` (latch); `MG_Impl/Pipe/PipeFill.cpp:84-86,
|
||||
546-556, 1955+, 2962-3306` (§3.1, §3.4); `MG_Backend/MGPipe/PipeInputs.{h,cpp}` (server-private
|
||||
stamp, §3.2-3.3); `MG_Remote/Server/PipeApplier.cpp` (`OnPresent` credit return, `StampVerbBoundary`,
|
||||
`MGPipeBarriered` body; `ApplyOne`'s flag line is id's); `MG_Remote/Server/ServerSession.{h,cpp}`
|
||||
(present credit, event producer flow control); `MG_Remote/Server/ServerLoop.cpp:375-392` (park
|
||||
predicate); `MG_Remote/Transport/EventRing.h`, `SessionRings.h`; `MG_Backend/Init.cpp` (flip
|
||||
`kMGPipeP5eRunAheadReady` — the integration commit); `MG_Impl/Pipe/PipeMutation.h:216-236` (the
|
||||
unbarriered-enqueue finding); `.github/workflows/test.yml:1140-1206` (the strict lane's allowlist
|
||||
step); `docs/Disaggregated/ARCHITECTURE.md` §11, §14, §17; `MG_Test/Wire/{RemoteClientTest,
|
||||
SessionTest, ServerLoopTest}.cpp`. **Red-once.** (1) Encode present without `WaitForPresentAck` →
|
||||
the `SessionTest.cpp:522-549` twin in `RemoteClientTest` parks a credit-1 client behind a stalled
|
||||
apply thread; without the wait the third present publishes and `Waits()` is unchanged → red by
|
||||
count. (2) Leave one `CopyField` in an unbarriered fill → `Fatal{RoleViolation, "gPipeInputs"}` by
|
||||
name (`RemoteGuards...FillWhileTheApplierOwnsIt`'s shape with `RunAhead=1`). (3) Count instead of
|
||||
Fatal under an unbarriered record → the strict lane's rewritten step turns from green to red on the
|
||||
first pulled row. (4) Keep `Fatal{EventRingOverflow}` → a unit case publishing 300 KiB of
|
||||
`kEventGpuWritten` behind an unwaited sequence aborts; with flow control it completes. (5) Publish
|
||||
bit 10 for Magma → `MagmaPipeIdentityTest` red. (6) `MOBILEGL_IPC_RUN_AHEAD=0` renders identically
|
||||
(SSIM); `MOBILEGL_IPC_VERB_BARRIER=0` under run-ahead is the documented red. **Quick gate (before the
|
||||
flip).** Unit + `integration-split` green with the bit unpublished (every branch inert);
|
||||
`RemoteGuards` strict arms green. **New names:** `MGPipeBarriered`, `MGPipeWaitClassFor` (c0e),
|
||||
`ClientSession::RunAheadArmed/ReleaseFillPins`, `MGPipeServerStampVerbBoundary`'s new signature,
|
||||
`IpcTable::RunAhead/PresentCredit`.
|
||||
|
||||
## 3 The integration gate (the commit that flips `kMGPipeP5eRunAheadReady`)
|
||||
|
||||
1. Unit green under both `MOBILEGL_IPC_STRICT_ERRORS` arms.
|
||||
2. `integration-split` green (111+ entries plus the new ones), broad inproc census with zero
|
||||
regressions vs `2fde7034`, the 79 traces with no new first blocker.
|
||||
3. `integration-split-strict` GREEN as a hard lane: the only admitted `[BARRIER-PULLED, ...]` markers
|
||||
are the §7 allowlist (`<field>@<verb>` for readbacks, XFB, CopyTex, `set_storage_block_binding`);
|
||||
any other marker fails the lane. Every scenario summary shows `rsp` = 0 on unbarriered records.
|
||||
4. The three negative controls behave as documented: `RUN_AHEAD=0` identical SSIM; `VERB_BARRIER=0`
|
||||
red at a barriered row; `RUN_AHEAD=1` on Magma logs once and runs lockstep.
|
||||
5. Every package's red-once re-run on the integrated tree (a revert of any one handle arm goes red
|
||||
in the strict lane by field and verb).
|
||||
6. G1 0/0/0/0, G2, G14, G5; the push build under `Transport=monolith` renders the four A/B traces
|
||||
with unchanged SSIM.
|
||||
7. `MOBILEGL_IPC_AUDIT=1` clean (no `0xDD` read) with the client a present ahead — the pmap push
|
||||
without a reply is the new consumer of retired staging.
|
||||
|
||||
## 4 The device exit (Redmi, MC 26.3 VD12, 30 s in-world window)
|
||||
|
||||
Arms: monolith; inproc lockstep (`MOBILEGL_IPC_RUN_AHEAD=0`); run-ahead credit 1; run-ahead credit 2.
|
||||
Per arm: fps; per-thread CPU ms/frame (client GL thread, `mgl-srv-apply`); `cliwait/clipark`,
|
||||
`credit-waits`, `srv/srvpark` from the wire ledger and the stats line (`ClientSession.cpp:1161-1189`,
|
||||
`ServerLoop.cpp:410-414`); `simpleperf` on both threads — the exit condition is that
|
||||
`WaitForApplied` self on the client falls from 27.9% to the present-credit wait alone and
|
||||
`DrainRing`'s real work is unchanged; the per-op wait tally must show NO `kWaitApplied` row and no
|
||||
reply row firing per draw on the steady path (what remains per frame — the texture subdata for the
|
||||
lightmap, `set_texture_params` replies, fences — is listed by op in the report as the trailing
|
||||
inventory); `rsp` = 0 on unbarriered records; SSIM of the four A/B traces vs monolith unchanged.
|
||||
The P5D report's method section (`P5D-INPROC-PERFORMANCE.md:58-71`) is the template; the bench
|
||||
scripts the brief named are not on this machine and are re-created beside it. Recorded, and
|
||||
GATED on: fps ≥ lockstep's, client-thread ms/frame < lockstep's, SSIM unchanged.
|
||||
|
||||
## 5 What trails (after the integration commit, each its own small package)
|
||||
|
||||
| item | owner | why it can trail |
|
||||
|---|---|---|
|
||||
| `GenerateMipmap` `kWaitApplied` → `kWaitNone` (if tx2 lands the `VerbMipRes` arm late) | tx2 | not on the steady path |
|
||||
| `set_storage_block_binding` by `ShaderCso` | pg | after-link only |
|
||||
| CopyTex endpoint / `GetTexImage` / readbacks by handle (the barriered scope sites `6166, 8837, 9161, 9216, 10029, 11884`) | tx2 / fb | barriered rows keep P5C's semantics (P8/P9 phases) |
|
||||
| `resource_subdata` texture half without a reply (D-D5 accept-by-construction) | ra + tx2 | one wait per frame for the lightmap today |
|
||||
| `set_texture_params` without a reply (the default-texture self-heal moved client-side) | tx2 | creation-time traffic |
|
||||
| client vertex arrays staged (`{BindingIndex, MGHostSpan}` tail) | P8 | refused under run-ahead |
|
||||
| XFB migration (`set_stream_output_targets`, the program row, the targets) | P3b/P4b/P9 | lockstep by escalation (i) |
|
||||
| `ResolvedDrawBuffers` deletion | vi | measurement first |
|
||||
| composite pipelines' uniform mirror vs `set_program_bindings` fire rate | pg | unmeasured; pipeline workloads only |
|
||||
| program-derived `set_shader_buffers` window | sb | narrowing, not correctness |
|
||||
| `MOBILEGL_IPC_EVENT_KB` (ring size under SSBO-heavy `kEventGpuWritten`) | ra | Iris-class workloads |
|
||||
| `Flush` as the doorbell point (ARCHITECTURE §11.6); credit-2 latency study | ra | measurement |
|
||||
| thread placement | — | out of scope by instruction; the per-thread numbers survive it |
|
||||
|
||||
## 6 The rulings the integrator makes (conflicts between scout designs, with the resolution)
|
||||
|
||||
| # | conflict | resolution (contract §9) |
|
||||
|---|---|---|
|
||||
| 1 | S7: handle arms run under `Transport=monolith` too (family bit selects); S1–S5: `Transport != Monolith` keeps the frontend arms under monolith | S1–S5's shape. The push-monolith build keeps its bytes and behaviour, the verify comparator keeps its frontend arm, and `RUN_AHEAD=0` becomes a pure wait-rule A/B on identical server code. |
|
||||
| 2 | Brief/S7 assumed client vertex arrays are refused under split; S1 read the code: they are not (`EmitTables.cpp:651-685`) | Verified S1 is right. Refuse under `RunAheadArmed` with `kDrawClientArrays`; lockstep unchanged; staging is P8's. |
|
||||
| 3 | S5: XFB/atomic waits decided from client state at emit; S6: a static per-op wait table | The wire-derived predicate `MGPipeBarriered(op, payload, st)` — static column + XFB-active from `MGPContextValues` + the draw flag — computed identically on both sides. |
|
||||
| 4 | S6 §4(6): a WAITED op may no longer read the frontend; S1–S5 keep readback/CopyTex/GetTexImage sites barriered | S6's argument is wrong for a single-context client parked in its own wait; barriered records keep P5C's semantics (rule F is scoped to unbarriered records). This is what keeps the first landing small. |
|
||||
| 5 | S4 §4.6: `ShaderStorageBlockBinding` is a GL-thread entry; S6: `set_storage_block_binding` is a `kCtxVerb` applied on the apply thread through `GetProgramObject(GlName)` | Verified S6 (`PipeCalls.def:243`, `PipeApplier.cpp:805-808`). `kWaitApplied` now; pg's trailing item resolves by `ShaderCso`. |
|
||||
| 6 | S2: `BindCurrentTextures` memo on `SamplerViewsSerial` alone; S4: on the program handle + serials | Both (a relink with unchanged resolution still needs the twin's new unit assignments). |
|
||||
| 7 | S3 R1: the image sweep gate needs S2's serial design | `(ShaderImagesSerial, TextureShutterSerial, ContextSerial, g_backendContextGeneration)`; keep the union walk. |
|
||||
| 8 | S4 R1: encode the archive per link vs pin a `SharedPtr` | Encode (rule B); measure; lazy encode at first bind as the fallback. |
|
||||
| 9 | S4 R2: a failed relink of a bound program | Re-issue with `LinkStatus = 0` iff the frontend reports it unlinked; pg verifies the frontend's actual behaviour; never `object_death`. |
|
||||
| 10 | S5 R2: high-water vs program-derived window | High-water (`TouchedBufferBindingPointCount`, already carried); 84 on the wire, backend clamps. |
|
||||
| 11 | S5 R1: one suppressor slot for three classes | Three slots. |
|
||||
| 12 | S7 R1: Magma's four apply-thread allocator sites vs an unconditional guard | One renamed scope, backend-kind-keyed; Magma is lockstep and every record is barriered there. |
|
||||
| 13 | S6 §3(9)/S7: the deferred-destroy queue "loses its producer" | It does not (barriered fills pin objects); the queue stays live; an unbarriered enqueue is the finding. |
|
||||
| 14 | S6 §3(3)/S2: `GenerateMipmap` waits until the unit read is gone | Verified (`ClientSession.cpp:900-914`; `VerbMipRes` already exists at `DirectGLES.cpp:8736`). tx2 flips the row. |
|
||||
| 15 | S3 R5: does an EGL resize re-emit the default-framebuffer record | Verified yes (`ClientSession.cpp:210-221` → `TextureObject.cpp:84-102` → `Tracker.h:594`); fb pins it. |
|
||||
| 16 | S3 vs the brief: `Access` "has no encoding" | Verified S3: `MGPipeEncodeImageAccess` exists (`ImageEmit.h:163-176`); the server comment is stale; the decode moves to `MGPipeValueTypes.h`. |
|
||||
| 17 | S6 §7: `resource_subdata`'s texture half | Buffer half `kWaitNone` in ra; texture half keeps its reply; trailing. |
|
||||
| 18 | present credit default | 1. |
|
||||
| 19 | S1 R4 / S2 R1 (A8): the var-tail windows are not pinned | The window rule in §5.3 with the sink check at every draw/dispatch; `set_vertex_buffers`' window is pinned by a test in vi (same class, same validate step). |
|
||||
|
||||
Open items that need a ruling the scouts could not settle and this brief does not: (a) whether
|
||||
`DoublePrecisionScenario` uses client arrays under split (decides whether vi's refusal needs a new
|
||||
scenario as its red-once); (b) the archive cost number (ruling 8's fallback trigger); (c) the NoSession
|
||||
server-only fixtures that lose death delivery when id deletes the hop (`grep RunOnApplyThread
|
||||
MG_Test/Wire`) — id enumerates them in its first commit and the integrator rules keep/rewrite.
|
||||
@@ -0,0 +1,500 @@
|
||||
# CONTRACT-P5E (draft) — the client runs ahead of apply on the Espryt draw path
|
||||
|
||||
Authority: this file, beside `CONTRACT-P5.md` (table 0, byte carriers, field ownership, R-1…R-17),
|
||||
`CONTRACT-P5B.md` (the class-C slots) and `CONTRACT-P5C.md` (rule E, the two named exemptions,
|
||||
SEG_EVENT, the guards). Where it disagrees with any of them this file is newer and wins; §8 lists
|
||||
every such place. Base: `feat/disaggregated @ 2fde7034` (code head `1f8de61b`). Every `file:line`
|
||||
was read at that commit; paths are under `MobileGL/` unless they start with `docs/`.
|
||||
|
||||
**How to change it.** Package c0e's file, edited by the integrator first. A P5e package (id / vi /
|
||||
sb / pg / tx2 / fb / ra) that needs a row changed goes through the integrator; the packages compile
|
||||
against the rows below from day one.
|
||||
|
||||
---
|
||||
|
||||
## §0 What P5e is, and the rule above every row
|
||||
|
||||
P5d made `inproc` CPU-bound on the client thread with the frame still `client work + (per draw)
|
||||
wait for apply + handoff` (R-1, `MG_Remote/Client/ClientSession.cpp:932-959`). The wait exists
|
||||
because the apply of a draw still dereferences client-owned memory: the object-class BARRIER_PULLED
|
||||
rows of `MG_Pipe/FieldOwnership.def:72-106` and the frontend-keyed twin registries
|
||||
(`MG_Backend/DirectGLES/SlotTables.h:411-449`) inside the two P5C §3.1 exemption scopes. **P5e
|
||||
retires the lockstep for every op on the Espryt draw path: the client publishes and moves on; the
|
||||
server resolves every object from a handle a record carried, and the only client memory it may read
|
||||
is the residual fill of a record the client is provably blocked behind.**
|
||||
|
||||
Rules A–E bind unchanged. P5e adds one definition and one rule:
|
||||
|
||||
**Definition — a BARRIERED record.** A record is barriered iff `MGPipeBarriered(op, payload,
|
||||
applierState)` is true, a pure function of wire-visible data computed identically by the emit
|
||||
table and by the sink (§2.1). The client blocks in `WaitForApplied(seq)` after publishing a
|
||||
barriered record; it never blocks after an unbarriered one.
|
||||
|
||||
**Rule F — an unbarriered record's apply names no client memory.** With a live wire on a
|
||||
run-ahead server (§6), the apply of an unbarriered record reads NOTHING from client-owned memory:
|
||||
no frontend object dereference, no `gPipeInputs` BARRIER_PULLED row, no `MGPipeSlots()` probe or
|
||||
mint, no `SharedPtr` to a frontend object taken or held. Every object is resolved from a handle the
|
||||
record or the applier state carries, through a handle-keyed twin table (§4). A violation is
|
||||
`Fatal{UnmigratedPipeInput, "<field>@<verb>"}` (a pulled row, §3.3), `Fatal{RoleViolation,
|
||||
"MGPipeSlots"}` (an allocator probe, §4.4) or `Fatal{RoleViolation, "<surface>"}` (P5C §6 layer 1),
|
||||
**regardless of `MOBILEGL_IPC_STRICT_ERRORS`** — the value would be torn or stale by construction,
|
||||
so there is no "count it" arm. A barriered record's apply keeps P5C's rules exactly: its pulls count
|
||||
into `rsp`, its probes are legal inside a scope, and the client's wait is what makes them legal.
|
||||
|
||||
Refusal vocabulary is P5C's, plus: `Fatal{UnmigratedVerb, "DrawArrays+CLIENT_ARRAYS"}` (§5.1),
|
||||
`Fatal{UnmigratedVerb, "set_global_constants"}` (§5.5), `Fatal{UnmigratedEmulation,
|
||||
"image-bindable-redirty"}` (§5.2), `Fatal{ProtocolCorruption, "SetSamplerViews.Count"}` /
|
||||
`"BindSamplerStates.Count"` / `"SetShaderBuffers.Class"` / `"SetShaderBuffers.Count"` /
|
||||
`"SetProgramBindings.<field>"` / `"Present.FrameSerial"` / `"ImageView.Access"` (§1, §5),
|
||||
`Fatal{PresentCreditTimeout}` (§2.4), `Fatal{RoleViolation, "gPipeInputs"}` (§3.5).
|
||||
`Fatal{EventRingOverflow}` is RETIRED on a run-ahead server (§2.6).
|
||||
|
||||
---
|
||||
|
||||
## §1 Table 0 additions — encodings the P5e rows introduce
|
||||
|
||||
| field | the ruling | zero means | who reads it |
|
||||
|---|---|---|---|
|
||||
| **`MGPCapBit::kCapRunAheadApply = 1ull << 10`** (`MGPipeTypes.h:108-135`, bits 0..9 used) | Set in the DirectGLES arm of the server's `CallMask` (`MG_Backend/Init.cpp`), NEVER in the DirectVulkan arm. It says "this server applies unbarriered records without reading client memory". The client latches `RunAheadArmed()` = `m_barrierArmed && Ipc.RunAhead && Caps().HasCap(kCapRunAheadApply)` at the first caps adoption after `Start`; a later snapshot may only turn it OFF. | absent = lockstep (Magma; and Espryt until the integration commit flips `kMGPipeP5eRunAheadReady`, §6.2) | `ClientSession::RunAheadArmed`, `MGPipeBarriered` on both sides |
|
||||
| **`MGPipeWaitClass`** — a fourth column of `PipeCalls.def`'s X-macro, generated beside `kMGPipeCallFlags` into `PipeWire.inc` as `MGPipeWaitClassFor(op)` | `kWaitReply` (every `kReplySlot` row), `kWaitPresent` (`Present`), `kWaitApplied` (the static barriered rows of §2.2), `kWaitNone` (everything else). Opcode order and the flag column are untouched: the column is a value, not a new op. | — | `EmitAndWaitTails`, `ServerVerbSink::ApplyOne` |
|
||||
| **`MGPDrawInfo::Flags` gains `kDrawClientArrays`** (next free bit beside `kDrawHasUserIndices`, `MGPipeTypes.h:1430`) | Set by the client emit arm when any ENABLED attribute of the bound VAO has no buffer. §2.1 escalation (ii). | no client array in this draw | `MGPipeBarriered`; `EmitDrawRecord`'s refusal (§5.1) |
|
||||
| **`MGPPresent::FrameSerial`** | Minted by the CLIENT, `++m_presentsSent`, 1-based — no longer 0 (`EmitTables.cpp:1040`). The sink calls `ServerSession::ReturnPresentCredit(FrameSerial)` after `table->Present()` returns (today `ReturnPresentCredit` has no production caller, `ServerSession.cpp:677-682`), one credit per swap. | 0 arriving on a run-ahead server is `Fatal{ProtocolCorruption, "Present.FrameSerial"}` | `OnPresent`, `WaitForPresentAck` |
|
||||
| **`MGPShaderBuffers` + `MGPBufferRange[]`** (`MGPipeTypes.h:901-919`, wire op 38, catalogued since P4a, no route/sink/emitter today) | One record per **Class** ∈ {Uniform=0, ShaderStorage=1, AtomicCounter=2}; `Start = 0` always; `Count = TouchedBufferBindingPointCount[target]` (the rv value already carried) clamped to `kMGPipeMaxBufferBindingPoints = 84` (pinned against `BufferState.h:29` in `PipeFill.cpp`); per entry `Res` = the buffer handle or null, `Offset/Size` from the point's range, **`Size = kMGPipeWholeBuffer` (`MGPipeTypes.h:406`) for a base binding** so the server re-resolves the extent against ITS descriptor at use (a `glBufferData` between emit and apply then binds the new extent, as GL does); `WritableMask` bit per entry for classes 1/2. `HostSpanCount = 0` on Espryt for the whole of P5e (`kCapNeedsHostUboBytes` is 0, `CONTRACT-P5.md:64`); the codec's honesty pass (`PipeWireCodec.cpp:1783-1799`) is the guard. `Class >= 3` → `Fatal{ProtocolCorruption, "SetShaderBuffers.Class"}`; `Start + Count > 84` → `"SetShaderBuffers.Count"`. XFB targets do NOT ride this record (`set_stream_output_targets` keeps its row, still unemitted: XFB stays lockstep, §5.7). | `Res` null = nothing bound at that point | `MGPipeApplySetShaderBuffers`, `SyncBufferBindingPointsByRecord`, the UBO loop, `SyncAtomicCounterBuffers` |
|
||||
| **`set_program_bindings` — opcode 80, appended.** `X(SetProgramBindings, MGPProgramBindings, kCtxState, kVarTail\|kHostSpan)` | Head `MGPProgramBindings { MGPipeHandle Cso; Uint64 Signature; Uint32 BlockBindingCount, SamplerUnitCount, StorageOverrideCount, Pad; }` (32 B, `MGP_ASSERT_POD`); three tails in order: `Int32 BlockBindings[BlockBindingCount]` (dense, GL uniform-block index order), `{Uint32 Location; Int32 Unit;}[SamplerUnitCount]` (sparse, ascending Location), `{MGHostSpan Name; Int32 Binding; Uint32 Pad;}[StorageOverrideCount]` (the storage-block override map is name-keyed BY DESIGN, `ProgramObject.h:1030-1034`; the name travels as a host span staged whole). `Signature` = the client's commutative hash of the override map, the same function as `Managers.cpp:10832-10841`, so the server's rebuild clause is one `Uint64` compare. Bounds: `BlockBindingCount <= 64`, `SamplerUnitCount <= 256`, `StorageOverrideCount <= 64`, else `Fatal{ProtocolCorruption, "SetProgramBindings.<field>"}` — a larger sampler array is a counted refusal, not a truncation. Emitted BEFORE `create_shader_state` at the same validate point (a rebuild inside the verb must already see the bindings). Dirty rule: bit `NewShaderBindings` (`Tracker.h:364-371, 419-448`) already mixes the three counters; the emitter latches on `(Cso, backendStateVersion, blockBindingVersion)`. A re-issued create clears the record's tails (`GlobalConstants`' rule, `PipeApply.cpp:2903-2909`). | all three counts 0 = "defaults" | `MGPipeApplySetProgramBindings`, the program twin's sync and memo keys |
|
||||
| **`MGPProgramDesc::LinkStatus`** (a `Uint8` in the descriptor's existing pad, `MGPipeTypes.h:585-597`; size unchanged, `PipeCatalogueTest` pins it) | 1 = the link the archive describes succeeded. `create_shader_state` is re-issued on the same handle at every link that changes `GetLinkVersion` (today's rule) and the record's `Serial` moves with it; a failed link re-issues with `LinkStatus = 0` and empty blobs IFF the frontend reports the program unlinked afterwards (§9 ruling 9 pins which). A draw on a `LinkStatus == 0` program DECLINES on the server, as the frontend raises `INVALID_OPERATION`. | not linked | the program twin (`SyncCurrentProgram`) |
|
||||
| **`MGPProgramDesc::Spirv[6]` / `Reflection` blobs are NON-EMPTY** on a live wire | The client encodes the link artefacts once per link with `ProgramArtifactsCodec` into `SEG_STAGE`; the applier decodes into RECORD-OWNED `LinkArtifacts`/`SpirvArtifacts` and the companion pointers (`ProgramEmit.h:230-260`) are deleted under a transport. `Size 0` with no companion is the existing trip wire `Fatal{ProtocolCorruption}` (`PipeApply.cpp:2858-2871`). A `SharedPtr` pin of the client's artefacts was considered and REFUSED: rule B, and `Link()` replaces them in place (`ProgramObject.cpp:348-356`). | — | the program twin's rebuild |
|
||||
| **`MGPImageView::Access`** | 0 = `GL_READ_ONLY`, 1 = `GL_WRITE_ONLY`, 2 = `GL_READ_WRITE` — the encoding `MGPipeEncodeImageAccess` already writes (`MG_Impl/Pipe/ImageEmit.h:163-176`). The decode `MGPipeDecodeImageAccess` lives in `MG_Pipe/MGPipeValueTypes.h` beside an enum so both roles pin one table; the server comment at `DirectGLES.cpp:2662-2669` is deleted as stale. Any other value is `Fatal{ProtocolCorruption, "ImageView.Access"}`. | read-only | `SyncImageTextureBinding` |
|
||||
| **`kMGPipeSubsystemBufferBindings = 1ull << 13`** (`MG_Pipe/MGPipe.h:105-109`, bits 13..62 reserved) | Owns dirty bits 15/16/17 (`NewConstBuffers/NewShaderBuffers/NewSoTargets`, `Tracker.h:97-99`) and the `SetShaderBuffers` emitter. Caps-required under a transport like bits 7–12; the default push mask becomes `0x3fff`. Bit 13 requires bit 7 (a range names a Buffer handle). `TrackerTest.cpp:385-387` is rewritten, not deleted. | bit clear = the frontend walk (monolith / A/B only) | `MGPipeSubsystemForDirty`, `SubsystemForEmitter` |
|
||||
| **`SetHashSuppressor` slots** (`SetHashSuppressor.h:65-66`) | `SetShaderBuffers` becomes THREE slots (`SetShaderBuffersUniform/ShaderStorage/AtomicCounter`) — one per Class, so an emission of one class never cancels another's; `SetProgramBindings` gets one. `SetStreamOutputTargets` stays "P4b" (unemitted). | — | the emitters |
|
||||
| **`IpcTable::RunAhead`** = `MOBILEGL_IPC_RUN_AHEAD` (default 1, range 0..1); **`IpcTable::PresentCredit`** = `MOBILEGL_IPC_PRESENT_CREDIT` (default **1**, range 1..8) | Parsed unconditionally like every IPC knob (`ConfigLoader.cpp:356-403`). `PipeVerify` forces `RunAhead = 0` beside `BatchWaits = 0` (`:377`). `RunAhead=1` on a server without the caps bit logs once "run-ahead requested, server does not publish kCapRunAheadApply" and runs lockstep. The stats line gains `credit-waits`. | `RunAhead=0` is the A/B control: identical server code, only the client's wait differs | `RunAheadArmed`, `EmitPresent` |
|
||||
| **`BufferState` bind-point generations** (client-only, `#if MOBILEGL_PIPE_PUSH`) | One `Uint64` per `BufferBindPointTargets` entry beside `NoteBufferChanged` (`BufferState.h:69-75`), bumped by `glBindBufferBase/Range` (`GL_Buffer.cpp:1501-1520, 1624-1650`) and `SetNamedTransformFeedbackBinding`. Not a wire field; listed because it is the emit rule's input and the pull build's object must not resize (the licence `TextureState::NoteImageUnitTouched` took at P5d r3). | — | bits 15/16/17's shutters |
|
||||
|
||||
---
|
||||
|
||||
## §2 ra — the wait rule
|
||||
|
||||
### 2.1 The barriered predicate (one function, two callers)
|
||||
|
||||
```
|
||||
MGPipeBarriered(op, payload, st) =
|
||||
MGPipeWaitClassFor(op) != kWaitNone // static column, §2.2
|
||||
|| (MGPipeCallClassFor(op) == kCtxVerb && st.IsTransformFeedbackActive) // (i) XFB stays lockstep
|
||||
|| (op == DrawVbo && (payload.Flags & kDrawClientArrays)) // (ii) client arrays
|
||||
```
|
||||
`st.IsTransformFeedbackActive` is `MGPContextValues`' value (`MGPipeTypes.h:1698`): on the client
|
||||
it is `ctx.IsTransformFeedbackActive()` at emit, on the server the applied value — `set_context_values`
|
||||
precedes the verb on the ring, so the two agree. Escalation (ii) is a refusal under run-ahead
|
||||
(§5.1), so on a run-ahead server it never reaches the sink; it is listed so the predicate is total.
|
||||
**No other runtime escalation exists**; adding one is an integrator ruling and a row here.
|
||||
|
||||
### 2.2 The static column, row by row
|
||||
|
||||
| class | rows | why |
|
||||
|---|---|---|
|
||||
| `kWaitReply` | every `kReplySlot` row (`PipeCalls.def:115-202, 206, 221`): GetCaps, ResourceCreate/Respecify, MapPersistent, FenceStatus/Wait, QueryAvailable/Result/Timestamp, SetTextureParams, ResourceSubData (texture half, §2.5), ResourceReadback, GetTextureImage, ReadPixels | the answer is not derivable (R-5) |
|
||||
| `kWaitPresent` | `Present` | the credit, §2.4 |
|
||||
| `kWaitApplied` | `ApplierReset`; `GenerateMipmap` (`kCtxObject`, waits today for the reason at `ClientSession.cpp:900-914` — until tx2 lands its `VerbMipRes` arm, then `kWaitNone`); `SetStorageBlockBinding` (`kCtxVerb`, resolves through `GetProgramObject(GlName)`, `PipeApplier.cpp:805-808`; trailing: pg resolves through `MGPStorageBlockBinding::ShaderCso` and flips it); `BeginStreamOutput`, `EndStreamOutput`, `PauseStreamOutput`, `ResumeStreamOutput`, `BindStreamOutput` (§5.7); `CopyFramebufferToTexture` (the CopyTex endpoint still syncs the frontend texture, `DirectGLES.cpp:9714-9735`; trailing, tx2) | each still pulls a row or probes; the wait keeps P5C's semantics for it |
|
||||
| `kWaitNone` | `DrawVbo`, `LaunchGrid`, `Clear`, `Blit`, `MemoryBarrier`, `Flush`, `SetSwapInterval`, `BindShaderImage`, `PatchParameter`; every `kCtxState` / `kCtxCso` / `kCtxObject` row without a reply (incl. `ObjectDeath`, `ResourceSubData` buffer half); `ResourceDestroy`, `UnmapPersistent`, `FenceCreate/Destroy`, `FenceWaitServer`; `QueryCreate/Begin/End/Destroy/Counter` | rule F holds for their sinks after §4/§5 |
|
||||
|
||||
The column is inert until the integration commit publishes the caps bit (§6.2), after vi/sb/pg/tx2/fb.
|
||||
|
||||
### 2.3 `EmitAndWaitTails` after `PublishAndNotify` (`ClientSession.cpp:877`)
|
||||
|
||||
```
|
||||
if (ownsReplySlot) -> WaitForAppliedBudget + DrainEventRing + ReadReply (unchanged)
|
||||
else if (RunAheadArmed())
|
||||
switch (class) kWaitNone: return seq;
|
||||
kWaitApplied: WaitForAppliedBudget + DrainEventRing + ReleaseFillPins(); return seq;
|
||||
kWaitPresent: return seq; // the credit wait ran BEFORE encode, §2.4
|
||||
else -> today's :915-959 shape, byte for byte (lockstep, Magma, verify)
|
||||
```
|
||||
`ReleaseFillPins()` clears the four O-class `SharedPtr` rows of `gPipeInputs` (`PipeInputs.h:801-809`)
|
||||
on the GL thread once the barriered apply returned — under run-ahead the next fill may be a frame
|
||||
away and a pinned VAO/program must not make the apply thread its last owner. `VerbBarrier==0`
|
||||
keeps its lockstep meaning (nothing but reply rows waits); under run-ahead it removes the
|
||||
`kWaitApplied` waits too and is the run-ahead NEGATIVE CONTROL: expected red is
|
||||
`Fatal{UnmigratedPipeInput, ...}` at the first barriered row's stale pull.
|
||||
|
||||
### 2.4 Present pacing
|
||||
|
||||
`EmitPresent` (`EmitTables.cpp:977-1053`): `BeforeReadOnlyVerb(); if (m_presentsSent >= PresentCredit)
|
||||
WaitForPresentAck(m_presentsSent + 1 - PresentCredit, 30 s)` — `ShutDown` returns, `TimedOut` is
|
||||
`Fatal{PresentCreditTimeout}`; then `DrainEventRing`, encode, publish, `PumpControlPlane`. Credit 1
|
||||
= the client publishes frame N+1 while the server applies and swaps frame N: one frame of overlap,
|
||||
at most one frame of added latency. Budget at ~850 draws + ~0.36 MB pmap/frame: SEG_CMD ~70 KB +
|
||||
set/CSO records per frame against 8 MiB, SEG_STAGE ~1 MB/frame against 32 MiB, SEG_REPLY unchanged.
|
||||
The credit, never the bytes, is the steady-state backpressure; `WaitForCmdSpace` and the stage bell
|
||||
(`PipeWireCodec.cpp:836`) are the safety net and both drain events on exit (§2.6).
|
||||
|
||||
### 2.5 Drains and forced waits
|
||||
|
||||
Drain points: every wait exit in `ClientSession` (reply, applied, present-ack, cmd-space, stage
|
||||
bell), the four EGL RPC returns (`BackendObject_Remote.cpp:200-245`), `Stop`. Forced waits:
|
||||
`MapBuffer(READ)` / `GetBufferSubData` / a `CopyBufferSubData` source → `SyncGpuWrites` (reply
|
||||
row, unchanged); `glFinish` → `WaitForApplied(LastPublishedSeq)` + drain (a new client `Finish`
|
||||
slot; `Flush`/`Finish` stay no-ops on the wire, ARCHITECTURE:415); every `Server*` EGL forwarder
|
||||
waits `WaitForApplied(LastPublishedSeq)` BEFORE the RPC (the mailbox is pumped between drain
|
||||
batches, `ServerLoop.cpp:385-390`, so a make-current would otherwise land between two run-ahead
|
||||
records); `ServerSwapEGLBuffers` is not on that list — present is the swap. **`glGetError`
|
||||
relaxation:** a run-ahead verb's `kEventGlError` is observed at the next drain point, i.e. at most
|
||||
one present credit later than the call after it; P5C §4.2 already assigns ordering to P9 and P5e
|
||||
names the window. **`resource_subdata`:** the BUFFER half passes `wantReply = false` through
|
||||
`MGPipeRouteResourceSubData` (the Bool is discarded today, `PipeFill.cpp:839`; the server still
|
||||
posts, the slot is never read — legal, `ReplySlot.h:16, 105`), which is what makes the persistent-map
|
||||
push (`PersistentMapTracker.cpp:735, 850`) fire-and-forget; the TEXTURE half keeps its wait because
|
||||
`DrainTextureSubData` clears the level's dirty flag on the accepted reply (D-D5; trailing).
|
||||
|
||||
### 2.6 Event-ring flow control (ARCHITECTURE §11.7 made real)
|
||||
|
||||
On a run-ahead server `Reserve == nullptr` is NOT `Fatal{EventRingOverflow}`: the producer latches
|
||||
`eventRingFull` (exists, `EventRing.h:135-143`), publishes, rings, and `ApplyThreadMain` parks at
|
||||
the record boundary with `eventRingFull == 0` added to `ready` (`ServerLoop.cpp:380-383`). The
|
||||
client re-checks `m_events.RingIsFull()` at every park exit and drains before re-parking. Deadlock
|
||||
argument: the server blocks only on the event ring; the client blocks only on watermarks the
|
||||
server advances; every client wait drains; so at most one side is parked at any instant. The
|
||||
lockstep arm keeps the Fatal (P5C §4.4).
|
||||
|
||||
### 2.7 Object lifetime under run-ahead
|
||||
|
||||
The client frees a slot only after its death record went out (`PipeFill.cpp:1623-1626`), the ring
|
||||
is in order, every record naming `{s,g}` precedes `destroy{s,g}` which precedes `create{s,g+1}`,
|
||||
and every server twin table Gen-checks (§4.3). **No wait is added at any delete.** Persistent maps:
|
||||
`Forget()` (`PersistentMapTracker.cpp:599-606`) drops tracker state only; pushed bytes were copied
|
||||
into SEG_STAGE at `StageOptional` and reclaim waits on `retiredSeq`, so a map released with blocks
|
||||
in flight is safe. The P5d deferred-destroy queue (`PipeMutation.h:216-236`) STAYS LIVE: a
|
||||
barriered record's apply may still pin a frontend object (its fill's `SharedPtr` rows, XFB
|
||||
`targets`), so the apply thread can still be a last owner. Under `RunAheadArmed` an enqueue from an
|
||||
UNBARRIERED apply is a finding: `MGLOG_E_ONCE` with the kind, Fatal under strict.
|
||||
|
||||
---
|
||||
|
||||
## §3 `gPipeInputs` — server-role memory for unbarriered records
|
||||
|
||||
1. **The client fills only for barriered records.** In `MGPipeValidateForVerb`
|
||||
(`PipeFill.cpp:2962-3306`), when `RunAheadArmed()` and `!MGPipeBarriered(...)`: step 2 (tracker
|
||||
walk) and step 3 (emitters) run unchanged; `:2989` (`++CurrentVerbSerial`), `:2999-3001`
|
||||
(`SetVerb/SetIdentity`), step 4 (`:3252-3270`, `CopyField` + `FilledGen`) and `MGPipeLeaveVerb`'s
|
||||
writes are SKIPPED; `MGPipeNoteFrontendMutation` returns at `:554`. The residual-value trip
|
||||
wire (`:3284-3294`) still emits — it compares on the server against the applier mirror.
|
||||
`RunAhead=0` on a caps-publishing server uses the SAME fill decision (the A/B changes one
|
||||
variable: the wait). `PipeVerify` forces lockstep, a fill for every verb, and every record
|
||||
barriered (both roles read the in-process flag; the comparator `:3304` is inproc-only).
|
||||
2. **The server's stamp is server-private.** `MGPipeServerStampVerbBoundary` writes
|
||||
`m_filled/m_currentVerb/m_serverStampedVerb` into applier-owned storage, never into the shared
|
||||
block; `MGPipeServerClearVerbBoundary()` from the GL thread (`:2997`) is DELETED under a
|
||||
transport. For a barriered record the server reads the client's fill (the client is parked) and
|
||||
its own stamp; for an unbarriered one it does not touch the block. `SetIdentity` (`:3001`) moves
|
||||
to `ApplyOne`, once per session. This removes the E note's hazard (b.4).
|
||||
3. **The detector.** `MGPipeInputUnfreshRead` (`PipeInputs.cpp:191-224`) under an unbarriered
|
||||
record takes `StrictBarrierPullFatal` (`:60-66`) regardless of `StrictErrors`; the seven sticky
|
||||
forwards (`MGPipeStickyForwardPull`, `:251-257`) the same; `CountBarrierPull` stays for barriered
|
||||
records. This is what turns `integration-split-strict` into a hard green lane (§7).
|
||||
4. `VertexAttribDefaultsOf` (`PipeFill.cpp:84-86`) diffs against the emitter's own last header
|
||||
(`g_attribDefaultLastHeader`, `:2949`), never against the block.
|
||||
5. `RefusePipeInputsTouchWhileApplierOwnsIt` (`ClientSession.cpp:1015-1056`) is re-derived: the
|
||||
`BatchWaits` early return at `:1037` goes; under `RunAheadArmed` any GL-thread write to the block
|
||||
outside a barriered fill is `Fatal{RoleViolation, "gPipeInputs"}` by name.
|
||||
`Fatal{BarrierViolation}` (`:840`) stays for `BatchWaits==0 && !RunAhead`.
|
||||
|
||||
---
|
||||
|
||||
## §4 id — handle-keyed twins
|
||||
|
||||
### 4.1 The rule
|
||||
With a live wire, every twin on the apply thread is resolved BY THE HANDLE the applier state or
|
||||
the record carries, never by a frontend object: `GetOrCreate(MGPipeHandle)` (`SlotTables.h:294-342`),
|
||||
`FindByHandle` (`:420-426`), `ReleaseByHandle` (`:394-408`). `HandleOf(stateObj)`,
|
||||
`Find(StateObject*)`, `GetOrCreate(const StatePtr&)`, `NoteStateForHandle/StateForHandle` and
|
||||
`Entry::stateRef` survive as the MONOLITH-GLUE half (§5.8) and are unreachable from an
|
||||
unbarriered apply. The twin sync bodies take `(MGPipeHandle, const <Record>&)` and store
|
||||
`m_handle` (the `m_pushedSyncHandle` pattern, `Managers.h:1857`); the object parameter is deleted
|
||||
from the transport overload, not defaulted to null. The E note's "content-addressed VAO CSO" is
|
||||
corrected: every kind mints its slot off the object's own lifetime id (`VertexInputEmit.h:170-172`,
|
||||
`TextureEmit.h:422`, `FramebufferEmit.h:257`, `ProgramEmit.h:411-422`), so the rekey is a
|
||||
replacement of the lookup ARGUMENT, not of the table.
|
||||
|
||||
### 4.2 Per kind
|
||||
| kind / table | key on the server | the record that names the handle before any verb reads it | twin created | twin dies |
|
||||
|---|---|---|---|---|
|
||||
| Buffer `g_backendBufferResources` (already handle-keyed) | `Res` from `VertexBuffers[]`, `IndexBuffer`, `BoundShaderBuffers[c][i]`, `Desc.BufferForTexBuffer`, `VerbIndirect*` | `resource_create/respecify` | `EnsureBufferResourceForHandle(nullptr, h)` | `resource_destroy` |
|
||||
| VAO `g_backendVertexArrayObjects` | `st.BoundVertexElements` (`PipeApply.h:594`; one CSO per VAO, re-created on the same handle when the config moves) | `create/bind_vertex_elements` | first `ResolveVaoTwin(handle)` at a draw | `object_death{VertexElementsCso}` / `delete_vertex_elements` |
|
||||
| Texture `g_backendTextureObjects` | `BoundSamplerViews[u].Texture`, `BoundShaderImages[u].Res`, `FramebufferRecords[h].State.{Color[i],Depth,Stencil}.Res`, `VerbMipRes`, `VerbCopyTexDst`, `MGPCopyImage` src/dst | `resource_create/respecify` (Texture) | first `SyncTextureToBackendByHandle(h)` | `object_death{Texture}` / `resource_destroy` |
|
||||
| Renderbuffer `g_backendRenderbufferObjects` | `MGPSurface.Res` with `Kind == Renderbuffer` | `resource_create/respecify` (Renderbuffer) | first attach sync | `object_death{Renderbuffer}` |
|
||||
| Framebuffer `g_backendFramebufferObjects` | `st.BoundFramebuffer[t]`, `record.Fbo`, `VerbBlitReadFbo/DrawFbo`; `kMGPipeDefaultFramebuffer` is never a twin | `set_framebuffer_state` | `GetOrCreateByHandle(record.Fbo)` (already, `DirectGLES.cpp:3197`) | `object_death{Framebuffer}` |
|
||||
| Program `g_backendProgramObjects` | `st.DrawProgram` / `DispatchProgram` / `BoundShaderCso`; composites at the band | `create_shader_state` (+ `set_program_bindings`) | first `SyncCurrentProgram(handle)` | `object_death{ShaderCso}` / `delete_shader_state` |
|
||||
| Sampler `g_backendSamplerObjects` | the CSO family ONLY: `st.BoundSamplerStates[u]` or `TextureResources[h].Params.BuiltinSampler` | `create_sampler_state` | `ResolveSamplerCsoTwin` (already, `Managers.cpp:13457-13486`) | `object_death{SamplerCso}` |
|
||||
| SamplerView `g_backendSamplerViews` | `BoundSamplerViews[u].View` (no draw-path resolver today; unchanged) | `create_sampler_view` | — | `object_death{SamplerViewCso}` |
|
||||
|
||||
The identity family of samplers (`ResolveUnitSamplerBackend` `DirectGLES.cpp:4985-5026`, the mint
|
||||
at `:5623-5630`, `Managers.cpp:13264-13280`) is deleted under a transport; a unit whose
|
||||
`BoundSamplerStates[u]` is null while the frontend held a sampler is a missing record and §5.3's
|
||||
window rule makes it unrepresentable. The creation moment is LAZY everywhere (no twin at
|
||||
`create_*`); the applier's Gen check refuses a bind or verb naming an unknown or stale handle
|
||||
(`PipeApply.cpp:2266, 2549, 2625, 2683, 2896`), so a twin is never minted for an object the ring has
|
||||
not introduced. `applier_reset` touches neither twins nor object records (`PipeApply.h:800-832`).
|
||||
|
||||
### 4.3 ABA
|
||||
`Gen` moves only on reuse (`SlotAllocator.cpp:410-419`). At the server every record naming `{s,g}`
|
||||
is applied before `object_death{s,g}`, which is applied before `create{s,g+1}`. `GetOrCreate({s,g+1})`
|
||||
on a live `{s,g}` entry resets it (`SlotTables.h:338`); `FindByHandle({s,g})` after the recycle
|
||||
answers null (`:424`); a backward `{s,g-1}` is refused (`:331`). Even with a death skipped (an
|
||||
object that never crossed emits none, `WireTables.cpp:595-596`) the forward-Gen reset answers.
|
||||
Twin memos key on `{slot,gen}` plus server serials, never on a pointer. `BackendSlotTable` gains
|
||||
the composite band (`m_band`, indexed `slot - base`, as `SlotAllocator.h:144` / `PipeApply.h:511`)
|
||||
so a pipeline program (slot >= 983040) does not grow the ordinary table to `kMaxHandleSlot` entries
|
||||
— a P5e prerequisite, not a follow-up, because the rekey makes it the ordinary path.
|
||||
|
||||
### 4.4 The scopes and the guard
|
||||
`MGPipeRefuseAllocatorFromApplyThread` (`SlotAllocator.cpp:22-38`) exempts a probe iff a scope is
|
||||
active AND `MGPipeApplierCurrentRecordIsBarriered()` (server-private, set by `ApplyOne` from
|
||||
§2.1; `true` for every record on a non-run-ahead server, §6). **`MGPipeFrontendKeyedRegistryScope`
|
||||
is deleted at its draw-path sites** — `DirectGLES.cpp:1609, 1734, 2588, 3303, 4236, 4329, 4585, 4926,
|
||||
4993, 5328, 5689, 6729, 6775, 9695` and `Managers.cpp:256, 2938 (draw-path callers), 4544, 5882,
|
||||
7087, 8481, 8717, 9256, 9310, 9709, 12949, 13273, 13570` — with the frontend probes they wrap; the
|
||||
class survives only around the barriered-row sites (`DirectGLES.cpp:6166, 8837, 9161, 9216, 10029,
|
||||
11884`, the verify arms `Managers.cpp:10382, 10403`) with their P8/P9 phases re-annotated.
|
||||
`MGPipeReverseAnnouncementScope` is renamed `MagmaP7AllocatorDebtScope`, compiled for the Magma
|
||||
sites only (`VulkanRenderer.cpp:4554, 4634, 8986`, `ResourceTracker.h:723`), exempting only when
|
||||
the server backend is DirectVulkan. The renderbuffer cross-check `Managers.cpp:9709-9720` (not
|
||||
transport-gated today, unlike `:9628-9632`) is deleted by the rekey, not gated. The NoSession
|
||||
server-only fixture hop (`Managers.cpp:224-246`) is deleted; such a fixture's twins die at Stop.
|
||||
|
||||
---
|
||||
|
||||
## §5 Per family — the clean gate, the records, the windows
|
||||
|
||||
### 5.1 VAO / vertex input / index (vi)
|
||||
Twin from `st.BoundVertexElements`; memo key `{BoundVertexElements, rec->ContentSerial,
|
||||
VertexBuffersSerial, IndexBufferSerial}` (all server-owned); the buffer walk is over
|
||||
`st.VertexBuffers[Start..+Count).Res` (dedupe on `{slot,gen}`) with
|
||||
`EnsureBufferResourceForHandle(nullptr, Res)` and `IsBufferDrawCleanByHandle(h, res, nullptr)`;
|
||||
`ResolvedDrawBuffers::Entry::frontend` leaves the split arm; the IBO arm reads `st.IndexBuffer.Res`
|
||||
+ `IndexBufferSerial` (also for the restart substitution, `DirectGLES.cpp:6447-6461`);
|
||||
`SyncCurrentVertexAttributeValues` keys on `{elementsHandle, ContentSerial, activeMask}` and reads
|
||||
`rec->Attributes[i].Enabled`; the dead `GetConfigVersion` read at `:4775` is deleted. **Client-memory
|
||||
vertex arrays are NOT refused under split today** (only `CLIENT_INDICES/CLIENT_COMMANDS/
|
||||
UNBOUND_PARAMETER`, `EmitTables.cpp:651-685`; the server dereferences `attrib.Offset` as a raw
|
||||
pointer, `Managers.cpp:5382`): under `RunAheadArmed` a draw with `kDrawClientArrays` is
|
||||
`Fatal{UnmigratedVerb, "DrawArrays+CLIENT_ARRAYS"}` raised on the GL thread in `EmitDrawRecord`'s
|
||||
array arm; the lockstep arm is unchanged; the staged form (a per-attribute `{BindingIndex,
|
||||
MGHostSpan}` tail like `kDrawHasUserIndices`) is P8's. Two pins by test: `CurrentBufferMutationEpoch()`
|
||||
(`Managers.cpp:794`) is apply-thread-only under a transport; the VAO twin key is 1:1 only while the
|
||||
vertex-elements CSO stays identity-addressed.
|
||||
|
||||
### 5.2 Textures (tx2)
|
||||
Every draw-path entry is `SyncTextureToBackendByHandle(h, imageBindable)`: record first, twin by
|
||||
`GetOrCreateByHandle`, three syncs `(h, *rec)`; the by-value twin copy + second `Find`
|
||||
(`DirectGLES.cpp:1745-1755, 1781-1805`) go with the map arm. Clean = `m_isInitialized &&
|
||||
m_syncedResourceSerial == rec->Serial && rec->PendingUploads.empty() && m_syncedParamsSerial ==
|
||||
rec->ParamsSerial && !rec->Params.ForceResync && !m_forceTextureParamsResync &&
|
||||
m_syncedBuiltinSampler == rec->Params.BuiltinSampler && m_syncedBuiltinSamplerSerial ==
|
||||
SamplerCso(rec->Params.BuiltinSampler)->Serial && !rec->Params.SamplerResync && !m_forceSamplerResync
|
||||
&& rec->Desc.StorageKind == Mipmap` — no new state. The four in-body live reads (`GetTarget` at
|
||||
`Managers.cpp:8876-8877, 8620-8621`; `IsTextureView` `:7060`; the TexBuffer backing `:8223-8231`)
|
||||
read `Desc.Target / Desc.ViewOf / Desc.BufferForTexBuffer`; `GetExternalIndex` in logs becomes
|
||||
`Desc.GlNameForDiag`. The unit work list is `{Res, backend}` keyed `(ContextSerial,
|
||||
SamplerViewsSerial, SamplerViewStart, SamplerViewCount, g_backendContextGeneration)`;
|
||||
`PairingsIntact` is deleted; `ResolveAndBindUnitTextures` is one pass over the window with the
|
||||
target from `SamplerViewCsos[View].View.Target`, then an unbind of every target the window did not
|
||||
claim driven by `g_boundTexturesCache`; the alias arbiter dies (the client arbitrated,
|
||||
`SamplerEmit.h:751-757`). **Named delta (P5e-5):** the unit list syncs the program-resolved texture
|
||||
per unit, not every slot of every touched unit; coverage is unchanged (views ∪ image units ∪
|
||||
attachment lists ∪ the waited texture ops). `RequireImageBindableStorage`'s re-dirty arm
|
||||
(`Managers.cpp:5930-5962`, already aborting three frames deep) becomes a NAMED refusal at its
|
||||
entry under a transport, `Fatal{UnmigratedEmulation, "image-bindable-redirty"}`; `ImageBindableHint`
|
||||
is the prevention, P9 owns the pull. `GenerateMipmap(target)` under a transport resolves the
|
||||
texture from `VerbMipRes` (as `EnsureGenerateMipmapStorageAllocated` already does, `DirectGLES.cpp:8736`),
|
||||
never the active unit (`:9563-9566`), and its row flips to `kWaitNone`. `m_force*Resync` are
|
||||
server-set and never cleared by the wire; the wire bits are never cleared by the server (D-E2, now
|
||||
load-bearing for a gate). The pinned guard list (`MipmapStorage.cpp:39-51`, `RemoteClientTest.cpp:1938-1978`)
|
||||
gains the six shape accessors it exempts today plus `GetSamplerObject/GetTextureParamsVersion/GetContentVersion`.
|
||||
|
||||
### 5.3 Samplers and the two unit windows (tx2; the rule binds the emitters)
|
||||
The effective sampler of unit u is `st.BoundSamplerStates[u]` if non-null else
|
||||
`TextureResources[view.Texture].Params.BuiltinSampler`; its values are the CSO record's
|
||||
(`MGPipeValueTypes.h:462-486`); the raw-depth-fetch substitution stays on the server
|
||||
(ARCHITECTURE §5.5); `texture2D->GetFormat()` becomes `SamplerViewCsos[View].View.InternalFormat`.
|
||||
**Window rule (A8 closed):** `set_sampler_views` and `bind_sampler_states` MUST carry `Start == 0`
|
||||
and `Count >= MaxTouchedTextureUnit + 1` (0 when none touched), as `SamplerEmit.h:733-737` emits
|
||||
today; at every draw/dispatch apply the sink checks the two counts against the applied
|
||||
`MGPContextValues::MaxTouchedTextureUnit` and a narrower window is `Fatal{ProtocolCorruption,
|
||||
"SetSamplerViews.Count"}` / `"BindSamplerStates.Count"` — a server-side re-derivation is refused.
|
||||
The `BindCurrentTextures` memo key is `{DrawProgram.{Slot,Gen}, ShaderCso.Serial, BindingsSerial,
|
||||
SamplerViewsSerial}` (ruling 6). The decline arms `DirectGLES.cpp:5152-5169` and `:2073-2098` become
|
||||
named refusals under a live wire; `CaptureUnitBindings/UnitBindingsUnchanged/g_observedUnitBindings`
|
||||
(`:1867-1957`) are monolith-only text.
|
||||
|
||||
### 5.4 Framebuffers, attachments, images (fb)
|
||||
`SyncCurrentFBO` is `SyncCurrentFBOByRecord` only; a decline under a transport is
|
||||
`Fatal{UnmigratedPipeInput, "GetFramebufferBindingSlot@<verb>"}`; `FramebufferRecordMatchesBinding`
|
||||
(`:3017-3033`) is monolith-only. `BackendFramebufferObject::SyncToBackend(record, target)`: the
|
||||
attachment walk is over `Color[0..7] + Depth + Stencil` (`Color[0]` alone when `IsDefault`) — the
|
||||
record's 11 surfaces ARE the point set (the emitter refuses a point at or above the wire width,
|
||||
`FramebufferEmit.h:489-501`; FRONT/BACK tokens exist only on the default framebuffer); the empty
|
||||
point is `Kind == None || Res null` for the detach (`Managers.cpp:10310`) and the N-6 refusal
|
||||
(`:9601-9606`) alike; `m_syncedFrontendAttachmentVersions` is replaced by the record hash;
|
||||
`g_attachmentBackendIdGeneration` stays. `SyncAttachmentSurface(target, surface, attachment)` takes
|
||||
no object; storage through `SyncMipmapsToBackendByHandle` / RBO `SyncToBackendByHandle(surface.Res)`.
|
||||
The two attachment texture lists key `(record.Fbo, ContentHash, ContextSerial,
|
||||
g_backendContextGeneration)` with entries `{Res, backend}` and `PairingsIntact` = `entry.Res ==
|
||||
surface.Res`. `ForceBindCurrentFBO` is handle-only and stamps nothing frontend (the stamps at
|
||||
`:4734-4738` and the legacy memo are skipped together under the transport test). The named blit
|
||||
takes two `const MGPFramebufferState&` (draw buffers, `ReadSurface`, `Kind`, layer/level/layered/
|
||||
format from the surface, `Samples` from the record, `kMGPipeDefaultFramebuffer` for the default)
|
||||
and retires `StateForHandle`; the bound arm reads `FramebufferRecordFor(st.BoundFramebuffer[t])`.
|
||||
`ScopedDetachedTextureFramebufferAttachments` walks a reverse index texture → FBO slots maintained
|
||||
at `set_framebuffer_state` apply. `MGPFramebufferState::Complete` is never a "may I draw" gate.
|
||||
`SyncReadFramebufferTextureAttachments` is not gated on the framebuffer bit (`:2227-2230`), so its
|
||||
retirement moves the object A/B baseline in BOTH arms (re-baselined, not a regression).
|
||||
**Default-framebuffer resize:** the surface-changed consumer's `AllocateStorage` (`ClientSession.cpp:210-221`)
|
||||
reaches `MGP_NOTE_AGGREGATE(FramebufferAttachment)` (`TextureObject.cpp:84-102`), so bit
|
||||
`NewFramebuffer` (`Tracker.h:594`) re-emits the record — verified at this head, pinned by a test in fb.
|
||||
Images: `SyncImageTextureBinding(const MGPImageView&)`: twin by `FindByHandle(Res)`, `Access`
|
||||
decoded, target and storage format off the TWIN (no new wire field; `MGPImageView` is 24 B, no
|
||||
pad); `ResolveShaderImageRecord`'s identity test and I5 seam log go. The sweep gate is
|
||||
`(ShaderImagesSerial, TextureShutterSerial, ContextSerial, g_backendContextGeneration)` — never a
|
||||
backend re-mint counter, so the "re-minted inside the sweep" property (`:2890-2901`) holds; the walk
|
||||
stays the UNION of the record window and `g_imageUnitHighWaterMark` (`:2811-2821`), never narrowed
|
||||
to the window. `MarkWritableImageBufferTexturesGpuWritten` is DELETED under a transport (the client
|
||||
owns the GPU-write set, `GpuWritePending.h:9-55`, `:83-115`); `WritableMask` survives as the record
|
||||
of which points P9's narrowing will name.
|
||||
|
||||
### 5.5 Programs (pg)
|
||||
Twin from the ShaderCso handle; `SyncToBackend(h, const MGPipeShaderCsoRecord&)` answers every
|
||||
reflection question from the record-owned archive and the bindings tails (`GetLinkedShaderSnapshot`
|
||||
`:12049` is a debug log, deleted on this arm). The nine-clause clean condition (`DirectGLES.cpp:4437-4507`)
|
||||
keeps its clause count and moves its inputs: `record.Serial` vs `m_syncedShaderCsoSerial` (exists,
|
||||
stamped at `Managers.cpp:12944-12966`, unread today — P5e is its first reader), `BindingsSerial`,
|
||||
`record.Signature`, `Desc.SpirvStatus`, `Desc.LinkStatus`; `ImageUnitFormatsStillMatch` and the
|
||||
patch clauses are fb's / value rows. The stash `g_currentDrawFrontendProgram` (`:4097-4098`)
|
||||
becomes `{MGPipeHandle, twin*}` compared against `st.DrawProgram`; `PrepareForCompute` reads
|
||||
`st.DispatchProgram`. The sampler-pass memo (`:5522`) keys on `BindingsSerial`;
|
||||
`sampledTargetForUnit` reads the sampler-unit tail and the archive's uniform types. **`MapUBO()`
|
||||
has no run-ahead answer:** when `ResolveGlobalConstantsRecord` declines under a transport it is
|
||||
`Fatal{UnmigratedVerb, "set_global_constants"}`, not a torn upload. `GetProgramObject/
|
||||
ValidateProgramName` keep their P9 rows: `GetBackendProgramId(name)` (`:6151`) is a monolith entry;
|
||||
`ShaderStorageBlockBinding` (`:10020`) is reached from the barriered `set_storage_block_binding`
|
||||
(§2.2) until pg's trailing item resolves it by `MGPStorageBlockBinding::ShaderCso`. Codec
|
||||
completeness: `ProgramArtifactsCodec.cpp:242`'s skipped member is named and either encoded or
|
||||
proven unread by the twin before pg claims "every reflection question is answered".
|
||||
|
||||
### 5.6 Buffer binding points (sb)
|
||||
Applier: `BoundShaderBuffers[3][84]`, `Start[3]/Count[3]/WritableMask[3]`, ONE `ShaderBuffersSerial`
|
||||
advanced on every applied record and ADVANCED (never zeroed) by `MGPipeApplierReset`
|
||||
(`VertexBuffersSerial`'s rule, `PipeApply.h:609-616`); the emitter's latch resets with it
|
||||
(`PipeFill.cpp:3129-3143`'s list). `SyncBufferBindingPointsByRecord(Class, glTarget)`: per entry
|
||||
`EnsureBufferResourceForHandle(nullptr, Res)`; whole-vs-range is `Offset == 0 && Size ==
|
||||
kMGPipeWholeBuffer`; clean = `resource->syncedChangeSerial` vs the resource record's `Serial`
|
||||
(`Managers.cpp:3151`) plus `ShaderBuffersSerial`; no twin key is introduced (a point names an object,
|
||||
it is not one). The UBO loop (`DirectGLES.cpp:5447-5497`) reads `BoundShaderBuffers[Uniform][binding]`
|
||||
where `binding` is the program's block binding (pg's tail); `binding >= Count` = nothing bound;
|
||||
`GetBufferResource(obj)` `:5472` becomes `FindBufferResourceForHandle`. `SyncAtomicCounterBuffers`
|
||||
reads `Count[AtomicCounter]`; `GetBufferBindingPointCount`'s sticky forward becomes FATAL under
|
||||
split (`InvalidateCompileEnv`'s shape, `FieldOwnership.def:163-165`). The three backend GPU-write
|
||||
marks (`DirectGLES.cpp:606, 658, 2775`) are deleted under a transport in ONE edit with fb's.
|
||||
**Client shutter (the P4b hole, verified: bits 15/16/17 read the content aggregate, `Tracker.h:525,
|
||||
636-639`, and `glBindBufferBase` moves only `BindingSlot::m_version`):** bit 15 =
|
||||
`Mix(bindPointGen[Uniform], programIdentity)`, bit 16 = `Mix(gen[ShaderStorage], gen[AtomicCounter])`,
|
||||
bit 17 = `Mix(gen[TransformFeedback], TransformFeedbackGeneration)`; the content aggregate leaves all
|
||||
three. `Touch` joins `gen_pipe_dirty_surface.py`'s `MUTATOR_PREFIXES` (`:87-90`) and `DirtySurface.def`
|
||||
gains the rows the generator then demands. `Coverage.def`'s EMITTED list gains `GetBufferBindingPoint
|
||||
→ SetShaderBuffers` as SHAPE-ONLY; `FieldOwnership.def:80-81` flips to RECORD_SUPPLIED when the four
|
||||
Espryt consumers are gone. `GetBufferBindingSlot`'s 15-pointer copy (`PipeFill.cpp:116-124`) needs no
|
||||
special case: an unbarriered record has no fill at all.
|
||||
|
||||
### 5.7 XFB — stays lockstep
|
||||
`StartPendingTransformFeedback` (`:1381-1510`), `SyncTransformFeedbackBindingPoints` (`:562-592`),
|
||||
`ReadbackCapturedRanges` (`:1118-1160`) and the `xfb.targets` pins are not migrated
|
||||
(`GetTransformFeedbackProgram` is an object row no package retires; the targets hold `SharedPtr`s
|
||||
across two verbs, which rule C forbids an applier entry to do without a barrier). Escalation (i)
|
||||
makes every verb inside an active span barriered; the cost on the Espryt steady path is one bool
|
||||
test per draw (`:1386`).
|
||||
|
||||
### 5.8 Monolith / G1 / the push build under `Transport=monolith` (ruling 1)
|
||||
Every server-side handle arm is selected by `MG_Config::Transport != Monolith` (the idiom at
|
||||
`DirectGLES.cpp:3226, 4725, 6534`, `Managers.cpp:9629`) AND the family bit; it runs under ANY
|
||||
active transport, lockstep or run-ahead, so `RUN_AHEAD=0` is a pure wait-rule A/B on identical
|
||||
server code. The push build under `Transport=monolith` keeps its frontend arms token for token
|
||||
(behaviour and bytes), which the verify comparator needs; the pull build compiles none of it (every
|
||||
new symbol sits under `MOBILEGL_PIPE_PUSH` / `MOBILEGL_BUILD_DISAGGREGATED`; the `TwinRegistry`
|
||||
alias keeps its mangled name, `Managers.h:626-640`; `BackendTextureObject`'s pull-build layout does
|
||||
not move — the admitted-resize set stays empty). Two overloads, not an `#if` inside one body — the
|
||||
frontend one is visibly the monolith-glue half, as `GetOrCreate(const StatePtr&)` is
|
||||
(`SlotTables.h:236-244`). G1 0/0/0/0, G2/G14 name-set rules kept; the new public names are listed in
|
||||
BRIEF-P5E per package. `MOBILEGL_PIPE_VERIFY` forces lockstep (`ConfigLoader.cpp:377`, confirmed).
|
||||
|
||||
---
|
||||
|
||||
## §6 Magma keeps the lockstep
|
||||
|
||||
1. The DirectVulkan arm of `CallMask` never sets `kCapRunAheadApply`; `RunAheadArmed()` is false;
|
||||
the client runs today's `:915-959` path; `MGPipeApplierCurrentRecordIsBarriered()` answers `true`
|
||||
for every record on a server that does not publish the bit, so Magma's probes inside
|
||||
`MagmaP7AllocatorDebtScope` and its BARRIER_PULLED reads keep P5C's semantics and `rsp`
|
||||
accounting. P7 retires them.
|
||||
2. On Espryt the bit is published by `Init.cpp`'s DirectGLES arm gated on one constant
|
||||
(`kMGPipeP5eRunAheadReady`, false until the integration commit), so every package lands with the
|
||||
column inert and nothing changes behaviour until the integrator flips it.
|
||||
3. Negative controls: `MOBILEGL_IPC_RUN_AHEAD=1` on Magma logs once and runs lockstep;
|
||||
`MagmaPipeIdentityTest`/`ServerLoopTest` pin that a DirectVulkan `CallMask` has no bit 10.
|
||||
|
||||
---
|
||||
|
||||
## §7 The strict gate
|
||||
|
||||
`integration-split-strict` (`.github/workflows/test.yml:1140-1206`) becomes a HARD GREEN lane for
|
||||
the Espryt run-ahead server: with `MOBILEGL_IPC_STRICT_ERRORS=1` and the caps bit published, every
|
||||
scenario must complete and every `[BARRIER-PULLED, ...]` marker in a private log is red. Because
|
||||
§3.3 aborts on an unbarriered pull regardless of the knob, strict adds only the barriered rows'
|
||||
pulls (readbacks, GenerateMipmap until tx2, XFB, CopyTex, set_storage_block_binding) — the lane's
|
||||
step lists those rows as the ONLY admitted markers (an allowlist by `<field>@<verb>`) and fails on
|
||||
any other. A revert of any handle arm in vi/sb/pg/tx2/fb goes red HERE, by field and verb, not in
|
||||
a picture. Magma keeps the expected-red step. `rsp` on unbarriered records is 0 in every scenario
|
||||
summary (pinned: a non-zero count would be a Fatal that did not fire). The `PipeSlotPeek` harness
|
||||
asserts zero scope entries per frame on the draw path.
|
||||
|
||||
---
|
||||
|
||||
## §8 Amendments to CONTRACT-P5C (the complete list)
|
||||
|
||||
1. **§3.1's two named exemptions** are superseded by §4.4: the registry scope is deleted at every
|
||||
draw-path site and exempts only a barriered record elsewhere; the announcement scope is Magma's.
|
||||
2. **§4.4 overflow**: lossless stays, but a run-ahead server parks on `Reserve == nullptr` (§2.6).
|
||||
3. **§5.2 `object_death`**: the ring keeps the ordering; the row is `kWaitNone`.
|
||||
4. **§5.1 `applier_reset`** is `kWaitApplied`; its `ContextSerial` assertion stands.
|
||||
5. **§6 CI lane**: the two-sided lane becomes one-sided green for Espryt (§7).
|
||||
6. **§6 layer 2** gains `Fatal{RoleViolation, "gPipeInputs"}` (§3.5); `InBarrierWait()` is
|
||||
re-derived as `MGPipeBarriered`. 7. **§3.3's state note** is retired by fb (§5.4).
|
||||
8. **`FieldOwnership.def`**: `GetBoundVertexArray`, `GetTextureUnitObject`, `GetImageTextureBinding`,
|
||||
`GetFramebufferBindingSlot`, `GetProgramForDraw/Dispatch`, `GetBufferBindingPoint` gain retiring
|
||||
phase "P5e (Espryt unbarriered), P7 (Magma)"; `GetBufferBindingPointCount`'s forward → FATAL under
|
||||
split; `GetTransformFeedbackProgram`, `GetProgramObject`, `GetTextureObject`, `ValidateProgramName`,
|
||||
`HasOpenTransformFeedbackSpan`, `RecordError` keep their rows (barriered-only readers).
|
||||
9. **Table 1** gains `set_program_bindings` (80), appended; `set_shader_buffers` (38) gains its
|
||||
route, sink and emitter (`PipeCatalogueTest.cpp:170-171, 242-243` invert). **Table 0** gains §1's
|
||||
thirteen rows. **Table 3** gains `IpcTable::RunAhead/PresentCredit`.
|
||||
10. **P5C §6's `rsp` paragraph**: the measured object-class pulls (948.5/frame on bsl) go to 0 on
|
||||
unbarriered records; what remains is the barriered allowlist of §7.
|
||||
|
||||
## §9 Rulings the integrator makes at c0e (recommendation first; BRIEF-P5E §6 has the conflicts)
|
||||
|
||||
1. Monolith arm selection: transport check + family bit, frontend arms kept for monolith (§5.8) —
|
||||
NOT S7's "handle arm under monolith too" (it would make the monolith push build depend on the
|
||||
new emissions and lose the verify comparator's frontend arm).
|
||||
2. Client vertex arrays: refuse under run-ahead (§5.1), stage in P8; wait-escalation rejected (it
|
||||
would need `Find(vao)` on the apply thread, which §4.4 forbids for a draw).
|
||||
3. XFB / atomic dispatch waits: the wire-derived predicate (§2.1); atomic-counter dispatch needs no
|
||||
escalation because sb lands 4.5.
|
||||
4. Present credit default 1, range 1..8; credit 2 is a measurement arm only.
|
||||
5. `resource_subdata`: buffer half `kWaitNone`, texture half keeps the reply (trailing D-D5).
|
||||
6. `BindCurrentTextures` memo key: both S2's and S4's rows (§5.3).
|
||||
7. Image sweep gate: applier serials, never a backend counter (§5.4); keep the union walk.
|
||||
8. Program archive: encode per link into SEG_STAGE (§1), measured on MC + a shader pack before pg
|
||||
is sized; the `SharedPtr` pin is refused; lazy encode at first bind is the fallback.
|
||||
9. Failed relink: re-issue with `LinkStatus = 0` iff the frontend reports the program unlinked
|
||||
afterwards; pg verifies which at `ProgramObject.cpp:348-356, 518-522`. Never an `object_death`.
|
||||
10. `set_shader_buffers` window: the touched high-water count per target; capacity 84 on the wire,
|
||||
the backend clamps (`DirectGLES.cpp:500-504`). 11. Suppressor: three class slots.
|
||||
12. Magma scope: one renamed scope, backend-kind-keyed exemption (§4.4).
|
||||
13. Deferred-destroy queue: stays live (§2.7). 14. `ResolvedDrawBuffers`: measured after vi.
|
||||
15. `Blit`'s `kWaitNone` is fb's landing, not a separate package; `Clear`'s is tx2+fb.
|
||||
@@ -0,0 +1,207 @@
|
||||
# P5e — the authoritative fact sheet for the doc update
|
||||
|
||||
Everything below is measured or landed. Do not restate anything that is not here; if a doc you are
|
||||
editing asserts something this sheet contradicts, this sheet wins and you say so in your report.
|
||||
|
||||
Head: **`5c007b22`** on `feat/disaggregated`, pushed to origin. Tree `~/w7/p5e-int`.
|
||||
Rulings: `~/w7/notes/p5e/INTEGRATOR-DECISIONS-P5E.md`, **ID-80 … ID-136**.
|
||||
Contract: `MobileGL/MG_Remote/CONTRACT-P5E.md` (landed by c0e, amended by gl and ra2).
|
||||
|
||||
## 1 What the phase set out to do, and where it stands
|
||||
|
||||
Retire the lockstep on the Espryt draw path: the client publishes an unbarriered record and walks
|
||||
away instead of waiting for the apply thread. **Run-ahead is ARMED** — both
|
||||
`kMGPipeP5eRunAheadReady` (`MG_Backend/Init.cpp`) and `kMGPipeP5eClientWaitRuleLanded`
|
||||
(`MG_Pipe/PipeApply.h`) are `true`. The phase is NOT closed: see §7.
|
||||
|
||||
## 2 The twelve packages
|
||||
|
||||
| wave | package | what it did |
|
||||
|---|---|---|
|
||||
| 1 | **c0e** | the contract and the wire: `PipeCalls.def`'s fifth column `WaitClass` + `MGPipeWaitClassFor`, `set_program_bindings` (opcode 80), `kCapRunAheadApply` (bit 10, DirectGLES arm only), `kDrawClientArrays`, subsystem bit 13, `MGPipeImageAccess`, the two knobs, the cross-package seams |
|
||||
| 1 | **id** | identity: registries rekeyed on `{slot, gen}`, by-handle resolvers, the allocator guard; ID-96's answer was the empty set |
|
||||
| 2 | **vi** | vertex input / VAO / index |
|
||||
| 2 | **sb** | buffer binding points; `MGPShaderBuffers::WritableMask` widened (ID-104) |
|
||||
| 2 | **pg** | programs: the per-link archive into SEG_STAGE, `set_program_bindings`' three tails |
|
||||
| 2 | **tx2** | textures and samplers, the staged store's by-handle reads |
|
||||
| 2 | **fb** | framebuffers, attachments, images, blit |
|
||||
| 2 | **ra** | the transport mechanics: the wait rule, present credit, `gPipeInputs` as server-role memory |
|
||||
| 2.5 | **fix1** | the monolith-arm regression the device found (ID-107); see §5 |
|
||||
| 3 | **pa** | the program family leaves the frontend on the draw and dispatch paths |
|
||||
| 3 | **mv** | multi-draw's frontend VAO read, plus gated entries for all five multi-draw tiers |
|
||||
| 3 | **gl** | the gate mechanism itself, plus two latent crashes |
|
||||
| 3 | **ra2** | the race the flip exposed, and the indirect-binding pull |
|
||||
|
||||
## 3 The strict lane became a hard gate
|
||||
|
||||
`GetProgramForDraw@DrawArrays` 62 → 0 (**no wire change**: the record already carried the per-link
|
||||
`ProgramArchive`; what was missing were readers that still asked the frontend object),
|
||||
`GetProgramForDispatch@DispatchCompute` 7 → 0, `GetBoundVertexArray@DrawArrays` 9 → 0.
|
||||
|
||||
The admission rule is **three disjuncts**, and none was designed up front — each was forced by a
|
||||
real entry failing:
|
||||
|
||||
1. the verb's wire op is statically barriered (ID-116);
|
||||
2. the field's retiring phase does not name this phase (ID-125);
|
||||
3. the record was barriered by ESCALATION rather than by its class (ID-128) — XFB-active draws and
|
||||
client-array draws, both of which the contract puts outside P5e.
|
||||
|
||||
The allowlist is **generated** by `scripts/gen_pipe_field_ownership.py`, not hand-kept: the 13-row
|
||||
copy `ra` had landed in CI was wrong in BOTH directions (it omitted `GetFramebufferBindingSlot@ReadPixels`,
|
||||
21 entries, and carried `GetTextureObject@CopyImageSubData`, which was not admissible). An admitted
|
||||
pull is **loud but not fatal** (ID-117): same marker grammar, tag `Admitted{` instead of `Fatal{`,
|
||||
deduped per pair. The lane is a **two-sided ratchet** — a pair that appears and is not expected
|
||||
fails, and an expected pair that stops appearing fails too, so the lane cannot rot green.
|
||||
|
||||
The ratchet earned itself on the merge: it named `GetProgramForDraw@DrawArrays` as no longer
|
||||
appearing (pa retired it) and `GetBufferBindingSlot@DrawArrays` as newly appearing (mv's indirect
|
||||
tiers forced a row mv had itself NAMED as latent before it could fire; it retires in P8).
|
||||
|
||||
## 4 Gate at the head
|
||||
|
||||
| gate | result |
|
||||
|---|---|
|
||||
| `build` | rc=0 |
|
||||
| `unit` | **2256 / 2256** |
|
||||
| `integration-split` | **179 / 179** |
|
||||
| `integration-gpu` | **1357 / 1357** |
|
||||
| `flavours` (ID-124, new) | rc=0 — pull 915 TUs (push define absent), push 929 TUs (push=1) |
|
||||
| generators / include-closure / dirty-surface / doc citations | all rc=0 (the `CONTRACT-P5.md:524` ambiguity is the standing pre-existing one) |
|
||||
| per-entry strict census | **179/179 green, zero `Fatal{`**, `Admitted{` exactly the eight expected rows |
|
||||
| expected-red lanes | `integration-clientarrays-split` 2 entries on `(Multi)DrawArrays+CLIENT_ARRAYS`; `integration-magma-split` 2 on `GetFramebufferBindingSlot@Clear` — both asserted by name |
|
||||
|
||||
Coverage grew: unit 2250 → 2256, `integration-split` 116 → 179, `integration-gpu` 1294 → 1357, and
|
||||
build flavours from **one** (split) to **three** (pull, push, split). The 65 new lane entries all
|
||||
cover arms or tiers that previously had **no gated entry at all**.
|
||||
|
||||
## 5 Three defect classes the phase found, and what each teaches
|
||||
|
||||
**(a) An ungated runtime arm (ID-107/109/110).** The push build has two server arms selected at
|
||||
runtime; every `integration-split` entry exported `MOBILEGL_TRANSPORT=inproc`, and split-only
|
||||
scenarios skip themselves off the split runtime, so the arm the phone ships on had zero gated
|
||||
entries. `44f91c74` was **1157/1294 on `integration-gpu`: 137 SEGFAULTs across 38 scenarios**, while
|
||||
unit and the split lane were green. Fixed by `66621767`. `gpu` is now a standing gate step.
|
||||
The code-shape lesson: **"a handle was noted" is not the statement "the record arm is selected"**.
|
||||
|
||||
**(b) Ungated build flavours (ID-124).** The gate configured only the split flavour. Three of four
|
||||
flavours were broken. And the first version of the new `flavours` step reported a clean 982-TU
|
||||
"pull" build that was a **second copy of the split build** — `-DMOBILEGL_PIPE_PUSH=OFF` beside an
|
||||
option that implies it is silently overridden, and the CMake cache still read OFF. The step now
|
||||
asserts the **effective compile define** out of `compile_commands.json`. Lesson: **the evidence for
|
||||
an arm must include proof that it was that arm.**
|
||||
|
||||
**(c) A guard that could never fire (ID-132/135).** Throwing the flip dropped `isplit` to 112/181
|
||||
and `gpu` to 1290/1359, **flaky** — 70 red on four fields across eleven verbs. One field at one verb
|
||||
consistently is a missing migration; four fields scattered and flaky is a race. Root cause:
|
||||
`gPipeInputs`' **field values** are already partitioned by `SuppliedFieldMask` and do not race; the
|
||||
**metadata scalars** do. It stayed invisible because
|
||||
`RefusePipeInputsTouchWhileApplierOwnsIt`'s run-ahead arm exempted any `isBarrieredFill` on a claim
|
||||
about the FUTURE ("the client is about to park") while the real order is fill → emit → park. The fix
|
||||
makes the claim a tested fact. A second defect fell out: `MGP_VERB_OP_LIST` joins the whole draw
|
||||
family through one row, so nineteen indexed-draw verbs answered "barriered", filled, and never
|
||||
parked. Contract §3.2 turns out to have **specified per-role stamp storage and never been landed**;
|
||||
that gap is what made the race possible.
|
||||
|
||||
**The methodological finding (ID-132), which is the most reusable thing in the phase:** a hard-green
|
||||
strict lane is necessary and **structurally not sufficient**. That lane runs under lockstep, where
|
||||
`ApplyOne` stamps every record barriered, so it cannot see anything that only happens once the
|
||||
client stops waiting. It measures remaining debt, not whether run-ahead is correct. The phase exit
|
||||
needs a separate post-flip lane.
|
||||
|
||||
## 6 Device measurements (Redmi `2f7cbe2e`, MC 26.3-rc-3, world `test`, DirectGLES)
|
||||
|
||||
### 6.1 The measurement correction that has to be stated first
|
||||
|
||||
The first matrix was **not CPU-clock-pinned** and is void: the **monolith arm's own** per-frame CPU
|
||||
moved 4.43 → 7.07 ms between two runs of the same arm, and the slow run was **cooler** (53.5 °C vs
|
||||
58.9). The `walt` governor had taken policy0 from 2745 to 748 MHz. `tools/device_bench/pin_device.sh`
|
||||
does not know this serial and **refuses to guess** — correct, and why it did not half-apply silently.
|
||||
`~/w7/notes/p5e/pin_redmi.sh` pins this device's own nodes, write order **min→hw floor, max→target,
|
||||
min→target**, and **reads back `scaling_cur_freq`** to verify; checked again after every session.
|
||||
|
||||
### 6.2 Render distance 12 — both arms hit the panel
|
||||
|
||||
Clocks pinned, GPU pinned, fan on, arms interleaved, 30 s windows, two runs each:
|
||||
|
||||
| arm | fps p50 | fps max | client ms/frame | apply ms/frame |
|
||||
|---|---|---|---|---|
|
||||
| monolith | 115.4 / 115.6 | 117.5 / 117.2 | 6.25 / 6.45 | — |
|
||||
| inproc run-ahead | 118.0 / 117.6 | 118.6 / 118.5 | 6.87 / 6.92 | 4.35 / 4.43 |
|
||||
| inproc lockstep (`RUN_AHEAD=0`) | 111.6 | 113.7 | 8.16 | 6.53 |
|
||||
|
||||
Monolith and run-ahead both reach the **120 Hz panel**; lockstep is the only arm that cannot. So
|
||||
this distance answers "can it reach the ceiling", not "which is faster".
|
||||
|
||||
### 6.3 Render distance 32 — the comparable round
|
||||
|
||||
`renderDistance:32` (backed up, restored afterwards). **~3550 draws/frame**, 4.2× the VD12 load, and
|
||||
**nobody near a ceiling** (the game's own `enableVsync:false`, `maxFps:260`; measured max 37–71).
|
||||
Settle raised to 75–150 s because the world streams far longer at this distance. Five runs per arm.
|
||||
|
||||
| arm | n | fps p50 median | p50 range | client ms/frame median | apply ms/frame |
|
||||
|---|---|---|---|---|---|
|
||||
| monolith | 5 | 58.5 | 56.3 – 67.9 (±10%) | 16.19 | — |
|
||||
| **inproc run-ahead** | 5 | **59.9** | 56.8 – 61.1 (±4%) | **15.72** | 11.1 – 12.1 |
|
||||
| inproc lockstep | 2 | 35.5 | 34.5 – 36.5 | 26.17 | 19.7 – 20.5 |
|
||||
|
||||
**Parity.** Run-ahead is marginally ahead on both medians and the difference sits well inside
|
||||
monolith's own spread; what IS outside the noise is that the split arm is **half as variable**.
|
||||
`mono1`'s 67.9 is the only outlier in the set (first run after install).
|
||||
|
||||
**Against the lockstep it replaces: p50 +69%, client CPU −40%, apply CPU −43%.** It is worth far
|
||||
more under heavy load, as expected — the rendezvous count tracks the draw count, about 900 per frame
|
||||
at VD12 and about 3600 at VD32.
|
||||
|
||||
Both arms are **client-thread saturated (~94%)**, so that column is each one's real bottleneck and
|
||||
they compare directly.
|
||||
|
||||
### 6.4 Why run-ahead was worth doing, from the profile (taken at `7c6f6886`, pre-flip)
|
||||
|
||||
Symbolized `simpleperf cpu-cycles`, client GL thread: `SessionProducer::WaitForAppliedOrEventBacklog`
|
||||
**31.58% SELF time**; the next symbol is 3.72%. The counters showed the client entering the doorbell
|
||||
wait about **916 times per frame** against ~849 draws, 99.8% of them resolved by spinning.
|
||||
`MOBILEGL_IPC_SPIN_US=0` (park every time) collapses the frame rate to **20.9**. So the cost is the
|
||||
**rendezvous itself**, not the spin tuning — which is why the fix is "stop having one per draw"
|
||||
rather than "make each one cheaper". After the wait, the client thread is a flat tail of 1–3%
|
||||
functions: there is no second lever.
|
||||
|
||||
## 7 What the phase has NOT done
|
||||
|
||||
- **BRIEF-P5E §3 items 4 and 5** — the three negative controls and the per-package red-once re-runs.
|
||||
Item 5's evidence form was **not executable** while every candidate was red before the revert, so
|
||||
ID-121 re-sequenced it to after the lane went green. It has not been run since.
|
||||
- `scripts/ci/split_negative_controls.sh`'s E1 control **fails its own check** and demands a
|
||||
`Fatal{BarrierViolation}` that cannot fire at `MOBILEGL_IPC_BATCH_WAITS`'s default of 1 (ID-122).
|
||||
- **G1** is still CI's to assert; the phase gate builds the flavours but does not do symbol identity
|
||||
(ID-123).
|
||||
- Contract §8 amendment 8 (`GetBufferBindingPointCount`'s sticky forward) is marked **UNLANDED**
|
||||
(ID-120); contract §3.2's per-role stamp storage is likewise unlanded and is what let (c) happen.
|
||||
- **Above the panel ceiling at VD12, which arm is faster** is unanswered: this device cannot hold a
|
||||
higher clock. VD32 answers the general question instead.
|
||||
|
||||
## 8 The next opportunity, which is not a defect
|
||||
|
||||
At VD32 the apply thread sits at **11–12 ms** while the client is at **15.7 ms**. The two sides are
|
||||
**unbalanced**, and moving work from client to apply would lower the bottleneck directly. This was
|
||||
meaningless under lockstep, where the two costs simply added; run-ahead is what makes it a lever.
|
||||
It belongs to a later phase.
|
||||
|
||||
## 9 Rulings worth indexing (ID-80 … ID-136; the full text is in the notes)
|
||||
|
||||
| ID | one line |
|
||||
|---|---|
|
||||
| 81 | handle arms only under `Transport != Monolith`; the push-monolith build keeps its frontend arms |
|
||||
| 84 | rule F is scoped to UNBARRIERED records; barriered ones keep P5C semantics |
|
||||
| 90 | Magma stays lockstep for all of P5e; `kCapRunAheadApply` is never published on DirectVulkan |
|
||||
| 103 | the barriered stamp is forced `true` until the client's wait rule lands; the predicate runs anyway |
|
||||
| 107/109/110 | the ungated monolith runtime arm, the `gpu` gate step, and stating the record-arm selector instead of inferring it |
|
||||
| 111 | the stamp must ask the server's OWN capability, or flipping the flag kills Magma |
|
||||
| 112 | a compile-time trip wire on the residual fill's seven rows |
|
||||
| 116/117/125/128 | the admission rule: generated, three disjuncts, admitted pulls loud but not fatal |
|
||||
| 119/115 | the `rsp` pin reworded to something checkable; the lane needs a positive control |
|
||||
| 121 | §3.5's red-once evidence form re-sequenced to after the lane is green |
|
||||
| 124 | three of four build flavours were broken; the arm check on the effective compile define |
|
||||
| 129 | a verb with no stamp row admits nothing |
|
||||
| 131 | `ctest -L` is a REGEX — a new label must not contain an existing one, and prove it by counting |
|
||||
| 132/135 | strict hard green is necessary and structurally not sufficient; right about the object, wrong about the mechanism |
|
||||
| 136 | a wait added to satisfy a lane is a real cost on a real path: ask **which arm pays**, not which lane goes green |
|
||||
@@ -0,0 +1,92 @@
|
||||
# P5e wave 3 — integration and the flip, as an executable checklist
|
||||
|
||||
Base `7c6f6886`. Integration tree `~/w7/p5e-int` (branch `p5e-wave2-landed`, fetched to the Windows
|
||||
worktree `MobileGL-disagg` via remote `wslpipe`, pushed to `origin/feat/disaggregated`).
|
||||
`G` below = `bash /home/swung/w7/notes/tools/p5e_gate.sh int <step>`.
|
||||
|
||||
Rulings this implements: ID-111 … ID-123.
|
||||
|
||||
## Phase A — land the three packages
|
||||
|
||||
| package | tree | scope | brief |
|
||||
|---|---|---|---|
|
||||
| `pa` | `~/w7/p5e-pa` | the program family, 69 of 109 red entries, the per-draw pull | `TASK-pa.md` |
|
||||
| `mv` | `~/w7/p5e-mv` | `MultiDraw.cpp`'s bound-VAO read, 9 entries (ID-113) | `TASK-mv.md` |
|
||||
| `gl` | `~/w7/p5e-gl` | the gate mechanism + two latent crashes (ID-111/112/115/116/117/118/119/120) | `TASK-gl.md` |
|
||||
|
||||
Merge order: `gl` first (it changes the strict knob and the generator, so the other two want to be
|
||||
measured under it), then `pa`, then `mv`. Expect conflicts only where `pa` and `gl` both touch
|
||||
`PipeInputs.*`; `gl` was told to stay out of `DirectGLES.cpp` and `MultiDraw.cpp`.
|
||||
|
||||
After each merge: `G build`, `G unit`, `G isplit`, `G gpu`, `G gens`. **`gpu` is not optional** —
|
||||
it is the push-monolith runtime arm and the only thing that would catch an ID-81 violation
|
||||
(ID-107/109; the last one cost 137 SEGFAULTs across 38 scenarios).
|
||||
|
||||
## Phase B — make the lane's claim evaluable, then measure it
|
||||
|
||||
1. **Re-take the census on the corrected harness.** The current census re-runs each entry under a
|
||||
FIXED environment, which is wrong for 14 of 109 (the `PersistentMapArm.` and `SmallRing.` and
|
||||
`NamedBlit.` prefixes carry extra `ENVIRONMENT`). Drive the environment from
|
||||
`ctest -L integration-split -N -V` per entry. Until that is done, any marker table is provisional.
|
||||
2. **The census is a first-fault histogram, not an inventory.** The 62 entries that abort on
|
||||
`GetProgramForDraw@DrawArrays` will not go green when that row lands; they will advance to their
|
||||
next pull. Budget a second census immediately after `pa` merges, before claiming any distance to
|
||||
hard green.
|
||||
3. Baselines to record BEFORE the flip so the deltas are attributable (all measured green at
|
||||
`7c6f6886` by the controls scout, re-confirm after the merges):
|
||||
- `MOBILEGL_IPC_RUN_AHEAD=0 ctest --test-dir build-split -L integration-split -j 4` → 116/116
|
||||
- `MOBILEGL_IPC_AUDIT=1 ctest --test-dir build-split -L integration-split -j 4` → 116/116
|
||||
- `MOBILEGL_IPC_STRICT_ERRORS=1 ctest -L unit` → 2250/2250
|
||||
- the default arm's split logs carrying "run-ahead requested … running lockstep"
|
||||
|
||||
## Phase C — the things BRIEF §3 asks for that do not exist or are broken
|
||||
|
||||
| BRIEF item | real state | action |
|
||||
|---|---|---|
|
||||
| §3.4(a) `RUN_AHEAD=0` identical picture | control exists and is green; SSIM harness does not | host-side pixel equality on the lane's readback scenarios is cheaper and stronger than SSIM; write that |
|
||||
| §3.4(b) `VERB_BARRIER=0` red at a barriered row | `scripts/ci/split_negative_controls.sh` **fails its own check** and demands a `Fatal{BarrierViolation}` that cannot fire at `BATCH_WAITS=1` | ID-122: fix, re-specify, or delete with a named reason. Do not leave it |
|
||||
| §3.4(c) Magma logs once and runs lockstep | already true and already in every split entry's private log | assert it, no new fixture |
|
||||
| §3.5 per-package red-once | **not executable** — every candidate is red before the revert (ID-121) | re-sequence after the lane is green; evidence form becomes "the table gains exactly this one pair" |
|
||||
| §3.6 G1 | the gate configures only `build-split`; no pull flavour exists (ID-123) | integrator runs one `-DMOBILEGL_PIPE_PUSH=OFF` configure+build; packages must write "not verified locally", never "G1 green" |
|
||||
| §3.7 `MOBILEGL_IPC_AUDIT=1` clean | measured 116/116 today | re-run post-flip, when a present-ahead client is the new consumer of retired staging |
|
||||
|
||||
## Phase D — the flip, in one commit
|
||||
|
||||
Flip together, never separately:
|
||||
|
||||
- `kMGPipeP5eRunAheadReady` — `MG_Backend/Init.cpp:98`
|
||||
- `kMGPipeP5eClientWaitRuleLanded` — `MG_Pipe/PipeApply.h:969`
|
||||
|
||||
and in the SAME commit, ID-111's one-line fix to the barriered stamp
|
||||
(`MG_Remote/Server/PipeApplier.cpp:1180-1182`), if `gl` has not already landed it. Without it the
|
||||
Vulkan backend stamps every draw unbarriered while its client is still lockstep and dies on the first
|
||||
draw.
|
||||
|
||||
## Phase E — the device matrix
|
||||
|
||||
Four arms, interleaved, 30 s windows, GPU pinned per arm (the pin is lost across app restarts), fan
|
||||
on, and the core each thread landed on recorded:
|
||||
|
||||
| arm | what it answers |
|
||||
|---|---|
|
||||
| monolith | the parity target |
|
||||
| inproc, `MOBILEGL_IPC_RUN_AHEAD=0` | the paired A/B control: identical server code, identical records, the only difference is whether the client waits |
|
||||
| inproc, run-ahead, `PRESENT_CREDIT=1` | the shipping configuration |
|
||||
| inproc, run-ahead, `PRESENT_CREDIT=2` | ID-92's measurement arm |
|
||||
|
||||
**Do not use `MOBILEGL_IPC_VERB_BARRIER=0` as the control** (ID-114): it is the first conjunct of
|
||||
`RunAheadArmed()`, so it turns run-ahead off as a side effect, and it aborts within seconds with
|
||||
`Fatal{UnmigratedPipeInput, "IsCapabilityEnabled@ClientWaitSync"}`.
|
||||
|
||||
Acceptance, in order of what actually decides it:
|
||||
|
||||
1. `cli` per frame falls from ~916 to the handful of records that stay barriered by ID-84.
|
||||
2. `rsp` stops scaling with `draws` (it was exactly the draw count under inproc, 0 under monolith).
|
||||
3. client thread CPU ms/frame falls from 6.1 toward the projected ~3.0 (`PERF-PROFILE-7c6f6886.md` §5).
|
||||
4. fps, last, and only compared within one interleaved session.
|
||||
|
||||
## Phase F — docs
|
||||
|
||||
`CURRENT_STAGE_PROGRESS.md` §2.5, `MEASUREMENTS.md` §10, `ROADMAP.md`'s P5e row, and a P5e report.
|
||||
The perf story belongs in the report, not scattered: `PERF-BASELINE-7c6f6886.md` and
|
||||
`PERF-PROFILE-7c6f6886.md` are its raw material.
|
||||
@@ -0,0 +1,64 @@
|
||||
# INTEGRATOR-DECISIONS-P5E (2026-09-18, base `feat/disaggregated @ 2fde7034`)
|
||||
|
||||
The 19 rulings of `BRIEF-P5E.md` §6 are ACCEPTED as written (resolution column), with the notes
|
||||
below. Numbering continues the campaign's ID series.
|
||||
|
||||
| ID | ruling |
|
||||
|---|---|
|
||||
| 80 | P5e is a phase of its own on the IPC track (P5d → **P5e** → P6): "the client runs ahead of apply on the Espryt draw path". Packages and order per BRIEF-P5E §1: c0e → id → {vi, sb, pg, tx2, fb} ∥ ra; the integration commit flips `kMGPipeP5eRunAheadReady`. |
|
||||
| 81 | Ruling 1 (monolith arm selection): S1–S5's shape — handle arms only under `Transport != Monolith`; the push-monolith build keeps its frontend arms and bytes. |
|
||||
| 82 | Ruling 2: client vertex arrays are REFUSED under run-ahead (`kDrawClientArrays`, `Fatal{UnmigratedVerb,"DrawArrays+CLIENT_ARRAYS"}` shape); lockstep unchanged; staging is P8's. vi answers open item (a) (`DoublePrecisionScenario`) itself and adds a scenario if none exercises it. |
|
||||
| 83 | Ruling 3: the wait decision is the wire-derived predicate `MGPipeBarriered(op, payload, applierState)` computed identically by both roles (static `WaitClass` column + XFB-active from `MGPContextValues` + `kDrawClientArrays`). |
|
||||
| 84 | Ruling 4: rule F is scoped to UNBARRIERED records; barriered records keep P5C semantics (the client is parked in its own wait), which leaves readback / CopyTex / GetTexImage / `set_storage_block_binding` / XFB barriered and trailing. |
|
||||
| 85 | Ruling 5: `set_storage_block_binding` is `kWaitApplied` now; pg's trailing item resolves by `ShaderCso`. |
|
||||
| 86 | Rulings 6, 7: `BindCurrentTextures` memo key = `SamplerViewsSerial` AND `{DrawProgram slot/gen, ShaderCso.Serial, BindingsSerial}`; the image sweep gate = `(ShaderImagesSerial, TextureShutterSerial, ContextSerial, g_backendContextGeneration)`, keeping the window/high-water union. |
|
||||
| 87 | Ruling 8: the program archive is ENCODED per link into SEG_STAGE (rule B); pg MEASURES links/frame, bytes/link and GL-thread ms on MC + a shader pack before declaring done; lazy encode at first bind is the fallback if the cost is visible (> 0.2 ms/frame steady). |
|
||||
| 88 | Ruling 9: a failed relink of a bound program re-issues `create_shader_state` with `LinkStatus = 0` iff the frontend reports it unlinked; never `object_death`. |
|
||||
| 89 | Rulings 10, 11: `set_shader_buffers` window = touched high-water per target, 84 on the wire, backend clamps; three suppressor slots. |
|
||||
| 90 | Ruling 12: Magma's four apply-thread allocator sites live under ONE renamed backend-kind-keyed scope (`MagmaP7AllocatorDebtScope`); Magma stays lockstep (no `kCapRunAheadApply`), every record barriered there. |
|
||||
| 91 | Ruling 13: the deferred-destroy queue stays; an unbarriered enqueue is a finding (ra pins it). |
|
||||
| 92 | Ruling 14: present credit default 1, range 1..8; credit 2 is a device measurement arm. |
|
||||
| 93 | Ruling 15 / 17: `resource_subdata` buffer half `kWaitNone` (the reply Bool is discarded today - the hidden per-64 KB lockstep of the persistent-map push goes away); the texture half keeps its reply (trailing, D-D5). |
|
||||
| 94 | Ruling 16: `MGPImageView::Access` IS encoded on the client (`ImageEmit.h`); the decode moves to `MGPipeValueTypes.h`; the stale server comment is fixed by fb. |
|
||||
| 95 | Ruling 19 / A8: the two unit windows (`set_sampler_views`, `set_vertex_buffers`) MUST cover `[0, MaxTouched…]`; the sink checks at every draw/dispatch (`CheckUnitWindows`); a narrower window is `Fatal{ProtocolCorruption, "<row>.Count"}`. |
|
||||
| 96 | Open item (c): id enumerates the NoSession server-only fixtures that lose death delivery when the mailbox hop is deleted and REWRITES them to drive `object_death` by handle through the applier (keep the cases, change the delivery); if a case cannot be expressed that way it is deleted with the reason in the report - the integrator confirms at landing. |
|
||||
| 97 | Gates per package: build + unit + `integration-split` + `gens`; the strict lane on the scenarios the package names. Phase exit = BRIEF-P5E §3 + §4. No inter-package adversarial review rounds (ID-66); one cross-family review (Kimi K3) at the phase close. |
|
||||
| 98 | Landing flow: package branches `p5e/<slug>` in WSL `~/w7/p5e-<slug>` (worktrees of `~/w7/pipe`'s object store, base = the Windows head fetched by sha); landing = fetch into the Windows worktree `MobileGL-disagg` from remote `wslpipe`, merge (ff when possible), gate on `~/w7/p5d-gate`, push origin. |
|
||||
| 99 | **id 落地裁定(2026-09-18,`p5e/id@0117d157`,unit 2204/2204、isplit 111/111、strict 与基线一致)**,逐条接受它提的六项:(1) 三个 by-handle resolver 声明/定义在各自 registry 旁(`Managers.h`/`Managers.cpp` 的三处),不在 BRIEF 猜的 `Managers.h:309-640` 区间——范围以代码结构为准,BRIEF 的行号是估计值;(2) `DirectGLES.cpp` 的 detach walk 落在 fb 的区间内,因为 `ForEachLive` 改签名后它是唯一调用点,不同提交会断构建——接受,fb 在其上 rebase,该处已具名指向 fb 的反向索引;(3) `Managers.cpp` 的 `HandleOfBuffer` 站点留在 `MGPipeFrontendKeyedRegistryScope` 名下(另一读法会让 Espryt 每条索引 draw 都中止);(4) 四个新公开名按 G2/G14 配 skip twin(unit 2203→2204 即此);(5) `ForEachLive` 只留 handle 臂、删掉弱引用回退——接受,这正是"server 跨记录持有前端对象"的最后一处;(6) **ID-96 的答案是空集**:删掉 NoSession mailbox hop 后,没有任何夹具失去死亡投递(探针在被删分支上跨 2204 unit + 111 isplit 从未触发),因此不改写、不删除任何用例。 |
|
||||
| 100 | id 未做的 `SanityTest` 四处搬迁**不是欠项**:ID-81(handle 臂仅在 `Transport != Monolith`)把前端键控成员保留为 monolith 胶水,那些用例因此仍能编译、仍覆盖该表面、且跑在非 apply 线程上(守卫本就不该触发)。scout-S7 的原设计假设这些成员被删除,与 ID-81 冲突,以 ID-81 为准。 |
|
||||
| 101 | id 额外新增的第二道守卫(`MGPipeRefuseFrontendKeyedRegistryFromUnbarrieredApply`:按前端身份读 registry 状态 / `ForEachLive` 的弱引用走查,不经分配器所以旧守卫看不见)**接受并进入契约 §4.4**:规则是"role 不得按对方身份索引自己的表并交回对方的对象",不只是"不得调对方的分配器"。 |
|
||||
| 102 | red-once 的假绿教训(id 自查发现):在 apply 线程上构造前端对象来驱动守卫是无效对照——构造函数自己会 mint,于是把守卫改回去也照样中止、用例照样"通过"。规则:**red-once 的被测动作必须是那一处探测本身**,前置对象在 client 线程上建好再把探测 post 过去。 |
|
||||
| 103 | **wave 1 集成裁定(`f6cfcbd3`)**:c0e 与 id 并行各写了一份共享 seam,合并后五处重复定义。保 c0e 的 `MGPipeBarriered` 真实实现(静态 wait-class 列 + XFB 升级 + 客户端数组升级),删 id 的恒真占位;当前记录标志保 c0e 的 `thread_local` + setter(它描述"本线程此刻在应用哪条记录",不是 applier 的每上下文状态;读它的守卫不该先去找对的 applier),删 id 的 `MGPipeApplierState` 成员;三个 by-handle resolver 保 id 的真实实现、删 c0e 的 stub(ID-99(1))。**并加就绪闸**:`ApplyOne` 在 `kMGPipeP5eClientWaitRuleLanded`(PipeApply.h,ra 翻)为 false 时一律盖 `true`——谓词说的是客户端"将会"怎么做,而 ra 未落地前客户端仍逐条等待,此时盖 false 会把 §4.4 的豁免从一个客户端自身等待仍使其安全的探测上收回(无缺陷的误杀);谓词照样每条记录计算,整阶段都在被执行而不是等到它开始决定的那天才首次运行。 |
|
||||
| 104 | **`MGPShaderBuffers::WritableMask` 是 Uint32、窗口却是 84 点**(c0e 发现,brief 与 scout S5 都漏了):裁定**加宽字段,让掩码覆盖所声明的窗口**(`Uint32 WritableMask[3]` 或 `Uint64`+`Uint32`),不缩窗口——缩到 32 会改变应用可见行为。POD 尺寸随之增长是可以的:本阶段 ABI fingerprint 已因 opcode 80 变动,`PipeCatalogueTest` 钉新尺寸。**sb 负责改这个 wire 结构**(c0e 已落地的类型文件的一处具名例外),与 emitter 同一提交。 |
|
||||
| 105 | **`MGPProgramDesc` 192 → 200 字节**:接受 c0e 的诚实版本。契约草稿里"塞进现有 pad、尺寸不变"在算术上不可能(固定头在偏移 24 处正好用满,`MGPBlobRef` 按 8 对齐)。不接受挤 `StageMask` 位或压窄 `ReservedNumSamplesOffset` 的替代——用可读的字段换 8 字节是划算的。 |
|
||||
| 106 | **`MG_Backend/Init.cpp` 的 consumer bit 13 由 sb 添加**,且必须与 `ShaderBufferEmit.h` 的 wired 常量同一提交(c0e 故意不加:无 emitter 时先不加是安全方向)。否则客户端的 R-8 存活门会把整族发射扣下。合并时按此核对。 |
|
||||
| 107 | **设备验证发现的 P5e 回归(2026-09-18,头 `44f91c74`)**:`MOBILEGL_TRANSPORT=monolith` 下游戏启动即 SIGSEGV,栈为 `Clear → SyncCurrentFBO → SyncToBackend(前端FBO) → SyncAttachmentSurface(MGPSurface) → SyncMipmapsToBackend(SharedPtr) +0x1`。根因:`SyncMipmapsToBackendByHandle` 传空 `SharedPtr` 并依赖"已记下句柄"把被调函数切到记录臂——有传输时成立,monolith 下无记录臂即空指针解引用(违反 ID-81)。**inproc 臂两次均正常**(31 s 进世界、60 s 采样、140.0 / 144.9 fps、852 draws/帧、零 Fatal),所以这是 monolith 专属回归。修复包 `p5e/fix1` 领走,并须补上门禁漏掉的覆盖:monolith 臂上"清一个带纹理附件的 FBO"没有任何 lane 条目走过,这正是 2250 unit + 113 isplit 全绿却漏掉它的原因。 |
|
||||
| 108 | **设备验证的执行纪律(本轮踩了三个坑,全部是测量污染而非代码问题)**:(a) `adb install` 的收尾会在一两分钟后杀掉正在跑的同包进程(`am_kill … due to installPackageLI`),装包与测量之间必须留出安静期;(b) 派给外部 CLI(Kimi)的任务其进程会活过 harness 的完成通知,**派出后不得自己再跑同一件事**——本轮两套实验同时对一台手机 force-stop / 清 logcat,得出了假的失败;(c) 不得在脚本正被执行时修改它(bash 边读边执行),要改先冻结副本。另:游戏日志里的 `GIT@` 戳记在增量构建下是旧的([[android-build-bisect-traps]] 的老账),判断版本要看库里的符号而不是戳记。 |
|
||||
| 109 | **fix1 的 lane 标签之问,裁定:标签保留,并把 monolith lane 升为集成分支的常设门禁步骤。** fix1 把 `DirectGLES.PushMonolithArm.` 挂上 `integration-split`,理由是该标签指的是"门禁要跑的集合"而不是"跑 inproc"——接受这个读法:ID-81 给 push 构建两条服务端臂,若只有一条在被门禁的集合里,"门禁全绿"就一直等于"两条臂里的一条全绿"。但这不够:fix1 实测 `ctest -L integration-gpu` 在 `44f91c74` 上是 **1157/1294,137 个 DirectGLES SEGFAULT、横跨 38 个 scenario**,而 `build`/`unit`/`isplit`/`strict`/`gens` 五步没有一步会看它。因此 `p5e_gate.sh` 新增 `gpu` 步(`ctest -L integration-gpu`,-j 4 约 10 分钟),**作为集成分支的落地前必跑步骤**,不下放到每个包(太慢,且包级改动的暴露面由 isplit 的两臂条目兜住)。这条同时是 ID-107 那个覆盖漏洞的结构性答案:漏的不是"某个用例没写",而是"整条运行时臂没有被门禁的条目"。 |
|
||||
| 110 | **fix1 报告 §3.5 求裁的 `kNoFrontendBuffer` 座(buffer-texture 的后备存储):裁定改成自述式的传输测试,而不是留作"靠链条安全"。** 该臂把 `kNoFrontendBuffer` 交给查找并依赖记录作答,其键是"已记下句柄"而非传输;它在 monolith 下不可达,只因为记下句柄的每一个写入点碰巧都被传输门住了——这正是让 monolith 臂丢掉 38 个 scenario 的那个形状(fix1 的根因就是一处把"记下了句柄"读成"记录臂会被选中",而这是两句不同的话)。新增 `MGB_TEXTURE_RECORD_ARM_SELECTED()` 把第二句话**只说一次**(`Transport != Monolith` 且 `TextureResourceSubsystemEnabled()`,即 §5.2/§5.8 里每一处可由空前端对象服务的读所共同依赖的两个合取项),`RefuseNullFrontendTextureOffTheHandleArm` 改为引用它(顺带去掉其内嵌 `#if`),`texBufferByRecord` 加为第三个合取项。有传输时该合取项已被 `pushedStorage != nullptr` 蕴含,故不改变任何行为、不关闭任何门;改的是"这条臂自己说出它依赖什么"。落地为 `3cc4e1ec`。 |
|
||||
| 111 | **翻开关的那次提交必须同时修 `ApplyOne` 的 barriered 盖章,否则 Magma 当场死(scout 发现,已自查证实)。** `kCapRunAheadApply` 从不在 DirectVulkan 上发布(`MGPipeTypes.h` 的 `MGPipeRunAheadCapBitsFor` 对非 DirectGLES 返回 `kCapNone`),但 `PipeApplier.cpp:1180-1182` 的盖章只看 `kMGPipeP5eClientWaitRuleLanded ? wireSaysBarriered : true`,**不看后端、不看能力位**。而 `draw_vbo` / `blit` / `clear` / `launch_grid` 都是 `kWaitNone`。于是开关一翻,Magma 的服务端会把每条 draw 记录盖成"未设障",而它的客户端仍在 lockstep——`CountBarrierPull`(`PipeInputs.cpp:95-97`)对未设障记录是**无条件 Fatal**,不经任何旋钮。后果有二:(a) `MagmaP7AllocatorDebtScope` 的豁免被撤回,`DirectVulkan.Split.NamedBlit.*` 在普通 isplit 车道上就红;(b) Magma 的 `*MGB_CTX->GetProgramForDraw()` 变成首帧必死。**裁定**:盖章改为与服务端自身能力的合取,`ServerPublishesRunAhead()`(已存在于 `PipeApplier.cpp:40-44`,读本会话 CallMask,无掩码时答 false,正是 bring-up 窗口要的答案)。`wireSaysBarriered` 仍无条件计算(ID-103 的理由:谓词整阶段都在被执行)。红一次:`RemoteClientTest` 里用一个 CallMask 不含位 10 的会话过一条 `DrawVbo`,断言 `MGPipeApplierCurrentRecordIsBarriered()` 为真;去掉新合取项即变假。这是客户端闩的服务端镜像,也是把 ID-90 从散文变成代码的那一行。 |
|
||||
| 112 | **`EmittedCallSuppliesTheWholeField` 是 Magma 的命根子,必须上编译期绊线。** 任何退役 BARRIER-PULLED 读的包,都只能改 DirectGLES 的消费方,**不得动 `MG_Impl/Pipe/PipeFill.cpp:2499-2519`**:残余填充是 Magma 取这些字段的唯一来源,而 Magma 拿到就解引用。七行里有两行(`GetBoundVertexArray`、`GetBufferBindingPoint`)**目前没有任何编译期保护**,删掉它们会让 Magma 首帧空指针——是设备 SIGSEGV,不是构建失败。**裁定**:把 `PipeFill.cpp:2667-2682` 的 `NoP4aFamilyFieldIsWhollySupplied` 扩成覆盖全部七行(或补第二条具名 `static_assert`),约十行,把 vi/sb 最可能犯的错从设备崩溃变成构建断裂。这是本阶段性价比最高的一处预防性改动,随 wave 3 集成落地。 |
|
||||
| 113 | **`MG_Backend/DirectGLES/MultiDraw.cpp` 归 `mv` 包**,答 vi 留下的开放裁定 R2。BRIEF-P5E §2 的包划分里没有任何一包认领这个文件,于是 9 条 `GetBoundVertexArray@DrawArrays`(全部是 `NumDraws != 1` 的索引 multi-draw)无人负责。vi 当时报"该字段 14 → 0"并非谎报:在 vi 的头上这 9 条更早死在 fb 的 `GetFramebufferBindingSlot@Clear` 上,是 fb 与 tx2 落地才把它们暴露出来。 |
|
||||
| 114 | **lockstep 之下"逐线程 CPU ms/帧"不再是首要指标**(perf scout 的反对意见,接受):它把自旋等待算成工作,而等待账本给出的两个方程在代数上退化,解不出"有用工作"。**裁定**:在 run-ahead 落地之前,首要指标是**扣除等待后的 CPU**——用 simpleperf 取 `Doorbell::Wait` 在 GL 线程与 apply 线程上的**包含式**占比,再乘回逐线程 CPU ms/帧;`MOBILEGL_IPC_SPIN_US=0` 那一臂作为交叉校验(它把等待移出 CPU,其线程 CPU 是有用工作的上界)。两法相差 15% 以内才采信。run-ahead 落地后自旋消失,旧指标恢复为首要。**另**:配对 A/B 控制用 `MOBILEGL_IPC_RUN_AHEAD=0`,**不得用 `MOBILEGL_IPC_VERB_BARRIER=0`**——后者是 `RunAheadArmed()` 的第一个合取项,会把 run-ahead 顺手关掉,而且本轮实测它在几秒内即 `Fatal{UnmigratedPipeInput, "IsCapabilityEnabled@ClientWaitSync"}`,给不出任何性能数字。 |
|
||||
| 115 | **strict 车道在宣布"硬绿"之前必须有阳性对照。** 当前 7 条通过项里没有一条是"带记录的 split GL 场景":三条是 monolith 传输(strict 在那里结构性失效),两条自跳过,一条死亡测试,一条 Python 检查。也就是说今天的"绿"与"strict 根本没武装"在观测上不可区分——这正是 E1/E3(a) 对照存在的理由。**裁定**:硬绿的定义里加一条断言——至少一条**会画东西的 inproc 条目**跑完且服务端盖了 verb 边界、`rsp` = 0。没有这条,116/116 不算数。 |
|
||||
| 116 | **白名单不是写出来的,是推出来的。** BRIEF §3.3 说的"§7 白名单"确实存在——在 `MobileGL/MG_Remote/CONTRACT-P5E.md:475-486`(BRIEF 的"§7"指的是契约,不是它自己),而且 `ra` 已经在 `.github/workflows/test.yml:1207-1292` 落了一份**手抄的 13 行**。**裁定:手抄的那份删掉,改为生成。** 判据是 ID-84 用现有表格的表述:一个 `<field>@<verb>` 对被采纳,当且仅当该字段行是 `BARRIER_PULLED` **且**该 verb 的线上 op 是**静态设障**的(`MGPipeWaitClassFor(op) != kWaitNone`),再与 `kMGPipeClassFieldMask[kMGPipeVerbClass[verb]]` 取交。由 `scripts/gen_pipe_field_ownership.py` 生成 `MGPipeBarrierPullAdmitted(field, verb)`(一张 69 × 128 位的表,运行期零成本),并加 `--print-admitted` 让 shell 与 C++ 读同一张表。这样:退役一个 verb 的等待类会自动收窄白名单;新增一行 BARRIER_PULLED 只在设障 verb 上放宽;跨包漂移不可能。**手抄那份在两个方向上都是错的**:`GetFramebufferBindingSlot@ReadPixels`(21 条,最大的幸存者)本该采纳却不在表里;`GetTextureObject@CopyImageSubData`(6 条)在表里却不该采纳。 |
|
||||
| 117 | **被采纳的 pull 是"响而不致命",这才让车道能真正变绿。** 今天 `CountBarrierPull`(`MG_Backend/MGPipe/PipeInputs.cpp:95-105`)在 strict 下对**每一条** barrier-pulled 读都 abort,不论是否在白名单里——所以 CI 里那段白名单比较是**不可达代码**(`rc != 0` 先退出),"硬绿"在旋钮不变的前提下根本不可能。**裁定**:给它第三态——未设障仍旧 Fatal(不动);设障且**不**被采纳仍旧 Fatal(不动);设障且被采纳则按 `(field, verb)` 去重记一条 `MGPipe: Admitted{UnmigratedPipeInput, "<F>@<V>"} [BARRIER-PULLED, ADMITTED, retires in <phase>]`。**保留 `<field>@<verb>` 与 `[BARRIER-PULLED, …]` 的语法、只换头部标签**,这样 P5c 以来写的每一条匹配 `Fatal{UnmigratedPipeInput` 的过滤器仍然精确地表示"红"。去重是必须的:一帧 852 次 draw 不能写 852 行。这正是 `PipeInputs.cpp:61-65` 那个 `why` 参数被引入的第三个理由。ID-81 无风险:`CountBarrierPull` 只在服务端盖了 verb 边界之后可达,而 monolith 臂从不盖章——今天那 3 条 `PushMonolithArm` 条目通过 strict 正是这个原因。 |
|
||||
| 118 | **`ResourceCopyRegion` 的等待类要改,`CopyImageSubData` 才站得住。** 车道采纳 `GetTextureObject@CopyImageSubData`,但 `generated/PipeWire.inc:412` 说该 op 是 `kWaitNone`;而 `GetTextureObject` 的退役相是 **P7**,不是 P5e。两者不能同时为真:翻开关之后,一条未设障的 copy 记录去读客户端内存,是无条件 Fatal,不经任何旋钮。**裁定:把 `ResourceCopyRegion` 移到设障的等待类**,而不是把字段塞进白名单当例外。理由:(a) 这正是 ID-84 说的"设障记录保留 P5C 语义",白名单随之自动采纳它,无需特例;(b) `CopyImageSubData` 不在逐帧热路径上(Minecraft 场景里每帧零次),一次等待的代价可忽略;(c) 反过来把字段特例化,等于在 P7 之前一直留一条"未设障却读客户端内存"的真实缺陷。 |
|
||||
| 119 | **"`rsp` = 0 on unbarriered records"这条钉子按构造就是空的,措辞要改。** `CountBarrierPull` 的未设障臂在 `++g_residualPulls` **之前**、且是 `[[noreturn]]`,所以未设障的 pull 永远不会加进 `rsp`——它直接 abort。于是 `rsp` 只数**设障**的 pull,那句话无论代码怎么写都成立(契约 `CONTRACT-P5E.md:484` 的论证"非零就说明有一次没触发的 Fatal"因此不成立)。而且翻开关之后,readback 与 XFB 场景**合法地**会有 `rsp > 0`,CI 现在那条"任何非零 rsp 都告警"会在正确行为上一直响。**裁定**:钉子改写为"**`rsp` 只数被采纳的设障 pull,且必须等于被采纳标记的计数**",并按设备证据的形式断言 `rsp` 与 `draws` 的关系而不是与 0 的关系——Redmi 上 inproc 的 `rsp` 恰等于 draw 数(~852)、monolith 为 0,所以 draw 路径退役的可观测形态是"`rsp` 不再随 `draws` 成比例"。 |
|
||||
| 120 | **契约 §8 修正 8 未落地,以代码为准并在契约里标注。** `CONTRACT-P5E.md:503-506` 说 `GetBufferBindingPointCount` 的 sticky forward 在 split 下变 FATAL,但 `FieldOwnership.def:147`(字段行)与 `:179`(forward 行)都仍是 `BARRIER_PULLED`,而生成器拒绝字段/forward 不一致的组合(`FieldOwnershipTest.TheSevenStickyForwardsAgreeWithTheirFieldRows` 钉住)。按写的落地会要么绊生成器、要么连字段行一起改,并改动推导集里 10 个对。**裁定**:本阶段**不**落地该修正;契约里就地标注"UNLANDED,随 P7/P13 落地",代码不动。理由与 ID-105 同源:契约里算术上做不到的话,改契约而不是硬塞代码。 |
|
||||
| 121 | **BRIEF §3 item 5 的证据形式在当前头上不可执行,改写并重新排序。** 它要求"revert 任意一条 handle 臂,strict 车道按 field 与 verb 变红"。但 116 条里今天只有 7 条 strict-绿,而且**没有一条会画东西**(三条 monolith `PushMonolithArm`、两条自跳过的 `PersistentCoherentMapScenario.TheMapLandsInTheArmItsLaneDeclares`、一条死亡测试、一条 `SplitLogPaths` 元数据)。于是每一个候选 revert 在 revert 之前**就已经是红的**——pg 与 fb 的报告早就撞上了这一点("标记不在任何一张表里"、"隔离是按帧的")。**裁定**:item 5 不是与 item 3 并行的,而是**被它门住**;证据形式改为"在车道已绿之后,revert 使标记表**恰好多出**那一个具名 `<field>@<verb>` 对,且别的对不动"。这也顺带给了 ID-115 的阳性对照一个用途:没有阳性对照,"恰好多出一个"是不可判定的。 |
|
||||
| 122 | **`scripts/ci/split_negative_controls.sh` 的 E1 对照今天就是坏的,必须修或重写,不得当作已有证据。** 在门禁树上跑两次都自检失败(`E1 control: 6/8 selected entries did not fail`),而且它索要的 `Fatal{BarrierViolation}` 那行**在 `MOBILEGL_IPC_BATCH_WAITS` 的默认值 1 下根本不可能触发**。一个永远打不出所要求证据的对照,比没有对照更坏:它会在评审里被当成绿的。**裁定**:随 wave 3 集成一并修——要么把控制改成在 `BATCH_WAITS=0` 下跑(那是它隐含假设的世界),要么把它索要的 Fatal 换成在默认配置下真能触发的那一条,并在脚本头部写清它证伪的是什么。修不动就删掉并在报告里具名说明,**不许留着**。 |
|
||||
| 123 | **G1(pull 构建符号恒等)本阶段的门禁跑不了,如实记账而不是假装跑过。** `p5e_gate.sh` 只配置 `build-split` 一种 flavour,没有 pull 也没有 push;fb 与 fix1 都各自报告过这一点。**裁定**:(a) 本阶段 G1 以 CI 为准,包的报告里写"未在本地验证,理由:门禁只配 split flavour",**不得**写成"G1 绿";(b) 集成提交之前,由集成者跑一次 `-DMOBILEGL_PIPE_PUSH=OFF` 的 configure + build 作为一次性核对,把结果记进集成报告。理由与 ID-108 同源:没跑过的东西不许写成跑过了。 |
|
||||
| 124 | **四个 flavour 里只有 split 编得过;`pull` 与 `push` 在 `7c6f6886` 上都是坏的。** 这条经历了两次自我更正,过程本身就是结论。第一次:我加了 `p5e_gate.sh flavours` 步,`pull` 臂报 rc=0 / 982 TU——**假绿**。`CMakeLists.txt:496-500` 规定 `MOBILEGL_BUILD_DISAGGREGATED=ON` **强制** `MOBILEGL_PIPE_PUSH=ON`,所以 `-DMOBILEGL_PIPE_PUSH=OFF` 被静默覆盖,那一臂其实是 split 构建的第二份拷贝;而 CMakeCache 里那行**仍然写着 OFF**,所以缓存不是证据。第二次:改成从 `compile_commands.json` 断言**实际生效的宏**、不符即失败后,才拿到真数字。**根本不存在"disaggregated 的 pull"这个 flavour。** 实测(均已断言生效宏):`pull`(DISAGG=OFF, PUSH=OFF,push=absent)**rc=1,743 TU**;`push`(DISAGG=OFF, PUSH=ON,push=1)**rc=1,419 TU**。四处编译错误、三个站点,共同的病因是"被 `MOBILEGL_BUILD_DISAGGREGATED` 守着的东西,被没守的代码用了":(a) `DirectGLES.cpp:6716` 的 `keysMatch`(声明在 `#if MOBILEGL_BUILD_DISAGGREGATED` 内,三目的 `:` 分支与使用点在 `#endif` 外)——两个 flavour 都中;(b) `DirectGLES.cpp:5575` 无保护地调用只在 `#if MOBILEGL_PIPE_PUSH` 里声明的 `ComputeShaderStorageBlockBindingSignatureOf`——pull 中;(c) `Managers.cpp:9081` 与 `:9344` 用 `BufferImpl::StagedTextureTargetForPipeTarget`,DISAGG=OFF 时不存在——push 中。**裁定**:(1) 三处由集成者在 wave 3 集成提交里修,**排在 pa 合并之后**(`keysMatch` 的修法必须保持惰性求值:现在的三目在 handle 臂上不会求值 legacy 分支,急切求值会在 pa 之后解引用空的 `currentProgram`,那正是 ID-107 那一类缺陷);(2) `flavours` 步进入集成分支必跑集合,**且必须保留生效宏断言**——没有它这一步会永远报绿;(3) 在此之前包报告里写"G1 绿"不成立(ID-123)。**这与 ID-107 是同一个病的两种时态**:四个 flavour 里只有一个在被编译、两条运行时臂里只有一条在门禁集合里;而且两次我都是先拿到一个"绿"、再发现那个绿是另一条臂冒充的。**规则:一条臂的证据必须包含"它确实是那条臂"的证明。** |
|
||||
| 125 | **ID-116 的采纳规则要补第二个析取项,否则会在一条本阶段无权触碰的行上把车道判红。** pa 退役了逐 draw 的 program 拉取之后,第一故障被揭开,露出 `GetTransformFeedbackProgram@DrawArrays`(11 条)。按静态规则它**不**被采纳(`DrawVbo` 是 `kWaitNone`),但契约 §5.7 把 transform feedback 整个排除在 P5e 之外,`FieldOwnership.def` 给该字段的退役相是"P3b/P4b (Espryt), P7 (Magma)"。**裁定**:设障记录上的 pull,满足以下**任一**即采纳——(1) 该 verb 的线上 op 静态设障(ID-116 原样);**或 (2) 该字段的退役相不指向本阶段**。未设障臂不动,仍是先行的 `[[noreturn]]`。析取项 (2) 才是 ID-84 的诚实表述:设障记录的 pull 按构造就是合法的,剩下的唯一问题是"P5e 是否还欠这次迁移",而退役相那一列正是这个问题的答案——数据早就在生成器读的表里,只多读一列。核对:应采纳 `GetFramebufferBindingSlot@ReadPixels`(1)、`GetTextureUnitObject@CopyTexImage2D`(1)、`GetTransformFeedbackProgram@DrawArrays`(2)、`GetTextureObject@CopyImageSubData`(2,且 ID-118 之后 (1) 也成立)、`ValidateProgramName@ShaderStorageBlockBinding`(2)、DirectVulkan 的 `GetFramebufferBindingSlot@Clear`(2);应拒绝 `GetProgramForDraw@DrawArrays` 与 `GetBoundVertexArray@DrawArrays`。 |
|
||||
| 126 | **pa 的臂选择是合取 `ProgramHandleArm() && TextureImpl::UnitTexturesByHandle()`,接受,并具名说明它的含义。** 后果是"program 位开、texture 位关"的混合 A/B 仍会拉取。这是对的而不是将就:被提升的那个值服务四个消费方,臂必须点到**每一个**,而 `ResolveAndBindUnitTextures` 的 legacy 臂(`sampledTargetForUnit`,`DirectGLES.cpp:6175`)确实读真实对象。两个子系统位是**各自独立的 A/B 控制**,混合档是诊断用的臂、不是发布配置;为一个没人发布的配置去给 `sampledTargetForUnit` 加归档臂(tx2 的活)不划算。**若将来有人要发布混合档,先补那个臂再改这里的合取,不得反过来。** |
|
||||
| 127 | **我自己又踩了 ID-108(c):在 pa 的 `gpu` 跑步途中改了 `p5e_gate.sh`,它的驱动打出了解析错误。** ctest 结果未受影响(改动在另一个 case 分支里),但证据被搅浑了,而这正是本轮我反复写在裁定里的那条纪律。**裁定**:(1) wave 3 剩余时间内该脚本冻结,不再编辑;(2) 更根本的修法,留给下一阶段的工装:包的门禁调用应当先把驱动脚本复制到自己的 `.p5e/` 下再执行,这样集成者的编辑与包的执行在时间上解耦——`run_arm_frozen.sh` 在设备侧已经是这个模式(ID-108(c) 的第一次),只是没有推广到主机侧。 |
|
||||
| 128 | **采纳规则的第三个析取项:按升级设障的记录。** 合并 pa + mv 后在全部 180 条上重跑修正过的逐条普查(每条用它**自己**的命令与环境,取自 `ctest --show-only=json-v1`,只在最上层叠加 strict 旋钮与私有日志路径),`GetProgramForDraw@DrawArrays` 已归零,剩下八行里有七行被 ID-116/ID-125 的两个析取项覆盖,**只剩 2 条无人认领**:两条都是 `ClientVertexArrayScenario.*`,即**客户端顶点数组**。ID-82 把它整个排除在 P5e 之外(run-ahead 下客户端具名拒绝,staging 归 P8),读点 `SyncClientSideVertexArraysForDrawArrays`(`DirectGLES.cpp:2223`)自己在被未设障应用时就 `Fatal{RoleViolation, "MGPipeSlots"}`。所以这次 pull 合法——但析取 1 不成立(`DrawVbo` 是 `kWaitNone`),析取 2 也不成立(`GetBoundVertexArray` 的退役相**确实**指向 P5e,对**普通** draw 路径而言这是对的,而那条路径 vi 与 mv 已经退役了)。**裁定**:补第三个析取项——记录是**按升级**而非按静态类设障的,即 `wireSaysBarriered(op, payload, st) && MGPipeWaitClassFor(op) == kWaitNone`。两半都已存在:`ApplyOne` 本来就无条件计算 `wireSaysBarriered`(ID-103 的理由),静态类就是生成器读的那张表;所以只是在现有 barriered 盖章旁边多盖一个位,不是新管线。**为什么这是原则性的而不是打补丁**:按 ID-83,升级只发生在 XFB 活跃与客户端数组两种 draw 上,而契约把**两者都**放在 P5e 之外。它同时也是 `GetTransformFeedbackProgram@DrawArrays` 更真实的理由(目前由析取 2 按相位采纳)——两者都成立之后,保留析取 2,不要替换。**"硬绿"的可检查定义**:三个析取项 + ID-117 的"响而不致命"落地后,strict 车道应报 **180/180 通过**,八行为 `Admitted{`、`Fatal{` 为零。达不到就报具体剩余标记,不许为了凑数改规则。 |
|
||||
| 129 | **"没有 stamp 行的 verb 什么都不采纳"——接受,这是 gl 自己的判断而不是 ID-125 说过的,但它是对的,而且是差 174 对与 491 对的那一刀。** 理由:`kMGPipeClassFieldMask[verbClass]` 是该 verb 的 may-read 表;一个不在自己 verb 类 may-read 掩码里的字段,**客户端的残余填充从来没有拷贝过它**,所以服务端去读它拿到的是**上一条 verb 的值**——那正是世代毒化机制存在要抓的陈旧读,与是否设障无关。ID-116 原本就写了"再与 `kMGPipeClassFieldMask` 取交",gl 的做法是它的忠实实现。两个集合之间取小的那个:采纳集合宁可窄,窄了会多红一条要人解释,宽了会放过真缺陷。 |
|
||||
| 130 | **"硬绿"的数字按 gl 的车道切分重述:不是"一条标签上 180/180"。** item 7 把两条 DirectVulkan 条目移到自己的标签上,所以判据是**两句**:(a) Espryt 车道全绿、`Fatal{` 为零、`Admitted{` 全部与生成表对得上、棘轮两侧都不动;(b) Magma 车道在 strict 下**预期红**且其标记被具名断言(契约 §7 早就是这么写的,只是没有车道)。合并后的具体条数以集成树实测为准,不预先钉死——**ID-128 里"180/180"那个数字作废,判据以本条为准**。为什么值得改:把两条 Magma 条目留在 Espryt 的白名单里,会让"Espryt 的白名单"变成一句关于两个后端的话,而 §7 说的不是那个意思。 |
|
||||
| 131 | **`ctest -L` 是正则,不是相等——记一条通用规则。** gl 发现我在 brief 里指定的标签 `integration-split-magma` **仍然会被 `-L integration-split` 匹配到**,也就是那两条条目根本没离开 Espryt 车道;它实测后改名为 `integration-magma-split`。**规则:新标签不得以既有标签为前缀**,且新增标签后必须实测 `ctest -N -L <旧标签>` 的条数没有把新条目算进去。这与 ID-124 的"一条臂的证据必须自证它确实是那条臂"是同一条:**过滤器写对了不等于过滤器选中了你以为的集合,要数一遍。** |
|
||||
| 132 | **strict 车道硬绿是必要条件,不是充分条件——而且是结构性的,不是这次没测到。** 把两个常量翻开之后(`p5e/flip @ 985ae62d`),`unit` 2254/2254、`gens`、`flavours` 全绿,但 `isplit` 掉到 **112/181**、`gpu` 掉到 **1290/1359**,而且**是 flaky 的**(-j 4 红 71 条、-j 1 红 68 条,单跑一条先过后崩)。全量普查:70 条红、17 个不同的 `<field>@<verb>` 对、只涉及**四个字段**(`GetRenderStateParametersVersion` 27、`GetTextureContextId` 25、`GetBufferBindingSlot` 16、`IsCapabilityEnabled` 2),横跨十一个 verb,其中包含 `ReadPixels`、`GetSyncStatus` 这些**本身就设障**的。**为什么 strict 不可能抓到它**:strict 跑在 lockstep 下,`ApplyOne` 把每条记录都盖成 barriered,所以任何"只在客户端不再等待时才发生"的事,它按构造就看不见。strict 量的是**剩余欠债**,不是 run-ahead 的**正确性**。**裁定**:(1) 阶段出口判据里必须加一条独立的"翻开开关后的车道",不得用 strict 硬绿代替;(2) 一个字段在一个 verb 上稳定失败是漏迁移,**四个字段散在十一个 verb 上且 flaky 是竞态**——按后者查,不按前者查;(3) 首要嫌疑是 `gPipeInputs` 这块共享可变内存的互斥**本来就是 lockstep 本身**:run-ahead 下客户端仍为**设障** verb 填充它(`PipeFill.cpp:3219`,`fillOwed = barriered`),而 apply 线程可能仍在排空**更早的未设障**记录并读同一块。这与项目自己早就写下的结论一致——P5d 的研究结论就是"退役这道障需要 `gPipeInputs` 版本化/双缓冲",并已排到 P11(ROADMAP 的 P11 行)。若查实如此,**"run-ahead 不能在 P11 之前落地"是一个完整且可接受的结论**,交由 `ra2` 包带证据回答。 |
|
||||
| 133 | **间接 multi-draw 的等待类升级,取 ID-118 的先例。** ra2 留的 18 条红全是 `GetBufferBindingSlot@DrawArrays [UNBARRIERED]`,落在 mv 为强制两个间接档位而注册的两条车道上;它犹豫的理由是"间接 draw 是热路径"。**这个理由在这里不成立**:`MOBILEGL_ESPRYT_MULTIDRAW_MODE` 默认 `auto`,而 mv 实测 `auto` 在本驱动上解析为 `ext`(它把档位日志提到 INFO 扫了全部六档,每档都解析为自己)。所以间接档是 opt-in,升级它们的等待类对发布路径零成本;非默认档上正确性优先于速度,`GetBufferBindingSlot` 由 P8 正式退役。 |
|
||||
| 134 | **两条 `ClientVertexArrayScenario` 单独成车道并转为"预期红"。** 它们不可能绿、也不该绿:ID-82 规定 run-ahead 下客户端内存顶点数组是**具名拒绝**,所以中止**就是**设计行为,一条要求它们绿的车道等于在要求那条拒绝不要触发。形制照 gl 的 Magma 切分(其 item 7):自有标签 + 断言**具体标记**而不是"容忍失败"的预期红步 + 从必须全绿的车道里移除。命名遵 ID-131:`ctest -L` 是正则,新标签不得被 `-L integration-split` 匹配到,且要用 `ctest -N -L integration-split` 数出来正好少两条来证明。 |
|
||||
| 135 | **ID-132 的自我更正:我点对了对象,点错了机制。** 我当时断言 `gPipeInputs` 的**字段值**竞态,并据此怀疑要等 P11 的版本化。ra2 实测证明:字段值**已经**由 `SuppliedFieldMask` 分区、不竞态;真正竞态的是**元数据标量**(`CurrentVerbSerial`、verb 边界标志、`m_currentVerb`)。而且真正让它不可见的是守卫本身:`RefusePipeInputsTouchWhileApplierOwnsIt` 的 run-ahead 臂对任何 `isBarrieredFill` 一律豁免,豁免的依据是一句**关于未来**的断言("客户端马上就要 park"),而实际顺序是 fill → emit → park。修法是把那句断言**变成事实**(写块之前强制等待)并让守卫去测事实。第二个缺陷同源:`MGP_VERB_OP_LIST` 把整个 draw 家族并到一行,于是十九个索引 draw verb 都答"设障"、都去填充、都不 park。**记这条的原因**:ID-132 的怀疑方向有用,结论不可信;下一个读到 ID-132 的人必须知道它哪半截经受住了证据。P11 的行仍然成立(一般情形),其最小充分形式见 ra2 报告 §5——特别是"只加 per-role 盖章而不做值版本化会比现状更糟"那一段。 |
|
||||
| 136 | **ID-133 的前提被实测推翻两处,撤回其中的升级,改走 ra2 提的更好解法;并把 `MultiDraw.cpp` 这一处越界授权给 ra2。** (1) **根本不存在"间接 multi-draw 的 op"**:二十个 draw 入口全部塌缩到一条 `draw_vbo`,档位是服务端按批次解析的,所以升级只能键在 `NumDraws > 1 && !kDrawIsIndirect` 上——**代价并不局限在 opt-in 车道**,普通 `glMultiDraw*` 在默认的 `ext` 档上也开始等了。那是在**手机实际发布的那条臂**上、为满足一条车道而引入的**逐 multi-draw 会合**,正是本阶段要消灭的东西,不能作为终局。(2) 那次 pull 是 `BoundDrawIndirectBufferId`(`MultiDraw.cpp:87`)在档位自己的 scratch buffer 周围**保存/恢复一个 GL 绑定名**,**不是数据依赖**,所以可以直接退役——给它邻居 `ResolveBoundIndexBuffer` 已有的 handle 臂即可。**裁定**:退役该 pull 并**同时**撤回升级 (iii),两半必须同一提交(只做一半的任一中间状态都不是我愿意 gate 或测量的状态);为此把 ID-113 划给 mv 的 `MultiDraw.cpp` 就这一处授权给 ra2,提交里具名说明,以免边界被误读为漂移。**留给全阶段的规则**:为了让一条车道变绿而加的等待,是真实路径上的真实代价;对任何升级要问的是**"哪条臂在为它买单"**,而不是"哪条车道绿了"——ID-133 我没问这句,ra2 问了。 |
|
||||
@@ -0,0 +1,57 @@
|
||||
# Read-only audit brief (Kimi): every apply-thread read of client-owned memory on the DirectGLES inproc draw path
|
||||
|
||||
Repository: the current directory (MobileGL, branch `feat/disaggregated`, head `2fde7034`). READ-ONLY:
|
||||
do not edit any file, do not build, do not run tests, do not touch adb or WSL. Use your file reading
|
||||
and grep tools only. Write the report file named at the end BEFORE your final message.
|
||||
|
||||
## Context
|
||||
MobileGL's split (`MOBILEGL_TRANSPORT=inproc`) runs the GL frontend on the application's GL thread
|
||||
("client role") and the backend (`MobileGL/MG_Backend/DirectGLES`) on an apply thread ("server role",
|
||||
`MobileGL/MG_Remote/Server/ServerLoop.cpp`, records applied by `MobileGL/MG_Remote/Server/PipeApplier.cpp`).
|
||||
Today every draw/clear/blit/dispatch waits for the apply thread (`MobileGL/MG_Remote/Client/ClientSession.cpp`,
|
||||
`EmitAndWaitTails`, the R-1 barrier). The next phase (P5e) wants the client to publish those records
|
||||
and continue WITHOUT waiting. That is only safe if, while applying a record, the apply thread reads
|
||||
nothing that the GL thread may be mutating at the same time.
|
||||
|
||||
Client-owned memory = anything reachable from `MG_State::pGLContext` / the `GLContext` object (binding
|
||||
tables, `TextureUnit` arrays, `BindingSlot`s, `VertexArrayObject` attributes, `ProgramObject` internals,
|
||||
`FramebufferObject` attachments, `BufferObject` shadow bytes), the frontend objects those slots hold
|
||||
(`ITextureObject`, `BufferObject`, `SamplerObject`, ...), the client slot allocator `MGPipeSlots()`
|
||||
(`MobileGL/MG_Impl/Pipe/SlotAllocator.*`, probed via `HandleOf`/`FindByLifetimeId`/`GetOrCreate(const StatePtr&)`
|
||||
in `MobileGL/MG_Backend/DirectGLES/SlotTables.h` and `HandleOfBuffer` in `Managers.cpp`), and the
|
||||
BARRIER_PULLED rows of `gPipeInputs` (`MobileGL/MG_Pipe/FieldOwnership.def`, storage
|
||||
`MobileGL/MG_Backend/MGPipe/PipeInputs.h`, read through `MGB_CTX->...`). Server-owned memory =
|
||||
`MG_Pipe::MGPipeApplier()` state, the twin objects in the DirectGLES registries, the server staged
|
||||
stores (`ServerStaged()`, `ServerStagedTexture()`), records and `SEG_STAGE` bytes.
|
||||
|
||||
## Task
|
||||
Starting from the record sinks in `MobileGL/MG_Remote/Server/PipeApplier.cpp` (`ServerVerbSink::OnDrawVbo`,
|
||||
`OnClear`, `OnBlit...`, `OnDispatch...`, `OnGenerateMipmap`, `OnCopyFramebufferToTexture`, and every
|
||||
`MGPipeApply*` record apply in `MobileGL/MG_Pipe/PipeApply.cpp`), follow the calls into
|
||||
`MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp` and `Managers.cpp` (PrepareForDraw, PrepareForCompute,
|
||||
SyncNeccessaryBuffers, SyncVaoAttributeBuffersByHandle, SyncNeccessaryTextures, SyncCurrentProgram,
|
||||
BindCurrentProgramWithResources, BindCurrentTextures, SyncCurrentFBO, BindCurrentFBO,
|
||||
SyncImageTextureBindingsForDraw, SyncBufferBindingPoints, Clear, BlitFramebuffer, GenerateMipmap,
|
||||
EnsureBufferResource*, IsBufferDrawClean*, and everything they call) and list EVERY site that reads
|
||||
client-owned memory, with the arm it is on when the transport is active (some sites have a record
|
||||
arm and a legacy arm; say which runs under `MG_Config::Transport != Monolith` with all
|
||||
`MOBILEGL_PIPE_PUSH` subsystem bits set).
|
||||
|
||||
For each site: `file:line`, the function, what is read (which client object/field/table), the kind
|
||||
(live dereference / lifetime-id + allocator probe / allocator mint / `gPipeInputs` BARRIER_PULLED row),
|
||||
whether it runs on every draw or only on a memo miss / rare path, and which pushed record or applier
|
||||
state field already carries the same information (look in `MobileGL/MG_Pipe/PipeApply.h`
|
||||
`MGPipeApplierState`, `MobileGL/MG_Pipe/MGPipeTypes.h`, `MobileGL/MG_Pipe/PipeCalls.def`) or "none".
|
||||
|
||||
Also list: (a) every `MGPipeFrontendKeyedRegistryScope` / `MGPipeReverseAnnouncementScope` construction
|
||||
site and what it wraps; (b) every place the apply thread holds a `SharedPtr` to a frontend object
|
||||
across records (memos, sync lists); (c) every `MGB_CTX->` accessor used from `MG_Backend/DirectGLES`
|
||||
whose row in `FieldOwnership.def` is BARRIER_PULLED.
|
||||
|
||||
Output: a markdown table per family (VAO/vertex, buffers, textures/samplers, framebuffers/attachments,
|
||||
images, programs/shader state, binding-point tables, XFB, misc), then the three lists, then a short
|
||||
"what would have to change for the apply thread to read only server-owned memory" per family
|
||||
(one paragraph each, no code). No process narration. <= 400 lines. Every `file:line` must resolve
|
||||
at head `2fde7034`.
|
||||
|
||||
Write the report to: `C:/Users/geekerwan/AppData/Local/Temp/claude/C--Users-geekerwan-AndroidStudioProjects-FoldCraftLauncher-MobileGL-disagg/5007453d-cb19-4ebf-96a3-60ba4fb55b47/scratchpad/p5e/kimi-audit.md`
|
||||
@@ -0,0 +1,130 @@
|
||||
# Device verification brief (Kimi): build FCL with the P5e MobileGL and prove it still runs
|
||||
|
||||
You are verifying a rendering-library change on a real Android phone. The change under test is
|
||||
`MobileGL` at commit `44f91c74` on branch `feat/disaggregated`: a large refactor (about 9,800 lines)
|
||||
that stops the rendering backend from reading the GL frontend's live objects and makes it read the
|
||||
pushed record stream instead. The threading is UNCHANGED by it — the split still runs lockstep —
|
||||
so the question this run answers is "did the refactor break rendering?", not "is it faster". Build the launcher, install it,
|
||||
run the game, and report what actually happened. Do not change any source file — if something does
|
||||
not build or does not run, report it precisely; fixing it is not your job.
|
||||
|
||||
## The one hard rule about hardware
|
||||
|
||||
**The only device you may touch is the Redmi with serial `2f7cbe2e`.** Every adb command must carry
|
||||
`-s 2f7cbe2e`. Never run a bare `adb` command that could pick another device, never `adb
|
||||
disconnect`/`kill-server`, never reboot, never factory-reset anything. The phone is rooted: `adb -s
|
||||
2f7cbe2e shell su -c '<cmd>'` works when you need root (you need it only for the fan and the
|
||||
thermal/clock reads below).
|
||||
|
||||
## 1. Build
|
||||
|
||||
Windows, Git Bash. The launcher repo is `C:/Users/geekerwan/AndroidStudioProjects/FoldCraftLauncher`;
|
||||
its `settings.gradle.kts` already points the `:MobileGL` subproject at the worktree
|
||||
`MobileGL-disagg`, which holds the change under test. Do not modify either.
|
||||
|
||||
```bash
|
||||
cd /c/Users/geekerwan/AndroidStudioProjects/FoldCraftLauncher
|
||||
export JAVA_HOME="C:/Program Files/Java/jdk-21"
|
||||
export JAVA_TOOL_OPTIONS='-Djdk.net.unixdomain.tmpdir=C:\Users\geekerwan\.gradle\uds'
|
||||
./gradlew.bat :FCL:assembleFordebug -Pmobilegl.buildDisaggregated=ON -Pmobilegl.buildDisaggregatedInproc=ON -Pmobilegl.pipePush=ON --console=plain
|
||||
```
|
||||
- `JAVA_TOOL_OPTIONS` is not optional: without it every gradle invocation dies with
|
||||
`Unable to establish loopback connection`.
|
||||
- The three `-P` flags are what select the split (disaggregated) build of the native library. A build
|
||||
without them is not the thing under test.
|
||||
- Expect ~1-3 minutes and `BUILD SUCCESSFUL`. If it fails with
|
||||
`Could not move temporary workspace ... transforms`, that is a known flaky gradle cache error —
|
||||
run the same command again once. Any other failure: capture the first 40 lines of the error
|
||||
(especially any `error:` line naming a `.cpp`/`.h` file) and STOP; report it.
|
||||
- Output: `FCL/build/outputs/apk/fordebug/FCL-fordebug-1.3.3.2-all.apk` (~717 MB). Record its
|
||||
timestamp and confirm it is newer than when you started.
|
||||
|
||||
## 2. Install
|
||||
|
||||
```bash
|
||||
adb -s 2f7cbe2e install -r /c/Users/geekerwan/AndroidStudioProjects/FoldCraftLauncher/FCL/build/outputs/apk/fordebug/FCL-fordebug-1.3.3.2-all.apk
|
||||
```
|
||||
Expect `Success`. Confirm with
|
||||
`adb -s 2f7cbe2e shell "dumpsys package com.tungsten.fcl.mgdebug.debug | grep lastUpdateTime"`.
|
||||
|
||||
## 3. Prepare the run
|
||||
|
||||
```bash
|
||||
# split (the thing under test):
|
||||
adb -s 2f7cbe2e shell "echo inproc > /sdcard/FCL/mg_transport.txt"
|
||||
adb -s 2f7cbe2e shell "rm -f /sdcard/FCL/mg_env.txt" # no extra env for the first run
|
||||
# fan on so nothing thermal-throttles, and keep the screen awake:
|
||||
adb -s 2f7cbe2e shell "su -c 'echo 2 > /sys/class/xm_power/hw_monitor/pwm_fan/target_level'"
|
||||
adb -s 2f7cbe2e shell input keyevent KEYCODE_WAKEUP
|
||||
adb -s 2f7cbe2e shell input keyevent 82
|
||||
adb -s 2f7cbe2e shell svc power stayon true
|
||||
adb -s 2f7cbe2e logcat -c
|
||||
```
|
||||
`/sdcard/FCL/mg_transport.txt` selects the transport at launch: `inproc` = the split build under
|
||||
test, `monolith` = the single-threaded control.
|
||||
|
||||
## 4. Run and watch
|
||||
|
||||
Start a background log capture, then launch. The app counts down ~5 s and auto-launches Minecraft
|
||||
26.3-rc-3 into the world `test`; the world takes 1-3 minutes to load.
|
||||
|
||||
```bash
|
||||
adb -s 2f7cbe2e logcat -v time -s MobileGL:I > /c/.../kimi-run-inproc.log 2>&1 &
|
||||
adb -s 2f7cbe2e shell am start -n com.tungsten.fcl.mgdebug.debug/com.tungsten.fcl.activity.SplashActivity
|
||||
```
|
||||
**The in-world signal** is the renderer's own periodic line in that log:
|
||||
```
|
||||
MGPipe stats: frames=<N> window=120 draws=<M> draws/f=<D> ...
|
||||
```
|
||||
The game is genuinely rendering the world once three consecutive lines show `draws/f` above ~400
|
||||
(a menu draws a handful; the world draws ~850). `frames=` must keep climbing.
|
||||
|
||||
Once in-world, let it run 60 seconds, then collect:
|
||||
- **fps**: from two `MGPipe stats:` lines ~30 s apart — `(frames2 - frames1) / (seconds between their
|
||||
timestamps)`. Report the number and the two lines you computed it from.
|
||||
- **a screenshot**: `adb -s 2f7cbe2e exec-out screencap -p > /c/.../kimi-inproc.png`, then look at it
|
||||
and say in one sentence what is on screen (a Minecraft world? a black screen? a menu?).
|
||||
- **liveness**: `adb -s 2f7cbe2e shell pidof com.tungsten.fcl.mgdebug.debug` must still print a pid.
|
||||
- **the failure scan**: search the whole captured log for `Fatal{`, `FATAL`, `abort`, `SIGSEGV`,
|
||||
`SIGABRT`, `RoleViolation`, `UnmigratedPipeInput`, `UnmigratedVerb`, `ProtocolCorruption`. Also
|
||||
`adb -s 2f7cbe2e logcat -d -b crash -v time | tail -40`. **Quote verbatim anything you find** —
|
||||
one of these lines is the single most important thing you can bring back. Note: two lines are
|
||||
EXPECTED and harmless, ignore them: `Failed to load EGL function: eglSwapBuffersWithDamageEXT`
|
||||
and `... eglUnlockSurfaceKHR`.
|
||||
|
||||
Then stop it: `adb -s 2f7cbe2e shell am force-stop com.tungsten.fcl.mgdebug.debug`.
|
||||
|
||||
## 5. The control run
|
||||
|
||||
Repeat section 3-4 with `echo monolith > /sdcard/FCL/mg_transport.txt` and a separate log file
|
||||
(`kimi-run-monolith.log`, `kimi-monolith.png`). This is the same library running single-threaded: it
|
||||
tells us whether anything you saw in the split run is specific to the change or true of both.
|
||||
|
||||
## 6. Restore the device
|
||||
|
||||
```bash
|
||||
adb -s 2f7cbe2e shell am force-stop com.tungsten.fcl.mgdebug.debug
|
||||
adb -s 2f7cbe2e shell "su -c 'echo 0 > /sys/class/xm_power/hw_monitor/pwm_fan/target_level'"
|
||||
adb -s 2f7cbe2e shell svc power stayon false
|
||||
adb -s 2f7cbe2e shell "echo monolith > /sdcard/FCL/mg_transport.txt"
|
||||
```
|
||||
|
||||
## 7. The report
|
||||
|
||||
Write it to the path given at the end of this brief BEFORE your final message, then answer with two
|
||||
lines: the report path and a one-word verdict (`PASS` / `FAIL` / `BLOCKED`).
|
||||
|
||||
The report must contain, in this order:
|
||||
1. **Verdict**, one line: does the split build run the game normally? PASS only if it reached the
|
||||
world, kept rendering for 60 s, showed no Fatal/crash, and the screenshot shows the world.
|
||||
2. Build: the command you ran, BUILD SUCCESSFUL or the error, the APK timestamp, whether you had to
|
||||
retry.
|
||||
3. Split run: time to in-world, the fps you computed and the two lines behind it, the screenshot
|
||||
description, pid alive yes/no, and the failure scan (verbatim quotes or "none found").
|
||||
4. Monolith run: the same four items.
|
||||
5. A short comparison: split fps vs monolith fps, and anything that differed between the two runs.
|
||||
6. Anything unexpected you saw and did not understand — describe it rather than explaining it away.
|
||||
|
||||
Do not edit source files, do not commit anything, do not push, do not touch any other device or any
|
||||
other repository. If a step cannot be completed, say which step and why, and continue with the steps
|
||||
that do not depend on it.
|
||||
@@ -0,0 +1,198 @@
|
||||
# P5e:退役 Espryt draw path 的 lockstep(run-ahead)
|
||||
|
||||
头 `5c007b22`,`feat/disaggregated`。契约 `MobileGL/MG_Remote/CONTRACT-P5E.md`,裁定
|
||||
`~/w7/notes/p5e/INTEGRATOR-DECISIONS-P5E.md`(ID-80..136)。**run-ahead 已武装,阶段未收官**(见"什么没完成")。
|
||||
|
||||
## 目标
|
||||
|
||||
P5c 让 `inproc` 成为只经 wire 交换的诚实两角色,P5d 把它的 CPU 代价压下来,但 R-1 的 lockstep 还在:
|
||||
客户端每条 `kCtxVerb` 都要等 `appliedSeq == emitSeq`。P5e 退役 draw path 上的这道等待——**客户端发了就走**,
|
||||
只有"设障"的记录才等。
|
||||
|
||||
一条记录能否未设障,取决于**应用它时会不会读客户端内存**。所以这个阶段的绝大部分工作不是改等待逻辑,
|
||||
而是把后端仍在读前端对象的那些点迁到记录上;等待规则本身是最后一步。
|
||||
|
||||
## 落地了什么
|
||||
|
||||
十二个包,三波:
|
||||
|
||||
| 波 | 包 | 一句话 |
|
||||
|---|---|---|
|
||||
| 1 | c0e | 契约与线上行:`PipeCalls.def` 第五列 `WaitClass` + `MGPipeWaitClassFor`、`set_program_bindings`(opcode 80)、`kCapRunAheadApply`(位 10,只在 DirectGLES 臂)、`kDrawClientArrays`、子系统位 13、两个旋钮、跨包 seam |
|
||||
| 1 | id | 身份:registry 按 `{slot, gen}` 重键、by-handle resolver、分配器守卫。ID-96 的答案是空集 |
|
||||
| 2 | vi | 顶点输入 / VAO / 索引 |
|
||||
| 2 | sb | 缓冲绑定点;`MGPShaderBuffers::WritableMask` 加宽(ID-104) |
|
||||
| 2 | pg | program:逐 link 的反射归档进 SEG_STAGE、`set_program_bindings` 的三条尾 |
|
||||
| 2 | tx2 | 纹理与 sampler、staged store 的按句柄读 |
|
||||
| 2 | fb | framebuffer、附件、image、blit |
|
||||
| 2 | ra | 传输机制:等待规则、present credit、`gPipeInputs` 变 server 角色内存 |
|
||||
| 2.5 | fix1 | 设备发现的 monolith 臂回归(ID-107),见下 |
|
||||
| 3 | pa | program 家族在 draw / dispatch 路径上离开前端 |
|
||||
| 3 | mv | multi-draw 的前端 VAO 读点;并给五个 multi-draw 档位补上门禁条目 |
|
||||
| 3 | gl | 门禁机制本身,加两处潜伏崩溃 |
|
||||
| 3 | ra2 | 翻开开关后暴露的竞态,以及间接绑定那次 pull |
|
||||
|
||||
**最重要的一条实现事实**:退役 `GetProgramForDraw@DrawArrays`(每帧每次 draw 都触发的那次拉取)
|
||||
**没有改动任何线上结构**。记录早就带着逐 link 的 `ProgramArchive`;缺的只是仍去问前端对象的读者。
|
||||
本阶段多数迁移是这个形状——数据已经在线上,读者没跟上。
|
||||
|
||||
## 三类缺陷,以及各自教的东西
|
||||
|
||||
这一节是本阶段最可复用的部分。
|
||||
|
||||
### 1. 一整条运行时臂没有被门禁(ID-107 / 109 / 110)
|
||||
|
||||
push 构建有**两条服务端臂**,运行时由 `MG_Config::Transport` 选;而 `integration-split` 的**每一条**条目
|
||||
都导出 `MOBILEGL_TRANSPORT=inproc`,split 专属场景又都在 `SetUp` 里自跳过——**手机实际发布的那条臂在
|
||||
门禁集合里零条目**。`44f91c74` 上 unit 2250/2250、`integration-split` 113/113 全绿,同一个头
|
||||
`ctest -L integration-gpu` 是 **1157/1294,137 个 SEGFAULT、横跨 38 个 scenario**,设备上表现为 monolith
|
||||
启动即崩。`66621767` 修复,`gpu` 成为常设门禁步。
|
||||
|
||||
代码形态的教训:**"已经记下句柄"不等于"记录臂会被选中"**,这是两句不同的话;只因"所有写入点碰巧都被
|
||||
传输门住"而安全的座,是靠链条安全,要改成自述式的传输测试(ID-110 的 `MGB_TEXTURE_RECORD_ARM_SELECTED()`)。
|
||||
|
||||
### 2. 构建 flavour 也没有被门禁,而且第一次补的门禁是假绿(ID-124)
|
||||
|
||||
门禁只配 split flavour。补上 `flavours` 步后实测:**四个 flavour 里只有 split 编得过**。
|
||||
|
||||
更值得记的是补门禁本身翻了一次车:第一版 `pull` 臂报 rc=0 / 982 TU,是假的——
|
||||
`CMakeLists.txt:496-500` 规定 `MOBILEGL_BUILD_DISAGGREGATED=ON` **强制** `MOBILEGL_PIPE_PUSH=ON`,
|
||||
所以 `-DMOBILEGL_PIPE_PUSH=OFF` 被静默覆盖,那一臂其实是 split 构建的第二份拷贝;**而 CMakeCache 里
|
||||
那一行仍然写着 OFF**。改成从 `compile_commands.json` 断言**实际生效的宏**、不符即失败,才拿到真数字
|
||||
(743 TU,rc=1)。
|
||||
|
||||
**规则:一条臂的证据必须包含"它确实是那条臂"的证明。** 传的 flag 不是证据,cache 不是证据。
|
||||
同源:`ctest -L` 是正则,新标签不得以既有标签为前缀,且要数一遍(ID-131)。
|
||||
|
||||
### 3. 一个永远打不响的守卫(ID-132 / 135)
|
||||
|
||||
翻开两个常量后 `unit` / `gens` / `flavours` 仍全绿,而 `isplit` 掉到 **112/181**、`gpu` 掉到
|
||||
**1290/1359**,**且 flaky**(-j 4 红 71、-j 1 红 68,单跑一条先过后崩)。全量普查:70 条红、
|
||||
只涉及**四个字段**、横跨**十一个 verb**。
|
||||
|
||||
**判据**:一个字段在一个 verb 上稳定失败 = 漏迁移;**四个字段散在十一个 verb 上且 flaky = 竞态**。
|
||||
|
||||
根因不是当初的猜测。`gPipeInputs` 的**字段值**已由 `SuppliedFieldMask` 分区、不竞态;竞态的是
|
||||
**元数据标量**(`CurrentVerbSerial`、`FilledGen[]`、`m_currentVerb`、`m_serverStampedVerb`)。
|
||||
而让它长期不可见的,是守卫本身:`RefusePipeInputsTouchWhileApplierOwnsIt` 的 run-ahead 臂对任何
|
||||
`isBarrieredFill` 一律豁免,豁免依据是一句**关于未来**的断言——"客户端马上就要 park"——而真实顺序是
|
||||
fill → emit → park。修法是把那句断言**变成事实**(写块之前强制等待),并让守卫去测事实。
|
||||
|
||||
同源的第二个缺陷:`MGP_VERB_OP_LIST` 把整个 draw 家族并到一行,于是十九个索引 draw verb 都答"设障"、
|
||||
都去填充、都不 park。
|
||||
|
||||
契约 §3.2 早就**规定了 per-role 的 stamp 存储,却从未落地**——那个缺口正是这次竞态成立的前提。
|
||||
一份描述"设计意图"而代码另做一套的设计文档,是这类缺陷得以存活的方式;`ARCHITECTURE.md` 的对应段落
|
||||
已按落地实现改写。
|
||||
|
||||
### 贯穿三者的方法论结论(ID-132)
|
||||
|
||||
**strict 车道硬绿是必要条件,而且结构性地不是充分条件。** strict 跑在 lockstep 下,`ApplyOne` 把每条
|
||||
记录都盖成 barriered,所以"只在客户端不再等待时才发生"的事,它按构造看不见。它量的是**剩余欠债**,
|
||||
不是 run-ahead 的**正确性**。阶段出口必须有一条独立的、**翻开开关之后**的车道。
|
||||
|
||||
## strict 车道成为可被脚本判定的硬绿
|
||||
|
||||
`GetProgramForDraw@DrawArrays` 62 → 0,`GetProgramForDispatch@DispatchCompute` 7 → 0,
|
||||
`GetBoundVertexArray@DrawArrays` 9 → 0。采纳规则最终是**三个析取项**,没有一条是预先设计出来的,
|
||||
每一条都是被一条真实条目逼出来的:
|
||||
|
||||
1. 该 verb 的线上 op 静态设障(ID-116);
|
||||
2. 该字段的退役相不指向本阶段(ID-125);
|
||||
3. 记录是**按升级**而非按静态类设障的(ID-128)——XFB 活跃与客户端数组两种 draw,契约把两者都放在
|
||||
P5e 之外。
|
||||
|
||||
白名单由 `scripts/gen_pipe_field_ownership.py` **生成**而非手抄:ra 原本落在 CI 里的 13 行手抄表
|
||||
**在两个方向上都错**(漏了 `GetFramebufferBindingSlot@ReadPixels` 的 21 条,又多了不该采纳的
|
||||
`GetTextureObject@CopyImageSubData`)。被采纳的 pull **响而不致命**(ID-117):同样的标记语法,头部
|
||||
标签换成 `Admitted{`,按 `(field, verb)` 去重。车道是**两侧棘轮**——新出现的对要认领,不再出现的对
|
||||
要删除,否则会"烂绿"。
|
||||
|
||||
棘轮在合并当天就自己点了名:`GetProgramForDraw@DrawArrays` 不再出现(pa 退役了它),
|
||||
`GetBufferBindingSlot@DrawArrays` 新出现(mv 的间接档位逼出了它,而 mv 自己在报告里**先命名了**这行
|
||||
潜伏项,然后才让它触发;它退役在 P8)。
|
||||
|
||||
## 门
|
||||
|
||||
| 门 | 阶段初 | 现在 |
|
||||
|---|---|---|
|
||||
| `unit` | 2250 | **2256 / 2256** |
|
||||
| `integration-split` | 116 | **179 / 179** |
|
||||
| `integration-gpu` | 1294 | **1357 / 1357** |
|
||||
| 构建 flavour | 只有 split 编得过 | **pull / push / split 三个全绿** |
|
||||
| 逐条 strict 普查 | 7 绿 / 109 红 | **179 绿 / 零 `Fatal{`**,八行 `Admitted{` |
|
||||
|
||||
新增的 65 条车道条目,全部覆盖此前**一条门禁条目都没有**的臂或档位。两条预期红车道各自具名断言:
|
||||
`integration-clientarrays-split`(`(Multi)DrawArrays+CLIENT_ARRAYS`)、`integration-magma-split`
|
||||
(`GetFramebufferBindingSlot@Clear`)。
|
||||
|
||||
## 数字
|
||||
|
||||
设备:Redmi `2f7cbe2e`,FCL fordebug + Minecraft 26.3-rc-3 世界 `test`,DirectGLES。
|
||||
|
||||
### 先讲定频,因为第一轮矩阵作废了
|
||||
|
||||
第一轮**没有定 CPU 频**:**monolith 自己那一臂**的逐帧 CPU 在两次运行之间从 4.43 跳到 7.07 ms,
|
||||
而慢的那次**温度更低**(53.5 vs 58.9 °C)——是 `walt` governor 把 policy0 从 2745 拉到 748 MHz,
|
||||
不是热降频。未定频的逐线程 CPU ms/帧**不能跨臂比较**。
|
||||
|
||||
`tools/device_bench/pin_device.sh` 不认识本机 serial 并**明确拒绝猜**(正确,猜错会静默失败);
|
||||
`~/w7/notes/p5e/pin_redmi.sh` 按本机节点写,写序 **min→硬件底 → max→目标 → min→目标**,并**回读
|
||||
`scaling_cur_freq` 验证**,每轮跑前跑后各 check 一次。
|
||||
|
||||
### 为什么值得做(侧写,`7c6f6886`,翻开关之前)
|
||||
|
||||
symbolized `simpleperf cpu-cycles`,客户端 GL 线程:`SessionProducer::WaitForAppliedOrEventBacklog`
|
||||
**31.58% 自身时间**,第二名只有 3.72%。计数器同期显示客户端每帧进入 doorbell 等待约 **916 次**
|
||||
(对 ~849 次 draw),99.8% 靠自旋解决;`MOBILEGL_IPC_SPIN_US=0` 让每次都 park,帧率塌到 **20.9**。
|
||||
**代价是会合本身,不是自旋参数**——所以修法是"不再每次 draw 会合",不是"把每次会合做便宜"。
|
||||
等待之后,客户端线程是一条 1-3% 的长尾:**没有第二个杠杆**。
|
||||
|
||||
### 渲染距离 12:两条臂都撞面板上限
|
||||
|
||||
| 臂 | fps p50 | fps max | client ms/帧 | apply ms/帧 |
|
||||
|---|---|---|---|---|
|
||||
| monolith | 115.4 / 115.6 | 117.5 / 117.2 | 6.25 / 6.45 | — |
|
||||
| inproc run-ahead | 118.0 / 117.6 | 118.6 / 118.5 | 6.87 / 6.92 | 4.35 / 4.43 |
|
||||
| inproc lockstep(`RUN_AHEAD=0`) | 111.6 | 113.7 | 8.16 | 6.53 |
|
||||
|
||||
monolith 与 run-ahead 都撞到 **120 Hz 面板**,只有 lockstep 撞不到。所以这一档回答的是"能不能撞到
|
||||
上限",不是"谁更快"。
|
||||
|
||||
### 渲染距离 32:可比的一轮
|
||||
|
||||
`renderDistance:32`,**~3550 draws/帧**(VD12 的 4.2 倍),**两条臂都远离任何上限**(游戏自身
|
||||
`enableVsync:false`、`maxFps:260`,实测 max 只有 37-71)。静置提到 75-150 s——VD32 的区块流式加载
|
||||
远比 VD12 长。每臂五次,交错。
|
||||
|
||||
| 臂 | n | fps p50 中位 | p50 范围 | client ms/帧 中位 | apply ms/帧 |
|
||||
|---|---|---|---|---|---|
|
||||
| monolith | 5 | 58.5 | 56.3 – 67.9(±10%) | 16.19 | — |
|
||||
| **inproc run-ahead** | 5 | **59.9** | 56.8 – 61.1(±4%) | **15.72** | 11.1 – 12.1 |
|
||||
| inproc lockstep | 2 | 35.5 | 34.5 – 36.5 | 26.17 | 19.7 – 20.5 |
|
||||
|
||||
**结论:齐平。** run-ahead 在两个中位数上都略微领先,但**差值远在 monolith 自身离散度之内,不能读作
|
||||
"比 monolith 快"**。确实超出噪声的是稳定性:monolith 五次 ±10%,run-ahead ±4%。`mono1` 的 67.9 是
|
||||
全场唯一离群值(装包后第一次运行)。
|
||||
|
||||
**相对它取代的 lockstep:p50 +69%、client CPU −40%、apply CPU −43%。** 负载越重越值钱,符合预期——
|
||||
会合次数随 draw 数走,VD12 每帧约 900 次,VD32 约 3600 次。
|
||||
|
||||
两条臂**都是 client 线程打满**(约 94%),所以 client ms/帧 这一列是各自真正的瓶颈,可直接比。
|
||||
|
||||
## 什么没完成
|
||||
|
||||
- **BRIEF-P5E §3 的 item 4 与 item 5**:三条阴性对照、逐包 red-once 重跑。item 5 的证据形式在当时
|
||||
**不可执行**(每个候选在 revert 之前就已经是红的),ID-121 把它重排到车道变绿之后——之后尚未执行。
|
||||
- `scripts/ci/split_negative_controls.sh` 的 E1 对照**自检就失败**,且它索要的 `Fatal{BarrierViolation}`
|
||||
在 `MOBILEGL_IPC_BATCH_WAITS` 默认值 1 下根本不可能触发(ID-122)。一个永远打不响的对照比没有对照更坏。
|
||||
- **G1** 仍由 CI 断言;本阶段门禁只编 flavour,不做符号恒等(ID-123)。
|
||||
- 契约 §8 修正 8(`GetBufferBindingPointCount` 的 sticky forward)标为 **UNLANDED**(ID-120);
|
||||
§3.2 的 per-role stamp 存储同样未落地,正是它让上面第 3 类缺陷成立。
|
||||
- **VD12 面板上限之上谁更快**没有回答:本机定不住更高频率。VD32 那一轮回答了一般性的问题。
|
||||
|
||||
## 下一个机会(不是缺陷)
|
||||
|
||||
VD32 下 apply 线程只有 **11-12 ms**,client 有 **15.7 ms**——**两侧不平衡**。把工作从 client 挪到
|
||||
apply 会直接降低瓶颈。这在 lockstep 下毫无意义(两侧串行相加),**是 run-ahead 解锁出来的方向**,
|
||||
留给后续阶段。
|
||||
@@ -0,0 +1,67 @@
|
||||
# P5e package preamble (read first; applies to every package agent)
|
||||
|
||||
You implement ONE package of P5e ("retire the lockstep on the Espryt draw path"). The plan is
|
||||
`BRIEF-P5E.md` (your package's section is your scope: the files and LINE RANGES you may edit; a line
|
||||
outside your range is the integrator's - ask via your report, do not edit it), the rules are
|
||||
`CONTRACT-P5E-draft.md` (a draft until c0e lands it as `MobileGL/MG_Remote/CONTRACT-P5E.md`; the
|
||||
integrator's rulings in `INTEGRATOR-DECISIONS-P5E.md` override the draft where they differ), and the
|
||||
map of the code is your scout report `scout-S?.md` plus the E note and the Kimi audit
|
||||
(`kimi-audit.md`, an independent list of every apply-thread read of client memory - cross-check
|
||||
your family's rows against it and say in your report which rows you retired, which you left
|
||||
barriered, and which you found not to exist).
|
||||
|
||||
## Where you work
|
||||
|
||||
Your tree is a WSL git worktree: `~/w7/p5e-<slug>` on branch `p5e/<slug>`, reachable from Windows as
|
||||
`//wsl.localhost/Arch/home/swung/w7/p5e-<slug>/` (read and edit files through that UNC path with the
|
||||
file tools; `mkdir` does not work over UNC - create directories with a wsl command). Every shell
|
||||
command runs inside WSL through a script file:
|
||||
```
|
||||
MSYS_NO_PATHCONV=1 wsl.exe -d Arch -- bash -lc "cd ~/w7/p5e-<slug> && <command>"
|
||||
```
|
||||
(For anything longer than one line, write a `.sh` into your tree's `.p5e/` directory over UNC and
|
||||
run it with `bash ~/w7/p5e-<slug>/.p5e/<name>.sh`.) Do not touch any other tree, never `~/w7/pipe`,
|
||||
never the Windows checkouts under `FoldCraftLauncher/`. No adb, no devices. No `git lfs` commands.
|
||||
Never `git reset --hard` / `git checkout -- .` on trees you did not create.
|
||||
|
||||
Build and gate (the split flavour is already configured in `build-split`; the first build after
|
||||
your edits is incremental with ccache):
|
||||
```
|
||||
bash ~/w7/notes/tools/p5e_gate.sh <slug> build # cmake --build build-split, prints errors
|
||||
bash ~/w7/notes/tools/p5e_gate.sh <slug> unit # ctest -L unit (tcache_count=0)
|
||||
bash ~/w7/notes/tools/p5e_gate.sh <slug> isplit # ctest -L integration-split (lavapipe)
|
||||
bash ~/w7/notes/tools/p5e_gate.sh <slug> strict # the strict lane (MOBILEGL_IPC_STRICT_ERRORS=1)
|
||||
bash ~/w7/notes/tools/p5e_gate.sh <slug> gens # gen_pipe / field_ownership / dirty-surface / include-closure / doc citations
|
||||
bash ~/w7/notes/tools/p5e_gate.sh <slug> one '<ctest -R regex>' # a subset, with output on failure
|
||||
```
|
||||
Each writes `~/w7/p5e-logs/<slug>-<step>.log` and prints the tail. A build takes 1-10 minutes; unit
|
||||
~1 min; isplit ~10 s; run them in the foreground (they finish inside the tool's timeout) - if a step
|
||||
exceeds 9 minutes, run it with `run_in_background` and wait for the notification.
|
||||
|
||||
## Rules (the same as every phase)
|
||||
|
||||
- Commit on your branch as you go (`git -C ~/w7/p5e-<slug> commit`), single-line subject
|
||||
`[Scope] (Disaggregated): <what>` with `- ` bullets in the body for the why; NO `Co-Authored-By`,
|
||||
no attribution lines. Check `git var GIT_COMMITTER_IDENT` prints `Swung0x48 <swung0x48@outlook.com>`
|
||||
before your first commit; if not, `git config user.name Swung0x48 && git config user.email
|
||||
swung0x48@outlook.com` in your tree only. Do not push, do not merge.
|
||||
- Every correctness-bearing change gets a red-once: the brief names them; run the red (revert the
|
||||
arm or use the hook), see the named Fatal / red test, put it back, record the exact evidence line
|
||||
in your report. Keep tests light otherwise.
|
||||
- G1: the pull build must not change. Keep every split-only change under `#if MOBILEGL_BUILD_DISAGGREGATED`
|
||||
(or transport-gated inside an existing `MOBILEGL_PIPE_PUSH` arm, per ruling 1); name any delta
|
||||
to shared code in the report. G2/G14: a test that exists only in the split build gets a skip twin.
|
||||
- No hot-path instrumentation left in; counters behind `MG_Util::PipeStats::Enabled()` are fine.
|
||||
- Comments in the file's voice: the WHY, updated not deleted.
|
||||
- Rework rule: if your own gate stays red after two full attempts on the same defect, stop and
|
||||
report the state precisely rather than thrashing.
|
||||
|
||||
## Report
|
||||
|
||||
Write `~/w7/notes/p5e/reports/<slug>-v1.md` (over UNC: `//wsl.localhost/Arch/home/swung/w7/notes/p5e/reports/`)
|
||||
BEFORE your final message: what changed per file (with the line ranges you touched), the rows of
|
||||
your family retired / left barriered / not found, the red-once evidence (verbatim lines), the gate
|
||||
results (exact pass counts), G1/monolith impact, seams you need from other packages and what you
|
||||
assumed about them, the rulings you need from the integrator, what you did not do. <= 200 lines.
|
||||
Your final message is the structured result only (branch, head sha, report path, gate summary,
|
||||
blockers).
|
||||
@@ -0,0 +1,112 @@
|
||||
# inproc vs monolith at `7c6f6886` — measured, and why
|
||||
|
||||
Redmi `2f7cbe2e`, FCL fordebug + Minecraft 26.3-rc-3, world `test`, VD12, DirectGLES, ~848 draws per
|
||||
frame. GPU pinned (`min_pwrlevel = max_pwrlevel = 0`, re-asserted per arm because the pin is lost
|
||||
across app restarts), fan on, 30 s window taken 20 s after the world settles. Arms interleaved so
|
||||
thermal drift shows in both. Harness: `~/w7/notes/tools/p5d_bench_fcl4.sh` (P5d's, unchanged).
|
||||
|
||||
## 1 The answer: yes, inproc is still slower
|
||||
|
||||
| arm | fps (window) | fps p50 | client GL thread ms/frame | apply thread ms/frame |
|
||||
|---|---|---|---|---|
|
||||
| mono1 | 254.9 | 267.9 | 3.898 | — |
|
||||
| inproc1 | 161.7 | 166.4 | 6.098 | 5.305 |
|
||||
| mono2 | 201.3 | 195.1 | 4.781 | — |
|
||||
| inproc2 | 141.8 | 143.5 | 6.958 | 5.653 |
|
||||
| mono3 | 192.4 | 254.2 | 4.694 | — |
|
||||
|
||||
Thermal drift is real (monolith's own GL thread moved 3.898 → 4.781 across the session), so read the
|
||||
PAIRED ratios, not the absolute numbers:
|
||||
|
||||
- **fps**: inproc is **0.62 – 0.74×** monolith.
|
||||
- **client thread CPU per frame**: inproc's client is **1.46 – 1.56×** monolith's single thread.
|
||||
- **total CPU per frame**: inproc 11.4 – 12.6 ms across two threads, monolith 3.9 – 4.8 ms on one.
|
||||
The split arm spends roughly **2.6×** the total CPU.
|
||||
|
||||
Monolith is cleanly single-thread CPU-bound: its GL thread reports **993.7 ms of CPU per second of
|
||||
wall clock**, i.e. 99.4% of one core. inproc is bound by its client thread, which is also ~99%.
|
||||
|
||||
**So parity means `max(client, apply) <= monolith's single-thread ms/frame`** — about 3.9 – 4.7 ms.
|
||||
It does NOT require the split arm to spend less total CPU than monolith; it requires neither thread
|
||||
to exceed what monolith's one thread spends. That is a question of balance and overhead.
|
||||
|
||||
## 2 Where the extra CPU goes: a rendezvous per draw
|
||||
|
||||
The renderer's own stats line counts entries into `Doorbell::Wait` as `srv` / `cli` and actual
|
||||
futex parks as `srvpark` / `clipark` (`MG_Util/Metrics/PipeStats.cpp:537`). A 60 s inproc sample
|
||||
(8,280 frames):
|
||||
|
||||
| counter | total | per frame |
|
||||
|---|---|---|
|
||||
| `cli` (client enters the wait) | 7,588,093 | **916** |
|
||||
| `clipark` (client actually parks) | 13,025 | 1.6 |
|
||||
| `srv` | 15,836,497 | 1,913 |
|
||||
| `srvpark` | 37,456 | 4.5 |
|
||||
| `rsp` (residual pulls) | 102,408 per 120-frame window | **853, i.e. one per draw** |
|
||||
|
||||
Against ~848 draws per frame, the client blocks **about once per draw** and 99.8% of those blocks
|
||||
resolve by spinning rather than parking. The monolith arm reports `rsp=0` and
|
||||
`wait[srv=0 srvpark=0 cli=0 clipark=0]` — it has no rendezvous at all.
|
||||
|
||||
`rsp` equalling the draw count is the same fact the strict lane reports as
|
||||
`GetProgramForDraw@DrawArrays`: one barrier-pulled field read per draw. A record that reads client
|
||||
memory cannot be unbarriered, so the draw path stays in lockstep and the client waits.
|
||||
|
||||
## 3 The spin is the cheap version of the rendezvous, not the problem
|
||||
|
||||
Control arm `MOBILEGL_IPC_SPIN_US=0` (park immediately instead of spinning up to 50 µs):
|
||||
|
||||
| arm | fps p50 | client ms/frame | apply ms/frame | `clipark` / `cli` |
|
||||
|---|---|---|---|---|
|
||||
| inproc (default, 50 µs) | 143.5 – 166.4 | 6.098 – 6.958 | 5.305 – 5.653 | 0.2% |
|
||||
| inproc `SPIN_US=0` | **20.9** | **20.167** | **14.681** | **99.6%** |
|
||||
|
||||
Making every rendezvous a futex park costs about 14 ms/frame more on the client and collapses the
|
||||
frame rate by 7×. So the 50 µs spin is not waste to be tuned away — it is what keeps the current
|
||||
design viable. **The cost is the rendezvous itself, and the fix is to stop having one per draw, not
|
||||
to make each one cheaper.** Tuning `SPIN_US` is a dead end in both directions.
|
||||
|
||||
## 4 The barrier-off control cannot answer the performance question
|
||||
|
||||
`MOBILEGL_IPC_VERB_BARRIER=0` aborts a few seconds into the run:
|
||||
|
||||
```
|
||||
F/MobileGL: MGPipe: Fatal{UnmigratedPipeInput, "IsCapabilityEnabled@ClientWaitSync"}
|
||||
```
|
||||
|
||||
which is exactly what `Config.h` documents it to do ("EXPECTED to be red, because 31 of the 63
|
||||
PipeInputs fields are still pulled from a live GLContext by the client's residual fill"). It is a
|
||||
correctness control and gives no usable CPU number. The ceiling that run-ahead buys therefore
|
||||
cannot be measured before run-ahead lands; §5 is an estimate, and it is labelled as one.
|
||||
|
||||
## 5 What run-ahead should buy, and what it will not
|
||||
|
||||
Let `F` be the client's frontend work, `B` the backend GL work, `E` the record encode, `D` the
|
||||
decode plus resolve, and `S` the rendezvous cost on each side. Then
|
||||
|
||||
- monolith ≈ `F + B` = 3.9 – 4.8 ms/frame (measured)
|
||||
- inproc client = `F + E + S_c` = 6.1 – 7.0 ms/frame (measured)
|
||||
- inproc apply = `D + B + S_a` = 5.3 – 5.7 ms/frame (measured)
|
||||
|
||||
so `E + D + S_c + S_a` ≈ **7 ms/frame**. Run-ahead removes `S_c` and `S_a` for unbarriered records
|
||||
and nothing else: **the encode and decode stay**. The acceptance signal is therefore not fps first
|
||||
but the counters:
|
||||
|
||||
- `rsp` must go to **0** on unbarriered records (BRIEF §3.3 already pins this),
|
||||
- `cli` must fall from ~916 per frame to the handful of records that stay barriered by ruling
|
||||
ID-84 (readback, XFB, CopyTex, `set_storage_block_binding`), which in this workload is a few per
|
||||
frame, not hundreds.
|
||||
|
||||
If after that the arm is still short of parity, the remaining gap is `E` and `D` and it is an
|
||||
encode/decode problem, to be attributed by symbolized call graph and not by self-percent — the trap
|
||||
P5d recorded after mis-diagnosing an idle poll as backend lock contention.
|
||||
|
||||
## 6 Measurement discipline for the next round
|
||||
|
||||
- Interleave arms in one session; report the paired ratio. A single-arm fps number drifted 27% in
|
||||
this very session.
|
||||
- Per-thread CPU ms/frame is the primary metric, fps the secondary — fps alone confounds vsync
|
||||
capping (this panel is 120 Hz and a capped monolith run reads 115) and thermal state.
|
||||
- Re-assert the GPU pin per arm; it is lost across app restarts.
|
||||
- Confirm the library under test by symbol probe on the APK's `lib/arm64-v8a/libMobileGL.so`, never
|
||||
by the in-game `GIT@` stamp, which is stale under incremental builds.
|
||||
@@ -0,0 +1,47 @@
|
||||
# CORRECTION to `PERF-PROFILE-7c6f6886.md` §5 — run-ahead removes much less of the fill than §4 implied
|
||||
|
||||
§4 is right that an unbarriered verb skips the residual fill. It is wrong to treat
|
||||
`MGPipeValidateForVerb`'s whole 18.03% as fill. The call tree under it (inproc, client thread,
|
||||
percentages relative to that subtree) says otherwise:
|
||||
|
||||
| share of the subtree | child | skipped under run-ahead? |
|
||||
|---|---|---|
|
||||
| 22.05% | `MGPipeTracker::Update` | **no** — the tracker walk runs regardless |
|
||||
| 20.48% | `MGPipeShaderBufferEmitter::EmitClass` | **no** — emitters PRODUCE records, which is the whole of what an unbarriered verb hands the server |
|
||||
| 19.76% | `MGPipeFillAccess::CopyField` | **yes** |
|
||||
| ~6.7% | the sampler / vertex-input / program / framebuffer emitters | **no** |
|
||||
| remainder | self, including the unconditional prologue | partly |
|
||||
|
||||
`PipeFill.cpp:3226-3231` says this in words: "What still runs, unchanged, is the tracker walk and the
|
||||
emitters (steps 2 and 3): those PRODUCE RECORDS, which is the whole of what an unbarriered verb is
|
||||
allowed to hand the server." So only about a fifth of that 18.03% goes away, i.e. **3.6 – 4.5% of the
|
||||
client thread**, not 18%.
|
||||
|
||||
## The corrected prediction
|
||||
|
||||
| | now | predicted after run-ahead |
|
||||
|---|---|---|
|
||||
| client GL thread | 6.1 ms/frame | **~3.9 ms/frame** (the 31.8% wait, plus ~4% of fill) |
|
||||
| apply thread | 5.3 ms/frame | ~2.0 ms/frame |
|
||||
| bound by | client | client |
|
||||
| implied fps | ~164 | **~250** |
|
||||
| monolith, same session | 3.9 – 4.8 ms/frame | 208 – 256 fps |
|
||||
|
||||
**The honest claim is PARITY, not past it.** The split arm should land level with monolith, with the
|
||||
apply thread holding roughly 2 ms of headroom.
|
||||
|
||||
Going beyond parity is separate work, and §2 of the profile already names its targets: the emitters
|
||||
and the encode path, which is where the client's remaining ~3.9 ms lives. The wait is not one of them
|
||||
any more once run-ahead lands.
|
||||
|
||||
§5 of the profile note is left in place rather than edited, so the error is visible: it
|
||||
double-counted the tracker walk and the emitters as removable and produced ~3.0 ms / ~330 fps. This
|
||||
file supersedes it.
|
||||
|
||||
## Why this matters beyond the number
|
||||
|
||||
The first estimate was built by subtracting whole inclusive percentages of a symbol whose name
|
||||
suggested it was all fill. That is the same class of error the previous phase recorded after
|
||||
attributing an idle poll's cost to backend lock contention: **a percentage next to a plausible name
|
||||
is not an attribution.** The call tree was three commands away and it changed the conclusion from
|
||||
"comfortably ahead" to "level". Take the tree.
|
||||
@@ -0,0 +1,42 @@
|
||||
# After run-ahead: there is no second lever
|
||||
|
||||
Client GL thread, inproc, ranked by SELF time (the same capture as `PERF-PROFILE-7c6f6886.md`):
|
||||
|
||||
| self | symbol |
|
||||
|---|---|
|
||||
| **31.58%** | `SessionProducer::WaitForAppliedOrEventBacklog` |
|
||||
| 3.72% | `MGPipeValidateForVerb` |
|
||||
| 3.43% | `MGPipeTracker::Update` |
|
||||
| 2.77% | `Client::ReadDrawBindings` |
|
||||
| 1.78% | `MGPipeSlotAllocator::FindByLifetimeId` |
|
||||
| 1.55% | `BufferState::GetBindingSlot` |
|
||||
| 1.36% | `MGPipeShaderBufferEmitter::EmitClass` |
|
||||
| 1.30% | `change_protection` (kernel: the persistent-map dirty-page tracking) |
|
||||
| 1.26% | `MGPipeFillAccess::CopyField` |
|
||||
| 1.26% | `__memcpy_aarch64_nt` |
|
||||
| 1.13% | `PipeWireEncoder::EncodeRecord` |
|
||||
|
||||
**One symbol is 31.6%. The next is 3.7%.** Everything after the wait is a long flat tail of
|
||||
one-to-three-percent functions.
|
||||
|
||||
That has two consequences, and they are the honest answer to "optimise inproc until it matches
|
||||
monolith":
|
||||
|
||||
1. **The projection in `PERF-CORRECTION.md` is sound.** There is no hidden concentration for the
|
||||
estimate to have missed — removing the wait really does leave a thread whose cost is the sum of
|
||||
many small things, which is what a ~3.9 ms/frame client looks like.
|
||||
2. **Going PAST parity has no single lever.** After P5e there is no 10% function to delete. Reaching,
|
||||
say, 1.5x monolith would mean a long grind across the tail: the tracker walk, the draw-binding
|
||||
read, the slot allocator's lifetime lookup, the shader-buffer emitter, the encoder, and the
|
||||
persistent-map page tracking that shows up here as kernel `change_protection`. Each is worth one
|
||||
to three percent of one thread.
|
||||
|
||||
So the correct thing to promise is parity, and the correct thing to do after landing it is to
|
||||
re-measure rather than to plan the grind in advance: with the wait gone, the tail's shares all change
|
||||
denominator and the ranking above is not the ranking that will matter.
|
||||
|
||||
One more caution for whoever does re-measure. `change_protection` at 1.30% is kernel time inside the
|
||||
mprotect-based dirty-page tracking P5d introduced for persistent maps, and `MOBILEGL_IPC_PERSISTENT_HASH_SUPPRESS=0`
|
||||
plus `MOBILEGL_IPC_PERSISTENT_BLOCK_KB` are its A/B knobs. It is the one item in the tail with a
|
||||
ready-made control arm, so it is the cheapest thing to attribute properly and the easiest to
|
||||
mis-attribute by staring at self-percent.
|
||||
@@ -0,0 +1,145 @@
|
||||
# The symbolized profile, and what run-ahead actually removes
|
||||
|
||||
Companion to `PERF-BASELINE-7c6f6886.md`. This is the number that phase's perf scout said had to be
|
||||
measured before any optimisation was written, and it is now measured.
|
||||
|
||||
Capture: `p5d_profile_r3.sh`, Redmi `2f7cbe2e`, inproc, Minecraft 26.3-rc-3 in world, GPU pinned,
|
||||
`simpleperf record -e cpu-cycles -p <pid> -g --duration 15`. 136,856 samples, 73.4 G cycles.
|
||||
Symbolized against the **unstripped** `libMobileGL.so` from
|
||||
`FCL/build/intermediates/merged_native_libs/fordebug/...`, not the APK copy.
|
||||
|
||||
## 1 Where the cycles are, by thread
|
||||
|
||||
| thread | share of process cycles |
|
||||
|---|---|
|
||||
| `Thread-17` (the client GL thread) | 47.3% |
|
||||
| `mgl-srv-apply` (the apply thread) | 30.1% |
|
||||
| `Server thread` (the JVM's) | 9.4% |
|
||||
| `C2 CompilerThre` | 6.0% |
|
||||
|
||||
## 2 The client thread, inclusive
|
||||
|
||||
| inclusive | self | symbol |
|
||||
|---|---|---|
|
||||
| 35.56% | 0.41% | `ClientSession::EmitAndWaitTails` |
|
||||
| **31.77%** | **31.58%** | **`SessionProducer::WaitForAppliedOrEventBacklog`** |
|
||||
| 34.42% | 0.15% | `EmitIndexedDraw` |
|
||||
| 31.19% | 0.09% | `EmitDrawRecord` |
|
||||
| **18.03%** | 3.72% | **`MGPipeValidateForVerb`** |
|
||||
| 16.88% | 0.06% | `DrawElementsInstancedBaseVertex_Backend` |
|
||||
|
||||
**31.6% of the client GL thread is spent spinning inside the lockstep wait**, almost all of it self
|
||||
time — it is the spin, not work reached through the wait.
|
||||
|
||||
## 3 The apply thread, inclusive
|
||||
|
||||
| inclusive | self | symbol |
|
||||
|---|---|---|
|
||||
| 97.74% | **60.64%** | `ServerLoop::ApplyThreadMain` |
|
||||
| 36.60% | 0.26% | `ServerLoop::DrainRing` |
|
||||
| 34.73% | 0.17% | `PipeApplier::ApplyOne` |
|
||||
| 22.13% | 0.48% | `ServerVerbSink::OnDrawVbo` |
|
||||
| 14.10% | 0.17% | `DirectGLES::PrepareForDraw` |
|
||||
|
||||
**60.6% of the apply thread is self time in `ApplyThreadMain`** — the idle poll waiting for the next
|
||||
record. Only ~37% is real applying.
|
||||
|
||||
## 4 Run-ahead removes TWO costs on the client, not one
|
||||
|
||||
The wait is the obvious one. The second is `MGPipeValidateForVerb`, and it is worth reading
|
||||
`MG_Impl/Pipe/PipeFill.cpp:3219-3280` to see why:
|
||||
|
||||
```cpp
|
||||
const Bool runAhead = ClientRunsAhead();
|
||||
...
|
||||
const Bool barriered = !runAhead || ClientVerbIsBarriered(verb, ctx);
|
||||
const Bool fillOwed = barriered;
|
||||
...
|
||||
if (fillOwed) { /* the residual fill */ }
|
||||
```
|
||||
|
||||
Under run-ahead, an **unbarriered** verb skips the residual fill entirely — `gPipeInputs` becomes
|
||||
server-role memory for that record and the client neither fills it, stamps it, nor withdraws the
|
||||
server's stamp. So the 18.03% is not merely reduced, it is **not executed** for unbarriered draws.
|
||||
|
||||
Today `ClientRunsAhead()` is false by construction: `RunAheadArmed()` requires
|
||||
`Caps().HasCap(kCapRunAheadApply)`, which requires `kMGPipeP5eRunAheadReady`, which is `false` until
|
||||
the integration commit.
|
||||
|
||||
## 5 The arithmetic, and the prediction
|
||||
|
||||
Measured client thread cost: 6.1 ms/frame. Of it, `EmitAndWaitTails` 35.6% and
|
||||
`MGPipeValidateForVerb` 18.0% — about **53% of the thread** — are what run-ahead removes for
|
||||
unbarriered records. Barriered records (readback, XFB, CopyTex, `set_storage_block_binding` per
|
||||
ruling ID-84) keep both, but in this workload those are a handful per frame against ~849 draws.
|
||||
|
||||
| | now | predicted after run-ahead |
|
||||
|---|---|---|
|
||||
| client GL thread | 6.1 ms/frame | **~3.0 ms/frame** |
|
||||
| apply thread | 5.3 ms/frame | **~2.0 ms/frame** |
|
||||
| bound by | client | client |
|
||||
| implied fps | ~164 | **~330** |
|
||||
| monolith, same session | — | 3.9 – 4.8 ms/frame, 208 – 256 fps |
|
||||
|
||||
**So the honest prediction is not merely parity but past it.** The split arm's remaining client work
|
||||
(frontend tracking plus record encode) is smaller than monolith's whole frame, because the backend GL
|
||||
work has genuinely moved to the other core and the apply thread has ~2 ms of real work against a
|
||||
~3 ms client.
|
||||
|
||||
This is a prediction from a profile, not a measurement of the end state, and it should be treated as
|
||||
such until the flip lands and the four-arm matrix is re-run. The two things that could spoil it:
|
||||
|
||||
1. **The apply thread's 60.6% idle poll** is a spin too. If the client stops feeding it in lockstep
|
||||
and starts feeding it in bursts, that poll's behaviour changes and its cost must be re-measured,
|
||||
not assumed to fall proportionally.
|
||||
2. **Core placement.** In this capture the split client sat on a mid core at 1555 MHz while the
|
||||
monolith render thread gets cpu7 at 1958 MHz, and the kernel ignores the library's affinity
|
||||
requests. That is a ~26% clock handicap the split arm pays for reasons outside this phase, and it
|
||||
is explicitly out of scope by instruction. Compare per-thread CPU ms/frame, which is clock-biased
|
||||
the same way in both arms only if both land on the same core class — state the core in every
|
||||
result (`p5d_bench_fcl4.sh` already records the `processor` field per thread).
|
||||
|
||||
## 6 What this means for the order of work
|
||||
|
||||
The two asks — "make the strict lane hard green" and "make inproc as fast as monolith" — are **one
|
||||
task**. `GetProgramForDraw@DrawArrays` is read once per draw; a record that reads client memory
|
||||
cannot be unbarriered; run-ahead cannot be armed until that read is gone. So the strict lane is not a
|
||||
precondition imposed by process, it is the same work seen from the correctness side.
|
||||
|
||||
After the flip, the next target is visible in §2 and is NOT the wait: `MGPipeValidateForVerb`'s
|
||||
residual 3.72% self plus whatever fill survives for barriered verbs, and the encode path
|
||||
(`EmitIndexedDraw` / `EmitDrawRecord`) which is where the client's remaining ~3 ms lives.
|
||||
|
||||
## 7 The monolith arm, profiled the same way
|
||||
|
||||
Same capture recipe, `MOBILEGL_TRANSPORT=monolith`, 15 s. Its `Thread-17` is 62.0% of process cycles
|
||||
(there is no apply thread to share with).
|
||||
|
||||
| inclusive | self | symbol |
|
||||
|---|---|---|
|
||||
| 46.35% | 0.24% | `DirectGLES::DrawElementsInstancedBaseVertex` |
|
||||
| 30.28% | 0.27% | `DirectGLES::PrepareForDraw` |
|
||||
| 15.64% | 1.37% | `TextureImpl::SyncNeccessaryTextures` |
|
||||
| **14.45%** | 3.44% | **`MGPipeValidateForVerb`** |
|
||||
| 7.02% | 0.88% | `BindCurrentProgramWithResources` |
|
||||
| 4.92% | 2.64% | `MGPipeFillAccess::CopyField` |
|
||||
|
||||
**The push-monolith arm pays the residual fill too**, and that is not a surprise once stated: the
|
||||
fill is gated on `ClientRunsAhead()`, which is false on monolith for the same reason it is false on
|
||||
inproc today, so `fillOwed` is true and `MGPipeValidateForVerb` does the full copy. 14.45% of
|
||||
monolith's thread, ~0.62 ms/frame at its measured 4.3 ms.
|
||||
|
||||
This sharpens the comparison rather than muddying it. After the flip, inproc's unbarriered draws stop
|
||||
paying that cost while the monolith arm keeps paying it, because monolith never arms run-ahead
|
||||
(ID-81 keeps its frontend arms and `kCapRunAheadApply` is a transport-side bit). So the projected
|
||||
end state is:
|
||||
|
||||
| | client thread ms/frame |
|
||||
|---|---|
|
||||
| monolith (unchanged) | 3.9 – 4.8, including ~0.62 of residual fill |
|
||||
| inproc after run-ahead (projected) | ~3.0 |
|
||||
|
||||
The split arm should end up ahead. Note also what this says about the pull build, which has no fill
|
||||
at all: part of what the push build costs BOTH arms today is machinery that only the split arm will
|
||||
eventually stop paying.
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
# Addendum to `PACKAGE-PREAMBLE-P5E.md` for wave 3 (pa / mv / gl), 2026-09-18
|
||||
|
||||
The preamble is still correct except where this file overrides it. Read both.
|
||||
|
||||
## 1 The contract is landed, the draft is gone
|
||||
|
||||
`CONTRACT-P5E-draft.md` was landed by c0e as `MobileGL/MG_Remote/CONTRACT-P5E.md` **in your tree**.
|
||||
Read the landed file, not the draft. `INTEGRATOR-DECISIONS-P5E.md` now runs to **ID-110** and still
|
||||
overrides both where they differ.
|
||||
|
||||
## 2 The gate has a sixth step, and it is not optional
|
||||
|
||||
```
|
||||
bash ~/w7/notes/tools/p5e_gate.sh <slug> gpu # ctest -L integration-gpu, ~10 min at -j 4
|
||||
```
|
||||
|
||||
`integration-split` entries ALL export `MOBILEGL_TRANSPORT=inproc`. The push build has a **second
|
||||
server arm** (`Transport == Monolith`) selected at runtime, and until 2026-09-18 it had no gated
|
||||
entry at all. A P5e package landed a null dereference on it under 2250 green unit entries and 113
|
||||
green split entries: the game SIGSEGV'd at startup on the phone, and `ctest -L integration-gpu` on
|
||||
the same head was **1157/1294 — 137 SEGFAULTs across 38 scenarios**. See rulings ID-107 / ID-109 /
|
||||
ID-110, fix commit `66621767`, and `docs/Disaggregated/CURRENT_STAGE_PROGRESS.md` §2.5.
|
||||
|
||||
**Run `gpu` before you report. 1294/1294 or explain.**
|
||||
|
||||
## 3 The arm-selection rule, stated as a checklist
|
||||
|
||||
Ruling ID-81: handle arms are selected by `MG_Config::Transport != Monolith`; the push-monolith
|
||||
build keeps its frontend arms token for token. Apply this to your own diff:
|
||||
|
||||
- **"A handle was noted" is NOT the statement "the record arm is selected."** They are different
|
||||
claims and conflating them is exactly what cost the phase 137 scenarios. A seat that is safe only
|
||||
because every writer of a note happens to be transport-gated is safe *by a chain*, not by its own
|
||||
statement. State the transport test where you rely on it. `MGB_TEXTURE_RECORD_ARM_SELECTED()`
|
||||
(`MG_Backend/DirectGLES/Managers.cpp`, ID-110) is the worked example.
|
||||
- **Never infer the arm from a pointer being null.** Decide with `MG_Config::Transport` (or your
|
||||
family's selector, which must itself reduce to it) and pass the pointer as glue.
|
||||
- **A null/missing record on the handle arm is a NAMED refusal, never a quiet fall-back to the
|
||||
frontend.** `RefuseNullFrontendTextureOffTheHandleArm` (`Managers.cpp`) is the shape: it aborts
|
||||
with `Fatal{RoleViolation, "<name>"}` and folds to a constant in the pull build so no call is
|
||||
added there.
|
||||
- **If you pass a null object into a body that can still read one, you have written the fix1 bug.**
|
||||
Either the body cannot reach a frontend read on that arm, or the refusal fires first.
|
||||
|
||||
## 4 Reading the strict lane properly
|
||||
|
||||
`ctest` does NOT carry `MGLOG_F` into its captured stdout, and the lane's entries write no log file,
|
||||
so `p5e_gate.sh <slug> strict` can only give you a pass count. **The pass count is not your
|
||||
deliverable.** Produce the per-entry marker census:
|
||||
|
||||
```
|
||||
bash ~/w7/notes/p5e/strict_census2.sh ~/w7/p5e-<slug>
|
||||
```
|
||||
|
||||
It re-runs each red entry alone against the test binary with `MOBILEGL_LOG_FILE_PATH` set and writes
|
||||
`~/w7/p5e-logs/strict-census/census2.tsv` (marker TAB entry). Copy it to a per-slug path first if
|
||||
you do not want to clobber the shared one. Report the table before and after your change.
|
||||
|
||||
**One known blind spot in that script**, which you must not repeat as a finding: it derives the
|
||||
gtest filter from the last two dot-components of the ctest entry name, so entries with a third
|
||||
segment (`Ct.`, `F1.`, `SmallRing.`, `PersistentMapArm.`, `NamedBlit.`) are re-run WITHOUT the extra
|
||||
`ENVIRONMENT` their lane block sets. `DirectGLES.Split.PersistentMapArm.PersistentCoherentMapScenario.TheMapLandsInTheArmItsLaneDeclares`
|
||||
is the one entry whose marker the census failed to capture for this reason. If your family touches
|
||||
such an entry, take its marker under its own lane environment (`ctest -V -N -R '^<entry>$'` prints
|
||||
the block's environment).
|
||||
|
||||
## 5 The baseline you are changing, measured
|
||||
|
||||
Head `7c6f6886`. `integration-split` 116/116 green; under `MOBILEGL_IPC_STRICT_ERRORS=1`, 7 pass and
|
||||
109 abort with:
|
||||
|
||||
| marker | entries | owner |
|
||||
|---|---|---|
|
||||
| `GetProgramForDraw@DrawArrays` | 61 | **pa** |
|
||||
| `GetFramebufferBindingSlot@ReadPixels` | 21 | allowlist (readback) |
|
||||
| `GetBoundVertexArray@DrawArrays` | 9 | **mv** |
|
||||
| `GetProgramForDispatch@DispatchCompute` | 7 | **pa** |
|
||||
| `GetTextureObject@CopyImageSubData` | 6 | allowlist (retires P7) |
|
||||
| `ValidateProgramName@ShaderStorageBlockBinding` | 2 | allowlist (retires P9) |
|
||||
| `GetTextureUnitObject@CopyTexImage2D` | 2 | allowlist (CopyTex) |
|
||||
| (census artifact, §4) | 1 | — |
|
||||
|
||||
Touch only your own rows. If your change removes or adds a row that is not yours, that is a finding
|
||||
for the report, not something to quietly absorb.
|
||||
|
||||
## 6 Device numbers, for context only — you do not run the device
|
||||
|
||||
Redmi, Minecraft 26.3-rc-3, ~849 draws/frame, GPU pinned, fan on, 30 s windows, interleaved:
|
||||
|
||||
| arm | fps p50 | client GL thread ms/frame | apply thread ms/frame |
|
||||
|---|---|---|---|
|
||||
| monolith ×3 | 267.9 / 195.1 / 254.2 | 3.898 / 4.781 / 4.694 | — |
|
||||
| inproc ×2 | 166.4 / 143.5 | 6.098 / 6.958 | 5.305 / 5.653 |
|
||||
|
||||
The split arm's client thread costs about 1.5× the monolith arm's single thread, and the device
|
||||
stats line shows the client entering the doorbell wait about 916 times per frame against 849 draws.
|
||||
That is the lockstep your package is clearing the way to remove. It is context, not a target: your
|
||||
deliverable is the marker table and the gate.
|
||||
@@ -0,0 +1,193 @@
|
||||
# P5e — 退役 Espryt draw path 的 lockstep(run-ahead,2026-09-19 收官)
|
||||
|
||||
> 本页是该阶段的**阶段汇总**:阶段表行、实测与落地形状的完整文本(2026-09-24 从上层索引移入,原文照录)都在这里;上层只留摘要——[`ROADMAP.md`](../../../Disaggregated/ROADMAP.md)、[`MEASUREMENTS.md`](../../../Disaggregated/MEASUREMENTS.md)、[`ARCHITECTURE.md`](../../../Disaggregated/ARCHITECTURE.md)。文中 `file:line` 与"今天""当前"按各段写成时的头理解;文中的 `MEASUREMENTS.md §N` / `ARCHITECTURE.md §17.x` 编号保留,对照表见 [`../README.md`](../README.md)。
|
||||
|
||||
## 摘要
|
||||
|
||||
- 一句话:client 发布完就走;server 用记录带的句柄解析每一个对象;它唯一可以读的 client 内存,是一条 client 确实被挡在后面(barriered)的记录的残余 fill。契约 `MobileGL/MG_Remote/CONTRACT-P5E.md`(规则 F),裁定 ID-80..136([`INTEGRATOR-DECISIONS-P5E.md`](INTEGRATOR-DECISIONS-P5E.md))。
|
||||
- 十二包三波:c0e → id;vi / sb / pg / tx2 / fb ∥ ra(+ fix1);pa / mv / gl / ra2。`kMGPipeP5eRunAheadReady` 与 `kMGPipeP5eClientWaitRuleLanded` 均已翻。
|
||||
- 门:unit strict 两臂 2256/2256;`integration-split` 179/179;`RUN_AHEAD=0` 对照 179/179;`VERB_BARRIER=0` 变红;`MOBILEGL_IPC_AUDIT=1` 179/179。
|
||||
- 设备:VD12 下 run-ahead 与 monolith 都撞 120 Hz 上限;**VD32(~3550 draws/帧)下 inproc 与 monolith 齐平**(59.9 vs 58.5 fps),run-ahead 相对 lockstep p50 +69%、client CPU −40%。
|
||||
- **具名未决**:E1 对照需按 ID-114 / ID-122 重新定义(`VERB_BARRIER=0` 会顺手关掉 run-ahead,所求的 `Fatal{BarrierViolation}` 出现 0 次)。
|
||||
- 报告:[`P5E-RUNAHEAD.md`](P5E-RUNAHEAD.md)(2026-09-24 从上层移入)。
|
||||
|
||||
## 阶段表行(原 `ROADMAP.md`)
|
||||
|
||||
- **阶段**:**P5e** 退役 Espryt draw path 的 lockstep
|
||||
- **状态**:✅ **已收官(2026-09-19)**,附一条具名未决:E1 对照需按 ID-114 重新定义
|
||||
- **落地什么 / 范围**:契约 `MG_Remote/CONTRACT-P5E.md`(规则 F:**未设障**记录的 apply 不得读任何 client 内存;ID-84 限定它只约束未设障记录);裁定 **ID-80..136**(`~/w7/notes/p5e/INTEGRATOR-DECISIONS-P5E.md`)。**十二个包,三波**:wave 1 **c0e**(契约 + 线上行:`PipeCalls.def` 第五列 `WaitClass`、`set_program_bindings` opcode 80、`kCapRunAheadApply` 位 10 仅 DirectGLES 臂、`kDrawClientArrays`、子系统位 13、两个旋钮)→ **id**(registry 按 `{slot, gen}` 重键、by-handle resolver、分配器守卫);wave 2 **vi / sb / pg / tx2 / fb** 五个 per-draw 家族 ∥ **ra**(等待规则、present credit、`gPipeInputs` 变 server 角色内存),加 **fix1**(设备发现的 monolith 臂回归,ID-107);wave 3 **pa**(program 家族离开前端)、**mv**(multi-draw + 五个档位的门禁条目)、**gl**(门禁机制本身 + 两处潜伏崩溃)、**ra2**(翻开关后暴露的竞态)。**`kMGPipeP5eRunAheadReady` 与 `kMGPipeP5eClientWaitRuleLanded` 均已翻**。最大的那次迁移(逐 draw 的 `GetProgramForDraw`)**没有改动任何线上结构**:记录早就带着逐 link 的 `ProgramArchive`,缺的是仍去问前端对象的读者。报告 [`P5E-RUNAHEAD.md`](P5E-RUNAHEAD.md)
|
||||
- **验收门 / 证据**:出口门已逐条跑过(BRIEF-P5E §3,2026-09-19 在集成树上,run-ahead 已武装):**item 1** unit 在 strict 两臂均 **2256/2256**;**item 2/3** `integration-split` **179/179**、逐条普查零 `Fatal{`、`Admitted{` 恰为八行;**item 4(a)** `RUN_AHEAD=0` 作为配对对照 **179/179 绿**;**item 4(b)** `VERB_BARRIER=0` **变红**(车道 62/179);**item 4(c)** Magma 逐字记下 `run-ahead requested, server does not publish kCapRunAheadApply - running lockstep`,而 Espryt 对照记下 `run-ahead ARMED`;**item 5** 在集成树上重跑 red-once(ID-121 重排后的形式):倒掉 pa 的臂得 `GetProgramForDraw@DrawArrays`、倒掉 mv 的臂得 `GetBoundVertexArray@DrawArrays`,**恰好各一个具名对**,还原后各自转绿;**item 7** `MOBILEGL_IPC_AUDIT=1` **179/179**。**唯一未过的是 E1 对照脚本本身**(ID-122):已修掉它两个遮蔽性缺陷(选中了一个在本车道永远跑不起来的阳性对照用例;ctest 与日志助手对“谁被选中”意见不一致),但它索要的 `Fatal{BarrierViolation}` 在整次运行里 **出现 0 次**:`BATCH_WAITS` 默认值 1 下那个重叠不发生,而 run-ahead 武装后 `VERB_BARRIER=0` 还会顺手关掉 run-ahead(ID-114),它产生的那条臂**既不是 lockstep 也不是 run-ahead**。E1 需要重新定义它要证伪什么,不是再调阈值;在想清楚之前不动它的计数规则,否则只是换一种伪绿。G1 仍由 CI 断言(ID-123)
|
||||
|
||||
## 实测:P5e(wave 1 `f6cfcbd3` → wave 2 `44f91c74` → fix1 `66621767` → ID-110 `3cc4e1ec`)(原 `MEASUREMENTS.md` §10)
|
||||
|
||||
P5e 尚未收官(`kMGPipeP5eRunAheadReady` 仍为 false),本节记的是**设备验证一轮**,问题是"八包合并后两条传输臂还能不能正常跑游戏",不是配对性能。
|
||||
|
||||
### 主机门(WSL `~/w7/p5e-int`,split flavour,头 `3cc4e1ec`)
|
||||
|
||||
| 门 | `44f91c74` | `3cc4e1ec` |
|
||||
|---|---|---|
|
||||
| unit | 2250/2250 | **2250/2250** |
|
||||
| `integration-split` | 113/113 | **116/116** |
|
||||
| `integration-gpu`(两条运行时臂,ID-109 起为常设步) | **1157/1294**(137 SEGFAULT / 38 scenario) | **1294/1294** |
|
||||
| `integration-split-strict` | 7/116 | 7/116(预期红) |
|
||||
|
||||
`integration-gpu` 那一列是本阶段最重要的一个数:`44f91c74` 的 137 个 SEGFAULT 在当时**没有任何门禁步骤会看到**——`integration-split` 的每一条都导出 `MOBILEGL_TRANSPORT=inproc`,而 push 构建有两条服务端臂。详见 `CURRENT_STAGE_PROGRESS.md` §2.5。
|
||||
|
||||
### 设备(Redmi `2f7cbe2e`,FCL fordebug + Minecraft 26.3-rc-3 世界 "test",VD12,DirectGLES;进世界后 60 s 采样)
|
||||
|
||||
| 臂 | 进世界 | fps | draws/帧 | 进程 | Fatal / crash buffer |
|
||||
|---|---|---|---|---|---|
|
||||
| monolith(`44f91c74`,修复前) | — | — | — | **65 s 后进程消失** | SIGSEGV,栈见 §2.5 |
|
||||
| monolith(`3cc4e1ec`) | 31 s | 263.5 | 845 | 存活 | 无 |
|
||||
| inproc(`3cc4e1ec`) | 31 s | 136.1 | 853 | 存活 | 无 |
|
||||
| inproc 复跑(`3cc4e1ec`) | 32 s | 140.3 | 852 | 存活 | 无 |
|
||||
|
||||
monolith 这一次未被 120 Hz vsync 封顶(与 §9 的 205.8 那次同类),两臂 fps 不可直接相比。inproc 的 136-140 与修复前记录的 140.0 / 144.9 同档:fix1 改的那行两臂都读,split 臂没有被拖慢。
|
||||
|
||||
### 测量纪律(本轮与上一轮踩到的坑,全部是污染而非代码问题)
|
||||
|
||||
- `adb install` 的收尾会在一两分钟后杀掉正在跑的同包进程(`am_kill … due to installPackageLI`):装包与测量之间必须等到 `dex2oat` 退出。
|
||||
- 派给外部 CLI 的任务,其进程会活过 harness 的完成通知;**派出后不得自己再跑同一件事**,否则两套实验同时对一台手机 force-stop / 清 logcat,得出假失败。
|
||||
- 不得在脚本正被 bash 执行时修改它(边读边执行);要改先冻结副本。
|
||||
- 游戏内 F3 的 `GIT@` 戳记在增量构建下是旧的,**判断库版本要看 APK 里 `.so` 的符号 / 字符串**,不看戳记。
|
||||
|
||||
## 实测:P5e wave 3 — run-ahead 武装后的设备矩阵(头 `25fba0d5`)(原 `MEASUREMENTS.md` §11)
|
||||
|
||||
Redmi `2f7cbe2e`,FCL fordebug + Minecraft 26.3-rc-3 世界 `test`,VD12,DirectGLES,~850 draws/帧。
|
||||
**CPU 定频**(见下),GPU 钉 pwrlevel 0 且每臂重新断言,风扇开,进世界后 20 s 稳定再取 30 s 窗口,臂交错。
|
||||
|
||||
### 定频,以及为什么这一节必须先讲它
|
||||
|
||||
第一轮矩阵没有定频,于是 **monolith 自己那一臂**的逐帧 CPU 在两次运行之间从 4.43 ms 跳到 7.07 ms,
|
||||
而慢的那次**温度更低**(53.5 °C vs 58.9 °C)——不是热降频,是 walt governor 把 policy0 从 2745 MHz
|
||||
拉到 748 MHz。未定频的逐线程 CPU ms/帧**不能跨臂比较**,那一轮矩阵作废。
|
||||
|
||||
`tools/device_bench/pin_device.sh` 不认识本机 serial,并**明确拒绝猜**("pin path 因 SoC 而异,猜错会静默失败")——
|
||||
这是对的,也正是它没有静默半应用的原因。按本机实测节点另写 `pin_redmi.sh`:写序 min→硬件底、max→目标、
|
||||
min→目标(顺序要紧,否则按 stock 相对目标的位置会半应用),并**回读 `scaling_cur_freq` 确认**,跑完再 check 一次。
|
||||
|
||||
### 结果(每臂两次,离散度 < 2%)
|
||||
|
||||
定频 little 1555200 / big 1958400:
|
||||
|
||||
| 臂 | fps p50 | fps max | client ms/帧 | apply ms/帧 |
|
||||
|---|---|---|---|---|
|
||||
| monolith | 115.1 | 117.0 | 6.19 | — |
|
||||
| inproc run-ahead | 117.6 / 117.9 | 118.3 / 118.6 | 6.71 / 6.63 | 4.30 / 4.32 |
|
||||
| inproc lockstep (`MOBILEGL_IPC_RUN_AHEAD=0`) | 111.1 / 110.7 | 114.9 / 115.1 | 8.27 / 8.09 | 6.44 / 6.41 |
|
||||
|
||||
定频 little 1996800 / big 1958400(更高会被厂商限幅器夹住):
|
||||
|
||||
| 臂 | fps p50 | fps max | client ms/帧 | apply ms/帧 |
|
||||
|---|---|---|---|---|
|
||||
| monolith | 115.6 / 115.4 | 117.2 / 117.5 | 6.45 / 6.25 | — |
|
||||
| inproc run-ahead | 117.6 / 118.0 | 118.5 / 118.6 | 6.92 / 6.87 | 4.43 / 4.35 |
|
||||
| inproc lockstep | 111.6 | 113.7 | 8.16 | 6.53 |
|
||||
|
||||
### 读法
|
||||
|
||||
- **配对 A/B**:`MOBILEGL_IPC_RUN_AHEAD=0` 与默认是同一构建、同一份记录、同一定频,唯一差别是客户端等不等
|
||||
(ID-114:**不得**用 `VERB_BARRIER=0`,它是 `RunAheadArmed()` 的第一个合取项,会顺手关掉 run-ahead,
|
||||
而且实测几秒内即 `Fatal{UnmigratedPipeInput, "IsCapabilityEnabled@ClientWaitSync"}`)。
|
||||
差值:client **−18%**、apply **−33%**、fps p50 **+6%**。
|
||||
- **两个定频档下 monolith 与 run-ahead 都撞到 120 Hz 面板上限**(max 117-118.6),**只有 lockstep 撞不到**
|
||||
(max 113.7-115.1)。所以"inproc 是否追平 monolith"在本机真实负载上的答案是**追平了**;阶段开始时是
|
||||
**0.62-0.74 倍**(见 §10)。
|
||||
- 逐帧 client CPU:run-ahead 6.9 / monolith 6.3,多约 **8%**,两者都在上限之下有余量。
|
||||
- **未回答**:面板上限之上谁更快。本机定不住更高频率;一次未定频的高频窗口给出 monolith p50 201 /
|
||||
run-ahead p50 181(约 1.10 倍),但那次不可配对,只作方向性提示。需要关 vsync 或换上限更高的设备。
|
||||
|
||||
### 侧写(`25fba0d5` 之前,`7c6f6886`,说明 run-ahead 为什么值得做)
|
||||
|
||||
symbolized `simpleperf cpu-cycles`,客户端 GL 线程:`SessionProducer::WaitForAppliedOrEventBacklog`
|
||||
**31.58% 自身时间**,其后第二名只有 3.72%。设备计数器同期显示客户端每帧进入 doorbell 等待约 **916 次**
|
||||
(对 ~849 次 draw),其中 99.8% 靠自旋解决——`MOBILEGL_IPC_SPIN_US=0` 让每次等待都 park,帧率塌到 20.9。
|
||||
所以代价是**会合本身**,不是自旋参数,这也是为什么修法是"不再每次 draw 会合"而不是"把每次会合做便宜"。
|
||||
|
||||
### 11.1 渲染距离 32 的对照(同头 `25fba0d5`,~3550 draws/帧)
|
||||
|
||||
§11 的矩阵在 VD12 下跑,而两条臂都撞到了 120 Hz 面板上限,所以那一节回答的是"能不能撞到上限",
|
||||
不是"谁更快"。把渲染距离拉到 **32**(`options.txt` 的 `renderDistance`,备份为 `.p5e-backup`,测完已还原)
|
||||
负载涨到 **~3550 draws/帧**(VD12 的 4.2 倍),**两条臂都远离任何上限**(游戏自身 `enableVsync:false`、
|
||||
`maxFps:260`,实测 max 只有 37-71),这才是可比的一轮。
|
||||
|
||||
条件:CPU 定频 little 1555200 / big 1958400(跑前跑后各 check 一次,均 PINNED),GPU 钉 pwrlevel 0,
|
||||
风扇开,进世界后**静置 75-150 s**再取 40 s 窗口——VD32 的区块流式加载远比 VD12 长,沿用 20 s 静置会把
|
||||
加载期算进稳态。臂交错。
|
||||
|
||||
| 臂 | n | fps p50 中位数 | p50 范围 | client ms/帧 中位数 | apply ms/帧 |
|
||||
|---|---|---|---|---|---|
|
||||
| monolith | 5 | **58.5** | 56.3 – 67.9 | 16.19 | — |
|
||||
| inproc **run-ahead** | 5 | **59.9** | 56.8 – 61.1 | **15.72** | 11.1 – 12.1 |
|
||||
| inproc lockstep(`RUN_AHEAD=0`) | 2 | 35.5 | 34.5 – 36.5 | 26.17 | 19.7 – 20.5 |
|
||||
|
||||
**结论:在 VD32 下 inproc 与 monolith 齐平**,中位数上 run-ahead 甚至略微领先(59.9 vs 58.5,
|
||||
client CPU 15.72 vs 16.19),差值远在 monolith 自身的离散度之内——**monolith 五次的范围是 56.3-67.9
|
||||
(±10%),run-ahead 是 56.8-61.1(±4%)**,也就是说 split 臂不但追平,还更稳。`mono1` 的 67.9 是全场唯一
|
||||
的离群值(装包后第一次运行)。
|
||||
|
||||
**run-ahead 相对它取代的 lockstep:p50 +69%、client CPU −40%、apply CPU −43%。**
|
||||
负载越重它越值钱,这是预期内的——会合次数随 draw 数走,VD12 是每帧约 900 次,VD32 约 3600 次。
|
||||
|
||||
两条臂**都是 client 线程打满**(run-ahead 15.72 ms CPU / 16.7 ms 帧 ≈ 94%;monolith 同理),所以这一列
|
||||
是各自真正的瓶颈,可以直接比。
|
||||
|
||||
**下一个机会,不是缺陷**:apply 线程只有 11.1-12.1 ms,client 有 15.7 ms——**两侧不平衡**。把工作从 client
|
||||
挪到 apply 会直接降低瓶颈。这在 lockstep 下毫无意义(两侧串行相加),run-ahead 之后才成立,是本阶段
|
||||
解锁出来的新优化方向,留给后续阶段。
|
||||
|
||||
## 落地形状(原 `ARCHITECTURE.md` §17.7)
|
||||
|
||||
### 17.7 P5e:client 在 Espryt draw 路径上跑在 apply 前面(权威为 `MobileGL/MG_Remote/CONTRACT-P5E.md`)
|
||||
|
||||
P5d 把 `inproc` 变成 client 线程 CPU-bound,帧仍是 `client 工作 +(每 draw)等 apply + 交接`。那个等待存在,是因为 draw 的 apply 仍在解引用 client 拥有的内存:`FieldOwnership.def` 的对象类 BARRIER-PULLED 行,以及两个 P5C 具名豁免 scope 里的前端键 twin registry。**P5e 的一句话:client 发布完就走;server 用记录带的句柄解析每一个对象;它唯一可以读的 client 内存,是一条 client 确实被挡在后面的记录的残余 fill。**
|
||||
|
||||
- **barriered 谓词**(§2.1,裁定 3 / ID-83):`MGPipeBarriered(op, payload, applierState)` = 静态 `WaitClass` 列 ≠ `kWaitNone`,或 XFB span 打开时的 `kCtxVerb`,或带 `kDrawClientArrays` 的 draw。两侧算同一个函数、同一份数据——client 在 emit 时用 `ctx.IsTransformFeedbackActive()`,server 用应用过的 `MGPContextValues` 镜像,而 `set_context_values` 在 ring 上先于 verb,所以两者一致。没有第四条升级;加一条是整合者的裁定加契约里的一行。
|
||||
- **规则 F**(§0):**unbarriered 记录的 apply 不读任何 client 内存**——不解引用前端对象、不读 BARRIER-PULLED 行、不探测也不铸造 `MGPipeSlots()`、不持有前端对象的 `SharedPtr`。违反是具名 Fatal,**与 `MOBILEGL_IPC_STRICT_ERRORS` 无关**:那个值按构造就是撕裂或陈旧的,没有"计一笔"的臂。barriered 记录原样保留 P5C 的语义(裁定 4 / ID-84),这正是第一次落地能做小的原因:回读、CopyTex、`GetTexImage`、`set_storage_block_binding`、XFB 都留在 barriered 且拖后。
|
||||
- **`gPipeInputs` 变成 server 角色内存**(§3):unbarriered verb 的 validate 只跑第 2 步(tracker 走查)和第 3 步(发射器)——它们产出记录,这正是 unbarriered verb 被允许交给 server 的全部——序号自增、verb 戳、撤回 server 戳与整个第 4 步都不跑。`MGPipeInputUnfreshRead` 的计数器在 unbarriered 记录下变成**无条件中止**,这是把 `integration-split-strict` 从"预期红"变成硬绿门的那一处(§7)。
|
||||
- **run-ahead 的臂**:`RunAheadArmed()` = `m_barrierArmed && Ipc.RunAhead && Caps().HasCap(kCapRunAheadApply)`,在 `Start` 之后第一次 caps 采纳时**锁存**,此后只能被关掉、不能被打开——已经不等就发布出去的记录收不回来。Magma 的 `CallMask` 永远不带 bit 10(`MGPipeRunAheadCapBitsFor` 是纯函数,`MagmaPipeIdentityTest` 钉住),Espryt 则由 `MG_Backend/Init.cpp` 的 `kMGPipeP5eRunAheadReady` 一个常量把整相位关在惰性里,直到整合提交把它翻过来。
|
||||
- **对照臂**:`MOBILEGL_IPC_RUN_AHEAD=0` 是 A/B 的**对照**而不是负控制——server 代码、fill 决定、每一条记录两臂都一样,唯一的差别是 client 等不等;`MOBILEGL_IPC_VERB_BARRIER=0` 保留它自己的意思,并且因为它是那个合取式的第一项,它会直接把 run-ahead 关掉。
|
||||
|
||||
## 本目录
|
||||
|
||||
| 文件 | 内容 |
|
||||
|---|---|
|
||||
| [`BRIEF-P5E.md`](BRIEF-P5E.md) | BRIEF-P5E — the package plan for retiring the lockstep on the Espryt draw path |
|
||||
| [`CONTRACT-P5E-draft.md`](CONTRACT-P5E-draft.md) | CONTRACT-P5E (draft) — the client runs ahead of apply on the Espryt draw path |
|
||||
| [`FACTS-P5E.md`](FACTS-P5E.md) | P5e — the authoritative fact sheet for the doc update |
|
||||
| [`FLIP-CHECKLIST.md`](FLIP-CHECKLIST.md) | P5e wave 3 — integration and the flip, as an executable checklist |
|
||||
| [`INTEGRATOR-DECISIONS-P5E.md`](INTEGRATOR-DECISIONS-P5E.md) | INTEGRATOR-DECISIONS-P5E (2026-09-18, base `feat/disaggregated @ 2fde7034`) |
|
||||
| [`KIMI-AUDIT-P5E.md`](KIMI-AUDIT-P5E.md) | Read-only audit brief (Kimi): every apply-thread read of client-owned memory on the DirectGLES inproc draw path |
|
||||
| [`kimi-audit.md`](kimi-audit.md) | P5e audit — apply-thread reads of client-owned memory on the DirectGLES inproc draw path |
|
||||
| [`KIMI-DEVICE-VERIFY.md`](KIMI-DEVICE-VERIFY.md) | Device verification brief (Kimi): build FCL with the P5e MobileGL and prove it still runs |
|
||||
| [`P5E-RUNAHEAD.md`](P5E-RUNAHEAD.md) | P5e:退役 Espryt draw path 的 lockstep(run-ahead) |
|
||||
| [`PACKAGE-PREAMBLE-P5E.md`](PACKAGE-PREAMBLE-P5E.md) | P5e package preamble (read first; applies to every package agent) |
|
||||
| [`PERF-BASELINE-7c6f6886.md`](PERF-BASELINE-7c6f6886.md) | inproc vs monolith at `7c6f6886` — measured, and why |
|
||||
| [`PERF-CORRECTION.md`](PERF-CORRECTION.md) | CORRECTION to `PERF-PROFILE-7c6f6886.md` §5 — run-ahead removes much less of the fill than §4 implied |
|
||||
| [`PERF-NEXT-TARGETS.md`](PERF-NEXT-TARGETS.md) | After run-ahead: there is no second lever |
|
||||
| [`PERF-PROFILE-7c6f6886.md`](PERF-PROFILE-7c6f6886.md) | The symbolized profile, and what run-ahead actually removes |
|
||||
| [`PREAMBLE-ADDENDUM-WAVE3.md`](PREAMBLE-ADDENDUM-WAVE3.md) | Addendum to `PACKAGE-PREAMBLE-P5E.md` for wave 3 (pa / mv / gl), 2026-09-18 |
|
||||
| [`SCOUT-P5E.md`](SCOUT-P5E.md) | P5e scouting brief: retire the lockstep on the Espryt draw path (client runs ahead of apply) |
|
||||
| [`scout-S1.md`](scout-S1.md) | S1 — VAO / vertex input / index, under run-ahead |
|
||||
| [`scout-S2.md`](scout-S2.md) | S2 — textures and samplers under run-ahead (P5e scouting report) |
|
||||
| [`scout-S3.md`](scout-S3.md) | S3 - framebuffers, attachments, images (P5e scouting, head `2fde7034`) |
|
||||
| [`scout-S4.md`](scout-S4.md) | S4 - programs / shader state (E note a.2) at head `2fde7034` |
|
||||
| [`scout-S5.md`](scout-S5.md) | S5 — buffer binding points and the remaining rows (P5e scouting report) |
|
||||
| [`scout-S6.md`](scout-S6.md) | S6 - transport mechanics of run-ahead (head `2fde7034`, paths under `MobileGL/`) |
|
||||
| [`scout-S7.md`](scout-S7.md) | S7 - identity: the five twin registries and the allocator (head `2fde7034`) |
|
||||
| [`STRICT-BASELINE-2fde7034.md`](STRICT-BASELINE-2fde7034.md) | Strict-lane baseline at `2fde7034` (the P5e starting point) |
|
||||
| [`STRICT-WORKLIST.md`](STRICT-WORKLIST.md) | P5e — what is actually left before the strict lane can be a hard gate |
|
||||
| [`TASK-c0e.md`](TASK-c0e.md) | Package c0e — the contract and the wire (P5e; lands first, inert) |
|
||||
| [`TASK-fb.md`](TASK-fb.md) | Package fb — framebuffers, attachments, images, blit from records (P5e wave 2) |
|
||||
| [`TASK-gl.md`](TASK-gl.md) | TASK-gl — make the strict lane mean something, and make the flip survivable |
|
||||
| [`TASK-id.md`](TASK-id.md) | Package id — identity: handle-keyed twins, the guard, the scopes (P5e; lands second) |
|
||||
| [`TASK-mv.md`](TASK-mv.md) | TASK-mv — the multi-draw path stops reading the frontend VAO |
|
||||
| [`TASK-pa.md`](TASK-pa.md) | TASK-pa — the program family leaves the frontend on the draw and dispatch paths |
|
||||
| [`TASK-pg.md`](TASK-pg.md) | Package pg — programs: the twin and every reflection answer come from records (P5e wave 2) |
|
||||
| [`TASK-ra.md`](TASK-ra.md) | Package ra — the wait rule, present credit, server-owned `gPipeInputs` (P5e; parallel, lands last) |
|
||||
| [`TASK-ra2.md`](TASK-ra2.md) | TASK-ra2 — make run-ahead actually correct |
|
||||
| [`TASK-sb.md`](TASK-sb.md) | Package sb — `set_shader_buffers`: the binding-point tables cross the wire (P5e wave 2) |
|
||||
| [`TASK-tx2.md`](TASK-tx2.md) | Package tx2 — textures and samplers by handle and window (P5e wave 2) |
|
||||
| [`TASK-vi.md`](TASK-vi.md) | Package vi — VAO / vertex input / index from records (P5e wave 2) |
|
||||
| [`WAVE3-CENSUS.md`](WAVE3-CENSUS.md) | Wave 3 census — the strict lane at `3c13fa4b` (pa + mv + ID-124 merged) |
|
||||
| [`reports/`](reports/) | 14 个文件:各包报告与设备验证(`device-verify-3cc4e1ec.md` 等) |
|
||||
@@ -0,0 +1,192 @@
|
||||
# P5e scouting brief: retire the lockstep on the Espryt draw path (client runs ahead of apply)
|
||||
|
||||
Repo (READ-ONLY for scouts): `C:/Users/geekerwan/AndroidStudioProjects/FoldCraftLauncher/MobileGL-disagg`,
|
||||
branch `feat/disaggregated`, head `2fde7034` (code head `1f8de61b`). Paths below are under `MobileGL/`
|
||||
unless they start with `docs/`. Cite `file:line` at this head; the E note's citations are at `85362a85`
|
||||
and may have moved a few lines in `ClientSession.cpp`, `ServerLoop.*`, `PersistentMapTracker.*`,
|
||||
`PipeFill.cpp`, `PipeInputs.cpp`, `SlotAllocator.*`, `Doorbell.*` (round 3 touched them) - re-resolve.
|
||||
|
||||
## Where we are
|
||||
|
||||
P5d round 3 made `inproc` CPU-bound on the client thread at ~9 ms/frame (Redmi, MC 26.3 VD12, ~850
|
||||
draws/frame), apply thread ~2-3 ms of real work per frame plus spinning. The frame is still
|
||||
`client work + (per draw) wait for apply + handoff`: every kCtxVerb (draw/clear/blit/dispatch) and
|
||||
every reply-slot row waits `appliedSeq == seq` (R-1, `MG_Remote/Client/ClientSession.cpp`
|
||||
EmitAndWaitTails). The reason the wait exists is stated in `MG_Remote/CONTRACT-P5C.md` §0 rule E
|
||||
and its two named exemptions (§3.1 object-class rows, §5.4 the two scopes): during apply the server
|
||||
still dereferences client-owned memory through the 15 object-class BARRIER_PULLED rows of
|
||||
`MG_Pipe/FieldOwnership.def` and through the five frontend-keyed twin registries
|
||||
(`MG_Backend/DirectGLES/SlotTables.h`, `HandleOf(stateObj)` -> `MGPipeSlots().FindByLifetimeId`,
|
||||
`GetOrCreate(const StatePtr&)` -> `MGPipeSlots().Acquire`) inside `MGPipeFrontendKeyedRegistryScope`
|
||||
/ `MGPipeReverseAnnouncementScope`. If the client ran ahead, those reads would race the GL thread's
|
||||
next verb (bindings move, objects die, the client slot allocator is mutated by glGen/glDelete) and
|
||||
the shared `gPipeInputs` block (`MG_Backend/MGPipe/PipeInputs.h`, the residual fill in
|
||||
`MG_Impl/Pipe/PipeFill.cpp` MGPipeValidateForVerb step 4, the server stamp in
|
||||
`MG_Backend/MGPipe/PipeInputs.cpp`) would be written by both roles.
|
||||
|
||||
**The research note** `SCOUT-INPUT-E-lockstep-feasibility.md` (same directory as this brief) already
|
||||
mapped, per object row, every server-side live read on the DirectGLES inproc draw path (its §(a)),
|
||||
why each is unsafe under run-ahead (§(b)), why a snapshot is not the answer (§(c)) and which pushed
|
||||
records already cover the data (§(d)). Its conclusion was "not as a P5d round" - the decision now is
|
||||
to DO it as its own phase (P5e), because it is the item that lets the two threads overlap.
|
||||
|
||||
## The target, stated as invariants (what "done" means)
|
||||
|
||||
P5e-1 On DirectGLES under an active transport, the apply of every op that the client publishes
|
||||
without waiting reads NOTHING from client-owned memory: no frontend object dereference, no
|
||||
`gPipeInputs` BARRIER_PULLED row, no `MGPipeSlots()` probe or mint. Every object is resolved
|
||||
from a handle the record (or the applier state built from records) carries, through a
|
||||
handle-keyed twin table.
|
||||
P5e-2 The client waits only at: reply-slot rows (already), the control records that need it
|
||||
(`applier_reset`, EGL make-current / surface changes), explicit sync (fence client-wait,
|
||||
Finish), and a present credit (the client may be at most N presents ahead; N configurable,
|
||||
default to be decided by the scouts - 1 or 2). Everything else - draws, clears, blits,
|
||||
dispatches, every set/CSO/object record, persistent-map pushes - is fire-and-forget on the
|
||||
in-order ring; SEG_CMD / SEG_STAGE space is the only backpressure.
|
||||
P5e-3 `gPipeInputs` becomes server-role memory under a live wire: the GL thread does not touch the
|
||||
block at all for run-ahead ops (the residual fill and the client-side stamp bookkeeping are
|
||||
skipped; the tracker dirty walk and the emitters still run - they produce records). The
|
||||
server's stamp + `MGPipeInputUnfreshRead` becomes the detector: any BARRIER_PULLED read
|
||||
during a run-ahead apply is `Fatal{UnmigratedPipeInput,...}` (strict), so the strict lane
|
||||
(`integration-split-strict`, `MOBILEGL_IPC_STRICT_ERRORS=1`) turns from "expected red" into a
|
||||
hard green gate for the migrated verbs.
|
||||
P5e-4 DirectVulkan (Magma, P7 not done) keeps the lockstep: the run-ahead switch is a backend
|
||||
capability the server publishes (caps snapshot / `CapsMirror`), not a client guess.
|
||||
P5e-5 Monolith and the pull build are byte-identical (G1) or every delta is named; the push
|
||||
build under `Transport=monolith` unchanged in behaviour; G2/G14 name-set rules kept.
|
||||
P5e-6 Evidence: per family a red-once (revert the handle arm -> a named Fatal or a named test red);
|
||||
the exit gate is unit + `integration-split` + `integration-split-strict` green for the
|
||||
migrated verbs, the four A/B traces rendering under run-ahead on the Redmi with SSIM
|
||||
unchanged, and the device numbers (fps + per-thread CPU ms/frame; the client thread
|
||||
should stop spending its 30% in WaitForApplied).
|
||||
|
||||
## Scout assignments (one agent each; read the code, not just the note; write your report file)
|
||||
|
||||
Every report: (1) the exact live reads of your family at head `2fde7034` (file:line, kind: live /
|
||||
id / mint / rec, and whether it runs on a memo hit or only on a miss), (2) what the records and
|
||||
applier state ALREADY carry for it (`MG_Pipe/PipeApply.h` MGPipeApplierState, `MG_Pipe/MGPipeTypes.h`
|
||||
record PODs, `MG_Pipe/PipeCalls.def` rows, the emitters in `MG_Impl/Pipe/*Emit.h` and
|
||||
`MG_Remote/Client/EmitTables.cpp`), (3) the gap: fields/records that do not exist yet and must be
|
||||
added (name the record, the fields, the encoding, and the client-side dirty/emit rule), (4) the
|
||||
retirement design: the server code shape after the change (which functions change, which twin
|
||||
table key, how "is it clean / does it need re-sync" is answered from server-owned serials),
|
||||
(5) monolith/G1 impact and how the monolith arm stays byte-identical (`#if`, transport check, or
|
||||
a separate function), (6) the red-once test(s), (7) risks and the things you could not settle.
|
||||
<= 250 lines, precise, in the voice of the existing contracts.
|
||||
|
||||
### S1 - VAO / vertex input / index (E note a.1)
|
||||
Sites: `DirectGLES/DirectGLES.cpp` ResolveVaoTwin, PrepareForDraw's config-version read,
|
||||
SyncVaoAttributeBuffersByHandle (memo hit + miss), the IBO arm, SyncCurrentVertexAttributeValues,
|
||||
DrawArrays/MultiDrawArrays client-side attribute paths, `Managers.cpp` EnsureBufferResource(obj) ->
|
||||
HandleOfBuffer. State: BoundVertexElements + VertexElementsCsos (content serial), VertexBuffers[]
|
||||
{Res,...} + VertexBuffersSerial, IndexBuffer.Res, SetVertexAttribDefaults record. Design question:
|
||||
the server's VAO twin key - the vertex-elements CSO handle (one GL VAO per CSO, buffers rebound per
|
||||
draw from VertexBuffers[]) or something else; what happens to `ResolvedDrawBuffers` memo keys;
|
||||
`EnsureBufferResourceForHandle(nullptr, h)` everywhere; client-side arrays are already refused
|
||||
under split (confirm).
|
||||
|
||||
### S2 - textures and samplers (a.3)
|
||||
Sites: CaptureDrawTextureSyncKeys / CurrentUnitBindingsEpoch, SyncNeccessaryTextures (memo hit:
|
||||
PairingsIntact + IsDrawSyncClean through borrowed slot pointers; memo miss: unit walk +
|
||||
SyncTextureObjectToBackend(frontend)), ResolveAndBindUnitTextures, the sampler pass,
|
||||
BindCurrentUnitSamplers, `TextureImpl` twin registry (`StateBackendObjectRegistry<ITextureObject,...>`
|
||||
keyed by frontend), `SyncMipmapsToBackend`, `ResolvePushedTextureParams/BuiltinSampler` (P4a/P5c tx
|
||||
already read records + the server staged store keyed by handle). State: BoundSamplerViews[unit]
|
||||
{View, Texture, Unit} + SamplerViewsSerial, BoundSamplerStates[] + SamplerStatesSerial,
|
||||
set_texture_params, tx `StagedTextureStore`. Design: twin keyed by texture handle; per-twin
|
||||
"clean" from server-owned serials (params serial, storage/defined-ness serial from tx, sampler-state
|
||||
handle) instead of `IsDrawSyncClean(frontend)`; the memo re-keyed on (unit -> texture handle +
|
||||
serials); texture death (`object_death` for textures exists since P5c ct?) and the default-texture
|
||||
/ builtin-sampler cases.
|
||||
|
||||
### S3 - framebuffers, attachments, images (a.4, a.5)
|
||||
Sites: SyncCurrentFBO/SyncCurrentFBOByRecord, BindCurrentFBO, the draw-FBO texture sync list in
|
||||
SyncNeccessaryTextures and SyncReadFramebufferTextureAttachments (identity half = pointer compare,
|
||||
`GetAllAttachmentObjects()` live), Clear/BlitFramebuffer bound arms, `g_fboTextureSyncList`,
|
||||
SyncImageTextureBinding (Access byte has no encoding), MarkWritableImageBufferTexturesGpuWritten
|
||||
(buffer-texture backing buffer via frontend). State: FramebufferRecords[handle] {Color[8]/Depth/
|
||||
Stencil surfaces, DrawBuffers, IsDefault}, BoundFramebuffer[2], FramebufferSerial, BoundShaderImages[]
|
||||
{Res, Unit, InternalFormat, Layer, Level, Layered, Access}, the TexBuffer backing record (P4a).
|
||||
Design: framebuffer twin keyed by handle (already? `FindByHandle(record.Fbo)` exists), attachment
|
||||
lists from the record's surface handles, the image `Access` encoding, the buffer-texture backing
|
||||
handle on the server.
|
||||
|
||||
### S4 - programs / shader state (a.2)
|
||||
Sites: SyncCurrentProgram, BindCurrentTextures (program-keyed memo), BindCurrentProgramWithResources
|
||||
(link/spirv status, UBO size, MapUBO without ShaderCso, GetUniformBlockBinding, backend state
|
||||
version, sampler-pass uniform unit indices), SyncAtomicCounterBuffers, PrepareForCompute's
|
||||
GetProgramForDispatch, `g_backendProgramObjects` registry, GetProgramObject/ValidateProgramName
|
||||
sticky rows. State: DrawProgram / DispatchProgram / BoundShaderCso handles, ShaderCso records
|
||||
(create_shader_state: SPIR-V + full reflection = `ProgramState/ProgramArtifacts.h`), GlobalConstants
|
||||
bytes + version. Design: program twin keyed by the shader-state handle; every reflection question
|
||||
answered from the archived artifacts; the "no ShaderCso record" arm (MapUBO) - who takes it and
|
||||
whether it can be refused under run-ahead; link status as record state.
|
||||
|
||||
### S5 - buffer binding points and the remaining rows (a.6 + the tail)
|
||||
Sites: SyncBufferBindingPoints (UBO/SSBO/atomic/XFB), the UBO loop in BindCurrentProgramWithResources,
|
||||
MarkShaderStorageBuffersGpuWritten, SyncAtomicCounterBuffers, GetBufferBindingPointCount sticky,
|
||||
XFB rows (GetTransformFeedbackProgram, HasOpenTransformFeedbackSpan, StartPendingTransformFeedback),
|
||||
GetBufferBindingSlot (15 pointers, filled every draw, no draw-path reader), RecordError.
|
||||
State: `set_shader_buffers` (`MGPShaderBuffers`, PipeCalls.def:174, kCtxState, kVarTail|kHostSpan,
|
||||
CONTRACT-P5C.md:169-176 says catalogued but NOT emitted until P4b). Design: the emission (client
|
||||
tracker dirty rule for the four binding-point tables - what dirty bit exists, `gen_pipe_dirty_surface`
|
||||
implications), the applier-side table, the Espryt consumers (UBO points at draw, SSBO/atomic points,
|
||||
XFB capture points), the named-UBO host span (D-B8 is Magma-only - can the Espryt emission omit
|
||||
it), `GetBufferBindingPointCount` from the record; what stays lockstep (an open XFB span? dispatch
|
||||
with atomic counters?) and how the client knows to wait there.
|
||||
|
||||
### S6 - transport mechanics of run-ahead (fable)
|
||||
`MG_Remote/Client/ClientSession.cpp` EmitAndWaitTails / the barrier flags / DrainEventRing /
|
||||
AwaitBufferWriteback / Stop's drain, `MG_Remote/Transport/SessionRings.h` (appliedSeq, presentAck,
|
||||
WaitForCmdSpace, stage retirement), `MG_Remote/Server/ServerLoop.cpp` + `PipeApplier.cpp`
|
||||
(ApplyOne, StampVerbBoundary, LeaveApplier, the deferred-destroy queue from P5d round 1 in
|
||||
`MG_Pipe/PipeMutation.h`), `MG_Remote/Client/PersistentMapTracker.cpp` (pushes before verbs),
|
||||
`MG_Remote/Client/GpuWritePending.cpp`, `CapsMirror.*`, `ConfigLoader.cpp` IPC knobs,
|
||||
`docs/Disaggregated/ARCHITECTURE.md` §11 (reverse channel, present credit `MOBILEGL_IPC_PRESENT_CREDIT`
|
||||
mentioned as P6+/P10), §17. Design: (1) the exact wait rule per op under run-ahead and the switch
|
||||
(`MOBILEGL_IPC_RUN_AHEAD`? default, the caps bit Espryt publishes, Magma stays lockstep, the
|
||||
negative control), (2) present pacing: `WaitForPresentAck` with credit N; what N does to the two rings
|
||||
(SEG_CMD 8 MiB, SEG_STAGE 32/256 MiB) at ~850 draws + 0.36 MB pmap per frame, (3) where events are
|
||||
drained now (present, reply rows) and which client operations must force a drain/wait
|
||||
(MapBuffer readback, GetBufferSubData, glFinish, fence client-wait, glGetError semantics under
|
||||
run-ahead - name the relaxation), (4) `gPipeInputs` ownership: the client-side skip of the residual
|
||||
fill + stamp bookkeeping under a live wire (which of `MGPipeValidateForVerb`'s steps stay: the
|
||||
tracker walk and the emitters must), the server-only stamp, the strict detector, the verify build
|
||||
(`MOBILEGL_PIPE_VERIFY` forces lockstep - confirm), (5) object lifetime under run-ahead: slot reuse
|
||||
{slot,gen} vs records still in flight, `object_death` ordering, the deferred-destroy queue, the
|
||||
client memos that hold frontend->handle maps, `Forget()` of persistent maps while pushes are in
|
||||
flight in SEG_STAGE, (6) the two scopes and `MGPipeRefuseAllocatorFromApplyThread`: after P5e the
|
||||
apply thread must never enter them - the guard becomes unconditional Fatal; list every remaining
|
||||
apply-thread allocator touch that the other scouts' designs do not already retire (readback paths,
|
||||
CopyTex, mip, blit named arms - are they run-ahead ops or waited ops?), (7) the measurement plan on
|
||||
the Redmi (bench scripts exist: `~/w7/notes/tools/p5d_bench_{fcl4,all4}.sh`).
|
||||
|
||||
### S7 - identity: the five twin registries and the allocator (fable)
|
||||
`DirectGLES/SlotTables.h` (BackendSlotTable, StateBackendObjectRegistry, HandleOf, FindByHandle,
|
||||
GetOrCreate(handle) from P5c hd, the holder list / DestroyByLifetimeId, dead-generation rules),
|
||||
`Managers.cpp` HandleOfBuffer / g_backendBufferResources / OnFrontendStateObjectDestroyed /
|
||||
EmitObjectDeathRecord (P5c ct), `MG_Impl/Pipe/SlotAllocator.*`, `MG_Impl/Pipe/ResourceTracker.h`,
|
||||
the client-side lifetime-id -> handle maps, `MG_Pipe/PipeMutation.h` deferred destroys. Deliver:
|
||||
for each of the five kinds (buffer, VAO, texture, framebuffer, program/shader state) + sampler +
|
||||
renderbuffer if they have twins: today's key, the record that carries the handle at create/bind,
|
||||
whether a death record exists, and the exact change to make the registry handle-keyed with no
|
||||
`GetOrCreate(const StatePtr&)` / `HandleOf(stateObj)` reachable on the apply thread; the twin
|
||||
creation moment (first record naming the handle) and the twin death moment (object_death / applier
|
||||
reset); the "recycled slot, new gen" ABA answer; how the 20 scope sites are removed and the two
|
||||
scopes deleted (or reduced to monolith-only). This is the spine the other scouts hang on - be exact.
|
||||
|
||||
### S8 - synthesis (fable; runs after S1-S7)
|
||||
Read all seven reports and write `CONTRACT-P5E-draft.md` (the rules: run-ahead op classes and
|
||||
wait points; server-owned `gPipeInputs`; handle-keyed twins; the new records/fields; Magma stays
|
||||
lockstep; the strict gate) and `BRIEF-P5E.md`: packages with file ownership boundaries that can be
|
||||
implemented in parallel worktrees, their order/dependencies (which package lands first so the
|
||||
others build on it - likely S7's registry re-key and S5's record), per-package red-once and quick
|
||||
gate, the integration gate, the device exit, and the open questions that need the integrator's
|
||||
ruling. Name conflicts between scout designs explicitly and resolve them (or list them as rulings
|
||||
needed). <= 500 lines each; write the files before the final message.
|
||||
|
||||
## Rules
|
||||
Read-only: no edits to the repo, no builds, no adb. Reports go to
|
||||
`C:/Users/geekerwan/AppData/Local/Temp/claude/C--Users-geekerwan-AndroidStudioProjects-FoldCraftLauncher-MobileGL-disagg/5007453d-cb19-4ebf-96a3-60ba4fb55b47/scratchpad/p5e/scout-<id>.md`
|
||||
(write the file BEFORE the final message; the final message is the structured result only).
|
||||
No process narration in the reports. Cite at head `2fde7034`.
|
||||
@@ -0,0 +1,37 @@
|
||||
# Strict-lane baseline at `2fde7034` (the P5e starting point)
|
||||
|
||||
Measured by the integrator on `~/w7/p5d-gate` (split build, lavapipe), 2026-09-18:
|
||||
|
||||
```
|
||||
MOBILEGL_IPC_STRICT_ERRORS=1 ctest -L integration-split --no-tests=error -j 4
|
||||
```
|
||||
|
||||
Result: the lane is RED by design today (CONTRACT-P5C §6 / the `integration-split-strict` CI job:
|
||||
"every integration-split entry aborts on its first BARRIER-PULLED read"). 111 entries, essentially
|
||||
all `Subprocess aborted`.
|
||||
|
||||
## The markers, from the per-entry private logs (ID-53)
|
||||
|
||||
Only 22 entries have a private `MOBILEGL_LOG_FILE_PATH`, so this is the visible slice. Each entry
|
||||
aborts on its FIRST pulled row, so the table is a **lower bound**: as a package retires a field, the
|
||||
next field in that entry's path surfaces and the table grows before it shrinks. That is expected —
|
||||
the metric is "which fields still appear", not the counts.
|
||||
|
||||
| marker (`field@verb`) | entries | family / owner |
|
||||
|---|---|---|
|
||||
| `GetTextureUnitObject@Clear` | 13 | tx2 |
|
||||
| `GetFramebufferBindingSlot@Clear` | 6 | fb |
|
||||
| `GetTextureUnitObject@GenerateMipmap` | 2 | tx2 |
|
||||
| `GetTextureUnitObject@ReadPixels` | 1 | tx2 (barriered row; allowlisted until P8/P9) |
|
||||
|
||||
Fields visible at the base: **`GetTextureUnitObject`, `GetFramebufferBindingSlot`** — nothing else
|
||||
gets a chance to abort first. `rsp=0` in every log that printed it (the P5c residual-value work).
|
||||
|
||||
## How each package uses this
|
||||
|
||||
Run `p5e_gate.sh <slug> strict` before and after your change and put BOTH marker tables in your
|
||||
report. A field of your family disappearing is your progress; a new field appearing behind it is
|
||||
another package's row surfacing, not a regression — name it and say whose it is.
|
||||
|
||||
The phase exit (BRIEF-P5E §3.3) is this lane GREEN with only the contract §7 allowlist
|
||||
(`<field>@<verb>` for readbacks, XFB, CopyTex, `set_storage_block_binding`) admitted.
|
||||
@@ -0,0 +1,95 @@
|
||||
# P5e — what is actually left before the strict lane can be a hard gate
|
||||
|
||||
Head `7c6f6886`. Measured, not assumed: the per-entry marker census is
|
||||
`~/w7/p5e-logs/strict-census/census2.tsv` (produced by `strict_census2.sh`, which runs each red
|
||||
entry alone against the test binary because ctest swallows `MGLOG_F` and the log-file knob is read
|
||||
before the config loader, so the lane's own entries never write one).
|
||||
|
||||
## 1 The census
|
||||
|
||||
`integration-split` is 116/116 green. Under `MOBILEGL_IPC_STRICT_ERRORS=1`: 7 pass, 109 abort.
|
||||
|
||||
| marker | entries | who retires it | verdict |
|
||||
|---|---|---|---|
|
||||
| `GetProgramForDraw@DrawArrays` | 61 | P5e | **must go** |
|
||||
| `GetFramebufferBindingSlot@ReadPixels` | 21 | P5e row, but a READBACK | allowlist candidate |
|
||||
| `GetBoundVertexArray@DrawArrays` | 9 | P5e | **must go** |
|
||||
| `GetProgramForDispatch@DispatchCompute` | 7 | P5e | **must go** |
|
||||
| `GetTextureObject@CopyImageSubData` | 6 | P7 | allowlist candidate |
|
||||
| `ValidateProgramName@ShaderStorageBlockBinding` | 2 | P9 | allowlist candidate |
|
||||
| `GetTextureUnitObject@CopyTexImage2D` | 2 | P5e row, but CopyTex | allowlist candidate |
|
||||
| (none captured) | 1 | — | **census artifact**, see §4 |
|
||||
|
||||
## 2 The program family (68 of the 109) — and the wire already carries the answer
|
||||
|
||||
The important finding: **no wire change is needed.** `MGPipeShaderCsoRecord`
|
||||
(`MG_Pipe/PipeApply.h:391`) already holds `SharedPtr<const ProgramArchive> Archive` — the whole of
|
||||
the frontend's `LinkArtifacts` plus the SPIR-V, encoded once per link by pg — and the three
|
||||
post-link mutable tails (`BlockBindings`, `SamplerUnits`, `StorageOverrides`) with a
|
||||
`BindingsSerial`. What is missing is not data on the wire; it is **readers that still ask the
|
||||
frontend object instead of the archive**.
|
||||
|
||||
Three sites, all in `MG_Backend/DirectGLES/DirectGLES.cpp`:
|
||||
|
||||
| site | what it is | state |
|
||||
|---|---|---|
|
||||
| `:6006` `PrepareForDraw` | `const auto& currentProgram = MGB_CTX->GetProgramForDraw();` — **unconditional**, no arm test. Merely calling the accessor trips `MGP_INPUT_CHECK` (`MG_Backend/MGPipe/PipeInputs.h:659`), so this alone is the per-draw marker. | the whole fix |
|
||||
| `:6746` `BindCurrentTextures()` (the no-arg overload) | same accessor, same problem | same fix |
|
||||
| `:7374`, `:7446` | already behind `if (ProgramHandleArm())` — pg did these | done |
|
||||
|
||||
Two genuine consumers keep it alive under the handle arm:
|
||||
|
||||
- **`ResolveAndBindUnitTextures` (`:6090`, reached from `BindCurrentTextures` at `:6719`)** reads
|
||||
`GetMaxUniformLocation`, `GetUniformSamplerOrImageUnitIndex`, `GetUniformType` off the frontend
|
||||
program. The memo KEY above it is already handle-only (`:6644-6663`, ruling ID-86) — it is the
|
||||
miss path that still reads the frontend.
|
||||
- **`SyncCurrentVertexAttributeValues` (`:2243`, called at `:6070`)** reads
|
||||
`GetActiveAttributeLocationMask` and `GetAttribType`. **The code already names this as the
|
||||
remaining work and whose it is**: its own comment at `:2258-2268` says "WHAT IS NOT RETIRED HERE,
|
||||
and it is S4/pg's not vi's: the two program reads below … stay until pg carries the attribute
|
||||
mask and types in the ShaderCso record."
|
||||
|
||||
So the package is: give both readers a handle arm that answers from `record->Archive->Link`, then
|
||||
arm-select the two accessor calls themselves. `GetProgramForDispatch@DispatchCompute` is the same
|
||||
shape in `PrepareForCompute`.
|
||||
|
||||
## 3 `GetBoundVertexArray@DrawArrays` (9) is confined to multi-draw
|
||||
|
||||
All nine entries are `MultiDrawScenario.*` plus `IndexedDrawFamilyScenario.MultiDrawElementsBaseVertexPaintsEverySubDraw`.
|
||||
vi retired the bound-VAO row on the record arm inside `SyncCurrentVertexAttributeValues`
|
||||
(`:2290`, `fromRecords ? noVao : MGB_CTX->GetBoundVertexArray()`), so this is a DIFFERENT site on
|
||||
the per-sub-draw path. Find it and give it the same treatment.
|
||||
|
||||
## 4 The one entry with no marker is a census artifact, not a finding
|
||||
|
||||
`DirectGLES.Split.PersistentMapArm.PersistentCoherentMapScenario.TheMapLandsInTheArmItsLaneDeclares`.
|
||||
The lane prefix `PersistentMapArm` carries EXTRA ctest `ENVIRONMENT` (the arm knob) that the
|
||||
direct-binary re-run did not reproduce, so the entry took a different path. Every entry with a
|
||||
third name segment (`Ct.`, `F1.`, `SmallRing.`, `PersistentMapArm.`, `NamedBlit.`) is subject to the
|
||||
same doubt and its marker must be re-taken under its own lane environment before the table is
|
||||
trusted.
|
||||
|
||||
## 5 The lane cannot go literally green as the knob is written
|
||||
|
||||
`CountBarrierPull` (`MG_Backend/MGPipe/PipeInputs.cpp:98`) aborts on EVERY barrier-pulled read when
|
||||
`StrictErrors` is set, allowlisted or not. So "GREEN as a hard lane" (BRIEF §3.3) cannot mean
|
||||
116/116 under the knob unchanged. Either the knob becomes allowlist-aware, or the gate becomes a
|
||||
marker-set comparison. `StrictBarrierPullFatal`'s `why` argument already exists **for this
|
||||
purpose** — its comment says "the lane's allowlist step reads this line and the two reasons mean
|
||||
different things to it". Whatever is chosen has to be decided once and mechanised, not kept by hand.
|
||||
|
||||
## 6 The performance target, measured
|
||||
|
||||
Monolith at this head, Redmi, MC 26.3-rc-3, ~849 draws/frame, GPU pinned, fan on, 30 s window:
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| fps | 254.9 (p50 267.9, min 197.7, max 275.9) |
|
||||
| GL thread `Thread-17` | **993.7 ms CPU per second** — 99.4% of one core |
|
||||
| per frame | **3.898 ms** |
|
||||
|
||||
Monolith is single-thread CPU-bound at 3.9 ms/frame. **Parity therefore means
|
||||
`max(client, apply) <= 3.9 ms/frame` on the split arm**, which is a question about balance and
|
||||
overhead, not a question about total work: the split may spend MORE total CPU than monolith and
|
||||
still win, as long as neither thread exceeds monolith's single-thread cost. That is the arithmetic
|
||||
the optimisation phase has to hit.
|
||||
@@ -0,0 +1,65 @@
|
||||
# Package c0e — the contract and the wire (P5e; lands first, inert)
|
||||
|
||||
Read in this order, all of it: `PACKAGE-PREAMBLE-P5E.md`, `INTEGRATOR-DECISIONS-P5E.md`,
|
||||
`BRIEF-P5E.md` (§0, §1, §2 "c0e", §3, §6), `CONTRACT-P5E-draft.md` (all of it — you are landing it),
|
||||
then the scout reports your rows come from (`scout-S6.md` for the wait classes / knobs / caps bit,
|
||||
`scout-S5.md` for `set_shader_buffers`' encoding and bit 13, `scout-S4.md` for `set_program_bindings`
|
||||
/ `LinkStatus`, `scout-S3.md` for the image `Access` decode, `scout-S1.md` for `kDrawClientArrays`,
|
||||
`scout-S7.md` for the seam declarations). All are in `//wsl.localhost/Arch/home/swung/w7/notes/p5e/`.
|
||||
Your slug is `c0e`; your tree is `~/w7/p5e-c0e` (built, on branch `p5e/c0e` at `2fde7034`).
|
||||
|
||||
## Deliverables (all inert: no behaviour changes; unit + integration-split + gens stay green; G1 0/0/0/0)
|
||||
|
||||
1. `MobileGL/MG_Remote/CONTRACT-P5E.md` — the draft, edited into its landed form: apply the 19 rulings
|
||||
as decided in `INTEGRATOR-DECISIONS-P5E.md` (they mostly match the draft's recommendations),
|
||||
make every `file:line` resolve at the HEAD of your branch (run `gens`; the doc-citation lint covers
|
||||
`MG_Remote/CONTRACT-P5*.md`), remove "draft" wording, keep the voice of CONTRACT-P5C.
|
||||
2. `MobileGL/MG_Pipe/PipeCalls.def`: the `WaitClass` column on every row exactly as CONTRACT-P5E §2.2
|
||||
(kWaitNone / kWaitApplied / kWaitReply / kWaitPresent / kWaitByPredicate…), `SetProgramBindings`
|
||||
(opcode 80) appended in S4's shape. Extend the generator(s) that read the def (`scripts/gen_pipe.py`
|
||||
and whatever emits the wire/route/thunk tables — find them) so that `MGPipeWaitClassFor(op)` is
|
||||
generated, the new op has its codec layout / thunk / table slot / route row (null route, refused
|
||||
by name until pg lands), and every `--check` / `--self-test` stays green with the regenerated
|
||||
`MobileGL/MG_Pipe/generated/*.inc` committed. The ABI fingerprint (`SessionRings.h`) must change
|
||||
with the new opcode; pin it.
|
||||
3. `MobileGL/MG_Pipe/MGPipeTypes.h`: `kCapRunAheadApply` (bit 10, MGPCapBit), `MGPProgramBindings`
|
||||
+ its tail PODs, `MGPProgramDesc::LinkStatus` in the spare bytes, `kDrawClientArrays` draw flag,
|
||||
`kMGPipeMaxBufferBindingPoints` (84; pinned against `BufferState.h`'s constant where both are
|
||||
visible), `MGP_ASSERT_POD` sizes; `MGPipeValueTypes.h`: `MGPipeImageAccess` enum with
|
||||
encode/decode (the client encode in `ImageEmit.h` already exists — move/alias, do not duplicate).
|
||||
4. `MobileGL/MG_Pipe/MGPipe.h`: subsystem bit 13 (`kMGPipeSubsystemBufferBindings`), default mask
|
||||
`0x3fff`; `MG_Impl/Pipe/SetHashSuppressor.h`: the three `SetShaderBuffers` class slots;
|
||||
`MG_Impl/Pipe/Tracker.h`: bits 15-17 mapped to subsystem 13 (`MGPipeSubsystemForDirty`);
|
||||
`TrackerTest.cpp`'s bit table; `MG_Pipe/FieldOwnership.def` re-annotations (retiring phase P5e
|
||||
on the rows the brief names); `MG_Pipe/Coverage.def` rows as the contract lists.
|
||||
5. `MobileGL/Config.h` / `ConfigLoader.cpp`: `IpcTable::RunAhead` (`MOBILEGL_IPC_RUN_AHEAD`, default
|
||||
1, forced 0 under `PipeVerify`, logged in the IPC line), `IpcTable::PresentCredit`
|
||||
(`MOBILEGL_IPC_PRESENT_CREDIT`, default 1, range 1..8).
|
||||
6. Seam declarations in `MobileGL/MG_Pipe/PipeApply.h` (+ `.cpp` bodies that assert "not landed" by
|
||||
name, never silently succeed): `MGPipeApplierCurrentRecordIsBarriered()`,
|
||||
`MGPipeBarriered(op, payload, applierState)` (the static column half implemented here; the
|
||||
XFB/client-array halves read the fields the contract names), the sb applier fields
|
||||
(`BoundShaderBuffers[3]`, `Start/Count/WritableMask[3]`, `ShaderBuffersSerial`) and
|
||||
`MGPipeApplySetShaderBuffers` declaration, the pg fields on `MGPipeShaderCsoRecord`
|
||||
(`BlockBindings`, `SamplerUnits`, `StorageOverrides`, `BindingsSerial`, `LinkStatus`) and
|
||||
`MGPipeApplySetProgramBindings` declaration, the by-handle sync signatures the family packages
|
||||
implement (`SyncTextureToBackendByHandle`, `SyncMipmapsToBackendByHandle`, `ResolveVaoTwin(handle)`,
|
||||
`ResolveProgramTwin(handle)`, `ResolveTextureTwin(handle)`, the FBO/RBO `SyncToBackendByHandle`
|
||||
overloads) — declared where the brief says (Managers.h ranges) with asserting bodies, so every
|
||||
package compiles against the same names from day one.
|
||||
7. `MobileGL/MG_Backend/Init.cpp`: `kMGPipeP5eRunAheadReady = false` and the DirectGLES arm that
|
||||
will publish bit 10 only when it is true (Magma never); `MagmaPipeIdentityTest` pins no bit 10.
|
||||
8. `MG_Test/Pipe/PipeCatalogueTest.cpp`: sizes, opcode 80, the null route pin, the wait-class table
|
||||
(every row's class asserted against the contract table by name).
|
||||
9. `docs/Disaggregated/ROADMAP.md`: the P5e row (status "进行中", the package list, the exit gate)
|
||||
inserted after P5d; `CURRENT_STAGE_PROGRESS.md` §1 row + §6 next-step line. Keep the citation lint green.
|
||||
|
||||
## Red-once (execute, revert, record)
|
||||
- Flip one row's `WaitClass` in the def without regenerating → `gen_pipe.py --check` red.
|
||||
- Change the `MGPProgramBindings` POD size → `PipeCatalogueTest` red.
|
||||
- Publish bit 10 on the Magma arm → `MagmaPipeIdentityTest` red.
|
||||
|
||||
## Gate
|
||||
`build`, `unit`, `isplit`, `gens` green; `strict` unchanged vs base (record its marker list in the
|
||||
report as the baseline the later packages must shrink). Commit in sensible slices (contract; def +
|
||||
generators + generated; types; knobs; seams + tests; docs).
|
||||
@@ -0,0 +1,71 @@
|
||||
# Package fb — framebuffers, attachments, images, blit from records (P5e wave 2)
|
||||
|
||||
Read in this order, all of it: `PACKAGE-PREAMBLE-P5E.md`, `INTEGRATOR-DECISIONS-P5E.md` (ID-86,
|
||||
ID-94 are yours), `BRIEF-P5E.md` (§0, §1, §2 "fb", §5, §6 rulings 7, 15, 16), `CONTRACT-P5E.md`
|
||||
§5.4, your scout report `scout-S3.md` (all of it), and the framebuffer / image rows of
|
||||
`kimi-audit.md` (rows 68-90) — report per row: retired / left barriered / not found. Notes:
|
||||
`//wsl.localhost/Arch/home/swung/w7/notes/p5e/`.
|
||||
|
||||
Your slug is `fb`; your tree is `~/w7/p5e-fb` (branch `p5e/fb`, based on the landed id head, built).
|
||||
You CALL tx2's `SyncTextureToBackendByHandle` / `SyncMipmapsToBackendByHandle` (declared by c0e with
|
||||
asserting bodies; tx2 writes them in parallel) — code against the declarations and say so in the
|
||||
report; the integrator resolves the order at landing.
|
||||
|
||||
## What "done" means for this family
|
||||
|
||||
The FBO and RBO twins resolve from the record (`st.BoundFramebuffer[t]` →
|
||||
`FramebufferRecords[handle]`), never from the binding slot or the frontend object; the draw-FBO and
|
||||
read-FBO attachment lists are keyed by `{record.Fbo, ContentHash}` with surface handles instead of
|
||||
borrowed attachment `SharedPtr` slots — this is the one unconditional per-draw live read of your
|
||||
family, so it is the package's core; `SyncAttachmentSurface` takes an `MGPSurface`, not a frontend
|
||||
attachment; the named blit resolves both endpoints from the two records; images come from
|
||||
`BoundShaderImages[]` with `Access` DECODED (ruling 16 / ID-94: the client already encodes it, the
|
||||
server comment is stale) and the sweep gate reads applier serials (ruling 7 / ID-86:
|
||||
`ShaderImagesSerial`, `TextureShutterSerial`, `ContextSerial`, `g_backendContextGeneration` — keep
|
||||
the window/high-water union); `MarkWritableImageBufferTexturesGpuWritten` is deleted under a
|
||||
transport (one edit paired with sb's deletion of the backend GPU-write marks — coordinate in the
|
||||
reports).
|
||||
|
||||
## Scope
|
||||
|
||||
`DirectGLES.cpp`: the doors, the list keys, `SyncReadFramebufferTextureAttachments`, the draw-FBO
|
||||
list, the image block (`SyncImageTextureBinding(const MGPImageView&)`, `ResolveShaderImageRecord`
|
||||
deleted, the sweep gate), `SyncCurrentFBO*`, `BindCurrentFBO` / `SyncAndBind*` / `ForceBindCurrentFBO`,
|
||||
`Clear`'s FBO lines, both blit arms, the detach walk + the new reverse index,
|
||||
`SyncRenderbufferObjectToBackend` by handle. `Managers.cpp` / `Managers.h`: the FBO/RBO twin bodies,
|
||||
the reverse index (texture → FBO slots) tx2 needs for detach. Tests:
|
||||
`MG_Test/Pipe/FramebufferEmitTest.cpp` (the server twin of the existing client case),
|
||||
`MG_Test/Pipe/ImageEmitTest.cpp` (the access constants pinned on BOTH sides), and a new
|
||||
default-framebuffer-resize re-emit case (your scout verified the resize does re-emit — pin it).
|
||||
|
||||
## Rulings that bind you
|
||||
|
||||
- ID-94 / ruling 16: `MGPImageView::Access` IS encoded client-side; move the decode to
|
||||
`MGPipeValueTypes.h` (c0e landed the enum) and delete the stale server comment.
|
||||
- ID-86 / ruling 7: the sweep gate is the four applier/backend serials, never a backend re-mint
|
||||
counter; keep the union of the record window with the image-unit high-water mark.
|
||||
- Your scout's open question on `SyncReadFramebufferTextureAttachments` being ungated on the
|
||||
framebuffer subsystem bit: its retirement changes behaviour in BOTH arms of the object A/B — name
|
||||
the delta in the report and re-baseline that A/B rather than hiding it.
|
||||
- The renderbuffer cross-check that runs a client-allocator `HandleOf` on the apply thread under
|
||||
split: fix it as part of this package and say whether it was a latent correctness bug.
|
||||
|
||||
## Red-once (execute, revert, quote)
|
||||
|
||||
1. `SyncAttachmentSurface` takes the frontend attachment again → `strict` names
|
||||
`Fatal{UnmigratedPipeInput, "GetFramebufferBindingSlot"}` on `SnormAttachmentScenario`.
|
||||
2. The draw-FBO list key back to the pointer compare → the id guard's `Fatal{RoleViolation, "MGPipeSlots"}`
|
||||
(id's hook forces "unbarriered").
|
||||
3. Map the image `Access` 1↔2 → `FormatlessImageBakeScenario` / `ImageLoadStoreSsoScenario` red plus
|
||||
the unit case.
|
||||
4. The named blit back on the frontend objects → `CopyImageLayeredScenario`,
|
||||
`LayeredAttachmentShapeScenario`.
|
||||
5. Keep the per-point version memo as a second gate → `CrossFrameBufferScenario` / the P4a seam
|
||||
scenario must stay green WITHOUT it.
|
||||
|
||||
## Gate
|
||||
|
||||
`build`, `unit`, `isplit`, `gens`; `strict` (record the markers that disappeared); `one` on the FBO,
|
||||
blit and image scenarios you touch; the seam greps your scout listed must come back silent. Say
|
||||
explicitly whether a blit is still barriered after your change (your scout argued it need not be —
|
||||
the contract's predicate decides, and ra owns the flip).
|
||||
@@ -0,0 +1,202 @@
|
||||
# TASK-gl — make the strict lane mean something, and make the flip survivable
|
||||
|
||||
Read `PACKAGE-PREAMBLE-P5E.md` and `PREAMBLE-ADDENDUM-WAVE3.md` first. Your tree is `~/w7/p5e-gl`,
|
||||
branch `p5e/gl`, base `7c6f6886`. Your slug for the gate driver is `gl`.
|
||||
|
||||
You are not migrating a field family. You are fixing the **mechanism** that decides whether P5e is
|
||||
finished, plus two defects that would break other backends the moment the phase's flags flip. Two
|
||||
sibling packages are running concurrently (`pa` on the program family in `~/w7/p5e-pa`, `mv` on
|
||||
multi-draw in `~/w7/p5e-mv`). Stay out of their trees and out of `MG_Backend/DirectGLES/DirectGLES.cpp`
|
||||
and `MultiDraw.cpp` except where this brief names a line.
|
||||
|
||||
Do the items **in the order given**. Items 1 and 2 are correctness landmines and must land even if
|
||||
you run out of room for the rest; commit each item separately.
|
||||
|
||||
---
|
||||
|
||||
## Item 1 — the barriered stamp must ask the server's own capability (ruling ID-111)
|
||||
|
||||
**This is a latent crash, not a cleanup.** `MGPipeRunAheadCapBitsFor` (`MG_Pipe/MGPipeTypes.h:160-166`)
|
||||
never publishes `kCapRunAheadApply` on `BackendType::DirectVulkan`, because ruling ID-90 keeps Magma
|
||||
in lockstep for all of P5e. But the server-side stamp in `PipeApplier::ApplyOne`
|
||||
(`MG_Remote/Server/PipeApplier.cpp:1180-1182`) reads only the build constant:
|
||||
|
||||
```cpp
|
||||
MG_Pipe::MGPipeApplierSetCurrentRecordBarriered(
|
||||
MG_Pipe::kMGPipeP5eClientWaitRuleLanded ? wireSaysBarriered : true);
|
||||
```
|
||||
|
||||
`draw_vbo`, `blit`, `clear` and `launch_grid` are all `kWaitNone`. So the moment
|
||||
`kMGPipeP5eClientWaitRuleLanded` flips, a **Magma** server stamps every draw record UNBARRIERED while
|
||||
its client is still lockstep — and `CountBarrierPull` (`MG_Backend/MGPipe/PipeInputs.cpp:95-97`)
|
||||
aborts unconditionally on an unbarriered pull, no knob involved. Magma dies on its first draw, and
|
||||
`MagmaP7AllocatorDebtScope`'s exemption is withdrawn with it.
|
||||
|
||||
**Fix**: conjoin the server's own capability. `ServerPublishesRunAhead()` already exists at
|
||||
`PipeApplier.cpp:40-44` and answers false for a session with no CallMask yet, which is the right
|
||||
answer for the bring-up window.
|
||||
|
||||
```cpp
|
||||
MG_Pipe::MGPipeApplierSetCurrentRecordBarriered(
|
||||
(MG_Pipe::kMGPipeP5eClientWaitRuleLanded && ServerPublishesRunAhead()) ? wireSaysBarriered : true);
|
||||
```
|
||||
|
||||
Keep `wireSaysBarriered` computed unconditionally — that is ID-103's reason, the predicate must stay
|
||||
exercised for the whole phase rather than first run on the day it starts deciding.
|
||||
|
||||
**Red-once**: a `RemoteClientTest` case that drives a `DrawVbo` through `ApplyOne` on a session whose
|
||||
CallMask lacks bit 10 and asserts `MGPipeApplierCurrentRecordIsBarriered()` is true. Removing the new
|
||||
conjunct makes it false. This is the server-side mirror of the client latch and it is what makes
|
||||
ID-90 true in code rather than in prose.
|
||||
|
||||
## Item 2 — a compile-time trip wire on the residual fill (ruling ID-112)
|
||||
|
||||
`EmittedCallSuppliesTheWholeField` (`MG_Impl/Pipe/PipeFill.cpp:2499-2519`) is Magma's **only** source
|
||||
for the seven pointer-backed fields, and Magma dereferences them immediately. Two of the seven rows,
|
||||
`GetBoundVertexArray` and `GetBufferBindingPoint`, have no compile-time protection at all: a package
|
||||
that "tidies up" by removing one would not break the build, it would SIGSEGV Magma on its first
|
||||
draw on a device.
|
||||
|
||||
**Fix**: widen `NoP4aFamilyFieldIsWhollySupplied` (`PipeFill.cpp:2667-2682`) to cover all seven rows,
|
||||
or add a second `static_assert` naming the two unprotected ones. About ten lines. This converts the
|
||||
most likely mistake of every remaining package from a device crash into a build break, which is why
|
||||
it is item 2 and not item 8.
|
||||
|
||||
**Red-once**: delete the `GetBoundVertexArray` row from the table and show the build fails with your
|
||||
named assertion.
|
||||
|
||||
## Item 3 — the admission predicate, GENERATED (ruling ID-116)
|
||||
|
||||
BRIEF §3.3's "§7 allowlist" exists, in `MobileGL/MG_Remote/CONTRACT-P5E.md:475-486`. Package `ra`
|
||||
also landed a **hand-kept 13-row copy** in `.github/workflows/test.yml:1207-1292`. That copy is wrong
|
||||
in both directions and must be deleted, not corrected.
|
||||
|
||||
The rule, which is ID-84 expressed in tables that already exist: a `<field>@<verb>` pair is admitted
|
||||
**iff** the field's row is `BARRIER_PULLED` **and** the verb's wire op is statically barriered
|
||||
(`MGPipeWaitClassFor(op) != kWaitNone`), intersected with `kMGPipeClassFieldMask[kMGPipeVerbClass[verb]]`.
|
||||
|
||||
**Fix**: extend `scripts/gen_pipe_field_ownership.py` — it already joins `FieldOwnership.def`, already
|
||||
emits `MG_Pipe/generated/PipeFieldOwnership.inc`, and already has `--check` / `--self-test` wired
|
||||
into the `gens` gate step — to emit
|
||||
|
||||
```cpp
|
||||
inline constexpr MGPipeFieldMask kMGPipeAdmittedPullMask[kMGPipeVerbCount] = { … };
|
||||
constexpr Bool MGPipeBarrierPullAdmitted(MGPipeInputField f, MGPipeVerb v) {
|
||||
return MGPipeFieldMaskHas(kMGPipeAdmittedPullMask[SizeT(v)], f);
|
||||
}
|
||||
```
|
||||
|
||||
from `kMGPipeFieldOwnership`, `MGP_VERB_OP_LIST` (`FieldOwnership.def:255`) and `kMGPipeWaitClasses`
|
||||
(`generated/PipeWire.inc:376`). Add `--print-admitted` so the shell reads the same table the C++ does.
|
||||
Extend `--self-test` with negative controls in the style already there.
|
||||
|
||||
By this rule `GetFramebufferBindingSlot@ReadPixels` (21 entries, the largest survivor) is admitted,
|
||||
and `GetTextureObject@CopyImageSubData` is not — see item 5.
|
||||
|
||||
## Item 4 — the strict knob becomes admission-aware (ruling ID-117)
|
||||
|
||||
Today `CountBarrierPull` aborts on **every** barrier-pulled read under `MOBILEGL_IPC_STRICT_ERRORS`,
|
||||
admitted or not, so the CI's allowlist comparison is unreachable code and "hard green" is impossible
|
||||
with the knob as written. Give it a third state, leaving the unbarriered arm exactly as it is:
|
||||
|
||||
```cpp
|
||||
if (!MGPipeApplierCurrentRecordIsBarriered())
|
||||
StrictBarrierPullFatal(field, verb, "UNBARRIERED, the client did not fill it"); // unchanged
|
||||
++g_residualPulls; …
|
||||
if (MG_Config::Ipc.StrictErrors) {
|
||||
if (!MGPipeBarrierPullAdmitted(field, verb))
|
||||
StrictBarrierPullFatal(field, verb, "MOBILEGL_IPC_STRICT_ERRORS=1"); // unchanged
|
||||
AdmittedBarrierPullOnce(field, verb); // MGLOG_W, deduped per (field, verb)
|
||||
}
|
||||
```
|
||||
|
||||
The admitted line keeps the marker grammar and changes only the leading tag:
|
||||
|
||||
```
|
||||
MGPipe: Admitted{UnmigratedPipeInput, "<F>@<V>"} [BARRIER-PULLED, ADMITTED, retires in <phase>]
|
||||
```
|
||||
|
||||
so every filter written since P5c that matches `Fatal{UnmigratedPipeInput` keeps meaning exactly
|
||||
"red". **The dedupe is required**: an 852-draw frame must not write 852 lines.
|
||||
|
||||
Check, do not assume, that `FieldOwnershipTest.StrictErrorsTurnsABarrierPulledReadIntoANamedAbort`
|
||||
and `StrictErrorsAlsoPromotesTheStickyForwards` still go red — both stamp `MGPipeVerb::DrawArrays`,
|
||||
whose op is `kWaitNone`, so they should.
|
||||
|
||||
## Item 5 — `ResourceCopyRegion` becomes barriered (ruling ID-118)
|
||||
|
||||
`GetTextureObject` retires in **P7**, not P5e, but `ResourceCopyRegion` is `kWaitNone`
|
||||
(`generated/PipeWire.inc:412`). After the flip that is a genuinely unbarriered record reading client
|
||||
memory: an unconditional Fatal, no knob. The ruling is to **move the op to a barriered wait class**
|
||||
rather than special-case the field into the allowlist — then item 3's derivation admits it with no
|
||||
exception, and P7 can retire the field on its own schedule. `CopyImageSubData` is not on the
|
||||
per-frame path (zero per frame in the Minecraft scene), so the wait costs nothing measurable. Say in
|
||||
your report which wait class you chose and why.
|
||||
|
||||
## Item 6 — the lane reads every log, and the `rsp` pin is reworded (rulings ID-119, ID-115)
|
||||
|
||||
Three defects, all measured:
|
||||
|
||||
1. **The CI step greps `MobileGL/MG_IntegrationTest/split-logs/`**, which holds 90 of the lane's 116
|
||||
entries. The 26 it misses are exactly the `F1.` readback block, both `NamedBlit` pairs, the four
|
||||
`Ct.` entries and `PersistentMapArm` — i.e. precisely the readback population the allowlist is
|
||||
about. Drive the log set from ctest instead of from a directory: `split_log_paths.py:12-33`
|
||||
already parses `ctest --show-only=json-v1` into `{entry: absolute MOBILEGL_LOG_FILE_PATH}`. Add a
|
||||
`markers` mode that walks that map and classifies every `Fatal{` and `Admitted{` line, and make
|
||||
the lane a **two-sided ratchet**: an unadmitted marker fails, and an admitted pair that no longer
|
||||
appears must be removed from the expected set (so the lane cannot rot green).
|
||||
2. **The `rsp` check greps for a counter no split lane emits.** And the pin itself is vacuous: the
|
||||
unbarriered arm of `CountBarrierPull` is `[[noreturn]]` and runs *before* `++g_residualPulls`, so
|
||||
`rsp` counts only barriered pulls and "`rsp` = 0 on unbarriered records" is true whatever the code
|
||||
does. Reword it to what is checkable: **`rsp` counts only admitted barriered pulls and must equal
|
||||
the admitted-marker tally**. Assert `rsp` against `draws` rather than against 0 — on the device
|
||||
`rsp` equalled the draw count under inproc and 0 under monolith, so the draw path's retirement is
|
||||
visible as `rsp` ceasing to scale with `draws`. `MG_IntegrationTest/Harness/PipeStatsWindow.h`
|
||||
already gives you `CounterOrAbsent(window, "rsp")` and `"draws"`; six scenarios already use it.
|
||||
You need one counting entry in the split lane with `MOBILEGL_PIPE_STATS=1`,
|
||||
`MOBILEGL_PIPE_STATS_PERIOD=1` and its **own private log path** — not a whole-lane env flip, which
|
||||
races under `-j` (`PipeStatsWindow.h:19-24` argues this).
|
||||
3. **The lane has no positive control** (ruling ID-115). Of the 7 entries that pass strict today,
|
||||
three are `PushMonolithArm` (where `MGPipeServerStampVerbBoundary` never runs, so
|
||||
`CountBarrierPull` is structurally unreachable), two self-skip, one is a death test and one is a
|
||||
Python check. Not one is a record-carrying split GL scenario. So today's "green" is
|
||||
indistinguishable from "strict never armed". Add an assertion that at least one **drawing** inproc
|
||||
entry completed with a server-stamped verb boundary. Without it, 116/116 means nothing.
|
||||
|
||||
## Item 7 — partition the lane by backend, or admit Magma's row
|
||||
|
||||
Both `DirectVulkan.Split.NamedBlit.*` entries carry `LABELS "integration-split"`
|
||||
(`MG_IntegrationTest/CMakeLists.txt:2270-2280`) and abort on `GetFramebufferBindingSlot@Clear`
|
||||
(`VulkanRenderer.cpp:7648`), which P5e does not unbarrier — `GetFramebufferBindingSlot` retires in P7
|
||||
on Magma. CONTRACT-P5E §7 already says in prose that Magma keeps the expected-red step. Give those
|
||||
entries an `integration-split-magma` label with their own expected-red step, so the Espryt allowlist
|
||||
stays a statement about Espryt. If you find a reason to prefer admitting the row instead, argue it.
|
||||
|
||||
## Item 8 — mark contract amendment 8 UNLANDED (ruling ID-120)
|
||||
|
||||
`CONTRACT-P5E.md:503-506` says `GetBufferBindingPointCount`'s sticky forward becomes FATAL under
|
||||
split. `FieldOwnership.def:147` and `:179` both still say `BARRIER_PULLED`, and the generator refuses
|
||||
a disagreeing field/forward pair (pinned by `FieldOwnershipTest.TheSevenStickyForwardsAgreeWithTheirFieldRows`).
|
||||
The amendment is unlanded and landing it as written would change 10 pairs of the derived set. **Do
|
||||
not land it.** Annotate it in the contract as UNLANDED with the phase that will land it (P7/P13), so
|
||||
the divergence is stated rather than discovered.
|
||||
|
||||
---
|
||||
|
||||
## Gate before you report
|
||||
|
||||
`build` rc=0 · `unit` 2250/2250 (expect this number to move — say by how much and why) ·
|
||||
`isplit` 116/116 · **`gpu` 1294/1294** · `gens` all rc=0, including your new generator arm and its
|
||||
self-test · and the strict lane, which after your change should **complete every entry**. Report the
|
||||
full marker table split into `Fatal{` (must be only what `pa` and `mv` still owe) and `Admitted{`.
|
||||
|
||||
**Expect the marker table to shift, not vanish.** The census is a first-fault histogram: entries that
|
||||
abort today on `GetProgramForDraw@DrawArrays` will, once that row lands, advance to their next pull.
|
||||
Do not read a changed table as a regression without checking which fault moved.
|
||||
|
||||
## Report
|
||||
|
||||
`~/w7/notes/p5e/reports/gl-v1.md`: per item, what you did, the red-once verbatim, and for any item
|
||||
you did not reach, exactly where you stopped and why. Also state plainly whether, with your changes,
|
||||
"the strict lane is hard green" is now a statement a script can evaluate — and if not, what is still
|
||||
missing.
|
||||
@@ -0,0 +1,59 @@
|
||||
# Package id — identity: handle-keyed twins, the guard, the scopes (P5e; lands second)
|
||||
|
||||
Read in this order, all of it: `PACKAGE-PREAMBLE-P5E.md`, `INTEGRATOR-DECISIONS-P5E.md` (ID-90 and
|
||||
ID-96 are yours), `BRIEF-P5E.md` (§0, §1, §2 "id", §6 rulings 1, 4, 12, 13), `CONTRACT-P5E-draft.md`
|
||||
§4 (all of it) and §9, your scout report `scout-S7.md` (all of it), and the rows of `kimi-audit.md`
|
||||
lists (a) and (b) (the scope construction sites and the frontend pointers held across records).
|
||||
All in `//wsl.localhost/Arch/home/swung/w7/notes/p5e/`. Your slug is `id`; your tree is `~/w7/p5e-id`
|
||||
(built, on branch `p5e/id` at `2fde7034`).
|
||||
|
||||
Package c0e is being implemented IN PARALLEL on `p5e/c0e` by another agent; it declares
|
||||
`MGPipeApplierCurrentRecordIsBarriered()` and `MGPipeBarriered(...)` in `MG_Pipe/PipeApply.h`. You do
|
||||
not wait for it: declare exactly those two names yourself in the same header with the contract's
|
||||
signatures (a minimal body: barriered = true for every record until ra lands - lockstep is unchanged
|
||||
by your package), and note in the report that c0e owns the final declaration; the integrator resolves
|
||||
the textual overlap at landing (one hunk).
|
||||
|
||||
## Deliverables (lockstep behaviour unchanged; the registries stop being frontend-keyed on the server)
|
||||
|
||||
1. `MG_Backend/DirectGLES/SlotTables.h`: the composite band `m_band`; `ForEachLive` re-typed as
|
||||
`fn(MGPipeHandle, const BackendPtr&)`; the frontend-keyed members (`HandleOf(stateObj)`,
|
||||
`Find(StateObject*)`, `GetOrCreate(const StatePtr&)`, `stateRef`, `NoteStateForHandle`, the mutable
|
||||
memo) kept ONLY as monolith glue, each asserting `!MGPipeApplierIsUnbarrieredApply()` in split
|
||||
builds (a named Fatal, not a silent path).
|
||||
2. `Managers.h:309-640` and the resolvers: `ResolveVaoTwin(MGPipeHandle)`, `ResolveProgramTwin(MGPipeHandle)`,
|
||||
`ResolveTextureTwin(MGPipeHandle)` in the shape of `SamplerImpl::ResolveSamplerCsoTwin`
|
||||
(`Managers.cpp:13457-13486` at base): handle in, record first, `GetOrCreate(handle)`, no frontend
|
||||
touch, no allocator probe; `AdoptTwinByHandle` as the shared body. The family packages will call
|
||||
these; if c0e's seam declarations differ in spelling, yours win for these three (tell the report).
|
||||
3. `Managers.cpp:188-372`: teardown; `OnFrontendStateObjectDestroyed` — delete the NoSession mailbox
|
||||
hop (`:224-246`) and the scope at `:256`; `ReleaseTwinsForWireObjectDeath` by handle; the twin
|
||||
death moment per CONTRACT-P5E §4.2, the ABA answer §4.3 (a recycled slot with a new gen re-mints;
|
||||
an old-gen handle is refused by `FindByHandle`'s gen compare — pin it).
|
||||
4. `MG_Impl/Pipe/SlotAllocator.{h,cpp}`: the guard `MGPipeRefuseAllocatorFromApplyThread` exempts
|
||||
only "inside a scope AND the current record is barriered" (contract §4.4); `MGPipeFrontendKeyedRegistryScope`
|
||||
stays as a class (the family packages delete their 20 sites); `MGPipeReverseAnnouncementScope` →
|
||||
`MagmaP7AllocatorDebtScope`, backend-kind-keyed (ruling 12), with the four Magma sites renamed
|
||||
(`VulkanRenderer.cpp:4554, 4634, 8986`, `ResourceTracker.h:723` at base — re-resolve) and Espryt's
|
||||
`HandleOfBuffer` site (`Managers.cpp:2933` at base) kept under the old scope name until vi/sb retire
|
||||
it (say so in the report). P5d round 3 already made the scope counters plain (apply-thread-only
|
||||
writers) — keep that shape.
|
||||
5. `MG_Remote/Server/PipeApplier.cpp` `ApplyOne`: set `CurrentRecordBarriered` from `MGPipeBarriered`
|
||||
(one line; ra rebases on it).
|
||||
6. Tests: `MG_Test/SanityTest.cpp` cases the brief lists (moved to the legacy arm or rewritten by
|
||||
handle; new `ACompositeHandleDoesNotGrowTheOrdinaryTable`); `MG_Test/Wire/RemoteClientTest.cpp`
|
||||
(`...IsAllowed` deleted; new `...FromTheApplyThreadIsFatalEvenAtTheOldDebtSites` posting `HandleOf`
|
||||
through `RunOnApplyThread` with the barriered flag forced false by a test hook). ID-96: enumerate
|
||||
every NoSession server-only fixture that loses death delivery when the hop is deleted
|
||||
(`grep RunOnApplyThread MG_Test/Wire`), rewrite them to drive `object_death` by handle through
|
||||
the applier, delete only what cannot be expressed that way, and list each in the report.
|
||||
|
||||
## Red-once (execute, revert, record)
|
||||
With the test hook forcing "unbarriered", `HandleOf` from the apply thread → `Fatal{RoleViolation, "MGPipeSlots"}`;
|
||||
put the exemption back → the case is green → red by expectation. Skip the Gen reset in the ABA
|
||||
case → red.
|
||||
|
||||
## Gate
|
||||
`build`, `unit`, `isplit`, `gens`, `strict` — unit and isplit must be exactly base-green (2203 /
|
||||
111 at base; new names only add). G2/G14: skip twins for split-only cases. Commit in slices
|
||||
(tables; resolvers; death path; guard + scopes; tests). Report per the preamble.
|
||||
@@ -0,0 +1,103 @@
|
||||
# TASK-mv — the multi-draw path stops reading the frontend VAO
|
||||
|
||||
Read `PACKAGE-PREAMBLE-P5E.md` first. Your tree is `~/w7/p5e-mv`, branch `p5e/mv`, base `7c6f6886`.
|
||||
Your slug for the gate driver is `mv`.
|
||||
|
||||
## 1 What is measured
|
||||
|
||||
Per-entry marker census at your base (`~/w7/p5e-logs/strict-census/census2.tsv`): **9 entries**
|
||||
abort with `Fatal{UnmigratedPipeInput, "GetBoundVertexArray@DrawArrays"}`, and every one of them is
|
||||
a multi-draw case:
|
||||
|
||||
```
|
||||
DirectGLES.Split.IndexedDrawFamilyScenario.MultiDrawElementsBaseVertexPaintsEverySubDraw
|
||||
DirectGLES.Split.MultiDrawScenario.BaseVertexBatchMatchesUnrolledDraws
|
||||
DirectGLES.Split.MultiDrawScenario.BaseVertexBeyondIndexTypeRangeMatchesUnrolledDraws
|
||||
DirectGLES.Split.MultiDrawScenario.PlainBatchMatchesUnrolledDraws
|
||||
DirectGLES.Split.MultiDrawScenario.PrimitiveRestartStripBatchMatchesUnrolledDraws
|
||||
DirectGLES.Split.MultiDrawScenario.PrimitiveRestartUnsignedShortBatchMatchesUnrolledDraws
|
||||
DirectGLES.Split.MultiDrawScenario.UnsignedByteBatchMatchesUnrolledDraws
|
||||
DirectGLES.Split.MultiDrawScenario.UnsignedShortBatchMatchesUnrolledDraws
|
||||
DirectGLES.Split.MultiDrawScenario.ZeroCountSubDrawsMatchUnrolledDraws
|
||||
```
|
||||
|
||||
That confinement is the point: package vi already retired the bound-VAO row on the ORDINARY draw
|
||||
path. `SyncCurrentVertexAttributeValues` takes `fromRecords ? noVao : MGB_CTX->GetBoundVertexArray()`
|
||||
(`DirectGLES.cpp:2291`) and `PrepareForDraw` takes
|
||||
`vertexInputFromRecords ? noFrontendVao : MGB_CTX->GetBoundVertexArray()` (`:5986`). What is left is
|
||||
a path vi did not own.
|
||||
|
||||
## 2 The site
|
||||
|
||||
`MobileGL/MG_Backend/DirectGLES/MultiDraw.cpp:93-98`:
|
||||
|
||||
```cpp
|
||||
const SharedPtr<MG_State::GLState::BufferObject>& BoundIndexBuffer() {
|
||||
static const SharedPtr<MG_State::GLState::BufferObject> none;
|
||||
const auto& vao = MGB_CTX->GetBoundVertexArray(); // <-- unconditional, no arm test
|
||||
if (!vao) return none;
|
||||
return vao->GetIndexBufferBindingSlot().GetBoundObject();
|
||||
}
|
||||
```
|
||||
|
||||
and its caller `BoundIndexBufferId()` just below, which turns it into a GL name through
|
||||
`BufferImpl::EnsureBufferResource`. Read the whole file first: the multi-draw tiers swap in a
|
||||
scratch index buffer and restore the original binding, and the comment at `:102-105` explains why
|
||||
restoring the exact name matters (the VAO twin memoises that it already synced this index binding).
|
||||
|
||||
Audit `MultiDraw.cpp` for any OTHER frontend read on the apply thread while you are in there, and
|
||||
report what you find even if you do not change it.
|
||||
|
||||
## 3 The wire already carries the answer
|
||||
|
||||
No wire change. The applier state already holds the index buffer:
|
||||
|
||||
- `MGPIndexBuffer IndexBuffer` and `Uint64 IndexBufferSerial` in the applier state
|
||||
(`MobileGL/MG_Pipe/PipeApply.h:688-690`), applied by `MGPipeApplySetIndexBuffer` (`:1247`).
|
||||
|
||||
So the handle arm answers `BoundIndexBuffer` from `MGPipeApplier().IndexBuffer` and resolves the
|
||||
buffer resource by handle, the way the other by-handle resolvers do. Find the buffer-side
|
||||
by-handle resolver that package vi / sb landed (`BufferImpl::EnsureBufferResourceForHandle` is one;
|
||||
read `Managers.h`'s block of `Pipe*RecordForHandle` declarations around `:735`) and use it rather
|
||||
than minting a new one.
|
||||
|
||||
If it turns out the multi-draw tiers need something from the VAO that the index-buffer record
|
||||
genuinely cannot answer, STOP and report rather than inventing a wire row. The integrator wants to
|
||||
hear it.
|
||||
|
||||
## 4 Requirements on the arm selection
|
||||
|
||||
1. **The arm is decided by `MG_Config::Transport`**, through the family's existing selector
|
||||
(`BufferImpl::VertexInputReadsRecords()` is the one this path's siblings use; check what it
|
||||
resolves to and use the same one), **never inferred from a pointer being null**. This is ruling
|
||||
ID-81. The phase has already paid for breaking it: fix1 (`66621767`) and rulings ID-107 /
|
||||
ID-109 / ID-110 exist because one seam read "a handle was noted" as "the record arm is
|
||||
selected". Read `docs/Disaggregated/CURRENT_STAGE_PROGRESS.md` §2.5 before you write it.
|
||||
2. **A missing record on the handle arm is a named refusal, not a silent fall-back to the
|
||||
frontend.** Copy `RefuseNullFrontendTextureOffTheHandleArm`'s shape (search `Managers.cpp`).
|
||||
3. **The pull build gains no call**; **the monolith arm keeps its bytes.**
|
||||
|
||||
## 5 Red-once (required, quoted verbatim in your report)
|
||||
|
||||
1. Revert the arm selection: the strict lane goes red again with `GetBoundVertexArray@DrawArrays`
|
||||
on those 9 entries.
|
||||
2. Make the record lookup miss on the handle arm: your named refusal fires, quoted from the entry's
|
||||
own log (`MOBILEGL_LOG_FILE_PATH` — `MGLOG_F` does not reach ctest's captured stdout; the
|
||||
working recipe is `~/w7/notes/p5e/strict_census2.sh`).
|
||||
3. Put both back and show green.
|
||||
|
||||
## 6 Gate before you report
|
||||
|
||||
`build` rc=0 · `unit` 2250/2250 · `isplit` 116/116 · **`gpu` 1294/1294** (new step, ID-109: the
|
||||
monolith runtime arm, and how an ID-81 violation gets caught) · `gens` all rc=0 · `strict`: the
|
||||
full per-entry marker census via `strict_census2.sh`. You succeed when
|
||||
`GetBoundVertexArray@DrawArrays` is gone from that table and nothing new has appeared.
|
||||
|
||||
Pay particular attention to the multi-draw correctness lane: `MultiDrawScenario` asserts that a
|
||||
batch matches unrolled draws, which is exactly the thing a wrong index buffer would break quietly.
|
||||
|
||||
## 7 Report
|
||||
|
||||
`~/w7/notes/p5e/reports/mv-v1.md`: the site inventory you actually found, the design and why, the
|
||||
three red-onces verbatim, the before/after marker census, the gate table, and anything left undone
|
||||
with the reason.
|
||||
@@ -0,0 +1,164 @@
|
||||
# TASK-pa — the program family leaves the frontend on the draw and dispatch paths
|
||||
|
||||
Read `PACKAGE-PREAMBLE-P5E.md` first. Your tree is `~/w7/p5e-pa`, branch `p5e/pa`, base `7c6f6886`.
|
||||
Your slug for the gate driver is `pa`.
|
||||
|
||||
Your package is the largest single item left in P5e: **68 of the 109 red entries in the strict
|
||||
lane**, and the one that fires once per draw on the device. Until it lands, no draw can be
|
||||
unbarriered, so the client keeps waiting for the apply thread at every draw and the split arm runs
|
||||
at roughly two thirds of the monolith frame rate.
|
||||
|
||||
## 1 What is measured, so you do not have to re-derive it
|
||||
|
||||
Per-entry marker census at your base (`~/w7/p5e-logs/strict-census/census2.tsv`):
|
||||
|
||||
| marker | entries |
|
||||
|---|---|
|
||||
| `Fatal{UnmigratedPipeInput, "GetProgramForDraw@DrawArrays"}` | 61 |
|
||||
| `Fatal{UnmigratedPipeInput, "GetProgramForDispatch@DispatchCompute"}` | 7 |
|
||||
|
||||
Those 68 are yours. The other markers belong to other packages or are allowlisted; do not touch them.
|
||||
|
||||
Device, same base, Redmi, Minecraft 26.3-rc-3, ~849 draws/frame, GPU pinned, 30 s window,
|
||||
interleaved so the thermal drift is visible in both arms:
|
||||
|
||||
| arm | fps p50 | client GL thread ms/frame | apply thread ms/frame |
|
||||
|---|---|---|---|
|
||||
| monolith | 267.9 / 195.1 | 3.898 / 4.781 | — |
|
||||
| inproc | 166.4 / 143.5 | 6.098 / 6.958 | 5.305 / 5.653 |
|
||||
|
||||
## 2 The finding that makes this package small: the wire already carries everything
|
||||
|
||||
`MGPipeShaderCsoRecord` (`MobileGL/MG_Pipe/PipeApply.h:391`) already holds
|
||||
|
||||
- `SharedPtr<const MG_State::GLState::ProgramArchive> Archive` — filled by package pg, once per
|
||||
link, under a transport only, null under monolith BY DESIGN (ruling ID-81). A
|
||||
`ProgramArchive` (`MG_State/GLState/ProgramState/ProgramArtifactsCodec.h:100`) holds
|
||||
`LinkArtifacts Link`, `SpirvArtifacts Spirv` and `LinkedStages`.
|
||||
- the three post-link mutable tails `BlockBindings`, `SamplerUnits`, `StorageOverrides`, with
|
||||
`Signature` and `BindingsSerial`.
|
||||
|
||||
And a program-pipeline **composite gets its own record** — the archive comment says so explicitly:
|
||||
"a program-pipeline composite and its stage programs are three records over one link's artefacts".
|
||||
|
||||
Now the key identity: every frontend accessor the two remaining readers call is a **pure function of
|
||||
`LinkArtifacts`**. `ProgramObject::Artifacts()` (`ProgramState/ProgramObject.h:1342`) returns
|
||||
`const LinkArtifacts&`, and each of `GetMaxUniformLocation` (`:161`), `GetUniformType` (`:303`),
|
||||
`GetActiveAttributeLocationMask` (`:662`), `GetAttribType` (`:712`) and
|
||||
`GetUniformSamplerOrImageUnitIndex` (`:857`) is a thin wrapper over it.
|
||||
|
||||
**So this package adds nothing to the wire, changes no record, and regenerates no catalogue.** It
|
||||
redirects readers from `program->Artifacts()` to `record->Archive->Link`. If you find yourself
|
||||
designing a new wire row, stop and report instead — you have probably found something this brief
|
||||
missed, and the integrator wants to hear it before you build it.
|
||||
|
||||
## 3 The sites
|
||||
|
||||
All in `MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp` unless said otherwise.
|
||||
|
||||
### 3.1 The two unconditional accessor calls — these ARE the marker
|
||||
|
||||
| site | code | note |
|
||||
|---|---|---|
|
||||
| `:6006` in `PrepareForDraw` | `const auto& currentProgram = MGB_CTX->GetProgramForDraw();` | no arm test at all |
|
||||
| `:6746` in `BindCurrentTextures()` (the no-argument overload) | `BindCurrentTextures(TextureImpl::CaptureDrawTextureSyncKeys(), MGB_CTX->GetProgramForDraw());` | same |
|
||||
|
||||
Merely CALLING the accessor trips the check — `MG_Backend/MGPipe/PipeInputs.h:659` runs
|
||||
`MGP_INPUT_CHECK(MGPipeInputField::GetProgramForDraw)` before returning. So arm-selecting the call
|
||||
is the last step, not the first: it is only legal once every consumer can be served without it.
|
||||
|
||||
`PrepareForCompute`'s `GetProgramForDispatch` is the same shape; find it and treat it identically.
|
||||
|
||||
### 3.2 The consumers that still genuinely need the object
|
||||
|
||||
**(a) `ResolveAndBindUnitTextures` (`:6090`, reached from `BindCurrentTextures` at `:6719`).**
|
||||
Reads `GetMaxUniformLocation`, `GetUniformSamplerOrImageUnitIndex`, `GetUniformType` (see the
|
||||
lambda at `:6175-6183`). Note that the memo KEY above it is ALREADY handle-only — tx2 landed that
|
||||
under ruling ID-86 (`:6644-6663`: `drawProgram`, `shaderCsoSerial`, `bindingsSerial`,
|
||||
`samplerViewsSerial`, `contextSerial`). It is only the **miss path** that still reads the frontend.
|
||||
Also note `:6668` computes `programKey` from `currentProgram.get()` unconditionally; on the handle
|
||||
arm that value is unused for entry selection (`:6671-6678` takes the `byHandle` branch) but it is
|
||||
still a read of the pointer, so it has to go too.
|
||||
|
||||
**(b) `SyncCurrentVertexAttributeValues` (`:2243`, called from `:6070`).** Reads
|
||||
`GetActiveAttributeLocationMask` (`:2293`) and `GetAttribType`. **The code already names this work
|
||||
and says it is yours**: its comment at `:2258-2268` reads "WHAT IS NOT RETIRED HERE, and it is
|
||||
S4/pg's not vi's: the two program reads below (GetActiveAttributeLocationMask, GetAttribType). They
|
||||
are frontend object rows of the PROGRAM family and stay until pg carries the attribute mask and
|
||||
types in the ShaderCso record." The archive carries them; you are the package that reads them from
|
||||
there.
|
||||
|
||||
**(c) `BindCurrentProgramWithResources` (`:6756`)** already takes `handleArm` at `:6763` and selects
|
||||
at `:6774`, but still receives the object as a parameter. Check every use of that parameter under
|
||||
the handle arm and make it null-safe in the sense of §5, not merely unused.
|
||||
|
||||
Sites `:7374` and `:7446` are already behind `if (ProgramHandleArm())` — pg did those. Read them:
|
||||
they are the model for the shape the integrator expects, including `FindShaderCsoRecord` and
|
||||
`ResolveProgramTwin`.
|
||||
|
||||
## 4 The design you are asked to land
|
||||
|
||||
A single arm-selected accessor for the current draw (or dispatch) program's link artefacts, e.g.
|
||||
|
||||
- `const MG_State::GLState::LinkArtifacts* CurrentDrawLinkArtifacts()` that, under
|
||||
`ProgramHandleArm()` (`Managers.h:714`, `Transport != Monolith && ProgramSubsystemEnabled()`),
|
||||
resolves `MGPipeApplier().DrawProgram` to its `MGPipeShaderCsoRecord` and returns
|
||||
`&record->Archive->Link`, and under the monolith arm returns `&program->Artifacts()`.
|
||||
|
||||
Then both readers in §3.2 take that, and the two calls in §3.1 become arm-selected. Whether the
|
||||
helper returns a pointer, a small view struct, or is spelled as two overloads is yours to choose;
|
||||
argue it in your report. Requirements on whatever you choose:
|
||||
|
||||
1. **The arm is decided by `MG_Config::Transport`, never inferred from a pointer being null.**
|
||||
This is ruling ID-81 and the phase has already paid for breaking it once: fix1 (`66621767`) and
|
||||
rulings ID-107 / ID-109 / ID-110 exist because a seam read "a handle was noted" as "the record
|
||||
arm is selected". Those are different statements. Read `CURRENT_STAGE_PROGRESS.md` §2.5 before
|
||||
you write the arm selection.
|
||||
2. **A null archive on the handle arm is a named refusal, not a fall-back to the frontend.** Copy
|
||||
the shape of `RefuseNullFrontendTextureOffTheHandleArm` (`Managers.cpp`, search for it) and of
|
||||
`MGB_TEXTURE_RECORD_ARM_SELECTED()`. Quietly reaching back into the frontend would hide a
|
||||
missing record behind a picture that still looks right, which is what the subsystem A/B exists
|
||||
to expose.
|
||||
3. **The pull build must not gain a call.** Guard so the preprocessed text of the pull flavour is
|
||||
unchanged (the `#else` arms of the existing macros are the precedent). G1 is a gate.
|
||||
4. **The monolith arm keeps its bytes.** The push-monolith build is what the phone ships; it keeps
|
||||
the frontend arms token for token.
|
||||
|
||||
## 5 What must still work
|
||||
|
||||
- **Program pipelines / separate shader objects.** `GLContext::GetProgramForDraw`
|
||||
(`MG_State/GLState/Core.cpp:609`) returns either the plainly bound program or a cached COMPOSITE
|
||||
flattened from the bound pipeline's stage programs. Confirm from the emitter that the composite
|
||||
is the thing `set_draw_program` names and that pg archives it, then prove it: the lane has
|
||||
`ProgramPipelineScenario` and `ImageLoadStoreSsoScenario`. If the composite turns out NOT to have
|
||||
a record, stop and report — that is a design gap, not something to paper over.
|
||||
- **Relink.** `create_shader_state` is re-issued on the same handle at every link that moves
|
||||
`GetLinkVersion`, including a FAILED relink (`LinkStatus` distinguishes them). The archive is
|
||||
replaced with it. Make sure a draw after a relink reads the new archive, and that a draw on an
|
||||
unlinked program declines exactly as it does today.
|
||||
- **The dispatch twin**, with `AtomicCounterScenario` and `UnboundImageDescriptorScenario` as its
|
||||
lane evidence (those are 7 of your entries).
|
||||
|
||||
## 6 Red-once (required, quoted verbatim in your report)
|
||||
|
||||
1. Revert your arm selection so the handle arm takes the frontend path: the strict lane must go red
|
||||
again with `GetProgramForDraw@DrawArrays`, and the entry count must return to 61.
|
||||
2. Make the archive lookup return null on the handle arm: your named refusal must fire, quoted from
|
||||
the entry's own log (`MOBILEGL_LOG_FILE_PATH`, because `MGLOG_F` does not reach ctest's captured
|
||||
stdout — see `strict_census2.sh` for the working recipe).
|
||||
3. Put both back and show green.
|
||||
|
||||
## 7 Gate before you report
|
||||
|
||||
`build` rc=0 · `unit` 2250/2250 · `isplit` 116/116 · **`gpu` 1294/1294** (this step is new, ID-109:
|
||||
it is the monolith runtime arm, and it is how the phase catches an ID-81 violation) · `gens` all
|
||||
rc=0 · `strict`: report the FULL per-entry marker census using `strict_census2.sh`, not just the
|
||||
pass count. Your package succeeds when `GetProgramForDraw@DrawArrays` and
|
||||
`GetProgramForDispatch@DispatchCompute` are gone from that table and nothing new has appeared.
|
||||
|
||||
## 8 Report
|
||||
|
||||
`~/w7/notes/p5e/reports/pa-v1.md`. Include: the read-site inventory you actually found (if it
|
||||
differs from §3, say so — this brief was written from a reading, not from a full audit), the design
|
||||
and why, the composite/relink evidence, the three red-onces verbatim, the before/after marker
|
||||
census, the gate table, and anything you were asked to do that you did not do, with the reason.
|
||||
@@ -0,0 +1,67 @@
|
||||
# Package pg — programs: the twin and every reflection answer come from records (P5e wave 2)
|
||||
|
||||
Read in this order, all of it: `PACKAGE-PREAMBLE-P5E.md`, `INTEGRATOR-DECISIONS-P5E.md` (ID-85,
|
||||
ID-87, ID-88 are yours), `BRIEF-P5E.md` (§0, §1, §2 "pg", §5, §6 rulings 5, 6, 8, 9),
|
||||
`CONTRACT-P5E.md` §5.5, your scout report `scout-S4.md` (all of it), and the program rows of
|
||||
`kimi-audit.md` (rows 91-110) — report per row: retired / left barriered / not found. Notes:
|
||||
`//wsl.localhost/Arch/home/swung/w7/notes/p5e/`.
|
||||
|
||||
Your slug is `pg`; your tree is `~/w7/p5e-pg` (branch `p5e/pg`, based on the landed id head, built).
|
||||
c0e landed `SetProgramBindings` (opcode 80) with its codec/route/thunk, `MGPProgramDesc::LinkStatus`,
|
||||
the `MGPipeShaderCsoRecord` fields (`BlockBindings`, `SamplerUnits`, `StorageOverrides`,
|
||||
`BindingsSerial`, `LinkStatus`) and `MGPipeApplySetProgramBindings`'s asserting declaration; id landed
|
||||
`ResolveProgramTwin(MGPipeHandle)`.
|
||||
|
||||
## What "done" means for this family
|
||||
|
||||
The program twin is keyed by the `ShaderCso` handle; `SyncCurrentProgram`, `BindCurrentTextures`'
|
||||
memo key, `BindCurrentProgramWithResources` and `PrepareForCompute`'s program line answer every
|
||||
question — link status, SPIR-V status, UBO size and bytes, block bindings, sampler unit indices,
|
||||
storage-block overrides, backend state version — from the record and the archived reflection, never
|
||||
from the frontend `ProgramObject`. The five frontend-keyed scope sites of this family are gone.
|
||||
|
||||
## Scope
|
||||
|
||||
`MG_Impl/Pipe/ProgramEmit.h` (the artefact archive encoded per link through `ProgramArtifactsCodec`
|
||||
into SEG_STAGE; `EmitProgramBindings`; `LinkStatus`; the failed-relink rule),
|
||||
`MG_State/GLState/ProgramState/ProgramArtifactsCodec.{h,cpp}` (completeness — name the member the
|
||||
codec skips at its libc++ caveat and either carry it or refuse by name), `MG_Pipe/PipeApply.{h,cpp}`
|
||||
(`MGPipeApplyCreateShaderState` adopts the blobs into record-owned artefacts under a transport;
|
||||
`MGPipeApplySetProgramBindings`), `MG_Pipe/PipeRoute.*` + `MG_Remote/Client/WireTables.cpp` (op 80
|
||||
route), `MG_Remote/Server/PipeApplier.cpp` (`OnSetProgramBindings`), `DirectGLES.cpp` (the stash,
|
||||
`ResolveGlobalConstantsRecord(handle)`, the `MapUBO` refusal, `SyncCurrentProgram(handle)` incl. the
|
||||
broadcast decline arm → Fatal under transport, `PrepareForDraw`'s program line,
|
||||
`BindCurrentProgramWithResources` EXCEPT the binding-point half (sb's) and the sampler pass (tx2's),
|
||||
`GetCurrentBackendProgram`, `PrepareForCompute`'s program line, `ShaderStorageBlockBinding`'s
|
||||
monolith body kept), `Managers.h` + `Managers.cpp` (`SyncToBackend(handle, record)`,
|
||||
`CacheResourceLocations`, `ReseedShaderStorageBlockBindings`), `MG_Test/Pipe/ProgramEmitTest.cpp`.
|
||||
|
||||
## Rulings that bind you
|
||||
|
||||
- ID-87 / ruling 8: ENCODE the archive per link (a `SharedPtr` pin is refused by rule B). **Measure**
|
||||
links/frame, bytes/link and GL-thread ms on Minecraft + a shader pack before you declare done; if
|
||||
the steady cost exceeds ~0.2 ms/frame, fall back to lazy encode at first bind and say so.
|
||||
- ID-88 / ruling 9: a failed relink of a bound program re-issues `create_shader_state` with
|
||||
`LinkStatus = 0` **iff the frontend reports it unlinked** — verify the frontend's actual behaviour
|
||||
in `ProgramObject::Link` rather than assuming; never `object_death`.
|
||||
- ID-85 / ruling 5: `set_storage_block_binding` is `kWaitApplied` for now (c0e set the column);
|
||||
resolving it by `ShaderCso` is your TRAILING item, not this package.
|
||||
- Ruling 6: `BindCurrentTextures`' memo key is BOTH tx2's `SamplerViewsSerial` and your
|
||||
`{DrawProgram slot/gen, ShaderCso.Serial, BindingsSerial}`. tx2 owns the line; agree the shape
|
||||
through your reports (state exactly what you expect of it).
|
||||
|
||||
## Red-once (execute, revert, quote)
|
||||
|
||||
1. Empty the applier's block-binding tail → `UniformInitializerScenario` / `Glsl420DeclarationScenario`
|
||||
wrong pixels (or a named refusal).
|
||||
2. Leave the archive blob refs at `Size 0` with the companion pointers removed → `Fatal{ProtocolCorruption}`.
|
||||
3. Delete the five scopes without re-keying → the id guard's `Fatal{RoleViolation, "MGPipeSlots"}`
|
||||
(id's hook forces "unbarriered").
|
||||
4. `strict` names `GetProgramForDraw@draw_vbo` before, and does not after.
|
||||
5. Force the global-constants subsystem bit off under run-ahead → `Fatal{UnmigratedVerb, "set_global_constants"}`.
|
||||
|
||||
## Gate
|
||||
|
||||
`build`, `unit`, `isplit`, `gens`; `one` on `RelinkStageSetScenario|PostLinkAttachScenario|ProgramPipelineScenario|AsyncCompileScenario|CsoContentAddressingScenario|HandleRecycleScenario`;
|
||||
`strict` (record which markers of this family disappeared). The archive cost measurement is part of
|
||||
the gate — report the numbers, not an argument.
|
||||
@@ -0,0 +1,70 @@
|
||||
# Package ra — the wait rule, present credit, server-owned `gPipeInputs` (P5e; parallel, lands last)
|
||||
|
||||
Read in this order, all of it: `PACKAGE-PREAMBLE-P5E.md`, `INTEGRATOR-DECISIONS-P5E.md` (ID-83,
|
||||
ID-84, ID-91, ID-92, ID-93 are yours), `BRIEF-P5E.md` (§0, §1, §2 "ra", §3 the integration gate, §4
|
||||
the device exit, §6 rulings 3, 4, 13, 14, 15, 17, 18), `CONTRACT-P5E.md` §2 and §3 (all of both),
|
||||
your scout report `scout-S6.md` (all of it), and lists (b) and (c) of `kimi-audit.md`. Notes:
|
||||
`//wsl.localhost/Arch/home/swung/w7/notes/p5e/`.
|
||||
|
||||
Your slug is `ra`; your tree is `~/w7/p5e-ra` (branch `p5e/ra`, based on the landed c0e head — NOT
|
||||
on the family packages; you are parallel to them and rebase at landing). c0e landed the `WaitClass`
|
||||
column, `MGPipeWaitClassFor(op)`, the `RunAhead` / `PresentCredit` knobs, `kCapRunAheadApply` (bit
|
||||
10) and `kMGPipeP5eRunAheadReady = false`; id landed the `CurrentRecordBarriered` line in `ApplyOne`.
|
||||
|
||||
## What "done" means
|
||||
|
||||
The mechanism exists and is INERT until the integration commit: with `kMGPipeP5eRunAheadReady`
|
||||
false the server never publishes bit 10, the client never arms run-ahead, and every gate is exactly
|
||||
as green as today. Your last commit flips that constant — but only after the family packages have
|
||||
landed and the integrator says so, so structure your branch that way (the flip is its own final
|
||||
commit, trivially revertable).
|
||||
|
||||
1. **The predicate.** `MGPipeBarriered(op, payload, applierState)` (c0e declared it) computed
|
||||
identically by both roles: the static `WaitClass` column, plus XFB-active from the context values
|
||||
and the `kDrawClientArrays` flag (ruling 3 / ID-83). The server's `ApplyOne` already sets
|
||||
`CurrentRecordBarriered` from it (id's line).
|
||||
2. **The client wait rule.** `EmitAndWaitTails` after `PublishAndNotify`: reply rows wait; barriered
|
||||
rows wait; unbarriered rows return. Present pacing through `WaitForPresentAck` with credit
|
||||
(default 1, range 1..8; ID-92) — the plumbing exists end to end and has no production caller
|
||||
today; `MGPPresent::FrameSerial` minted client-side; `OnPresent` returns the credit. Drains and
|
||||
forced waits per contract §2.5 (MapBuffer / GetBufferSubData / glFinish / fence client-wait /
|
||||
the EGL forwarders / the glGetError window — name the relaxation in the contract and in code).
|
||||
3. **`resource_subdata`'s buffer half stops waiting** (ruling 15 / ID-93): the reply Bool is
|
||||
discarded at the call site today, so every 64 KB persistent-map block push is a hidden round
|
||||
trip. The row keeps its `kReplySlot` on the wire; the client neither waits nor reads. The texture
|
||||
half keeps its reply (trailing).
|
||||
4. **`gPipeInputs` becomes server-role memory for unbarriered records** (contract §3): the client's
|
||||
residual fill and its stamp bookkeeping do not run for them (the tracker walk and the emitters
|
||||
still run — they produce records); the stamp becomes server-private; `MGPipeInputUnfreshRead`
|
||||
becomes an UNCONDITIONAL detector for unbarriered applies (a named Fatal, not a counter), which
|
||||
is what turns the strict lane into a hard gate. Barriered records keep P5C's semantics exactly
|
||||
(ID-84 / ruling 4).
|
||||
5. **Event-ring flow control** (contract §2.6): the ring's overflow is a Fatal today on the premise
|
||||
that the client drains at every verb — under run-ahead that premise is gone. Make the producer
|
||||
block/flow-control instead, and keep a named refusal for the impossible case.
|
||||
6. **Lifetime under run-ahead** (contract §2.7): slot reuse vs records in flight, `object_death`
|
||||
ordering, the deferred-destroy queue (ID-91 / ruling 13: it stays; an unbarriered enqueue is a
|
||||
finding — pin it), `Forget()` of a persistent map while its pushes are in SEG_STAGE.
|
||||
7. **The strict lane** (`.github/workflows/test.yml`): rewritten as a hard green gate with the
|
||||
contract §7 allowlist (`<field>@<verb>` for the barriered rows that keep pulling).
|
||||
8. Docs: `docs/Disaggregated/ARCHITECTURE.md` §11, §14, §17 — the wait rule, the credit, the event
|
||||
ring, `gPipeInputs` ownership.
|
||||
|
||||
## Red-once (execute, revert, quote)
|
||||
|
||||
1. Encode present without `WaitForPresentAck` → the credit-1 client behind a stalled apply thread
|
||||
publishes a third present; `Waits()` unchanged → red by count.
|
||||
2. Leave one `CopyField` in an unbarriered fill → `Fatal{RoleViolation, "gPipeInputs"}` by name.
|
||||
3. Count instead of Fatal under an unbarriered record → the strict lane turns red on the first
|
||||
pulled row (that is the gate's own red-once).
|
||||
4. Keep the event-ring Fatal → a unit case publishing ~300 KiB of events behind an unwaited
|
||||
sequence aborts; with flow control it completes.
|
||||
5. Publish bit 10 for Magma → `MagmaPipeIdentityTest` red.
|
||||
6. `MOBILEGL_IPC_RUN_AHEAD=0` renders identically; `MOBILEGL_IPC_VERB_BARRIER=0` under run-ahead is
|
||||
the documented red.
|
||||
|
||||
## Gate (before the flip)
|
||||
|
||||
`build`, `unit`, `isplit`, `gens`, `strict` — all exactly as green as the base, because every branch
|
||||
is inert with the bit unpublished. Your report must state, per numbered item above, what is wired
|
||||
and what it does when the bit flips; the integrator runs the device exit.
|
||||
@@ -0,0 +1,119 @@
|
||||
# TASK-ra2 — make run-ahead actually correct
|
||||
|
||||
Read `PACKAGE-PREAMBLE-P5E.md` and `PREAMBLE-ADDENDUM-WAVE3.md` first. Your tree is `~/w7/p5e-ra2`,
|
||||
branch `p5e/flip`, head `985ae62d`. Your slug for the gate driver is `ra2`.
|
||||
|
||||
**Your head already has the flip thrown.** Both `kMGPipeP5eRunAheadReady` (`MG_Backend/Init.cpp`)
|
||||
and `kMGPipeP5eClientWaitRuleLanded` (`MG_Pipe/PipeApply.h`) are `true`. That is the whole point:
|
||||
everything below reproduces on your head the moment you build it.
|
||||
|
||||
## 1 What is measured, and what it is not
|
||||
|
||||
The phase's strict lane is HARD GREEN on the integration branch (`72bc4268`): 181/181, zero
|
||||
`Fatal{`, ten `Admitted{` rows all owned by later phases. That lane runs under LOCKSTEP, where
|
||||
`PipeApplier::ApplyOne` stamps every record barriered, **so it cannot see anything that only happens
|
||||
once the client stops waiting.** It measures remaining debt. It does not measure whether run-ahead
|
||||
is correct. Your package is what measures that.
|
||||
|
||||
With the flip thrown, on your head:
|
||||
|
||||
| gate | result |
|
||||
|---|---|
|
||||
| `build` | rc=0 |
|
||||
| `unit` | 2254/2254 |
|
||||
| `gens` | all rc=0 |
|
||||
| `flavours` | rc=0 |
|
||||
| `isplit` | **112 / 181** |
|
||||
| `gpu` | **1290 / 1359** |
|
||||
|
||||
The 69-70 failures are **flaky**: 71 at `-j 4`, 68 at `-j 1`, and a single entry run alone passes
|
||||
and then aborts on a repeat (`ctest -R '<entry>' --repeat until-fail:12`).
|
||||
|
||||
A census over all 181 entries, each under its OWN command and `ENVIRONMENT` taken from
|
||||
`ctest --show-only=json-v1` (`~/w7/notes/p5e/strict_census3.py`, and
|
||||
`~/w7/notes/p5e/catch_flip_abort.py` to catch one entry's abort text), gives **70 red on 17 distinct
|
||||
`<field>@<verb>` pairs over just FOUR fields**:
|
||||
|
||||
| count | field |
|
||||
|---|---|
|
||||
| 27 | `GetRenderStateParametersVersion` |
|
||||
| 25 | `GetTextureContextId` |
|
||||
| 16 | `GetBufferBindingSlot` |
|
||||
| 2 | `IsCapabilityEnabled` |
|
||||
|
||||
across eleven verbs: `Clear`, `DrawArrays`, `DrawElements`, `DrawElementsBaseVertex`,
|
||||
`DrawElementsIndirect`, `DrawElementsInstancedBaseVertex`, `EndTransformFeedback`, `GetIntegeri_v`,
|
||||
`GetSyncStatus`, `MultiDrawElementsBaseVertex`, `ReadPixels`.
|
||||
|
||||
**Two populations, and the split matters:**
|
||||
|
||||
- **16** abort on the UNBARRIERED arm — the marker carries `[BARRIER-PULLED, UNBARRIERED, …]`.
|
||||
- **54** abort with NO `[BARRIER-PULLED]` bracket at all. That is the plain unfresh-read abort for a
|
||||
field whose ownership is `kRecordSupplied` — the freshness stamp says it was never filled. Example
|
||||
verbatim: `MGPipe: Fatal{UnmigratedPipeInput, "GetTextureContextId@ReadPixels"}`.
|
||||
|
||||
The census outputs are at `~/w7/p5e-logs/census-flipped/` (per-entry logs plus `census3.json`).
|
||||
|
||||
## 2 The hypothesis you must TEST, not assume
|
||||
|
||||
One field at one verb, consistently, would be a missing migration. **Four fields scattered over
|
||||
eleven verbs, flaky run to run, and including verbs that are barriered** (`ReadPixels`,
|
||||
`GetSyncStatus`) is the signature of a RACE.
|
||||
|
||||
The obvious candidate: `gPipeInputs` is shared mutable state whose mutual exclusion WAS the
|
||||
lockstep. Under run-ahead the client still fills it for BARRIERED verbs
|
||||
(`MGPipeValidateForVerb`, `MG_Impl/Pipe/PipeFill.cpp:3219`, `fillOwed = barriered`) while the apply
|
||||
thread may still be draining EARLIER unbarriered records and reading the same block. The client's
|
||||
fill and the server's `MGPipeServerStampVerbBoundary` (`MG_Backend/MGPipe/PipeInputs.cpp:183`) then
|
||||
overlap, and whichever writes `FilledGen[]` last decides whether the other's read is fresh.
|
||||
|
||||
This is consistent with something the project already wrote down: P5d's own research concluded that
|
||||
retiring this barrier needs **`gPipeInputs` versioning or double-buffering**, and deferred it to P11
|
||||
after P3b/P4b's handle-keyed twin tables (see the P11 row in `docs/Disaggregated/ROADMAP.md` and
|
||||
P5d's report). If that conclusion is right, the honest outcome of your package may be "run-ahead
|
||||
cannot land before that work", and saying so with evidence is a complete and acceptable result.
|
||||
|
||||
**Do not start from the hypothesis.** Start from the failure. Instrument, get a reproducer smaller
|
||||
than a scenario if you can, and establish WHICH writer clobbers WHICH read, with evidence. If the
|
||||
hypothesis is wrong, say what is actually happening.
|
||||
|
||||
Two facts that will help you rule things in or out:
|
||||
- `RefusePipeInputsTouchWhileApplierOwnsIt` (`MG_Remote/Client/ClientSession`) already exists as the
|
||||
guard for exactly this class, and it takes an `isBarrieredFill` argument. Find out whether it
|
||||
fires, and if it does not, why not.
|
||||
- `MOBILEGL_IPC_RUN_AHEAD=0` at runtime turns the client's waiting back on with identical server
|
||||
code and identical records (`MobileGL/Config.h`, the `RunAhead` comment). That is your A/B
|
||||
control: if a failing entry passes under it on your head, the defect is in the wait rule and not
|
||||
in a record's content. Run it. Do NOT use `MOBILEGL_IPC_VERB_BARRIER=0`, which is the first
|
||||
conjunct of `RunAheadArmed()` and turns run-ahead off as a side effect.
|
||||
|
||||
## 3 What to deliver
|
||||
|
||||
In order of value:
|
||||
|
||||
1. **The diagnosis**, with evidence. Which writer, which reader, which field, what the interleaving
|
||||
is. A verbatim reproducer.
|
||||
2. **The verdict**: is this fixable inside P5e, or does it need the `gPipeInputs` versioning that
|
||||
P5d deferred to P11? Answer with the argument, not with a preference. If the answer is "needs
|
||||
P11", say exactly what P11 has to provide and what the smallest version of it would be.
|
||||
3. **The fix**, if it is P5e-sized. Every arm you add follows ID-81 and ID-110: the arm is decided
|
||||
by `MG_Config::Transport` or a family selector that reduces to it, STATED not inferred, and a
|
||||
missing record is a named refusal, never a quiet fall-back.
|
||||
4. **A regression test that fails without the fix.** The strict lane cannot catch this class by
|
||||
construction (it runs under lockstep), so whatever you add must run with the flip thrown. Say
|
||||
where it lives and how the gate reaches it.
|
||||
|
||||
## 4 Gate
|
||||
|
||||
`build` · `unit` · `isplit` · `gpu` · `gens` · `flavours`, all on your tree, plus the census
|
||||
(`strict_census3.py`). The bar for "fixed" is **`isplit` 181/181 and `gpu` 1359/1359 with the flip
|
||||
still thrown**, and the census showing no `Fatal{` that is not one of the ten admitted rows.
|
||||
|
||||
If you cannot reach that bar, report the exact remaining set rather than reverting the flip to make
|
||||
the numbers look green — the flip is the thing under test.
|
||||
|
||||
## 5 Report
|
||||
|
||||
`~/w7/notes/p5e/reports/ra2-v1.md`. Lead with the verdict in §3.2, because that is the decision the
|
||||
integrator has to make. Then the diagnosis with its evidence, then what you changed, then the gate
|
||||
table, then what you did not do and why.
|
||||
@@ -0,0 +1,82 @@
|
||||
# Package sb — `set_shader_buffers`: the binding-point tables cross the wire (P5e wave 2)
|
||||
|
||||
Read in this order, all of it: `PACKAGE-PREAMBLE-P5E.md`, `INTEGRATOR-DECISIONS-P5E.md` (ID-89,
|
||||
ID-93 are yours), `BRIEF-P5E.md` (§0, §1, §2 "sb", §5, §6 rulings 3, 10, 11), `CONTRACT-P5E.md`
|
||||
§5.6 (and §2.1 for the barriered predicate's XFB input), your scout report `scout-S5.md` (all of it),
|
||||
and the binding-point / XFB rows of `kimi-audit.md` (rows 111-124) — report per row: retired / left
|
||||
barriered / not found. Notes: `//wsl.localhost/Arch/home/swung/w7/notes/p5e/`.
|
||||
|
||||
Your slug is `sb`; your tree is `~/w7/p5e-sb` (branch `p5e/sb`, based on the landed id head, built).
|
||||
c0e has already landed the row's `WaitClass`, subsystem bit 13, the three suppressor slots, the
|
||||
applier field declarations (`BoundShaderBuffers[3]`, `Start/Count/WritableMask[3]`,
|
||||
`ShaderBuffersSerial`) and `MGPipeApplySetShaderBuffers`'s declaration with an asserting body — you
|
||||
write the bodies.
|
||||
|
||||
## What "done" means for this family
|
||||
|
||||
`set_shader_buffers` (`MGPShaderBuffers`, opcode 38, `kCtxState`, catalogued since P5 and never
|
||||
emitted) is EMITTED for the first time: one record per class (Uniform=0, ShaderStorage=1,
|
||||
AtomicCounter=2), the window is the touched high-water mark per target, capacity 84 on the wire,
|
||||
the backend clamps to the driver's limit. On the server, `SyncBufferBindingPoints`,
|
||||
`SyncAtomicCounterBuffers`, `MarkShaderStorageBuffersGpuWritten` and the point half of the UBO loop
|
||||
in `BindCurrentProgramWithResources` read the applier's arrays instead of
|
||||
`MGB_CTX->GetBufferBindingPoint(...)`, resolving every buffer with
|
||||
`EnsureBufferResourceForHandle(nullptr, handle)`. The backend's GPU-write marks (which reach into
|
||||
client objects) are deleted under a transport — the client's own `MarkGpuWritesForDraw` already
|
||||
covers them (verify, and say so).
|
||||
|
||||
## Scope
|
||||
|
||||
Client: `MG_State/GLState/BufferState/BufferState.h` (bind-point generations, push-only),
|
||||
`MG_Impl/GLImpl/Buffer/GL_Buffer.cpp` (the bumps at every bind-point mutator, including the named
|
||||
XFB binding), `MG_Impl/Pipe/Tracker.h` (bits 15/16/17 shutters), new
|
||||
`MG_Impl/Pipe/ShaderBufferEmit.h`, `MG_Impl/Pipe/PipeFill.cpp` (`SubsystemForEmitter` row, the
|
||||
pairing asserts, the validate order, the reset list, the `kMGPipeMaxBufferBindingPoints`/84 pin).
|
||||
Wire/apply: `MG_Pipe/PipeApply.{h,cpp}` (`MGPipeApplySetShaderBuffers`), `MG_Pipe/PipeRoute.{h,cpp}`
|
||||
+ `MG_Remote/Client/WireTables.cpp` (route rows), `MG_Remote/Server/PipeApplier.cpp`
|
||||
(`OnSetShaderBuffers` only). Backend: `DirectGLES.cpp` `SyncBufferBindingPoints` →
|
||||
`SyncBufferBindingPointsByRecord`, `MarkShaderStorageBuffersGpuWritten`, `SyncAtomicCounterBuffers`,
|
||||
their call lines, and the POINT half of the UBO loop (the `GetUniformBlockBinding` line above it is
|
||||
pg's — do not touch it; coordinate through the report). Gates: `scripts/gen_pipe_dirty_surface.py`
|
||||
+ `DirtySurface.def` rows. Tests: `TrackerTest.cpp`, new `ShaderBufferEmitTest.cpp`,
|
||||
`PipeCatalogueTest.cpp` (invert the "not emitted" pins).
|
||||
|
||||
## Rulings that bind you
|
||||
|
||||
- **ID-104 (found by c0e after the brief was written, and it is a WIRE change you own):**
|
||||
`MGPShaderBuffers::WritableMask` is a `Uint32` while the window capacity is 84 points, so the
|
||||
mask can only describe the first 32. **Widen the field so the mask covers the declared window**
|
||||
(`Uint32 WritableMask[3]`, or `Uint64` + `Uint32` — your choice, say why); do NOT narrow the
|
||||
window, which would change what applications can bind. The POD grows; that is fine (opcode 80
|
||||
already moved the ABI fingerprint this phase) — pin the new size in `PipeCatalogueTest`. This is
|
||||
a named exemption to the file-ownership rule: you edit `MG_Pipe/MGPipeTypes.h` (c0e's file) in
|
||||
the same commit as the emitter, and nobody else touches that struct.
|
||||
- **ID-106:** `MG_Backend/Init.cpp`'s `ConsumedSubsystemsFor` does NOT yet carry bit 13 — c0e
|
||||
deliberately withheld it (no emitter existed, and withholding is the safe direction). **You add
|
||||
it in the same commit that sets `ShaderBufferEmit.h`'s wired constant**, or the client's R-8
|
||||
liveness gate withholds the whole family and your emission never runs.
|
||||
- ID-89 / rulings 10, 11: high-water window (`TouchedBufferBindingPointCount` per target), 84 on the
|
||||
wire, backend clamps; three suppressor slots (one per class).
|
||||
- `kMGPipeWholeBuffer` as the wire token for a base binding needs its contract row — c0e landed the
|
||||
table-0 row; make the emitter use it so a `glBufferData` between emission and apply cannot bind a
|
||||
stale extent.
|
||||
- XFB stays lockstep (contract §5.7): the XFB capture points are NOT part of your emission unless
|
||||
your scout's design says they are — if you emit them, the barriered predicate must keep XFB draws
|
||||
barriered regardless.
|
||||
|
||||
## Red-once (execute, revert, quote)
|
||||
|
||||
1. Revert the handle walk under a live wire → `Fatal{UnmigratedPipeInput, "GetBufferBindingPoint@DrawVbo"}`
|
||||
under `strict` on `SsboArrayDynamicIndexScenario` / `StorageBufferRegrowScenario` / `AtomicCounterScenario`.
|
||||
2. `TrackerTest`: `glBindBufferBase(UNIFORM,1,A); Update(); glBindBufferBase(UNIFORM,1,B); Update()`
|
||||
must set bit 15 on the second update — red against today's tracker.
|
||||
3. `GetBufferBindingPointCount`'s `rsp` non-zero before your change, 0 after, on `AtomicCounterScenario`.
|
||||
4. Delete the backend marks and show `ProducerMarkCount(ShaderStorageBinding)` still non-zero while
|
||||
`SsboArrayLengthScenario`'s readback sees the writes.
|
||||
|
||||
## Gate
|
||||
|
||||
`build`, `unit`, `isplit`, `gens` (the dirty-surface generator must stay green — you are adding
|
||||
mutators), `one` on the four SSBO/atomic scenarios and the three XFB ones, `strict` (record the
|
||||
markers that disappeared). Also run the subsystem A/B with bit 13 cleared and confirm it reproduces
|
||||
today's picture — that is the arm that proves the emission is what the server consumes.
|
||||
@@ -0,0 +1,74 @@
|
||||
# Package tx2 — textures and samplers by handle and window (P5e wave 2)
|
||||
|
||||
Read in this order, all of it: `PACKAGE-PREAMBLE-P5E.md`, `INTEGRATOR-DECISIONS-P5E.md` (ID-86,
|
||||
ID-93, ID-95 are yours), `BRIEF-P5E.md` (§0, §1, §2 "tx2", §5, §6 rulings 6, 14, 19),
|
||||
`CONTRACT-P5E.md` §5.2 and §5.3, your scout report `scout-S2.md` (all of it), and the texture /
|
||||
sampler rows of `kimi-audit.md` (rows 35-67) — report per row: retired / left barriered / not found.
|
||||
Notes: `//wsl.localhost/Arch/home/swung/w7/notes/p5e/`.
|
||||
|
||||
Your slug is `tx2`; your tree is `~/w7/p5e-tx2` (branch `p5e/tx2`, based on the landed id head,
|
||||
built). id landed `ResolveTextureTwin(MGPipeHandle)`; c0e declared `SyncTextureToBackendByHandle`
|
||||
and `SyncMipmapsToBackendByHandle` with asserting bodies — you write them, and fb calls them.
|
||||
|
||||
## What "done" means for this family
|
||||
|
||||
Your scout's headline: the SAMPLER half is already run-ahead clean on its record arm
|
||||
(`BindCurrentUnitSamplers` + `ResolveSamplerCsoTwin`) — that is the shape you bring to the TEXTURE
|
||||
half. After this package: the per-draw unit work list is built from `st.BoundSamplerViews[]`
|
||||
(handles), not from borrowed pointers into the frontend texture units; `PairingsIntact` and
|
||||
`IsDrawSyncClean(frontend)` are replaced by `IsDrawSyncCleanByRecord(handle, record)` reading the
|
||||
twin's own serials; every `HandleOf(frontendTexture)` re-entry is `ResolveTextureTwin(handle)`;
|
||||
`GetTarget` / `IsTextureView` / the texbuffer backing all come from the descriptor; `GenerateMipmap`
|
||||
resolves `VerbMipRes` and can drop its wait (ruling 14 — flip the row's `WaitClass` to `kWaitNone`
|
||||
only if your arm is complete, else leave it and list it as trailing); the identity sampler family
|
||||
(the apply-thread mint for a unit not covered by `bind_sampler_states`) is deleted and becomes a
|
||||
named refusal.
|
||||
|
||||
## Scope
|
||||
|
||||
`DirectGLES.cpp`: `SyncTextureToBackendByHandle` (new), the unit epoch/capture pair (monolith-only;
|
||||
the decline arm becomes a refusal), `UnitTextureSyncEntry`'s re-shape (push-only) and the unit half
|
||||
of `SyncNeccessaryTextures`, `ResolveAndBindUnitTextures`, `BindCurrentUnitSamplers`,
|
||||
`BindCurrentTextures`' memo key (ruling 6: `SamplerViewsSerial` AND pg's program key — pg states
|
||||
its half in its report), the sampler pass (the mint deleted), `GenerateMipmap` by `VerbMipRes`, the
|
||||
mip-shape `HandleOf` sites; trailing and NOT yours now: the CopyTex endpoint and `GetTexImage`
|
||||
(barriered, P8/P9). `Managers.cpp`: `RequireImageBindableStorage`'s entry refusal,
|
||||
`SyncMipmapsToBackend(handle, record)`, the texture registry re-entries, the sampler identity family
|
||||
under transport, `ResolveSamplerCsoTwin` (your model). `Managers.h`: `IsDrawSyncCleanByRecord` and
|
||||
the twin's serial members. `MG_Backend/DirectGLES/MipmapStorage.cpp`: the guard accessor list widened.
|
||||
`MG_Remote/Server/PipeApplier.cpp`: ONE function `CheckUnitWindows(st)` called from `OnDrawVbo` and
|
||||
`OnLaunchGrid` (ruling 19 / ID-95). Tests: `MG_Test/Wire/RemoteClientTest.cpp`, `MG_Test/SanityTest.cpp`
|
||||
(+ an ABA sibling), keep `SampledSetStalenessScenario` and `TextureParamsWithoutASamplerViewScenario`.
|
||||
|
||||
## Rulings that bind you
|
||||
|
||||
- ID-95 / ruling 19 (A8, blocking for your family): the `set_sampler_views` window MUST cover
|
||||
`[0, MaxTouchedTextureUnit]`; the sink checks it at every draw/dispatch; narrower is
|
||||
`Fatal{ProtocolCorruption, "SetSamplerViews.Count"}`. The emitter already emits
|
||||
`Start=0/Count=maxTouched+1` — your job is to make the contract's promise checkable and checked.
|
||||
- ID-86 / ruling 6: the memo key is both halves.
|
||||
- Behaviour narrowing you must NAME in the report (G1 §): driving the work list off
|
||||
`BoundSamplerViews` syncs only the program-resolved texture per unit, where today the walk syncs
|
||||
every slot of every touched unit. Say what stops being synced and why that is correct (or refuse).
|
||||
- Your scout's R4: the new clean gate reads both the wire's resync bits and the twin's own force
|
||||
flags — make "neither side clears the other's" explicit in code and in the report.
|
||||
- Your scout's R5 (S1 boundary): the buffer-texture arm still hands a frontend `BufferObject` to
|
||||
`EnsureBufferResourceForHandle` for the emulated-persistent-map question — resolve it with
|
||||
`Desc.BufferForTexBuffer` or state precisely why it must stay.
|
||||
|
||||
## Red-once (execute, revert, quote)
|
||||
|
||||
1. Revert any handle arm → the widened `MipmapStorage` / buffer-arm guard aborts by accessor name.
|
||||
2. Revert the window arm of `ResolveAndBindUnitTextures` → `strict` names
|
||||
`Fatal{UnmigratedPipeInput, "GetTextureUnitObject@DrawVbo"}`.
|
||||
3. ABA: recycle a slot to `{s, g+1}` while the old entry is in the work list → the twin re-mints;
|
||||
skip the Gen reset → red.
|
||||
4. Narrow the emitter's `Count` by one → `Fatal{ProtocolCorruption, "SetSamplerViews.Count"}`.
|
||||
5. `GenerateMipmap` with the row unwaited and the unit walk restored →
|
||||
`Fatal{UnmigratedPipeInput, "GetActiveTextureUnit@..."}` (`F1WireScenario.GenerateMipmap*Pixels`).
|
||||
|
||||
## Gate
|
||||
|
||||
`build`, `unit`, `isplit`, `gens`; `strict` (record the markers that disappeared); `one` on the
|
||||
texture/sampler scenarios you touch. If `PipeSlotPeek` (or an equivalent) can assert zero
|
||||
registry-scope entries per frame for this family, add that assertion.
|
||||
@@ -0,0 +1,69 @@
|
||||
# Package vi — VAO / vertex input / index from records (P5e wave 2)
|
||||
|
||||
Read in this order, all of it: `PACKAGE-PREAMBLE-P5E.md`, `INTEGRATOR-DECISIONS-P5E.md` (ID-81,
|
||||
ID-82, ID-95 are yours), `BRIEF-P5E.md` (§0, §1, §2 "vi", §5, §6 rulings 1, 2, 19),
|
||||
`CONTRACT-P5E.md` §4 and §5.1 (landed by c0e in `MobileGL/MG_Remote/`; the draft in the notes dir is
|
||||
the same text), your scout report `scout-S1.md` (all of it), and the VAO / buffer rows of
|
||||
`kimi-audit.md` (rows 1-34) — your report must say, per row, retired / left barriered / not found.
|
||||
All notes are in `//wsl.localhost/Arch/home/swung/w7/notes/p5e/`.
|
||||
|
||||
Your slug is `vi`; your tree is `~/w7/p5e-vi` (branch `p5e/vi`, based on the landed id head, already
|
||||
configured and built). The twin resolvers `ResolveVaoTwin(MGPipeHandle)` and the by-handle registry
|
||||
API are id's and already in your base — use them, do not re-declare.
|
||||
|
||||
## What "done" means for this family
|
||||
|
||||
On the DirectGLES draw path under an active transport, nothing in the VAO / vertex-input / index
|
||||
family reads the frontend: the twin resolves from `st.BoundVertexElements`, the attribute walk and
|
||||
its dirty repair run over `st.VertexBuffers[Start..Start+Count)` and the CSO record's `Attributes[]`,
|
||||
the IBO arm resolves `st.IndexBuffer.Res`, every buffer ensure is
|
||||
`EnsureBufferResourceForHandle(nullptr, handle)`, and the clean stamp uses the server-owned
|
||||
`{elementsHandle, elementsSerial, buffersSerial}` (+ the new `iboSerial`) instead of the VAO's
|
||||
config version. The three frontend-keyed scope sites of this family (`DirectGLES.cpp:1609, :6729,
|
||||
:6775` at the P5d base — re-resolve) are gone.
|
||||
|
||||
## Scope (the only regions you may edit; anything else is the integrator's)
|
||||
|
||||
`MG_Backend/DirectGLES/DirectGLES.cpp`: `SyncVaoAttributeBuffersByHandle` + the IBO arm of
|
||||
`SyncNeccessaryBuffers`; `ResolveVaoTwin` / `SyncCurrentVAO` / `SyncCurrentVertexAttributeValues`;
|
||||
the VAO lines of `PrepareForDraw` only; the restart helpers (`BoundElementArrayBuffer`/`...Id`);
|
||||
the `DrawArrays` / `MultiDrawArrays` client-array arms (monolith-only after your change).
|
||||
`MG_Backend/DirectGLES/Managers.h`: `ResolvedDrawBuffers` (`Entry::frontend` leaves the split arm,
|
||||
`iboSerial` added) and `PendingAttribValueMask`'s key. `Managers.cpp`: `SyncToBackendFromApplier`
|
||||
(signature/entry only — its body is already record-only and is your existence proof),
|
||||
`SyncClientSideAttributesForDrawArrays` (monolith-only). `MG_Remote/Client/EmitTables.cpp`: the
|
||||
`kDrawClientArrays` flag and the run-ahead refusal beside the existing `CLIENT_INDICES` refusal.
|
||||
Tests: `MG_Test/Pipe/VertexInputEmitTest.cpp`, a `SanityTest.cpp` sibling, and the scenario work below.
|
||||
|
||||
## Rulings that bind you
|
||||
|
||||
- ID-82 / ruling 2: client-memory vertex arrays are **not** refused today (your scout verified it).
|
||||
Refuse them when run-ahead is armed — `kDrawClientArrays` on the draw record, a named
|
||||
`Fatal{UnmigratedVerb, "DrawArrays+CLIENT_ARRAYS"}`-shape refusal on the client. Lockstep keeps
|
||||
today's behaviour exactly. Answer the open question yourself: does any existing scenario
|
||||
(`DoublePrecisionScenario`?) exercise a client array under split — if none does, add one so the
|
||||
refusal has a red-once.
|
||||
- ID-81 / ruling 1: handle arms only under `Transport != Monolith`; the push-monolith build keeps
|
||||
its frontend arms and its bytes.
|
||||
- ID-95 / ruling 19: `set_vertex_buffers`' window must cover the attributes the CSO declares; pin it
|
||||
with a test in the same validate step (a narrower window is `Fatal{ProtocolCorruption, "<row>.Count"}`).
|
||||
|
||||
## Red-once (execute each, revert, quote the evidence line in the report)
|
||||
|
||||
1. Revert `ResolveVaoTwin` to the frontend lookup → the id guard's `Fatal{RoleViolation, "MGPipeSlots"}`
|
||||
(use id's test hook to force "unbarriered" — run-ahead is not armed yet).
|
||||
2. Publish `set_vertex_buffers` for A,B, repoint the frontend VAO at C without re-emitting, sync →
|
||||
A,B must be ensured; the revert ensures C.
|
||||
3. The same on `set_index_buffer` / `st.IndexBuffer.Res`.
|
||||
4. `glDrawArrays` with a client array under the run-ahead flag → the named refusal.
|
||||
|
||||
## Gate
|
||||
|
||||
`build`, `unit`, `isplit`, `gens` green; `one` on `VertexAttribBindingScenario|VertexArrayEnableDisableScenario|PrimitiveRestartScenario|ResidentIndexScenario|MultiDrawScenario|DrawParametersScenario|HandleRecycleScenario|ObjectSubsystemControlScenario`;
|
||||
`strict` — record which `UnmigratedPipeInput` markers of this family disappeared vs the c0e baseline
|
||||
in your report (that list is the phase's progress metric). Also answer, with evidence: does any
|
||||
GL-thread path bump `CurrentBufferMutationEpoch` under a transport (your scout's open question 2) —
|
||||
pin the answer with an assertion or a test rather than an argument.
|
||||
|
||||
Trailing (do NOT do): deleting `ResolvedDrawBuffers` (needs a measurement first), staging client
|
||||
arrays (P8).
|
||||
@@ -0,0 +1,60 @@
|
||||
# Wave 3 census — the strict lane at `3c13fa4b` (pa + mv + ID-124 merged)
|
||||
|
||||
Harness: `strict_census3.py`, which takes each entry's OWN command and environment from
|
||||
`ctest --show-only=json-v1` and layers only `MOBILEGL_IPC_STRICT_ERRORS=1` and a private
|
||||
`MOBILEGL_LOG_FILE_PATH` on top, last. The two earlier harnesses each produced a table that looked
|
||||
complete and was not: v1 was defeated by lane-pinned log paths, v2 by re-running 14 of 109 entries
|
||||
under an environment their lane does not use.
|
||||
|
||||
## The table
|
||||
|
||||
180 lane entries. 24 green, 156 red.
|
||||
|
||||
| marker | entries | admitted by | owner |
|
||||
|---|---|---|---|
|
||||
| `GetFramebufferBindingSlot@ReadPixels` | 113 | ID-116 disjunct 1 (ReadPixels is statically barriered) | trails to P8/P9 |
|
||||
| `GetBufferBindingSlot@DrawArrays` | 18 | ID-125 disjunct 2 (retires P8 / P9 / P13) | P8 |
|
||||
| `GetTransformFeedbackProgram@DrawArrays` | 11 | ID-125 disjunct 2, and ID-128 disjunct 3 | P3b/P4b |
|
||||
| `GetTextureObject@CopyImageSubData` | 6 | ID-125 disjunct 2; ID-118 also makes disjunct 1 hold | P7 |
|
||||
| `ValidateProgramName@ShaderStorageBlockBinding` | 2 | ID-125 disjunct 2 (retires P9) | P9 |
|
||||
| `GetBoundVertexArray@DrawArrays` | 2 | **ID-128 disjunct 3 only** | P8 (client arrays) |
|
||||
| `GetTextureUnitObject@CopyTexImage2D` | 2 | ID-116 disjunct 1 | trails |
|
||||
| `GetFramebufferBindingSlot@Clear` (DirectVulkan) | 2 | ID-125 disjunct 2 on the Magma side | P7 |
|
||||
|
||||
**`GetProgramForDraw@DrawArrays` and `GetProgramForDispatch@DispatchCompute` are gone.** They were
|
||||
62 and 7 at the wave's base and they were the per-draw pull that kept every draw barriered.
|
||||
|
||||
## Two rows that the wave created, and both were predicted
|
||||
|
||||
- **`GetBufferBindingSlot@DrawArrays`, 18 entries, all in `MultiDrawTierIndirect` and
|
||||
`MultiDrawTierMultiIndirect`.** Package `mv` NAMED this in its report as a latent row before it
|
||||
could fire: `BoundDrawIndirectBufferId`'s `GetBufferBindingSlot(DrawIndirect)`, which "would
|
||||
surface as `GetBufferBindingSlot@DrawArrays` if an indirect tier were ever forced under strict".
|
||||
It then gated the indirect tiers, which forced them. The field retires in P8 (`FieldOwnership.def:78`),
|
||||
so it is admitted, not owed. A latent row named and then made visible in the same package is the
|
||||
outcome you want.
|
||||
- **`GetFramebufferBindingSlot@ReadPixels` grew from 19 to 113.** Unmasking: entries that used to
|
||||
die on the program row now get as far as their readback.
|
||||
|
||||
## The rule is now complete against this table
|
||||
|
||||
Three disjuncts, and every row above is covered:
|
||||
|
||||
1. the verb's wire op is statically barriered (ID-116);
|
||||
2. the field's retiring phase does not name P5e (ID-125);
|
||||
3. the record was barriered by ESCALATION rather than statically — `wireSaysBarriered && waitClass == kWaitNone` (ID-128).
|
||||
|
||||
Disjunct 3 exists because of exactly two entries, both `ClientVertexArrayScenario.*`, and it is the
|
||||
principled one rather than a patch: escalation happens only for XFB-active and client-array draws,
|
||||
and the contract puts both outside this phase.
|
||||
|
||||
**Hard green is therefore a checkable number: 180 of 180, eight rows reporting `Admitted{`, zero
|
||||
reporting `Fatal{`.** Not an argument.
|
||||
|
||||
## What is NOT in this table
|
||||
|
||||
The census measures first faults under the strict knob. It says nothing about whether run-ahead is
|
||||
correct, only about whether any record still reads client memory in a way P5e owes. The negative
|
||||
controls, the red-once re-runs and the device exit are separate gates (`FLIP-CHECKLIST.md` phases C
|
||||
to E), and BRIEF §3 item 5's evidence form had to be re-sequenced because every candidate was red
|
||||
before the revert (ID-121).
|
||||
@@ -0,0 +1,254 @@
|
||||
# P5e audit — apply-thread reads of client-owned memory on the DirectGLES inproc draw path
|
||||
|
||||
Repo head `2fde7034` (`feat/disaggregated`). Read-only static audit; no build, no run.
|
||||
|
||||
Legend — paths: `D` = `MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp`, `M` = `MobileGL/MG_Backend/DirectGLES/Managers.cpp`, `ST` = `MobileGL/MG_Backend/DirectGLES/SlotTables.h`, `PA` = `MobileGL/MG_Remote/Server/PipeApplier.cpp`, `AP` = `MobileGL/MG_Pipe/PipeApply.cpp/.h`, `MT` = `MobileGL/MG_Pipe/MGPipeTypes.h`, `PI` = `MobileGL/MG_Backend/MGPipe/PipeInputs.h`, `MD` = `MobileGL/MG_Backend/DirectGLES/MultiDraw.cpp`.
|
||||
Kinds: `LIVE` = dereference of a client object/field; `PROBE` = `GetLifetimeId()` + `MGPipeSlots().FindByLifetimeId`; `MINT` = `MGPipeSlots().Acquire(...)`; `ROW-O` = `gPipeInputs` BARRIER_PULLED row holding a raw pointer/SharedPtr into the live `GLContext`; `ROW-V` = BARRIER_PULLED copied-value row.
|
||||
Arm: `rec` = runs when `MG_Config::Transport != Monolith` with all `MOBILEGL_PIPE_PUSH` bits; `leg` = legacy/monolith arm only; `both` = no transport branch.
|
||||
Freq: `draw` = every draw/dispatch; `memo` = only on memo miss / clean-probe open; `rare` = config change / error / special-feature path.
|
||||
"Dup" = pushed record or `MGPipeApplierState` field (`AP:PipeApply.h`) already carrying the same information; `none` = nothing pushed covers it.
|
||||
|
||||
Sink map (all sinks are in `PA`; bodies read no `MG_State` — every client read is one level down in the callee): `OnDrawVbo` PA:430 → the 19 draw entries (`D:6705`-`D:7295`), all of which call `PrepareForDraw` (D:4762) first; `OnClear` PA:168 → `Clear` D:6180 / `ClearBufferfi` D:10045 / `ClearBufferfv` D:10091 / `ClearBufferiv` D:10104 / `ClearBufferuiv` D:10120; `OnBlit` PA:232 → `BlitFramebuffer` D:8322; `OnLaunchGrid` PA:670 → `DispatchCompute` D:9610 / `DispatchComputeIndirect` D:9618 → `PrepareForCompute` D:6118; `OnGenerateMipmap` PA:915 → `GenerateMipmap` D:9559; `OnCopyFramebufferToTexture` PA:931 → `CopyTexImage2D` D:9256 / `CopyTexSubImage2D` D:9373. `AP` (`PipeApply.cpp`, 38 `MGPipeApply*` entries) contains **zero** client-owned reads — no `pGLContext`, no `MGPipeSlots()` probe, no `MGB_CTX->`.
|
||||
|
||||
## VAO / vertex
|
||||
|
||||
| # | site | function | what is read | kind | freq | arm | dup |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| 1 | D:4770 | `PrepareForDraw` | `MGB_CTX->GetBoundVertexArray()` — SharedPtr to client VAO | ROW-O | draw | both | `BoundVertexElements` (AP:594) |
|
||||
| 2 | D:1617 → ST:436-446 | `VertexArrayImpl::ResolveVaoTwin` | `Find(vao.get())` → `HandleOf` → `MGPipeSlots().FindByLifetimeId` | PROBE | draw (memo hit at ST:444 skips) | rec (slot arm) | `BoundVertexElements` |
|
||||
| 3 | D:1618 → ST:247-248 | `ResolveVaoTwin` | `GetOrCreate(vao)` → `MGPipeSlots().Acquire` | MINT | rare | rec | none (first-touch only) |
|
||||
| 4 | D:1626, D:1629-1634 | `ResolveVaoTwin` | legacy memo/registry keyed on frontend heap address + `stateRef` weak_ptr | LIVE | draw | leg | none |
|
||||
| 5 | D:4775 | `PrepareForDraw` | `currentVAO->GetConfigVersion()` | LIVE | draw | both | none (server has `VertexBuffersSerial`/`ContentSerial` only) |
|
||||
| 6 | D:1653 → M:4881 | `SyncCurrentVAO` | client VAO handed to `SyncToBackend` | LIVE handoff | draw | both; handle arm diverts to `SyncToBackendFromApplier` M:5160 (zero client reads) | `VertexElementsCso` record (AP:487) |
|
||||
| 7 | M:4919-5104 | `BackendVertexArrayObject::SyncToBackend` | `GetConfigVersion`, index slot, `GetAllAttributeVersions`/`GetAllAttributes`, per-attrib `Enabled/Divisor/IsBgra/Offset/Stride/Type/...` | LIVE | draw | leg only | `MGPVertexAttribWire`/`MGPVertexBindingPointWire` (MT:389-400) |
|
||||
| 8 | M:5479-5544 | `SyncFloat64AttributeAsFloat32` | `attrib.*`, `bufferObject->MappedData()` — client shadow bytes; `NarrowDoubleStreamToFloat32` reads them | LIVE | rare | leg | none |
|
||||
| 9 | D:1669 | `SyncCurrentVertexAttributeValues` | `GetBoundVertexArray()` | ROW-O | draw | both | `BoundVertexElements` |
|
||||
| 10 | D:1683, D:1688, D:1700 | `SyncCurrentVertexAttributeValues` | `vao->GetConfigVersion()`, `vao->GetAttribute(location).Enabled`; `GetCurrentVertexAttribute(location)` | LIVE + ROW-V | draw / memo | both | `SetVertexAttribDefaults` (AP:1600) for :1700; none for :1683/:1688 |
|
||||
| 11 | D:6449, D:6451, D:6459 | `BoundElementArrayBuffer` | `GetBoundVertexArray()`, VAO index slot `GetBoundObject()`, `EnsureBufferResource` | ROW-O + LIVE + PROBE | per indexed draw | both | `IndexBuffer` (AP:620) |
|
||||
| 12 | D:6724, D:6731 | `DrawArrays` | `GetBoundVertexArray()` + registry `Find(currentVAO.get())` → the one true per-draw `MGPipeSlots().FindByLifetimeId` from the apply thread | ROW-O + PROBE | every DrawArrays | both | `BoundVertexElements` |
|
||||
| 13 | D:6768, D:6777 | `MultiDrawArrays` | same pair, per sub-draw | ROW-O + PROBE | per sub-draw | both | `BoundVertexElements` |
|
||||
| 14 | M:5372-5449 | `SyncClientSideAttributesForDrawArrays` | `GetAllAttributes()`, `attrib.Offset` reinterpreted as client-memory pointer, client array bytes uploaded | LIVE | VAOs with client-side arrays | both | none (client-memory vertex data) |
|
||||
| 15 | MD:96 | `BoundIndexBuffer` | `MGB_CTX->GetBoundVertexArray()` | ROW-O | per multi-draw element call | both | `BoundVertexElements` |
|
||||
|
||||
## Buffers
|
||||
|
||||
| # | site | function | what is read | kind | freq | arm | dup |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| 16 | D:897 | `SyncNeccessaryBuffers` | `currentVAOObject->GetIndexBufferBindingSlot().GetBoundObject()` | LIVE | every indexed draw | both | `IndexBuffer` (AP:620) |
|
||||
| 17 | D:907 → M:2922-2941 | `SyncNeccessaryBuffers` | `HandleOfBuffer(possibleIBO.get())` → `MGPipeSlots().FindByLifetimeId` | PROBE | every indexed draw | rec | `IndexBuffer.Res` |
|
||||
| 18 | D:911 → M:3109-3151 | `IsBufferDrawCleanByHandle` | server-only under split; `frontend->IsMapped()` at M:3147 is monolith-only | LIVE (monolith) | memo | both | resource record `Serial`/`HasLiveHostWrites` |
|
||||
| 19 | D:915, D:932 | `SyncNeccessaryBuffers` | `EnsureBufferResource(possibleIBO)` | PROBE | rare | rec | `IndexBuffer.Res` |
|
||||
| 20 | D:926, D:928, D:934 | `SyncNeccessaryBuffers` | `memo->iboFrontend == possibleIBO.get()` — client address compare | LIVE | every indexed draw | leg | `IndexBuffer.Res` |
|
||||
| 21 | D:842 | `SyncNeccessaryBuffers` | `currentVAOObject->GetAttribute(entry.attribIndex).Buffer` | LIVE | rare (clean-probe fail) | both | `VertexBuffers` window (AP:598-600) |
|
||||
| 22 | D:857-861 | `SyncNeccessaryBuffers` | `GetAllAttributes()`, per-attrib `Enabled`/`Buffer` | LIVE | memo | leg-memo path | `VertexElementsCso` + `VertexBuffers` |
|
||||
| 23 | D:864, D:874 | `SyncNeccessaryBuffers` | stored raw client `BufferObject*`, `EnsureBufferResource(bufferObject)` | LIVE + PROBE | memo | both | buffer handle in `VertexBuffers` |
|
||||
| 24 | D:736, D:746-753, D:763, D:766-770 | `SyncVaoAttributeBuffersByHandle` | memo-miss full walk: `GetAllAttributes`, `attrib.Buffer`, stores client pointer + `HandleOfBuffer` | LIVE + PROBE | memo | rec | `VertexBuffers`/`VertexElementsCso` |
|
||||
| 25 | M:3158 | `IsBufferDrawClean` | `HandleOfBuffer(frontend)` | PROBE | every probe | rec | resource record |
|
||||
| 26 | M:3163, M:3175, M:3179, M:3180 | `IsBufferDrawClean` | `frontend->GetBackendResource/IsMapped/GetSize/GetChangeSerial` | LIVE | every probe | leg | resource record |
|
||||
| 27 | M:3444 | `EnsureBufferResource` | `HandleOfBuffer(bufferObject.get())` | PROBE | per bound VBO/IBO/SSBO/UBO/atomic/XFB/PBO per draw | rec | the handle in each pushing record |
|
||||
| 28 | M:3452 | `EnsureBufferResource` | `bufferObject->GetExternalIndex()` | LIVE | error arm only | both | none |
|
||||
| 29 | M:3221, M:3340, M:3393 | `EnsureBufferResourceForHandle` | `bufferObject->MappedData()/SyncPersistentMappedRange()/HasDefinedContent()` — **monolith-only**; under an active transport this function is client-free | LIVE | — | leg | `ServerStaged()` shadow + resource record |
|
||||
| 30 | M:2953 | `MarkBufferGpuWritten` | `HandleOfBuffer(bufferObject.get())` before the reverse announcement | PROBE | per SSBO per draw | rec | none (reverse direction) |
|
||||
| 31 | M:2950 | `MarkBufferGpuWritten` | `bufferObject->MarkGpuWritten()` — client **write** | LIVE | per SSBO per draw | leg | none |
|
||||
| 32 | M:3083 | `GetBufferResource` | `bufferObject->GetBackendResource()` (called per UBO per draw from D:5472) | LIVE | draw | both | none |
|
||||
| 33 | D:962, D:5987, D:6077, D:6511, D:6930-6931, D:7082-7083 | indirect/restart helpers | client `GetBufferBindingSlot(DrawIndirect/Parameter)` + `MappedData()` — all behind `Transport == Monolith`; record arms (D:373, D:951-956, D:6534-6536, D:6889-6927, D:7043-7079) read applier handles + server staged shadows only | ROW-O + LIVE | indirect draws | leg | `VerbIndirectBuffer`/`VerbIndirectParameterBuffer` (AP:742-743) |
|
||||
| 34 | M:5364-5468 | see #14 | client-side attribute bytes | LIVE | rare | both | none |
|
||||
|
||||
## Textures / samplers
|
||||
|
||||
| # | site | function | what is read | kind | freq | arm | dup |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| 35 | D:1899-1913 | `UnitBindingsUnchanged` | `GetTextureUnitObject(unit)` (raw `TextureUnit*` into client array), `GetAllBindingSlots()`, `GetBoundObject()->GetLifetimeId()`, sampler `GetLifetimeId()` | ROW-O + LIVE | memo | rec walk arm | `BoundSamplerViews`/`BoundSamplerStates` windows (AP:673-681) |
|
||||
| 36 | D:1871-1885 | `CaptureUnitBindings` | same tables, captures lifetime ids | ROW-O + LIVE | memo | rec | same |
|
||||
| 37 | D:1934-1940, D:1947-1953 | legacy twins of the above | same + `WeakPtr` owner checks | LIVE | memo | leg | same |
|
||||
| 38 | D:2346 → D:2136, D:2356, D:2359-2361 | `SyncNeccessaryTextures` served path | `entry.slot->get()` — borrowed pointer **into a client binding slot**; `*entry.slot` ITextureObject handed to twin sync | LIVE | **every draw, per list entry** | both | `BoundSamplerViews` |
|
||||
| 39 | D:2374-2376 | `SyncNeccessaryTextures` rebuild | `GetTextureUnitObject(index)`, slots, `GetBoundObject()` | ROW-O | memo | both | `BoundSamplerViews` |
|
||||
| 40 | D:2379-2381 | `SyncNeccessaryTextures` | `IsUndefinedDefaultTexture(...)`, probe + `SyncTextureObjectToBackend` mint | LIVE + PROBE/MINT | memo | both | texture resource handle |
|
||||
| 41 | D:2405-2406, D:2408-2409 | `SyncNeccessaryTextures` draw-FBO half | `GetFramebufferBindingSlotChecked(Draw).GetBoundObject()`, slot `GetVersion()`, `currentFBO->GetObjectVersion()` | ROW-O + LIVE | **every draw** | both | `BoundFramebuffer[Draw]` + `FramebufferRecord` (AP:646,524) |
|
||||
| 42 | D:2438-2447 | `SyncNeccessaryTextures` | replay of memoised `*entry.slot` through `IsDrawSyncClean` | LIVE | memo | both | `BoundSamplerViews` |
|
||||
| 43 | D:2450-2459 | `SyncNeccessaryTextures` | `currentFBO->GetAllAttachmentObjects()`, `attachment.GetTexture()` + mint | LIVE + MINT | memo | both | `MGPFramebufferState` (MT:750) |
|
||||
| 44 | D:2246-2247, D:2252, D:2258-2259 | `SyncReadFramebufferTextureAttachments` | read-FBO slot `GetBoundObject()`, pointer compare, versions | ROW-O + LIVE | every draw (PUSH) | both | `BoundFramebuffer[Read]` |
|
||||
| 45 | D:2285, D:2290-2296 | same | `PairingsIntact` + replay to `SyncTextureParamsToBackend`/`SyncBuiltinSamplerToBackend`/`SyncMipmapsToBackend` | LIVE | memo | both | sampler-view/params records |
|
||||
| 46 | D:2303-2308 | same | `readFBO->GetAllAttachmentObjects()`, `GetTexture()` + mint | LIVE + MINT | memo | both | `MGPFramebufferState` |
|
||||
| 47 | D:1736, D:1738 | `SyncTextureObjectToBackend` | `g_backendTextureObjects.Find(textureObject.get())` / `GetOrCreate(textureObject)` | PROBE + MINT | per texture sync | both | texture resource handle |
|
||||
| 48 | D:1781, D:1790, D:1797-1799 | `SyncTextureObjectToBackend` | re-resolution tail Find/GetOrCreate | PROBE + MINT | per call | both | same |
|
||||
| 49 | D:1758, D:1760-1762, D:1771-1772 | `SyncTextureObjectToBackend` | client SharedPtr handed into `BackendTextureObject::Sync*` (deep reads at M:5816/7049/8554/8802) | LIVE | per sync | both | pushed params/mipmap records |
|
||||
| 50 | D:4861, D:4876-4877 | `ResolveAndBindUnitTextures` | `GetTextureUnitObject(unit)`, `GetAllBindingSlots()`, `GetBoundObject()` | ROW-O | memo | both | `BoundSamplerViews` |
|
||||
| 51 | D:4883, D:4885, D:4888 | same | `IsUndefinedDefaultTexture`, `GetExternalIndex()`, `GetTarget()` | LIVE | memo | both | none |
|
||||
| 52 | D:4914-4918 | same | `textureUnit.GetSamplerObject()` ×2, `textureObject->GetSamplerObject()`, `SamplesAsIncompleteTexture` | LIVE | memo | both | `BoundSamplerStates` |
|
||||
| 53 | D:4928, D:4945-4946 | same | `Find(textureObject.get())`; clear pass reads `bindingSlot.GetTarget()` | PROBE + LIVE | memo | both | view handle |
|
||||
| 54 | D:5157, D:5159-5160 | `BindCurrentUnitSamplers` legacy arm | `GetTextureUnitObject(unit).GetSamplerObject()` | ROW-O + LIVE | memo | leg | `BoundSamplerStates` |
|
||||
| 55 | D:4999, D:5003, D:5015, D:5018 | `ResolveUnitSamplerBackend` | `HandleOf(samplerObject.get())` probe, `OwnerEquals` weak memo, `Find` | PROBE + LIVE | per non-CSO sampler per draw | rec | `BoundSamplerStates` |
|
||||
| 56 | D:5626 | `BindCurrentProgramWithResources` | `g_backendSamplerObjects.GetOrCreate(samplerObject)` | MINT | rare | leg-in-rec fallback | `BoundSamplerStates` |
|
||||
| 57 | D:5633-5637, D:5639 | same | `SyncToBackend(samplerObject, ...)` — client SamplerObject | LIVE | memo | both | `SamplerCsos` record (AP:501) |
|
||||
| 58 | D:5573, D:5577-5580, D:5591-5595 | same | `GetLodBias()`, binding-slot reads, `texture2D->GetSamplerObject()/GetFormat()` | LIVE | memo | both | none (LOD-bias/depth-fetch fixups) |
|
||||
| 59 | D:9564-9566, D:9568-9570 | `GenerateMipmap` | `GetTextureUnitObject(unitIndex)` (client array), slot `GetBoundObject()`, `texture->GetFormat()` | ROW-O + LIVE | every mipmap | both (rec arm too) | `MGPMipPlan.Res` (MT:1382) covers identity only |
|
||||
| 60 | D:9162, D:9217 | `GenerateDepth/ColorTexture2DMipmap` | `HandleOf(texture.get())` | PROBE | rare | rec | `VerbMipRes` (AP:739) |
|
||||
| 61 | D:9484-9548 | `GenerateThreeChannelFloatMipmapOnCpu` | `GetFormat`, `AsMipmapTexture`, `GetMipmapLevelCount/TexelSize`, `MapMipmapData` — client shadow bytes read+written, `MarkStorageDirty` | LIVE | rare | both | none |
|
||||
| 62 | D:9580, D:9584-9585, D:9591, D:9603 | `GenerateMipmap` | `texture->GetFormat()/GetTarget()` | LIVE | every mipmap | both | resource record `Desc` |
|
||||
| 63 | D:8839, D:8861-8897 | `ScopedDetachedTextureFramebufferAttachments` | `Find(texture.get())` probe; **unmemoised walk of every live twin's client FBO**: `GetAllAttachmentObjects`, `GetTexture`, `GetTextureUploadTarget`, `IsLayered`, `GetTextureLevel` | PROBE + LIVE | rare (per mipmap) | both | none |
|
||||
| 64 | D:8472 | `UpdateTextureBindingAtTarget` | `GetTextureUnitObject(unit)` | ROW-O | every copy-tex | both | `MGPCopyFromFramebuffer.Dst` (MT:1639) covers the handle |
|
||||
| 65 | D:9302-9312, D:9416+ | `CopyTexImage2D`/`CopyTexSubImage2D` legacy arm | unit binding slot `GetBoundObject()`, `Find(textureObject.get())`, `GetFormat()` | ROW-O + LIVE + PROBE | every copy-tex | leg | `VerbCopyTexDst` (AP:737) |
|
||||
| 66 | M:5884, M:7089, M:8483, M:8719 | texture `HandleOf` probes | `g_backendTextureObjects.HandleOf` → allocator probe | PROBE | memo/feature paths | rec | resource handle |
|
||||
| 67 | M:9261, M:9318 | `SyncAttachmentObject` | `GetOrCreate(stateTextureObject)` / `GetOrCreate(renderbufferObject)` | MINT | FBO attach walk | leg | attachment record |
|
||||
|
||||
## Framebuffers / attachments
|
||||
|
||||
| # | site | function | what is read | kind | freq | arm | dup |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| 68 | D:3019, D:3021, D:3032 | `FramebufferRecordMatchesBinding` (from `SyncCurrentFBO` rec arm D:3112-3113) | `GetFramebufferBindingSlotChecked(target).GetBoundObject()` — **client slot, every record-arm draw, per target**; `pDefaultFramebufferInfo->defaultFBO`; `HandleOf(bound.get())` at D:3032 is monolith-gated | ROW-O + LIVE | draw | rec | `BoundFramebuffer` + `FramebufferSerial` (AP:646,652) |
|
||||
| 69 | D:3178-3179, D:3186 | `SyncCurrentFBO` rec arm | `slot.GetBoundObject()` on serial miss; `currentFBO` handoff | ROW-O + LIVE | memo | rec | `FramebufferRecords` (AP:524) |
|
||||
| 70 | D:3227-3228 | `SyncCurrentFBO` rec arm | `NoteStateForHandle(record.Fbo, currentFBO)` — **stores the client FBO into the twin table** | LIVE | per handle sync | rec | — |
|
||||
| 71 | D:3269 → M:10044 | `SyncCurrentFBO` rec arm | `backendObj->SyncToBackend(currentFBO, target)` walks the frontend FBO | LIVE | memo | rec | `MGPFramebufferState` |
|
||||
| 72 | D:3305-3306, D:3317-3319, D:3336, D:3349, D:3358, D:3360, D:3367-3369, D:3373 | `SyncCurrentFBO` legacy arm | slot + `GetBoundObject()`, versions, `defaultFBO`, `Find`/`GetOrCreate` mint, `SyncReadBufferToBackend`, `SyncToBackend` | ROW-O + LIVE + PROBE/MINT | draw | leg | same records |
|
||||
| 73 | D:4568, D:4580-4581, D:4592, D:4600, D:4602 | `BindCurrentFBO` legacy arm (record arm D:4528-4565 is client-free: applier record + `FindByHandle`) | slot, `GetBoundObject()`, `defaultFBO`, `Find`, weak-owner memo | ROW-O + LIVE + PROBE | draw | leg | `BoundFramebufferRecord` |
|
||||
| 74 | D:4720-4721, D:4734-4736 | `ForceBindCurrentFBO` | `GetFramebufferBindingSlotChecked(target).GetBoundObject()` + versions + `fbo.get()` — **unconditional on both arms**; memoises the frontend pointer at D:4736 | ROW-O + LIVE | every call (clear/blit/DSA) | both | `BoundFramebuffer` |
|
||||
| 75 | D:4630, D:4646-4647, D:4655 | `SyncAndBindFramebufferObject` | `defaultFBO` compare, `Find`/`GetOrCreate` mint, `SyncToBackend` | LIVE + PROBE/MINT | rare | both | `MGPFramebufferState` |
|
||||
| 76 | D:4700, D:4705 | `SyncAndBindFramebufferByHandle` | `StateForHandle(fbo)` returns the **recorded client FBO** (server-side weak note from #70); `SyncToBackend(stateObj, target)` walks it | LIVE | rare (named blit) | rec | handle itself is server |
|
||||
| 77 | D:8357-8359 | `BlitFramebuffer` named arm | `FramebufferImpl::pDefaultFramebufferInfo->defaultFBO` | LIVE | rare | rec | none |
|
||||
| 78 | D:8407-8410 | `BlitFramebuffer` bound arm | `GetFramebufferBindingSlot(Read/Draw).GetBoundObject()` ×2 — **both client FBOs, every bound blit** | ROW-O + LIVE | every bound blit | both | none (`MGPBlit` null-handle form carries no FBO identity) |
|
||||
| 79 | D:8210-8302 | `BlitLayeredDestinationAspects` | `GetDrawBuffers()`, `GetReadBuffer()`, `GetAttachment(...)`, `IsLayered/GetTextureLevel/GetTextureLayer`, `GetTexture()`, `GetFormat()/GetSamples()`, `GetTarget()` + `SyncTextureObjectToBackend` probe/mint | LIVE + PROBE/MINT | every blit | both | none (attachment detail not in `MGPBlit`) |
|
||||
| 80 | D:6284, D:6288-6291 | `Clear` | `GetFramebufferBindingSlot(Draw).GetBoundObject()` + `GetExternalIndex/GetObjectVersion/GetDrawBuffers()` — **debug-log only** | ROW-O + LIVE | dbg | both | — |
|
||||
| 81 | M:10054, M:10119, M:10121, M:10216, M:10283-10284 | `BackendFramebufferObject::SyncToBackend` | `stateFBOObject->GetExternalIndex/GetDrawBuffers/GetAttachment/GetAllAttachmentObjects/GetAllFramebufferAttachmentVersions` | LIVE | per FBO sync | both (entered from #71/#75/#76) | `MGPFramebufferState` |
|
||||
| 82 | M:9938, M:9872, M:9886 | `SyncReadBufferToBackend` | `GetReadBuffer()`, `GetExternalIndex()` | LIVE | per FBO sync | both | `MGPFramebufferState` |
|
||||
| 83 | M:9862, M:10101 | same / `SyncToBackend` | `HandleOf(stateFBOObject)` — monolith branch only | PROBE | per sync | leg | FBO handle |
|
||||
| 84 | D:4386-4399 | `SyncCurrentProgram` (FBO half) | `GetFramebufferBindingSlotChecked(Draw)`, `slot.GetBoundObject()/GetVersion()`, `drawFBO->GetObjectVersion()`, `drawFBO->GetDrawBuffers()` | ROW-O + LIVE | draw (memo-guarded at D:4390) | both | `BoundFramebufferRecord(Draw)` + `MGPFramebufferState.DrawBuffers` |
|
||||
|
||||
## Images
|
||||
|
||||
| # | site | function | what is read | kind | freq | arm | dup |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| 85 | D:2650-2653 | `SyncImageTextureBinding` | `GetImageTextureBinding(unit)` (client array), `binding.Texture`, `IsWritableImageBufferTexture` (`Texture->GetStorageType()`) | ROW-O + LIVE | memo/rare | both | `BoundShaderImages` window (AP:683-686) |
|
||||
| 86 | D:2660, D:2671 | same | `SyncTextureObjectToBackend(imageBinding.Texture, true)` probe/mint; `imageBinding.Texture.get()` identity via `HandleOf` D:2634 | PROBE/MINT + LIVE | memo | both | `MGPImageView` |
|
||||
| 87 | D:2672-2675 | same | legacy arm reads `imageBinding.Layered/Layer/Level/Format` (rec arm reads the `MGPImageView` record) | LIVE | memo | leg | `MGPImageView` |
|
||||
| 88 | D:2682, D:2723-2724, D:2736, D:2744 | same | `GetTarget()`, `GetFormat()`, `imageBinding.Access` | LIVE | memo | both | `MGPImageView` |
|
||||
| 89 | D:2767, D:2773-2774 | `MarkWritableImageBufferTexturesGpuWritten` | `GetImageTextureBinding(unit)`, downcast to `TextureObjectBuffer*`, `GetBufferBindingSlot().GetBoundObject()` | ROW-O + LIVE | every draw when writable image-buffer units exist | both | `BoundShaderImages` |
|
||||
| 90 | M:10849 | `BoundImageUnitFormat` (via `ImageUnitFormatsStillMatch`, D:4472) | `MGB_CTX->GetImageTextureBinding(unit).Format` | ROW-O | programs with format-less image units | both | `MGPImageView.Format` |
|
||||
|
||||
## Programs / shader state
|
||||
|
||||
| # | site | function | what is read | kind | freq | arm | dup |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| 91 | D:4781 | `PrepareForDraw` | `MGB_CTX->GetProgramForDraw()` — SharedPtr to client ProgramObject | ROW-O | draw | both | `DrawProgram` (AP:691) |
|
||||
| 92 | D:6126 | `PrepareForCompute` | `MGB_CTX->GetProgramForDispatch()` | ROW-O | every dispatch | both | `DispatchProgram` (AP:692) |
|
||||
| 93 | D:4339 | `SyncCurrentProgram` | `currentProgram->GetLinkStatus()/GetSpirvStatus()` | LIVE | draw | both | `ShaderCsos` record (AP:503) |
|
||||
| 94 | D:4415-4416 | `SyncCurrentProgram` | `g_backendProgramObjects.Find(currentProgram.get())` → `HandleOf` probe; `GetOrCreate(currentProgram)` mint | PROBE + MINT | draw | rec | `DrawProgram` handle |
|
||||
| 95 | D:4425-4429 | `SyncCurrentProgram` | `g_programTwinLookupMemo.Lookup(currentProgram)`; address-keyed `Find`/`GetOrCreate` mint | LIVE + MINT | draw | leg | `DrawProgram` |
|
||||
| 96 | D:4457-4459 | `SyncCurrentProgram` | `currentProgram->GetLinkVersion()/GetImageUnitVersion()` | LIVE | draw | both | `ShaderCso` serials |
|
||||
| 97 | D:4463-4464 → M:10821 | `SyncCurrentProgram` | `ComputeShaderStorageBlockBindingSignature(*currentProgram)` → `ProgramObject::GetShaderStorageBlockBindingOverrides()` | LIVE | draw (early-out on empty map) | both | none (overrides not pushed) |
|
||||
| 98 | D:4507 | `SyncCurrentProgram` | `twin->SyncToBackend(currentProgram)` — full client ProgramObject handoff | LIVE | memo | both | `CreateShaderState` record |
|
||||
| 99 | D:4242, D:4274-4313 | `ResolveGlobalConstantsRecord` | `HandleOf(program)` probe; `program->GetUBOSize()` compares | PROBE + LIVE | every draw with a default UBO | rec | `SetGlobalConstants` record (AP:3010) |
|
||||
| 100 | D:5257, D:5279-5282 | `BindCurrentTextures` | `programKey = currentProgram.get()`; `GetLifetimeId()`, `GetBackendStateVersion()`, `GetLinkStatus()` | LIVE | draw | both | `DrawProgram` |
|
||||
| 101 | D:5320, D:5333, D:5337 | `BindCurrentProgramWithResources` | `GetLinkStatus()/GetSpirvStatus()`, `currentProgram.get()`, `Find` probe | LIVE + PROBE | draw | both | `DrawProgram` |
|
||||
| 102 | D:5349, D:5372-5373 | same | `GetUBOSize()`, `GetUBOContentVersion()` | LIVE | every draw with UBO | both | `ShaderCso.Desc.GlobalUboSize` + `GlobalConstantsSerial` |
|
||||
| 103 | D:5380, D:5382, D:5425-5430 | same | `currentProgram->MapUBO()` — client shadow bytes (legacy fallback of the ring path); `GetUBOSize()` for upload | LIVE | ring-miss only | both | `GlobalConstants` bytes |
|
||||
| 104 | D:5463 | same | `currentProgram->GetUniformBlockBinding(i)` | LIVE | per UBO per draw | both | `ShaderCso.Desc` |
|
||||
| 105 | D:5522, D:5546 | same | `GetBackendStateVersion()`, `GetUniformSamplerOrImageUnitIndex(location)` | LIVE | memo | both | `ShaderCso` records |
|
||||
| 106 | D:1672, D:1701 | `SyncCurrentVertexAttributeValues` | `program->GetActiveAttributeLocationMask()`, `program->GetAttribType(location)` | LIVE | draw | both | none |
|
||||
| 107 | D:5679, D:5683-5692 | `GetCurrentBackendProgram` | `GetProgramForDraw()` + stash-miss `Find(currentProgram.get())` probe | ROW-O + PROBE | per indirect sub-draw | both | `DrawProgram` |
|
||||
| 108 | D:5733-5740 | `CurrentProgramMayNeedPerSubDrawBuiltins` | `currentProgram->GetLinkVersion()` | LIVE | per sub-draw query | both | `ShaderCso` serial |
|
||||
| 109 | D:6157, D:10023, D:6152, D:10022 | `GetBackendProgramId` / `ShaderStorageBlockBinding` | `GetProgramObject(...)`, `ValidateProgramName(...)` — frontend name-table probe | LIVE | API-driven, not per draw | both | none |
|
||||
| 110 | M:12954 | `BackendProgramObjectImpl::SyncToBackend` | `HandleOf(stateProgramObject)` | PROBE | per program sync/relink | rec | `ShaderCso` handle |
|
||||
|
||||
## Binding-point tables
|
||||
|
||||
| # | site | function | what is read | kind | freq | arm | dup |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| 111 | D:510-511 | `SyncBufferBindingPoints` | `GetBufferBindingPoint(target, i)` — raw pointer into the live GLContext array; `point.GetBoundObject()` SharedPtr to client BufferObject | ROW-O + LIVE | per touched SSBO per draw; per UBO+SSBO per dispatch | **both — no arm switch** | `MGPShaderBuffers` record (MT:910) |
|
||||
| 112 | D:517, D:524, D:526, D:529-530 | same | `EnsureBufferResource(obj)` probe; `point.GetRange()`; `obj->GetSize()` | PROBE + LIVE | per bound point | both | buffer handle + range in record |
|
||||
| 113 | D:602, D:605 | `MarkShaderStorageBuffersGpuWritten` | touched count; `GetBufferBindingPoint(ShaderStorage,i).GetBoundObject()` | ROW-V + ROW-O/LIVE | **every draw** | both | `MGPShaderBuffers` |
|
||||
| 114 | D:569-570, D:575, D:583, D:585, D:588-589 | `SyncTransformFeedbackBindingPoints` | TF binding point, `GetBoundObject()`, ensure probe, `GetRange()`, `GetSize()` | ROW-O + LIVE + PROBE | rare (capture span open) | both | none |
|
||||
| 115 | D:621, D:628, D:630, D:636, D:642-648, D:658-660 | `SyncAtomicCounterBuffers` | count; `GetBufferBindingPoint(AtomicCounter, ...)`, `GetBoundObject()`, ensure, `GetRange()`, `GetSize()`, `MarkBufferGpuWritten` | ROW-V/O + LIVE + PROBE | rare (programs with atomic counters) | both | none |
|
||||
| 116 | D:669, D:675 | `SyncBoundBuffer` | `GetBufferBindingSlot(target).GetBoundObject()`, ensure probe | ROW-O + LIVE + PROBE | monolith indirect paths | leg | `VerbIndirectBuffer`/`VerbDispatchIndirectBuffer` |
|
||||
| 117 | D:5464-5466 | `BindCurrentProgramWithResources` | `GetBufferBindingPoint(Uniform, binding)`, `GetBoundObject()`, `GetRange()` | ROW-O + LIVE | per UBO per draw | both | none (UBO bindings not pushed as records) |
|
||||
| 118 | D:5472-5479 | same | `GetBufferResource(bufferObj.get())`, `IsBufferDrawClean`, `EnsureBufferResource(bufferObj)` | LIVE + PROBE | per UBO (epoch-stamped) | both | buffer handle |
|
||||
|
||||
## XFB
|
||||
|
||||
| # | site | function | what is read | kind | freq | arm | dup |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| 119 | D:1387 | `StartPendingTransformFeedback` | `MGB_CTX->GetTransformFeedbackProgram()` | ROW-O | span start | both | none (`TransformFeedback*` context values are pushed, the program row is not) |
|
||||
| 120 | D:1405, D:1407-1415, D:1417 | same | `program->GetTransformFeedbackBufferCount()`, TF binding points, `GetBoundObject()`, ensure probe, `GetRange()`, `GetSize()`; pushes the client `SharedPtr<BufferObject>` into `xfb.targets` | LIVE + ROW-O + PROBE | span start | both | none |
|
||||
| 121 | D:1427, D:1434, D:1439, D:1463, D:1497 | same | `NeedsScatteredTransformFeedbackCapture()`, `GetTransformFeedbackStride/PackedStride/BufferMode()` | LIVE | span start | both | none |
|
||||
| 122 | D:1138, D:1295 | `ReadbackCapturedRanges` / `ScatterCapturedRecords` | `HandleOfBuffer(target.buffer.get())` | PROBE | span end | rec | buffer handle (carried in `xfb.targets`, but stored as SharedPtr) |
|
||||
| 123 | D:1174, D:1191, D:1310, D:1342 | same | `IsBackendPersistentMapped()`, `WritebackFromBackend(...)`, `MappedData()` | LIVE | span end | leg | none |
|
||||
| 124 | D:1247, D:1282, D:1312 | `ScatterCapturedRecords` | `program->GetTransformFeedbackPackedStride/Stride/Varyings()` | LIVE | span end | both | none |
|
||||
|
||||
## Misc
|
||||
|
||||
| # | site | function | what is read | kind | freq | arm | dup |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| 125 | PA:742-743 | `ServerVerbSink::OnResourceCopyRegion` | `gPipeInputs.GetTextureObject(SrcGlName/DstGlName)` — BARRIER_PULLED sticky-forward frontend name-table probe returning `SharedPtr<ITextureObject>` (`FieldOwnership.def:151`) | ROW-O | per `CopyImageSubData` | both | `MGPCopyRegion.Src/Dst` handles (MT:1302); the GL names are the declared P5b debt |
|
||||
| 126 | PA:591 | `OnDrawVbo` | `MGPipeHostBytes(*userIndices)` — SEG_STAGE bytes under split; client pointer under monolith | ROW-V (split: server bytes) | `kDrawHasUserIndices` arm only | both | record tail |
|
||||
| 127 | D:11761, D:11765, D:12192, D:12196, D:10232, D:11214, D:11451 | readback helpers (`ReadPixels`, `GetTexImage`, `StoreReadbackRowsToClient`, ...) | pack-PBO `GetBufferBindingSlot` + ensure | ROW-O + PROBE | readback paths | both | `MGPReadbackInfo` (MT:1388) |
|
||||
| 128 | MD:909, MD:930 | `MultiDrawImpl::DrawElementsBatch` | `BoundIndexBuffer()` (client EBO), `BoundIndexBufferId()` | LIVE | per multi-draw | both | `IndexBuffer` (AP:620) |
|
||||
|
||||
## (a) Scope construction sites
|
||||
|
||||
`MGPipeFrontendKeyedRegistryScope` (exempts `MGPipeSlots()` from the apply-thread `Fatal{RoleViolation}`, `MobileGL/MG_Impl/Pipe/SlotAllocator.cpp:29`). Production sites: D:1609 (`ResolveVaoTwin`, VAO twin resolve, every draw) · D:1734 (`SyncTextureObjectToBackend`) · D:2588 (`ResolveShaderImageRecord`, image-seam identity) · D:3303 (`SyncCurrentFBO`, legacy half) · D:4236 (`ResolveGlobalConstantsRecord`) · D:4329 (`SyncCurrentProgram`, whole function) · D:4585 (`BindCurrentFBO`) · D:4926 (`ResolveAndBindUnitTextures`) · D:4993 (`ResolveUnitSamplerBackend`) · D:5328 (`BindCurrentTextures`) · D:5689 (`GetCurrentBackendProgram`) · D:6166 (`GetBackendProgramId`) · D:6729 (`DrawArrays`) · D:6775 (`MultiDrawArrays`) · D:8837 (`ScopedDetachedTextureFramebufferAttachments`) · D:9161 / D:9216 (mipmap depth/color) · D:9695 (`SyncRenderbufferObjectToBackend`) · D:10029 (`ShaderStorageBlockBinding`) · D:11884 (`GetTexImage`) · M:256 (`OnFrontendStateObjectDestroyed`, NoSession arm only) · M:4544 (`HandleOfSamplerViewForTexture`) · M:5882 (`RequireImageBindableStorage`) · M:7087 (`SyncMipmapsToBackend`) · M:8481 (`ResolvePushedBuiltinSampler`) · M:8717 (`ResolvePushedTextureParams`) · M:9256 / M:9310 (`SyncAttachmentObject`, legacy arm) · M:9709 (`SyncAttachmentSurface` RBO cross-check) · M:10382 / M:10403 (debug-only verification block in `BackendFramebufferObject::SyncToBackend`) · M:12949 (`BackendProgramObjectImpl::SyncToBackend`) · M:13273 (`BackendSamplerObject::SyncToBackend`) · M:13570 (`BackendRenderbufferObject::SyncToBackend`). Tests: `MobileGL/MG_Test/Wire/RemoteClientTest.cpp:1883, :1903`.
|
||||
|
||||
`MGPipeReverseAnnouncementScope`: `MobileGL/MG_Impl/Pipe/ResourceTracker.h:723` (`MGPipeAnnounceBufferGpuWritten`) · M:2938 (`BufferImpl::HandleOfBuffer`) · test at `RemoteClientTest.cpp:1885`. Definitions: `MobileGL/MG_Impl/Pipe/SlotAllocator.h:199-233`.
|
||||
|
||||
## (b) Frontend objects/pointers held across records by the apply thread
|
||||
|
||||
| site | storage | what |
|
||||
|---|---|---|
|
||||
| D:67 | `g_rawDepthFetchSamplerState` | SharedPtr to a frontend `SamplerObject` created and retained by the backend for process life |
|
||||
| D:1027, D:1054 (in `g_xfbObjects` D:1064) | `XfbObjectState::targets[].buffer`, `scatterProgram` | SharedPtrs to frontend `BufferObject`/`ProgramObject` pinned across a capture span |
|
||||
| D:117-121; instances D:138, D:140, D:146 | `TwinLookupMemo` ×3 (VAO/program/FBO) | raw frontend key + `WeakPtr` owner (legacy arm) |
|
||||
| D:1847/1849, D:1926/1928 (in `g_observedUnitBindings` D:1959) | `UnitBindingsSnapshot::legacySlotObjects`/`legacySamplerObject` | WeakPtrs to frontend textures/samplers |
|
||||
| D:2127-2131 (in `g_unitTextureSyncList` D:2140) | `UnitTextureSyncEntry` | borrowed pointer into a frontend binding slot + raw `ITextureObject*` |
|
||||
| D:2151-2152, D:2235-2236 | `g_fboTextureSyncList`, `g_readFboTextureSyncList` + raw `FramebufferObject*` keys | draw/read FBO attachment sync lists |
|
||||
| D:4097-4098 | `g_currentDrawFrontendProgram`/`g_currentDrawBackendProgram` | per-draw program/twin stash |
|
||||
| D:4107 | `g_broadcastMemoFbo` | raw `const FramebufferObject*` memo key |
|
||||
| D:4978-4985 | `g_unitSamplerLookupMemos` | per-unit `WeakPtr` frontend sampler + handle key |
|
||||
| D:5220-5235 | `g_resolvedTextureBindingMemos` | frontend `ProgramObject` as `const void*` key + bound-texture copies |
|
||||
| D:5588-5592 | `rawDepthSamplerObject` | pointer into frontend `TextureUnit` storage (transient per sampler pass) |
|
||||
| `Managers.h:1223/1254/1278` | `BackendVertexArrayObject::ResolvedDrawBuffers::Entry::frontend`, `iboFrontend` | raw client `BufferObject*` per-VAO memo |
|
||||
| `Managers.h:1378` | `BackendVertexArrayObject::m_syncedIndexBufferObject` | raw `BufferObject*` |
|
||||
| `Managers.h:2054` / M:10453 | `g_fboSyncedObjects[2]` | raw `FramebufferObject*` per target (compare-only) |
|
||||
| `Managers.h:320-324`; registries at 1423/1818/1943/2540/2678/2819 | legacy `StateBackendObjectRegistry::m_entries` | raw frontend address key + `StateWeakPtr` |
|
||||
| ST:156-167, ST:362-378 | `BackendSlotTable::Entry::stateRef`; `NoteStateForHandle`/`StateForHandle` | per-handle frontend `WeakPtr`/SharedPtr note |
|
||||
| PI:807, PI:812-814 | `m_boundVertexArray`, `m_programForDispatch`, `m_programForDraw`, `m_transformFeedbackProgram` | SharedPtrs to frontend objects inside `gPipeInputs` (BARRIER_PULLED rows) |
|
||||
| PI:808-811, PI:815 | `m_bufferBindingSlot[15]`, `m_bufferBindingPointBase[15]`, `m_framebufferBindingSlot[2]`, `m_imageTextureBindingBase`, `m_textureUnitBase` | raw pointers into frontend tables inside `gPipeInputs` |
|
||||
|
||||
## (c) `MGB_CTX->` accessors used from `MG_Backend/DirectGLES` whose `FieldOwnership.def` row is BARRIER_PULLED
|
||||
|
||||
Under `MOBILEGL_PIPE_PUSH`, `MGB_CTX` = `&gPipeInputs` (`MobileGL/MG_Pipe/PipeInputsSwitch.h:17-27`); BARRIER_PULLED object rows dereference the live GLContext through the pointer bases at PI:807-815.
|
||||
|
||||
| accessor | call sites |
|
||||
|---|---|
|
||||
| `GetFramebufferBindingSlot` / `GetFramebufferBindingSlotChecked` | D:182, D:197, D:6284, D:8408-8409; M:9397, M:9775 |
|
||||
| `GetBufferBindingSlot` | D:401, D:669, D:962, D:6852, D:6930-6931, D:7009, D:7082-7083, D:7263, D:7312, D:10232, D:11214, D:11451, D:11761, D:12192; `Utils.cpp:2353`; MD:88 |
|
||||
| `GetBufferBindingPoint` | D:510, D:569, D:605, D:628, D:1407, D:5464 |
|
||||
| `GetBufferBindingPointCount` | D:621 |
|
||||
| `GetBoundVertexArray` | D:1669, D:4770, D:6449, D:6724, D:6768; MD:96 |
|
||||
| `GetTextureUnitObject` | D:1871, D:1899, D:1934, D:1947, D:2374, D:4861, D:5157, D:5562, D:8472, D:9302, D:9416, D:9564, D:11874 |
|
||||
| `GetImageTextureBinding` | D:2650, D:2767; M:10849 |
|
||||
| `GetProgramForDraw` | D:4781, D:5308, D:5679, D:5734 |
|
||||
| `GetProgramForDispatch` | D:6126 |
|
||||
| `GetTransformFeedbackProgram` | D:1387 |
|
||||
| `GetProgramObject` / `ValidateProgramName` | D:6157, D:10023 / D:6152, D:10022 |
|
||||
| `RecordError` | D:8804; M:13668 |
|
||||
|
||||
(`GetTouchedBufferBindingPointCount`, `GetActiveTextureUnit`, `GetCurrentVertexAttribute`, `GetPrimitiveRestartIndex`, `GetRenderStateParameters*`, `GetViewport`, `IsCapabilityEnabled`, `IsTransformFeedbackActive/Paused`, `GetPatch*`, `GetTransformFeedbackCapturedVertices`, `GetMaxTouchedTextureUnit` are RECORD-SUPPLIED; `GetTextureContextId`/`GetTextureBindGeneration`/`GetSamplingResolutionGeneration`/`GetPixelStoreParameters(false)` are APPLIER_DERIVED — server-owned, not listed.)
|
||||
|
||||
## What would have to change for the apply thread to read only server-owned memory
|
||||
|
||||
**VAO/vertex.** The bound-VAO row (`GetBoundVertexArray`) must become a handle read of `BoundVertexElements` plus the `VertexElementsCso` record; `GetConfigVersion()` compares must be replaced by the applier's own `VertexBuffersSerial`/`IndexBufferSerial`/`ContentSerial`. The `DrawArrays`/`MultiDrawArrays` entry-path probe (#12/#13) and `SyncClientSideAttributesForDrawArrays` (#14) have no pushed equivalent for client-side arrays — those draws would need the client-array bytes staged with the record or the path refused under split. The legacy memo/registry arm (#4, #7, #8) dies with the legacy arm.
|
||||
|
||||
**Buffers.** Every `HandleOfBuffer` probe on the hot path (#17, #25, #27, #30) is redundant with handles already present in `IndexBuffer`, the `VertexBuffers` window, and the shader-buffer records; the sync lists must key on handles and drop the stored raw frontend pointers. `GetBufferResource`/`GetBackendResource` (#32) needs a handle-keyed twin lookup. The reverse announcement `MarkBufferGpuWritten` (#30/#31) must consume the record-side handle instead of probing the client allocator per SSBO per draw.
|
||||
|
||||
**Textures/samplers.** The memoised sync lists must stop borrowing pointers into client binding slots (#38); the unit windows already exist as `BoundSamplerViews`/`BoundSamplerStates` records, so the per-draw key check, the rebuild walk (#35-#40), and `ResolveAndBindUnitTextures` (#50-#53) can all run on handle arrays. Frontend-keyed `Find`/`GetOrCreate` (#47-#48, #55, #66) becomes `FindByHandle`/`GetOrCreateByHandle`. `GenerateMipmap`'s unit/slot resolution (#59) must take the texture from `VerbMipRes` only; the CPU-mip shadow path (#61) and the unkeyed all-twin detach sweep (#63) need staged shadow bytes and a handle-keyed affected-FBO list respectively.
|
||||
|
||||
**Framebuffers/attachments.** The record arm of `SyncCurrentFBO` must stop validating the pushed record against the live binding slot (#68) — the record's own `Gen`/serial is the truth; the slot read at #69, the `NoteStateForHandle` SharedPtr stash (#70), and the `SyncToBackend(currentFBO)` walk (#71, #81, #82) must be replaced by applying `MGPFramebufferState` directly. `ForceBindCurrentFBO` (#74) needs a handle-keyed force-bind. The bound-form blit (#78, #79) must carry FBO handles and attachment descriptors in `MGPBlit` (or a companion record), since today nothing pushed identifies the two framebuffers or their attachments.
|
||||
|
||||
**Images.** `GetImageTextureBinding` rows (#85-#90) are already duplicated by the `BoundShaderImages` window (`MGPImageView` records); the apply path needs to read the window + serial and drop the live binding read, the `binding.Texture` dereference, and the `HandleOf` identity check, including the format-less-image `BoundImageUnitFormat` lookup.
|
||||
|
||||
**Programs/shader state.** The program rows (#91, #92) become `DrawProgram`/`DispatchProgram` handle reads; twin identity resolves by handle, eliminating #94/#95. Version checks (#96, #102, #108) map to `ShaderCso` serials; the per-draw `GetShaderStorageBlockBindingOverrides` signature (#97) and the attribute mask/type reads (#106) need to be baked into the `ShaderCso` record at create/relink time. `MapUBO` fallback bytes (#103) already have the `GlobalConstants` record as the pushed arm. The name-table probes (#109) are API-driven and can stay latency-bound or be handle-translated at emit.
|
||||
|
||||
**Binding-point tables.** This family has no transport branch at all: `SyncBufferBindingPoints`, `MarkShaderStorageBuffersGpuWritten`, `SyncAtomicCounterBuffers`, and the per-UBO loop read the live GLContext arrays on every draw/dispatch (#111-#118). The SSBO side is partly covered by `MGPShaderBuffers`; UBO and atomic-counter bindings need equivalent pushed windows (handle + range per index) so the loops iterate applier state, and `EnsureBufferResource` becomes handle-keyed throughout.
|
||||
|
||||
**XFB.** Capture setup (#119-#121) reads the TF program row and TF binding points live; the record arm needs the TF program handle and the captured-target list pushed at `BindStreamOutput`/begin, with `xfb.targets` storing handles instead of client SharedPtrs. The span-end readback probes (#122) then resolve by handle; the legacy writeback arm (#123) is monolith-only and unaffected.
|
||||
|
||||
**Misc.** `OnResourceCopyRegion`'s sticky-forward name-table probe (#125) must resolve `MGPCopyRegion.Src/Dst` handles instead of the GL names. Readback pack-PBO reads (#127) need the pack buffer handle in `MGPReadbackInfo`-class records. The multi-draw EBO reads (#128) fold into the `IndexBuffer` handle. The two deliberate leaks (`gPipeInputs`, PI:818-835; `MGPipeSlots()`, `SlotAllocator.cpp:370-381`) and every frontend-pointer memo in list (b) must be retired or converted to handle keys before the R-1 barrier can be removed.
|
||||
@@ -0,0 +1,192 @@
|
||||
# c0e — the contract and the wire (P5e). Report v1
|
||||
|
||||
Branch `p5e/c0e`, head `a513c53ee3b9fa1497312b8eddb499995e94d16f` (base `2fde7034`), six commits,
|
||||
35 files, +2276/−195. Everything is INERT: the caps bit is not published, opcode 80 has no route,
|
||||
bit 13 is not in `kMGPipeWiredSubsystems`, and every new applier entry point and by-handle backend
|
||||
signature aborts by name. `build` / `unit` / `isplit` / `gens` green; `strict` is the phase's
|
||||
expected-red baseline, recorded below.
|
||||
|
||||
## Gate
|
||||
|
||||
| step | result |
|
||||
|---|---|
|
||||
| `build` | rc 0 (341 TUs on the first full pass) |
|
||||
| `unit` | **2205/2205** (`tcache_count=0`; 2203 at base + the two names below) |
|
||||
| `isplit` | **111/111** |
|
||||
| `gens` | `gen_pipe --check` up to date; `gen_pipe --self-test` **12** controls (9 at base); `gen_pipe_field_ownership --check` up to date, `--self-test` 15 controls; include-closure 4 probes / 0 problems; dirty-surface `--check` rc 0, `--self-test` 27 controls; doc citations **3 problems at HEAD vs 4 at base** — all three are pre-existing `CONTRACT-P5.md` rows, c0e adds none and incidentally retires one |
|
||||
| `strict` | 108 failed / 2 skipped / 1 passed out of 111 — **unchanged in shape**: `.github/workflows/test.yml:1199-1206` gates this lane on the run FAILING, and the one pass is `SplitLogPaths.PrivateAndDistinct`, which draws nothing |
|
||||
|
||||
### The strict baseline the later packages must shrink
|
||||
|
||||
From the 88 private logs under `build-split/MobileGL/MG_IntegrationTest/split-logs/`; 86 carry
|
||||
`BARRIER-PULLED, MOBILEGL_IPC_STRICT_ERRORS=1`. Each scenario aborts at its FIRST pulled row, so
|
||||
this is the first-blocker census and not the full pull set.
|
||||
|
||||
```
|
||||
39 Fatal{UnmigratedPipeInput, "GetFramebufferBindingSlot@Clear"} -> fb
|
||||
14 Fatal{UnmigratedPipeInput, "GetBoundVertexArray@DrawArrays"} -> vi
|
||||
13 Fatal{UnmigratedPipeInput, "GetImageTextureBinding@BindImageTexture"} -> fb
|
||||
9 Fatal{UnmigratedPipeInput, "GetTextureUnitObject@Clear"} -> tx2
|
||||
6 Fatal{UnmigratedPipeInput, "GetTextureObject@CopyImageSubData"} -> sticky, P7 (stays)
|
||||
3 Fatal{UnmigratedPipeInput, "GetProgramForDispatch@DispatchCompute"} -> pg
|
||||
2 Fatal{UnmigratedPipeInput, "ValidateProgramName@ShaderStorageBlockBinding"} -> §7 allowlist
|
||||
```
|
||||
|
||||
## What changed, per file
|
||||
|
||||
**`MG_Pipe/MGPipeTypes.h`** (+144) — `kCapRunAheadApply` (bit 10) and the pure arm
|
||||
`MGPipeRunAheadCapBitsFor(BackendType, Bool ready)`; `kMGPipeMaxBufferBindingPoints` (84);
|
||||
`kMGPipeShaderBufferClass{Uniform,ShaderStorage,AtomicCounter,Count}`; `MGPProgramBindings` (32 B)
|
||||
+ `MGPProgramSamplerUnit` (8 B) + `MGPProgramStorageOverride` (40 B) + the three declared bounds;
|
||||
`MGPProgramDesc::LinkStatus`; `kDrawClientArrays` (bit 6).
|
||||
|
||||
**`MG_Pipe/MGPipeValueTypes.h`** (+49) — `MGPipeImageAccess` and the three constants, with
|
||||
`MGPipeDecodeImageAccess` / `MGPipeImageAccessIsValid` / `…Reads` / `…Writes`. Pure: the
|
||||
include-closure probe stays 0 problems.
|
||||
|
||||
**`MG_Impl/Pipe/ImageEmit.h`** — `MGPipeEncodeImageAccess` MOVED out of the emitter's private
|
||||
section into a free function that names the shared enumerators. Not duplicated: the literals are
|
||||
gone.
|
||||
|
||||
**`MG_Pipe/MGPipe.h`** — `enum MGPipeWaitClass`; `kMGPipeSubsystemBufferBindings` (bit 13);
|
||||
`kMGPipeSubsystemsMigratedAtP5e` = `0x3fff` with its drift assert.
|
||||
|
||||
**`MG_Pipe/PipeCalls.def`** (+220/−…) — the fifth column on all 79 rows plus
|
||||
`SetProgramBindings` appended as opcode 80 (`kCtxState`, `kVarTail|kHostSpan`, `kWaitNone`), count
|
||||
79 → 80, `kCtxState` 18 → 19.
|
||||
|
||||
**`scripts/gen_pipe.py`** (+127) — the 5-arg `CALL_RE`, `parse_wait_classes()` read out of
|
||||
`MGPipe.h`, `check_wait_classes_are_known()` (unknown token; `kReplySlot`↔`kWaitReply` BOTH ways),
|
||||
`kMGPipeWaitClasses[]` + `MGPipeWaitClassFor(op)` + five spot static_asserts in `PipeWire.inc`,
|
||||
three new `--self-test` controls.
|
||||
|
||||
**`MG_Remote/Wire/PipeWireCodec.{h,cpp}`** (+112) — `WireRecordLayout` grows to
|
||||
`kMaxWireRecordTails = 3`; the `SetProgramBindings` layout arm (three counts refused against their
|
||||
bounds, three tails always declared, each 8-aligned); the decode arm that validates and DECLINES,
|
||||
walking the third tail's name spans through `CheckHostSpanIsHonest` itself — they are members of a
|
||||
40-byte element, so the encoder's blanket second-tail pass would read one span and a quarter of
|
||||
garbage. The tail cross-check's Fatal line now prints all three tail sizes.
|
||||
|
||||
**`MG_Pipe/PipeApply.{h,cpp}`** (+244) — `MGPipeBarriered(op, payload, st)` **implemented** (all
|
||||
three clauses); `MGPipeApplierCurrentRecordIsBarriered()` + its writer, **implemented**, default
|
||||
`true`; `MGPipeApplySetShaderBuffers` / `MGPipeApplySetProgramBindings` declared and aborting; the
|
||||
sb applier window (`BoundShaderBuffers[3][84]`, `ShaderBufferStart/Count/WritableMask[3]`,
|
||||
`ShaderBuffersSerial`), the pg record tails (`BlockBindings`, `SamplerUnits`, `StorageOverrides`,
|
||||
`Signature`, `BindingsSerial`) and `MGPipeProgramStorageOverride`; `MGPipeApplierState::
|
||||
IsTransformFeedbackActive`, mirrored by `MGPipeApplySetContextValues`. `PipeApply.h` now includes
|
||||
`MGPipe.h` (sibling layer; the closure gate is unchanged).
|
||||
|
||||
**`MG_Backend/DirectGLES/Managers.{h,cpp}`** (+120) — eight by-handle seams declared, bodies in
|
||||
ONE block at the end of `Managers.cpp` calling `MGPipeP5eSeamNotLanded(name, owner, handle)`:
|
||||
`VertexArrayImpl::ResolveVaoTwin`, `TextureImpl::{SyncTextureToBackendByHandle, ResolveTextureTwin}`,
|
||||
`BackendTextureObject::SyncMipmapsToBackendByHandle`,
|
||||
`BackendFramebufferObject::SyncToBackendByHandle`,
|
||||
`BackendRenderbufferObject::SyncToBackendByHandle`, `PrgramImpl::ResolveProgramTwin`,
|
||||
`BackendProgramObjectImpl::SyncToBackendByHandle`.
|
||||
|
||||
**`MG_Impl/Pipe/{Tracker.h, SetHashSuppressor.h, PipeFill.cpp}`** — bits 15/16/17 → subsystem 13
|
||||
and `kMGPipeDirtyEmittedAtP5e`; the three `SetShaderBuffers*` suppressor slots and
|
||||
`SetProgramBindings`; `SubsystemForEmitter`'s and `EmittedCallSuppliesTheWholeField`'s new arms,
|
||||
three pairing asserts, and the `kMGPipeMaxBufferBindingPoints == BufferBindingPointCount` pin.
|
||||
|
||||
**`MG_Pipe/{Coverage.def, FieldOwnership.def, PipeFields.def}`** — the shape-only
|
||||
`GetBufferBindingPoint → SetShaderBuffers` emitted row; the seven object-class rows re-annotated to
|
||||
`"P5e (Espryt unbarriered), P7 (Magma)"`; `F(LinkStatus)` and the three new verify payloads (82).
|
||||
|
||||
**`Config.h` / `ConfigLoader.cpp` / `MG_Backend/Init.cpp`** — `RunAhead`, `PresentCredit`, the log
|
||||
line, the `PipeVerify` force, the push default `0x3fff`, `kMGPipeP5eRunAheadReady = false` and the
|
||||
caps arm.
|
||||
|
||||
**Tests** — `PipeCatalogueTest` (macro arity, the sizes, opcode 80, the null-route pins, the draw
|
||||
flag, and the new wait-class case); `MagmaPipeIdentityTest` (new case + its pull-build skip twin);
|
||||
`TrackerTest`; `FieldOwnershipTest`'s strict string. **Docs** — the P5E contract, the ROADMAP row,
|
||||
`CURRENT_STAGE_PROGRESS` §1 and §6.
|
||||
|
||||
## Red-once evidence (verbatim)
|
||||
|
||||
1. **Flip one row's `WaitClass`, do not regenerate** (`GenerateMipmap` `kWaitApplied`→`kWaitNone`):
|
||||
`gen_pipe: OUT OF DATE: MobileGL/MG_Pipe/generated/PipeWire.inc`, rc 1. Reverted → `gen_pipe:
|
||||
generated files are up to date`.
|
||||
2. **The same flip, regenerated** (the stronger half — this is what the contract-vs-def case buys):
|
||||
`PipeCatalogue.EveryRowCarriesTheWaitClassTheContractGivesIt ***Failed`,
|
||||
`PipeCatalogueTest.cpp:747: Failure … Expected equality of these values: MGPipeWaitClassFor(op)
|
||||
… kWaitApplied … GenerateMipmap`. Reverted → 34/34.
|
||||
3. **`sizeof(MGPProgramBindings)` 32 → 40** (a `Uint64 Pad1` plus the matching `MGP_ASSERT_POD`):
|
||||
`PipeCatalogue.LateArrivalsAreAppendedWithoutRenumbering ***Failed`, `Expected equality of these
|
||||
values: sizeof(MGPProgramBindings) Which is: 40 / 32u Which is: 32`. Reverted → 34/34.
|
||||
4. **Publish bit 10 on the Magma arm** (`MGPipeRunAheadCapBitsFor` stops testing the backend type):
|
||||
`MagmaPipeIdentityTest.AMagmaServerNeverPublishesTheRunAheadCapBit ***Failed`,
|
||||
`MagmaPipeIdentityTest.cpp:241: Failure … MG_Pipe::MGPipeRunAheadCapBitsFor(BackendType::
|
||||
DirectVulkan, true) & kCapRunAheadApply Which is: 1024 / 0u Which is: 0`. Reverted → 5/5.
|
||||
|
||||
## G1 / G2 / G14
|
||||
|
||||
- **G2/G14, new ctest names (both added, none removed):**
|
||||
`PipeCatalogue.EveryRowCarriesTheWaitClassTheContractGivesIt` (compiles in both flavours) and
|
||||
`MagmaPipeIdentityTest.AMagmaServerNeverPublishesTheRunAheadCapBit` (in
|
||||
`MGL_MAGMA_PIPE_IDENTITY_TEST_LIST`, so the pull build declares its skip twin).
|
||||
- **G1: NOT MEASURED HERE** — no pull-build baseline `.so` exists on this machine and the gate
|
||||
wrapper has no pull flavour. The deltas to shared code, named:
|
||||
(a) `MGPipeScreen`/`MGPipeContext` each gain one function-pointer member and the three generated
|
||||
per-opcode arrays each gain one entry — **the identical delta P5b (five opcodes) and P5c (three)
|
||||
made, both of which measured 0/0/0/0**;
|
||||
(b) `MGPProgramDesc` 192 → 200 bytes — the payload is instantiated only under
|
||||
`MOBILEGL_PIPE_PUSH` (`PipeApply.cpp`, `PipeRoute.cpp`, `MG_Impl/Pipe/ProgramEmit.h` and the
|
||||
codec are all push-only sources), so the pull build holds none;
|
||||
(c) `MGPipeValueTypes.h` gains four `constexpr` functions and an enum — no symbol unless
|
||||
odr-used, and the pull build uses none of them;
|
||||
(d) `Config.h`'s `IpcTable` grows two `Uint32` — `IpcTable` is inside
|
||||
`#if MOBILEGL_BUILD_DISAGGREGATED`, so the pull build does not compile it at all.
|
||||
The integrator should run the real G1 pair at landing.
|
||||
|
||||
## Rows of my "family" (the contract), against `kimi-audit.md`
|
||||
|
||||
c0e retires no apply-thread read: it is the inert contract commit. What it DID do for the audit's
|
||||
benefit is give every row a place to be retired INTO — the wait class that decides whether a row's
|
||||
apply may read client memory at all, and the eight by-handle signatures the five per-draw families
|
||||
replace bodies in. The audit's rows stay exactly where they are; the strict census above is the
|
||||
first-blocker half of that list as measured at this head.
|
||||
|
||||
## Rulings I need from the integrator
|
||||
|
||||
1. **`MGPShaderBuffers::WritableMask` is a `Uint32` and the window is 84.** The mask can describe
|
||||
only the first 32 binding points of a class. The contract now records this (§5.6) and hands sb
|
||||
the choice — narrow the window, widen the field, or declare the bound — but it is a WIRE field,
|
||||
so it is not sb's to pick. This was not caught in the brief or in S5.
|
||||
2. **`MGPProgramDesc` grew 192 → 200.** The draft's "in the descriptor's existing pad, size
|
||||
unchanged" is arithmetically impossible: the fixed head is exactly full at 24 bytes and
|
||||
`MGPBlobRef` is 8-aligned. I landed the honest version and argued it in the contract and in the
|
||||
header. If the integrator would rather pay a bit in `StageMask` or shrink
|
||||
`ReservedNumSamplesOffset`, that is a different record and a different commit.
|
||||
3. **Consumer bit 13 in `Init.cpp`'s `ConsumedSubsystemsFor`.** I did NOT add it: withholding a
|
||||
consumer bit is the safe direction (the file says so itself), no emitter exists yet, and
|
||||
`Init.cpp`'s consumer mask is not in c0e's brief scope. sb must add it in the same commit that
|
||||
gives `ShaderBufferEmit.h` its wired constant, or the client's R-8 gate will withhold the whole
|
||||
family. Flagged so it is not discovered at the merge.
|
||||
|
||||
## Seams I assumed
|
||||
|
||||
- `MGPipeApplySetProgramBindings` takes the three tails PLUS a `const char* const*` of RESOLVED
|
||||
override names, because the names ride SEG_STAGE and SEG_STAGE retires with the record (rule C).
|
||||
pg must copy them into the record before the call returns. If pg wants the spans instead, the
|
||||
signature is mine to change — ask.
|
||||
- `MGPipeBarriered`'s `payload` may be null and clause 3 then falls through. ra's emit-side caller
|
||||
must pass the real `MGPDrawInfo` it is about to publish.
|
||||
- `MGPipeApplierCurrentRecordIsBarriered()` is `thread_local` and defaults `true`. id sets it from
|
||||
`MGPipeBarriered` at the top of `ApplyOne`; nothing clears it, because every dispatch sets it.
|
||||
|
||||
## What I did not do
|
||||
|
||||
- **G1 measurement** (above) and the strict lane's *comparison against a base run* — the lane is
|
||||
expected-red by CI design at this head, so what I recorded is the marker census, not a diff. No
|
||||
base build exists on this machine.
|
||||
- **`MOBILEGL_IPC_RUN_AHEAD` / `PRESENT_CREDIT` have no reader yet.** They parse, they log, they
|
||||
are forced by `PipeVerify`. `ClientSession` is ra's file and c0e does not touch it.
|
||||
- **`ARCHITECTURE.md` §11/§14/§17 and `README.md`'s knob table** still describe the lockstep and
|
||||
list neither knob. The brief gives `ARCHITECTURE.md` to ra; `README.md` is nobody's — the
|
||||
integrator should hand it to ra with the rest.
|
||||
- **`.github/workflows/test.yml`'s strict step** is untouched (ra's, per BRIEF §2).
|
||||
- **`MG_Test/Wire/ServerLoopTest.cpp`'s bit-10 pin.** BRIEF §6 names it beside
|
||||
`MagmaPipeIdentityTest`; the unit case I added covers the arm as a pure function, which is the
|
||||
half a unit lane can reach. A `ServerLoopTest` pin over a real `CallMask` belongs with ra's
|
||||
session work.
|
||||
@@ -0,0 +1,60 @@
|
||||
# P5e 设备验证(头 `3cc4e1ec`,Redmi `2f7cbe2e`)
|
||||
|
||||
**结论:PASS。两条传输臂都能正常跑游戏。** 上一轮设备验证发现的 monolith 启动即崩已修复并回归。
|
||||
|
||||
## 1. 被测物
|
||||
|
||||
- MobileGL `feat/disaggregated @ 3cc4e1ec`(= wave2 `44f91c74` + fix1 `66621767` + ID-110)
|
||||
- FCL fordebug,`./gradlew :FCL:assembleFordebug -Pmobilegl.buildDisaggregated=ON -Pmobilegl.buildDisaggregatedInproc=ON -Pmobilegl.pipePush=ON`,BUILD SUCCESSFUL
|
||||
- Minecraft 26.3-rc-3,世界 `test`,VD12,DirectGLES
|
||||
- **版本身份以符号探针确认**,不看游戏内 `GIT@` 戳记(增量构建下它是旧的):APK 的
|
||||
`lib/arm64-v8a/libMobileGL.so` 内含 `texture-handle-arm`、
|
||||
`was handed a NULL frontend texture for handle`、`the storage sync needs the frontend`、
|
||||
`refusing to attach a renderbuffer with no storage` 四个 fix1 新增字符串。
|
||||
|
||||
## 2. 三臂结果(进世界后 60 s 采样)
|
||||
|
||||
| 臂 | 进世界 | fps | draws/帧 | 进程 | Fatal / crash buffer | 截图 |
|
||||
|---|---|---|---|---|---|---|
|
||||
| monolith | 31 s | **263.5** | 845 | 存活 | 无 | 世界正常(夜间地形、树、热键栏) |
|
||||
| inproc | 31 s | **136.1** | 853 | 存活 | 无 | 同一视角同一世界 |
|
||||
| inproc 复跑 | 32 s | **140.3** | 852 | 存活 | 无 | 同上 |
|
||||
|
||||
对照:修复前(`44f91c74`)同一臂 monolith 是 **65 s 后进程消失**,SIGSEGV 于
|
||||
`Lightmap.<init>` → `clearColorTexture` → `glClear` → … → `SyncMipmapsToBackend(空 SharedPtr)`。
|
||||
|
||||
两点说明:
|
||||
|
||||
- monolith 这一次**未被 120 Hz vsync 封顶**(与 P5d 记录的 205.8 那次同类),所以 263.5 与
|
||||
inproc 的 136-140 **不可直接比大小**。本轮问的是"改完还能不能正常跑",不是配对性能。
|
||||
- inproc 的 136-140 与修复前记录的 140.0 / 144.9 同档。fix1 改的那行(臂选择本身)两臂都读,
|
||||
split 臂没有被拖慢。
|
||||
|
||||
## 3. 主机门(WSL `~/w7/p5e-int`,split flavour)
|
||||
|
||||
| 门 | `44f91c74` | `3cc4e1ec` |
|
||||
|---|---|---|
|
||||
| build | rc=0 | rc=0 |
|
||||
| unit | 2250/2250 | **2250/2250** |
|
||||
| `integration-split` | 113/113 | **116/116** |
|
||||
| `integration-gpu`(两条运行时臂) | **1157/1294**(137 SEGFAULT / 38 scenario) | **1294/1294** |
|
||||
| `integration-split-strict` | 7/116 | 7/116(预期红,逐数相同) |
|
||||
| 生成器 / include 闭包 / dirty-surface / doc 引用 | 绿 | 绿(只余 `CONTRACT-P5.md:524` 既有歧义行) |
|
||||
|
||||
## 4. 两条裁定
|
||||
|
||||
- **ID-109**:fix1 给 monolith lane 挂 `integration-split` 标签的读法**接受**(该标签指"门禁要跑
|
||||
的集合",不是"跑 inproc")。并把 `integration-gpu` 升为**集成分支的常设门禁步骤**
|
||||
(`p5e_gate.sh gpu`)。漏的不是某个用例,是整条运行时臂。
|
||||
- **ID-110**:fix1 报告 §3.5 留的那处"靠链条安全"的座(`texBufferByRecord`)改为自述式传输
|
||||
测试。新增 `MGB_TEXTURE_RECORD_ARM_SELECTED()` 把"记录臂被选中"只说一次。有传输时该合取项
|
||||
已被 `pushedStorage != nullptr` 蕴含,行为不变。
|
||||
|
||||
## 5. 阶段状态
|
||||
|
||||
P5e **未收官**:`kMGPipeP5eRunAheadReady` 与 `kMGPipeP5eClientWaitRuleLanded` 仍为 `false`。
|
||||
翻转它们的门是 BRIEF-P5E §3(strict 车道转硬绿,只余 §7 白名单 —— 当前 7/116,是本阶段剩下的
|
||||
主要工作)与 §4(设备出口:fps ≥ lockstep、client 线程 CPU ms/帧 < lockstep、SSIM 不变、
|
||||
逐 op 等待清单无 `kWaitApplied` 行与逐 draw reply 行)。
|
||||
|
||||
已推送 `origin/feat/disaggregated @ 7c6f6886`(含本轮文档写回)。
|
||||
@@ -0,0 +1,215 @@
|
||||
# P5e package `fb` — framebuffers, attachments, images, blit (report v1)
|
||||
|
||||
Branch `p5e/fb`, head **`ca1beb69`**, base `f6cfcbd3`. Tree `~/w7/p5e-fb`. Six commits; the fourth
|
||||
(`f4675d1a`) is a SCAFFOLD that the sixth (`ca1beb69`) reverts — see §5.
|
||||
|
||||
## 1 What changed, per file (ranges at the NEW head)
|
||||
|
||||
**`DirectGLES.cpp`** — `:242-264` the doors (`RefuseFramebufferBindingSlotRead`,
|
||||
`FramebufferRecordArmIsMandatory` = `Transport != Monolith && FramebufferSubsystemEnabled()`,
|
||||
ruling 1 / §5.8, which selects every arm below). `:2171-2272` the list keys: a new
|
||||
`FboAttachmentSyncEntry {Res, backend}`, six statics, `SyncRecordAttachmentTextures` — **I did NOT
|
||||
touch `UnitTextureSyncEntry`**; tx2 owns its re-shape, the attachment lists borrow nothing, and a
|
||||
type of their own avoids the collision. `:2344-2412` `SyncFramebufferAttachmentTexturesByRecord`
|
||||
(the core), selected at `:2573`. `:2726-2968` images: `ResolveShaderImageRecord` and
|
||||
`g_imageRecordSeamIsAuthoritative` DELETED; `IssueImageTextureBind`, `GLAccessForImageView`,
|
||||
`IsWritableImageBufferView`, `SyncImageTextureBinding(const MGPImageView&)`,
|
||||
`NoteImageUnitBoundWithoutReadingTheFrontend`. `:2976` the GPU-write marks. `:3055-3180` the sweep
|
||||
walk and its gate. `:3290` `FramebufferRecordMatchesBinding` monolith-only. `:3428-3543`
|
||||
`SyncCurrentFBOByRecord`'s loop; `:3571` / `:4781` the two declines; `:4920`
|
||||
`SyncAndBindFramebufferByHandle`; `:4956` `ForceBindCurrentFBO`; `:6570` `Clear`'s debug
|
||||
diagnostic. `:8609-8806` the record blit overload + `PushedReadBufferPoint` + `BlitEndpointRecord`,
|
||||
`:8850` named arm, `:8955` bound arm. `:9409-9484` the detach walk. `:10118` the RBO refusal.
|
||||
`:10561` `BindImageTexture`.
|
||||
|
||||
**`Managers.cpp`** — `:4374` `PipeTextureTargetForHandle`; `:9662` `PushedSurfaceForAttachment`
|
||||
exported; `:9675-9820` `SyncAttachmentSurface` loses its attachment parameter and both
|
||||
cross-checks; `:9951-10035` `ApplyReadBufferFromRecord` + `SyncReadBufferToBackendByHandle`;
|
||||
`:10331` the record-side empty-point test; `:10525-10760` the reverse index +
|
||||
`BackendFramebufferObject::SyncToBackendByHandle`; `:11228` `BoundImageUnitFormat`;
|
||||
`:14025-14105` `BackendRenderbufferObject::SyncToBackendByHandle`; the two fb stubs deleted.
|
||||
|
||||
**`Managers.h`** — six declarations (§6.4, §6.8). **Tests** — `FramebufferEmitTest.cpp` +2,
|
||||
`ImageEmitTest.cpp` +1, all three in the X-macro skip lists (G2/G14).
|
||||
|
||||
## 2 Kimi-audit rows 68-90
|
||||
|
||||
**RETIRED** (no frontend read under a transport): 68 (monolith-only), 69, 70 (`NoteStateForHandle`
|
||||
deleted), 71, 74, 76, 77, 78, 79, 80, 81, 82, 85, 86, 87, 88, 89, 90.
|
||||
|
||||
**LEFT as monolith glue**, unreachable under a transport because `SyncCurrentFBO` / `BindCurrentFBO`
|
||||
abort before them: 72, 73, 75, 83.
|
||||
|
||||
**NOT MINE:** 84 (`SyncCurrentProgram`'s fragColor-broadcast half). Its record arm exists and is
|
||||
what a transport takes; its decline arm still reads the binding slot, and that decline is in **pg's**
|
||||
line range. A framebuffer row inside a program function — named so the integrator can rule whether
|
||||
pg refuses it or fb widens. Nothing in the split lane reaches it.
|
||||
|
||||
**NOT FOUND:** none. Every row 68-90 exists at this head.
|
||||
|
||||
## 3 The rulings I was asked to answer
|
||||
|
||||
- **ID-94 / ruling 16** — done. `Access` decodes through `MGPipeValueTypes.h`; the stale "the
|
||||
encoding does not exist at the contract commit" comment is deleted and corrected in place.
|
||||
- **ID-86 / ruling 7** — done: `(ShaderImagesSerial, TextureShutterSerial, ContextSerial,
|
||||
g_backendContextGeneration)`, in their own three fields beside the frontend pair. The old
|
||||
comment's argument is KEPT because it is what decides which values are admissible: an applier
|
||||
serial moves when the CLIENT said something, strictly before the sweep the saying provoked, so
|
||||
the "re-minted inside this sweep" property survives the re-key. Never a backend re-mint counter.
|
||||
The window/high-water union is kept and re-argued in place.
|
||||
- **`SyncReadFramebufferTextureAttachments` ungated on the framebuffer bit** — the delta is
|
||||
SMALLER than S3 feared. The function is still not gated on the bit; what selects the record arm
|
||||
is the TRANSPORT plus the bit. So the object A/B moves only in its SPLIT arm, and the
|
||||
push-monolith arm is token-for-token what it was. **It still needs re-baselining for the split
|
||||
arm** — integrator, with the phase's other re-baselines.
|
||||
- **The renderbuffer cross-check (base `Managers.cpp:9711`)** — fixed by DELETION, not gating
|
||||
(§4.4's instruction). **A latent RULE violation, not a latent wrong-picture bug**: the probe ran
|
||||
on the apply thread under split while its texture sibling was transport-gated, but inside
|
||||
`MGPipeFrontendKeyedRegistryScope` with the client parked, so its answer was correct. It becomes
|
||||
a correctness bug the instant the record is unbarriered — which is why it is deleted, not gated.
|
||||
|
||||
## 4 Red-once evidence (executed, quoted verbatim)
|
||||
|
||||
**R1 — `SyncAttachmentSurface` takes the frontend attachment again** (reverted
|
||||
`SyncCurrentFBOByRecord` to `SyncToBackend(currentFBO, target)`, the only way the attachment sync
|
||||
can be handed one). Full strict lane marker tables: with the arm, no `GetFramebufferBindingSlot`
|
||||
marker at all; with it reverted, `2 Fatal{UnmigratedPipeInput, "GetFramebufferBindingSlot@Clear"}`.
|
||||
The private log's line:
|
||||
```
|
||||
MGPipe: Fatal{UnmigratedPipeInput, "GetFramebufferBindingSlot@Clear"} [BARRIER-PULLED, MOBILEGL_IPC_STRICT_ERRORS=1, retires in P5e (Espryt unbarriered), P7 (Magma)]
|
||||
```
|
||||
|
||||
**R2 — the draw-FBO list key back to the pointer compare**, id's hook armed
|
||||
(`kMGPipeP5eClientWaitRuleLanded = true`), on
|
||||
`ClearThenReadPixelsScenario.ClearWithNoDrawIsVisibleToDefaultFramebufferReadPixels`:
|
||||
```
|
||||
MGPipe: Fatal{RoleViolation, "MGPipeSlots"} - the apply thread called MGPipeSlots().HandleOf. ...
|
||||
A named exemption scope admits it only while the record being applied is BARRIERED (barriered=0) ...
|
||||
#3 MGPipeRefuseAllocatorFromApplyThread #4 BackendSlotTable<ITextureObject>::Find
|
||||
#5 TextureImpl::SyncTextureObjectToBackend #6 TextureImpl::SyncNeccessaryTextures
|
||||
#7 DirectGLES::Clear #8 ServerVerbSink::OnClear
|
||||
```
|
||||
Control (key restored, hook still armed): the entry passes `OnClear` untouched and aborts later at
|
||||
`#5 VertexArrayImpl::ResolveVaoTwin #6 PrepareForDraw #7 DrawArrays #8 OnDrawVbo` — **vi's** site.
|
||||
The isolation is by FRAME, because with the hook armed every unlanded family aborts somewhere; it
|
||||
becomes a plain before/after once vi and tx2 land.
|
||||
|
||||
**R3 — the image `Access` mapped 1↔2.** (a) the SHARED table (`WriteOnly = 2, ReadWrite = 1`):
|
||||
```
|
||||
../MobileGL/MG_Test/Pipe/ImageEmitTest.cpp:511: Failure
|
||||
Expected equality of these values: Which is: '\x2' (2) Which is: 1
|
||||
../MobileGL/MG_Test/Pipe/ImageEmitTest.cpp:512: Failure
|
||||
Expected equality of these values: Which is: '\x1' (1) Which is: 2
|
||||
```
|
||||
(b) the SERVER decode alone (`GLAccessForImageView`): `Split.UnboundImageDescriptorScenario` 13/13
|
||||
and the whole split lane 111/111 stay GREEN — **lavapipe does not enforce `glBindImageTexture`'s
|
||||
access**, so the unit case is the only witness that exists here, which is why the brief asked for
|
||||
it. `FormatlessImageBakeScenario` / `ImageLoadStoreSsoScenario` are MONOLITH-lane entries with no
|
||||
split twin: they run the frontend arm and cannot reach the decode at all.
|
||||
|
||||
**R4 — the named blit back on the frontend objects: DID NOT GO RED**, and I stopped after two
|
||||
attempts rather than manufacture one. `Split.NamedBlit.F1WireScenario` 4/4 green with the revert.
|
||||
Three measured reasons: both endpoints of those cases are BOUND (hence synced) before the blit, so
|
||||
the twin is already configured and the state note is not load-bearing for them; the
|
||||
layered-destination substitute is gated on `MG_Util::SelfTest::BlitIgnoresDestinationArrayLayer`,
|
||||
which lavapipe does not trip, so the aspect plan's body never executes in this lane on EITHER arm;
|
||||
and with id's hook armed the entry aborts earlier at tx2's unlanded unit walk
|
||||
(`#5 SyncTextureObjectToBackend #6 SyncNeccessaryTextures #7 Clear`). What IS shown:
|
||||
`Split.NamedBlit.F1WireScenario` (4) and `Split.CopyImageLayeredScenario` (6) are green with the
|
||||
record-driven blit — the substitution is behaviour-preserving. **Ruling wanted**: whether a
|
||||
device-lane witness is required before this arm is accepted.
|
||||
|
||||
**R5 — the per-point version memo as a second gate: the proof is that it is ABSENT and the lane is
|
||||
green.** `SyncToBackendByHandle` has no `m_syncedFrontendAttachmentVersions` at all (the record
|
||||
hash plus `g_attachmentBackendIdGeneration` are the only gates) and `integration-split` is 111/111,
|
||||
including `Split.F1.F1WireScenario` (13) and `Split.CopyImageLayeredScenario` (6). The
|
||||
re-storaged-attached-RBO shape S3 named for `P4aSeamAuditScenario` F-3 is covered by the existing
|
||||
`FramebufferEmit.ARestoragedAttachedRenderbufferPublishesItsNewExtent`, still green.
|
||||
|
||||
## 5 Gate
|
||||
|
||||
`build` rc=0 · `unit` **2209/2209** (2206 before the three new cases) · `isplit` **111/111** ·
|
||||
`strict` 3/111 · `gens` all seven rc=0 · `one` **77/77** on `Split.{F1,NamedBlit,Ct}`,
|
||||
`Split.CopyImageLayeredScenario`, `Split.UnboundImageDescriptorScenario`, `FramebufferEmit.`,
|
||||
`ImageEmit.` · seam greps SILENT (the image seam log is deleted; no framebuffer "does not describe
|
||||
the binding it names" line in any of the 88 private logs). The one `gens` doc-citation complaint
|
||||
(`CONTRACT-P5.md:524`) is PRE-EXISTING — verified with `--rev f6cfcbd3`.
|
||||
|
||||
**Strict markers, base (22 private logs) vs now (88; the slice is four times larger because fb's
|
||||
field no longer aborts first on those entries):**
|
||||
|
||||
| marker | base | now | owner |
|
||||
|---|---|---|---|
|
||||
| `GetFramebufferBindingSlot@Clear` | 6 | **0** | fb — retired |
|
||||
| `GetImageTextureBinding@BindImageTexture` | 0 visible | **0** | fb — surfaced at 13 mid-package, fixed (§6.8) |
|
||||
| `GetTextureUnitObject@Clear` | 13 | 18 | tx2 |
|
||||
| `GetTextureUnitObject@GenerateMipmap` | 2 | 0 | tx2 |
|
||||
| `GetBoundVertexArray@DrawArrays` | — | 14 | vi |
|
||||
| `GetProgramForDispatch@DispatchCompute` | — | 7 | pg |
|
||||
| `ValidateProgramName@ShaderStorageBlockBinding` | — | 2 | pg (barriered, §7 allowlist) |
|
||||
| `GetTextureObject@CopyImageSubData` | — | 6 | P7/P9 (barriered) |
|
||||
| `GetTextureObject@Clear` | — | 39 | **the scaffold's own cost**, gone with it |
|
||||
|
||||
**THE HEAD DOES NOT PASS `isplit`, BY CONSTRUCTION.** fb calls tx2's
|
||||
`SyncTextureToBackendByHandle` / `SyncMipmapsToBackendByHandle` from four places. With c0e's
|
||||
aborting stubs back, every entry whose framebuffer has a texture attachment dies on
|
||||
`Fatal{UnmigratedVerb, "TextureImpl::SyncTextureToBackendByHandle"}`. Every number above was taken
|
||||
at `fcd7c5c8`, where `f4675d1a` bodied the two seams by resolving the frontend texture from the
|
||||
record's own `Desc.GlNameForDiag` through the `GetTextureObject` sticky forward — correct under
|
||||
lockstep, deliberately NOT tx2's design, reverted at `ca1beb69`. **fb and tx2 land together, or fb
|
||||
after tx2.**
|
||||
|
||||
## 6 Seams assumed, and deltas to name
|
||||
|
||||
1. **`SyncTextureToBackendByHandle(h, imageBindable)` is the by-handle twin of
|
||||
`SyncTextureObjectToBackend(obj, …)`** — it does (or memo-skips) params, builtin sampler and
|
||||
mipmaps, and returns the twin. The two attachment lists make ONE such call per entry instead of
|
||||
the pre-handle arm's three, because by-handle forms of `SyncTextureParamsToBackend` /
|
||||
`SyncBuiltinSamplerToBackend` / `IsDrawSyncClean` are tx2's new names and are not declared
|
||||
seams. If tx2's `IsDrawSyncCleanByRecord` ends up OUTSIDE that call, fb's lists need a re-look.
|
||||
2. **`SyncMipmapsToBackendByHandle(h)` drives storage from the descriptor** with no frontend
|
||||
object — that is what let `SyncAttachmentSurface` drop its parameter.
|
||||
3. **`MarkWritableImageBufferTexturesGpuWritten` deleted under a transport** — paired with **sb's**
|
||||
deletion of the backend storage-block marks. I gated at the TOP of the function, not at the two
|
||||
call sites, so the unit bookkeeping is out of an apply thread's reach too; sb should say whether
|
||||
it did the same.
|
||||
4. **The reverse index is maintained at `SyncToBackendByHandle`**, not at `set_framebuffer_state`
|
||||
apply as §5.4's wording suggests. Same set: a framebuffer whose record was never synced has no
|
||||
driver attachment to detach, and every path that can have one syncs first. It lives in
|
||||
`FramebufferImpl` (`NoteFramebufferTextureAttachments` / `FramebuffersAttachingTexture`) and
|
||||
**tx2 calls the second one** if it wants it.
|
||||
5. **`UnitTextureSyncEntry` untouched** (see §1).
|
||||
6. **Shared-code delta (G1):** the image bind's format rules are factored into one `static`
|
||||
`IssueImageTextureBind` that the PULL build compiles too, because the alternative was the same
|
||||
hundred lines of widening/split reasoning twice and a divergence there is an out-of-bounds image
|
||||
read, not a wrong pixel. One caller in the pull build, internal linkage, no new symbol. Named
|
||||
here rather than left to a G1 diff. Everything else is under `MOBILEGL_PIPE_PUSH` /
|
||||
`MOBILEGL_BUILD_DISAGGREGATED`.
|
||||
7. **Push-monolith delta:** `SyncAttachmentSurface`'s two loud cross-checks and the N-6 refusal go
|
||||
on that arm too (no second answer left to check against), and `SyncImageTextureBinding(Uint)` no
|
||||
longer takes its four field values off the record there. Both behaviour-identical by
|
||||
construction — the client copies the unit's own binding, P4a's own argument — but they ARE token
|
||||
moves in the push-monolith build. The pull build is unaffected.
|
||||
8. **Out of my stated range, taken deliberately:** `DirectGLES.cpp`'s `BindImageTexture` (the
|
||||
`bind_shader_image` sink target) was reading `GetImageTextureBinding` on an UNBARRIERED row and
|
||||
strict named it on 13 entries; no other package's range names it. It now records the high-water
|
||||
mark and defers to the sweep (the sink bumps the texture shutter serial right after, so the
|
||||
sweep cannot be suppressed). `Managers.h:717` gained `PipeTextureTargetForHandle` beside
|
||||
`PipeTextureRecordForHandle`. **Ruling wanted**: `MGPImageBind::Res` stops at the sink, so that
|
||||
funnel cannot resolve a twin at all — should the backend `BindImageTexture` entry eventually
|
||||
take the handle, or is deferring the permanent answer?
|
||||
|
||||
## 7 Is a blit still barriered?
|
||||
|
||||
**No, and it need not be.** `Blit` is `kWaitNone` in §2.2's static column and fb removes the last
|
||||
reason S3 could see to escalate: both arms resolve every endpoint, aspect and texture from records
|
||||
and applier state, and the two `ForceBindCurrentFBO` calls that restore the bindings afterwards are
|
||||
handle-only. The predicate decides and **ra owns the flip** — fb changed no wait class, and asks
|
||||
for none.
|
||||
|
||||
## 8 What I did not do
|
||||
|
||||
No device measurement, no adb, no pull-build (G1) compile — the gate configures the split flavour
|
||||
only. The object A/B is not re-baselined (§3). The resize case has no negative control beyond the
|
||||
suite's own `AnUnchangedBindingPairEmitsNothing`, which is what stops it passing because the
|
||||
emitter fires unconditionally. Row 84 left to pg (§2).
|
||||
@@ -0,0 +1,256 @@
|
||||
# P5e `fix1` — the by-handle attachment sync on the monolith arm (report v1)
|
||||
|
||||
Branch `p5e/fix1`, head **`66621767`**, base `44f91c74` (P5e wave-2 integration). Tree
|
||||
`~/w7/p5e-fix1`. One commit. Three files: `MG_Backend/DirectGLES/Managers.cpp`,
|
||||
`MG_IntegrationTest/CMakeLists.txt`, and a new `MG_IntegrationTest/Scenarios/MonolithAttachmentClearScenario.cpp`.
|
||||
|
||||
## 1 Root cause
|
||||
|
||||
The push build has TWO server arms and P5e only repaired one of them at this seam. Since P4a
|
||||
(D-C2) the push build resolves framebuffer ATTACHMENTS from the applier record in **both**
|
||||
arms — `BackendFramebufferObject::SyncToBackend(const SharedPtr<FramebufferObject>&, target)`
|
||||
computes `pushedRecord` gated on `FramebufferSubsystemEnabled()` **alone**, with no transport
|
||||
test — and under `Transport == Monolith` that object overload is what `SyncCurrentFBO` →
|
||||
`SyncCurrentFBOByRecord` reaches (`DirectGLES.cpp:4304`, the arm below
|
||||
`FramebufferRecordArmIsMandatory()`), which is exactly the frame the `hs_err` names. Package fb
|
||||
then dropped `SyncAttachmentSurface`'s frontend attachment parameter and pointed its storage sync
|
||||
at tx2's `SyncMipmapsToBackendByHandle`, whose contract is "the noted handle routes the body onto
|
||||
the record arm". That contract is false on the monolith arm: the record arm inside
|
||||
`SyncMipmapsToBackend` is itself selected by `MG_Config::Transport != Monolith` (the texture-VIEW
|
||||
test at `Managers.cpp:7397-7412` and `RequireImageBindableStorage`'s re-dirty transition at
|
||||
`:7458`, both tx2's ruling-1 arms), so with a null `SharedPtr` and monolith transport control fell
|
||||
through to `stateTextureObject->IsTextureView()` and dereferenced null — the SIGSEGV at
|
||||
`libMobileGL.so+0x80b57c` in `Lightmap.<init>` → `clearColorTexture` → `glClear`. fb's report §7
|
||||
enumerates the push-monolith deltas it took deliberately (the two cross-checks, the N-6 refusal)
|
||||
and this one — the storage sync itself — is not among them; it is an unnamed delta, and a fatal
|
||||
one. The renderbuffer half of the same function has the same arm error with a milder symptom
|
||||
(§3.2). **Everything in the task brief's diagnosis is confirmed**, with one correction: the
|
||||
governing arm selection that is missing is not "the monolith arm must not use the record-shaped
|
||||
attachment sync" (that is P4a's design and predates ID-81) but "the monolith arm must not use the
|
||||
by-handle STORAGE sync", which is the thing ID-81 actually governs.
|
||||
|
||||
## 2 The fix, and why this one
|
||||
|
||||
Three edits, all in `Managers.cpp`.
|
||||
|
||||
**(a) `SyncAttachmentSurface` selects the storage sync by transport, and the monolith arm keeps
|
||||
its frontend object** (`Managers.cpp:10068-10230`). The frontend attachment comes back as a
|
||||
`const FramebufferAttachmentObject*` parameter — null on the handle arm, `&attachmentObject` from
|
||||
the object-form walk — used for **nothing but** the storage sync:
|
||||
`Transport != Monolith` → `SyncMipmapsToBackendByHandle(surface.Res)` / RBO
|
||||
`SyncToBackendByHandle(surface.Res)` exactly as §5.4 prescribes; `Transport == Monolith` →
|
||||
`SyncMipmapsToBackend(attachment->GetTexture())` / `SyncToBackend(attachment->GetRenderbuffer())`,
|
||||
which is `f6cfcbd3`'s text token for token. Which arm is taken is decided by `MG_Config::Transport`
|
||||
and never inferred from the pointer, so the two statements cannot drift.
|
||||
|
||||
This is candidate **(a) of the brief, narrowed to the seam ID-81 owns**, plus candidate **(c)** as
|
||||
its backstop. I did not take (a) at the FBO sync site (gating `pushedRecord` itself on the
|
||||
transport): that would revert P4a's record-driven attach shape in the push-monolith build,
|
||||
silently moving draw-buffer decode, the four cross-object masks and the empty-point test back onto
|
||||
the frontend for the arm the phone ships on — a far larger behaviour change than the defect, and
|
||||
one that would reopen review N-6's hole (attach decided by the record, detach by the frontend).
|
||||
I did not take **(b)** (resolve the frontend object from the registry inside
|
||||
`SyncMipmapsToBackendByHandle`) because the registry *cannot reliably answer*: `Entry::stateRef`
|
||||
is written only by the minting `GetOrCreate(StatePtr)`, and this path adopts its twin through
|
||||
`AdoptTwinByHandle`, which sets no `stateRef` — a texture that reaches the driver first as an
|
||||
attachment would get a null from `StateForHandle` and we would be back where we started, one
|
||||
indirection later. The caller *has* the object; asking it is honest and total.
|
||||
|
||||
**(b) The null-frontend contract is named and enforced** (`Managers.cpp:6972-7017`).
|
||||
`RefuseNullFrontendTextureOffTheHandleArm(entry, notedHandle)` is one shared check behind the new
|
||||
`MGB_TEXTURE_NULL_FRONTEND_REFUSED` macro, spelled by all three sync bodies
|
||||
(`SyncMipmapsToBackend`, `SyncTextureParamsToBackend`, `SyncBuiltinSamplerToBackend`) in place of
|
||||
the bare `!obj && MGB_TEXTURE_HANDLE_ARM_OFF(*this)` test. Semantics: no handle noted → decline as
|
||||
before; handle noted **and** (`Transport != Monolith` **and** `TextureResourceSubsystemEnabled()`)
|
||||
→ proceed onto the record arm; handle noted on any other arm →
|
||||
`Fatal{RoleViolation, "texture-handle-arm"}` and `std::abort()`. So the shape becomes **loudly
|
||||
named wherever it is not impossible**, which is what the brief asked for and what makes the
|
||||
red-once below a named abort rather than a SIGSEGV. G1: the `#else` branch defines the macro to
|
||||
`(true)`, so the pull build's preprocessed text is `(!obj && true)` — identical to before, no call
|
||||
added (the D-P rule `MGB_TEXTURE_HANDLE_ARM_OFF` was written for).
|
||||
|
||||
**(c) The renderbuffer arm is arm-selected too**, for a reason that is a behaviour delta rather
|
||||
than a crash: `BackendRenderbufferObject::SyncToBackendByHandle` dereferences nothing, but it
|
||||
deliberately drops the `MGB_CTX->RecordError(OutOfMemory, …)` the object form raises, "because on
|
||||
this arm there is no application on this side of the wire to report it to". On the push-monolith
|
||||
arm there is one, so the monolith arm keeps the object form.
|
||||
|
||||
## 3 The audit of the same class
|
||||
|
||||
The class: *a by-handle seam that passes a null/empty frontend object and relies on a record arm
|
||||
being selected*. I walked every one in `MG_Backend/DirectGLES` and checked each call site's arm
|
||||
selector by hand.
|
||||
|
||||
**3.1 Defective, fixed.** `BackendTextureObject::SyncMipmapsToBackendByHandle`, single call site
|
||||
`SyncAttachmentSurface` (`Managers.cpp:10102`) — the crash.
|
||||
|
||||
**3.2 Same arm error, milder, fixed.** `BackendRenderbufferObject::SyncToBackendByHandle`, single
|
||||
call site the same function (`Managers.cpp:10201`) — §2(c) above.
|
||||
|
||||
**3.3 Checked and correct (transport-gated at every call site).**
|
||||
|
||||
| seam | call sites | selector |
|
||||
|---|---|---|
|
||||
| `TextureImpl::SyncTextureToBackendByHandle` (passes `kNoFrontendTexture` to all three sync bodies) | `DirectGLES.cpp:2950, 2958` (fb's two attachment lists) | `FramebufferRecordArmIsMandatory()` at `:3333` |
|
||||
| | `:3230, 3243` (the unit work list) | `UnitTexturesByHandle()` at `:2821` |
|
||||
| | `:3669` (image bind) | reached only from the record overload, selected at `:3824` |
|
||||
| | `:10242, 10249` (blit expressed as a copy) | the record overload, selected at `:10303` / `:10378` |
|
||||
| | `:11453, 11570, 11801` (CopyTex ×2, GenerateMipmap) | each its own `Transport != Monolith` |
|
||||
| | `Managers.cpp:7125` (a view's storage owner) | inside `SyncTextureViewToBackendByRecord`, itself behind `:7397` |
|
||||
| `BackendFramebufferObject::SyncToBackendByHandle` / `SyncReadBufferToBackendByHandle` | `DirectGLES.cpp:4265, 4267, 5905` | `FramebufferRecordArmIsMandatory()`; bodies are record-only and hold no frontend object |
|
||||
| `BackendProgramObjectImpl::SyncToBackendByHandle` | `DirectGLES.cpp:5692` via `SyncCurrentProgramByHandle` | `ProgramHandleArm()`; it is a SEPARATE body from the object head, not the object body fed a null |
|
||||
| `RequireImageBindableStorageByHandle` | `Managers.cpp:7459` | `:7458`, record-only body |
|
||||
| `SyncTextureViewToBackendByRecord` | `Managers.cpp:7450` | takes a possibly-null object and guards it: `if (stateTextureObject) SyncTextureViewToBackend(...)` |
|
||||
|
||||
**3.4 Checked and correct by a different construction — null-tolerant AND transport-aware bodies.**
|
||||
vi's and sb's buffer seams are the model this fix follows and they got it right:
|
||||
`IsBufferDrawCleanByHandle(res, resource, nullptr)` makes its one frontend read conditional on
|
||||
`askTheObjectWhetherItIsMapped = (Transport == Monolith)` *and* on `frontend != nullptr`, and
|
||||
`EnsureBufferResourceForHandle(nullptr, res)` returns `resource->hostBytes` under a transport and
|
||||
`bufferObject->MappedData()` only when it has an object. The record-arm callers are
|
||||
`VertexInputReadsRecords()`-gated and the push-monolith arm passes the real object
|
||||
(`DirectGLES.cpp:1172` vs `:1386`); sb's whole walk is behind `ResolveBufferBindingSubsystemArm()`,
|
||||
which returns false under monolith.
|
||||
|
||||
**3.5 One case named rather than changed.** `Managers.cpp:8650`'s `kNoFrontendBuffer` (the
|
||||
buffer-texture backing on the `texBufferByRecord` arm) is keyed on `pushedStorage != nullptr &&
|
||||
!MGB_TEXTURE_HANDLE_ARM_OFF(*this)` — on a NOTED HANDLE, not on the transport. It is unreachable
|
||||
under monolith only because every writer of that note is transport-gated (§3.3), i.e. it is safe
|
||||
by a chain rather than by a statement. It does not crash (the callee is null-tolerant); what it
|
||||
would lose on the monolith arm is the live `MappedData()` base for a mapped buffer texture. I left
|
||||
it alone rather than widen this fix's blast radius. **Ruling wanted**: whether the handle-note
|
||||
should be re-stated as a transport test there, or whether "a handle is only ever noted under a
|
||||
transport" is to be made an invariant with a check of its own.
|
||||
|
||||
**3.6 Not in this class, checked anyway.** `ScopedDetachedTextureFramebufferAttachments`' handle
|
||||
arm and `ForEachLive`+`StateForHandle` (`DirectGLES.cpp:11078`) hold no null across a sync;
|
||||
Magma's `VulkanRenderer.cpp` is out of scope (ID-90 keeps it lockstep) and untouched.
|
||||
|
||||
## 4 The coverage hole, and what closes it
|
||||
|
||||
**The hole is bigger than "no lane entry clears a texture-attached FBO" (ID-107), and it is
|
||||
structural.** The gate runs `-L unit` and `-L integration-split`. **Every** `integration-split`
|
||||
entry exports `MOBILEGL_TRANSPORT=inproc`, which selects `FramebufferRecordArmIsMandatory()` and
|
||||
therefore `SyncToBackendByHandle` — the arm that never enters the object overload at all. And
|
||||
every P5-era scenario that *does* clear a texture-attached framebuffer (`F1WireScenario` and its
|
||||
family) calls `SplitRuntimeSkipReason()` in `SetUp` and **skips itself the moment the runtime is
|
||||
not split**, so the ambient monolith registration of those files runs zero cases. The push build's
|
||||
second runtime arm — the one the phone ships on — had no gated entry at all.
|
||||
|
||||
Measured on this tree, at HEAD's behaviour: `ctest -L integration-gpu` (the ungated monolith lane)
|
||||
is **1157 passed / 137 failed of 1294, every failure a DirectGLES SEGFAULT**. The information was
|
||||
there; nothing the gate runs looked at it.
|
||||
|
||||
**What I added.** `Scenarios/MonolithAttachmentClearScenario.cpp`, three cases in the shape the
|
||||
existing scenarios use (fixture + attach + `glClear` + `glReadPixels` against pinned channel
|
||||
values): a **mutable** 2D texture attachment (`glTexImage2D`, the Lightmap shape, the arm that
|
||||
crashed), an **immutable** one (`glTexStorage2D`, so a regression confined to level definition
|
||||
cannot account for a green), and a **renderbuffer** (the sibling arm of §2(c)). The assertion is
|
||||
the pixel, not "it did not crash": a clear against a driver framebuffer whose attachment point was
|
||||
never filled raises `GL_INVALID_FRAMEBUFFER_OPERATION` and writes nothing, which is the silent
|
||||
form of the same defect and fails here too.
|
||||
|
||||
**How it reaches the gate.** A new `DirectGLES.PushMonolithArm.` block in
|
||||
`MG_IntegrationTest/CMakeLists.txt`, registered inside `if (MOBILEGL_BUILD_DISAGGREGATED)`, with
|
||||
`MOBILEGL_TRANSPORT=monolith` as a ctest ENVIRONMENT property (review N-6's reason, the
|
||||
`PersistentMapArm` pair's precedent: a job-level `inproc` export must not be able to turn the
|
||||
other-arm lane into a fourth copy of the split one) and `LABELS "integration-gpu;integration-split"`.
|
||||
**The `integration-split` label on a monolith entry is a deliberate reading** and the one thing in
|
||||
this package an integrator may want to overrule: that label does not mean "runs inproc", it means
|
||||
"the set the disaggregation gate runs", which is why the block above it argues that a build without
|
||||
`-DMOBILEGL_BUILD_DISAGGREGATED=ON` must match nothing under it — still true, since my block is
|
||||
inside that `if`. ID-81 gives the push build two arms; if only one of them is in the gated set,
|
||||
"the gate is green" keeps meaning "one of the two arms is green". The alternative, which I did not
|
||||
take because it edits shared tooling outside this tree, is to add `-L integration-gpu` (or a third
|
||||
label) to `~/w7/notes/tools/p5e_gate.sh`.
|
||||
|
||||
`integration-split` is now **116** entries (113 + 3). The scenario is also registered ambiently, so
|
||||
`DirectGLES.MonolithAttachmentClearScenario.*` and `DirectVulkan.MonolithAttachmentClearScenario.*`
|
||||
exist in `integration-gpu` (9 entries in total, all green).
|
||||
|
||||
### 4.1 Red-once, executed and quoted verbatim
|
||||
|
||||
**R1 — the arm selection reverted, the named refusal kept.** `SyncAttachmentSurface`'s
|
||||
`if (MG_Config::Transport != Monolith)` replaced by `if (true)`; rebuilt.
|
||||
`ctest -R 'PushMonolithArm.MonolithAttachmentClearScenario'` → **33% tests passed, 2 tests failed
|
||||
out of 3**:
|
||||
```
|
||||
3457 - DirectGLES.PushMonolithArm.MonolithAttachmentClearScenario.AClearOfAMutableTextureAttachmentReachesItsPixels (Subprocess aborted) integration-gpu integration-split
|
||||
3458 - DirectGLES.PushMonolithArm.MonolithAttachmentClearScenario.AClearOfAnImmutableTextureAttachmentReachesItsPixels (Subprocess aborted) integration-gpu integration-split
|
||||
```
|
||||
and the abort is named, from the entry's own log (`MOBILEGL_LOG_FILE_PATH`, because `MGLOG_F` does
|
||||
not reach ctest's captured stdout):
|
||||
```
|
||||
[09:41:35] [Linux MobileGLIntegra/FATAL]: MGPipe: Fatal{RoleViolation, "texture-handle-arm"} - SyncMipmapsToBackend was handed a NULL frontend texture for handle {15, 0} on an arm that cannot answer without one. The by-handle entries pass null on the strength of a noted handle, and the record arm they rely on is selected by Transport != Monolith AND the texture-resource subsystem bit (CONTRACT-P5E §5.8, ID-81); neither holds here, so the body below would read a frontend object that does not exist
|
||||
```
|
||||
The renderbuffer case stays green, which is the control: that arm's by-handle form dereferences
|
||||
nothing.
|
||||
|
||||
**R2 — both halves reverted (= HEAD's behaviour), the device's own crash.** The refusal macro
|
||||
additionally reverted to `MGB_TEXTURE_HANDLE_ARM_OFF`; rebuilt. Running the case directly:
|
||||
```
|
||||
2258 Segmentation fault ./MobileGLIntegrationTest --gtest_filter=MonolithAttachmentClearScenario.AClearOfAMutableTextureAttachmentReachesItsPixels
|
||||
direct-run exit=139 (139 = SIGSEGV, 134 = SIGABRT)
|
||||
```
|
||||
and through ctest:
|
||||
```
|
||||
3457 - DirectGLES.PushMonolithArm.MonolithAttachmentClearScenario.AClearOfAMutableTextureAttachmentReachesItsPixels (SEGFAULT) integration-gpu integration-split
|
||||
3458 - DirectGLES.PushMonolithArm.MonolithAttachmentClearScenario.AClearOfAnImmutableTextureAttachmentReachesItsPixels (SEGFAULT) integration-gpu integration-split
|
||||
```
|
||||
|
||||
**R3 — the whole monolith lane, before and after.** Taken at R2's state and again at the restored
|
||||
head, same build flags, same machine:
|
||||
|
||||
| `ctest -L integration-gpu` | result |
|
||||
|---|---|
|
||||
| HEAD's behaviour (R2) | **1157 / 1294**, 137 failed — 137 SEGFAULT, 0 Failed, 0 aborted, 0 timeout, all `DirectGLES.` |
|
||||
| with the fix | **1294 / 1294** |
|
||||
|
||||
The 137 span **38 distinct scenarios** (36 pre-existing plus my two new prefixes) —
|
||||
`OrientationScenario`, `PrimitiveRestartScenario`, `DepthStencilReadbackMatrixScenario`,
|
||||
`SnormAttachmentScenario`, `ThreeChannelAttachmentScenario`, `SampledSetStalenessScenario`,
|
||||
`PixelStoreSweepScenario`, `FramebufferChurnScenario`, `P4aSeamAuditScenario`,
|
||||
`CopyImageLayeredScenario`, `GuiBatchScenario`, … — every one of them a case that renders to or
|
||||
clears a framebuffer holding a texture attachment. So the
|
||||
regression was never confined to the Lightmap path; it broke the monolith arm wholesale, and no
|
||||
gated lane entry touched it.
|
||||
|
||||
**R4 — restored, markers clean.** No `RED-ONCE` marker survives in the tree (`grep`, checked
|
||||
before the commit); the committed diff is the three files in §0.
|
||||
|
||||
## 5 Gate
|
||||
|
||||
| step | result |
|
||||
|---|---|
|
||||
| `build` | rc=0 |
|
||||
| `unit` | **2250 / 2250** |
|
||||
| `isplit` (`integration-split`) | **116 / 116** (113 + the 3 new entries) |
|
||||
| `gens` | all seven rc=0; the one doc-citation line (`CONTRACT-P5.md:524 Core.cpp:39 ambiguous`) is the pre-existing one every package has reported |
|
||||
| `one` (the new entries) | **9 / 9** on `MonolithAttachmentClearScenario` (3 `DirectGLES.`, 3 `DirectVulkan.`, 3 `DirectGLES.PushMonolithArm.`) |
|
||||
| `integration-gpu` (not a gate step; measured for §4.1 R3) | **1294 / 1294** |
|
||||
| `strict` | 7 passed / 109 failed of 116. The 3 new entries pass (they are monolith, so no BARRIER-PULLED row is reachable); the 113 pre-existing entries are unchanged, and cannot be otherwise — every edit in this commit either selects the monolith arm or, under a transport, returns exactly what the pre-fix expression returned. No `Fatal{UnmigratedPipeInput, …}` marker moved. |
|
||||
|
||||
## 6 What I could not settle
|
||||
|
||||
1. **The `integration-split` label on a monolith lane** (§4). My reading is that the label names
|
||||
the gate's set, not the transport, and that ID-81's second arm has nowhere else to live. The
|
||||
clean alternative is a gate-script change (`-L integration-gpu`, or a new `integration-arms`
|
||||
label) in `~/w7/notes/tools/p5e_gate.sh`, which is outside this worktree and shared with every
|
||||
other package, so I did not touch it. **Integrator's call.**
|
||||
2. **The 137 monolith SEGFAULTs were latent for the whole of wave 2** and no package's gate could
|
||||
have seen them, because none of `build`/`unit`/`isplit`/`strict`/`gens` runs the monolith
|
||||
integration lane. Whether the phase should adopt `integration-gpu` as a standing gate step —
|
||||
it is ~10 minutes at `-j 4` — is a phase-level decision, not fix1's.
|
||||
3. **`Managers.cpp:8650`'s handle-note-keyed arm** (§3.5): safe by a chain of transport-gated
|
||||
writers rather than by its own statement. Left alone deliberately.
|
||||
4. **No pull-build (G1) compile.** The gate configures the split flavour only, as fb also
|
||||
reported. The argument that the pull build's bytes do not move is textual and I state it rather
|
||||
than measure it: `SyncAttachmentSurface` lives inside `#if MOBILEGL_PIPE_PUSH` and is not
|
||||
compiled there at all; the new refusal is inside the same `#if`, and its `#else` macro is
|
||||
`(true)`, so the three guards' preprocessed text in the pull build is the pre-fix1 text token
|
||||
for token. A `-DMOBILEGL_PIPE_PUSH=OFF` configure would settle it.
|
||||
5. **No device run.** I have no adb and did not take one. **Request:** one push-monolith run of
|
||||
Minecraft 26.3-rc-3 on the Redmi at `66621767` to confirm the startup crash is gone and the
|
||||
frame is correct, and — if it is cheap — one inproc run to confirm the split arm is still the
|
||||
140-145 fps / 852-draws-per-frame shape ID-107 recorded, since this commit touches a line that
|
||||
both arms read (the arm selection itself).
|
||||
@@ -0,0 +1,264 @@
|
||||
# gl-v1 — the gate mechanism, and two latent crashes
|
||||
|
||||
Branch `p5e/gl`, base `7c6f6886`, head `e5b74028`. Ten commits; all eight brief items landed, plus
|
||||
ID-125 and ID-128 which arrived mid-task.
|
||||
|
||||
| # | item | commit |
|
||||
|---|---|---|
|
||||
| 1 | barriered stamp asks the server's capability (ID-111) | `8df7861f` |
|
||||
| 2 | compile-time trip wire on the residual fill (ID-112) | `f94752c0` |
|
||||
| 3 | admission predicate, generated (ID-116) | `a211756a` |
|
||||
| — | retiring-phase disjunct (ID-125) | `faf19a6a` |
|
||||
| — | escalation disjunct (ID-128) | `a0836568` |
|
||||
| 4 | strict knob becomes admission-aware (ID-117) | `4f492edb` |
|
||||
| 5 | `ResourceCopyRegion` becomes barriered (ID-118) | `a6ddeb08` |
|
||||
| 6 | lane reads every log, counts, positive control (ID-119/115) | `bc6e24ff` |
|
||||
| 7 | Magma's entries get their own lane | `664cbf3e` |
|
||||
| 8 | amendment 8 marked UNLANDED (ID-120) | `e5b74028` |
|
||||
|
||||
## Gate
|
||||
|
||||
| step | result | delta and why |
|
||||
|---|---|---|
|
||||
| `build` | rc=0 | |
|
||||
| `unit` | **2254/2254** | +4 split-only cases (one per red-once: ID-111, ID-116, ID-117, ID-128). One rename, no deletions. |
|
||||
| `isplit` | **117/117** | +3 for the new `TriangleScenario` case (plain split, `SmallRing`, and its own `StrictArming` block); −2 for the DirectVulkan `NamedBlit` pair moving to `integration-magma-split`. |
|
||||
| `gpu` | **1299/1299** | +5: the same case is discovered by five gpu-labelled blocks and skips loudly in four. |
|
||||
| `strict` | 49/117, 68 abort | was 7/116. The 68 are exactly `pa`'s and `mv`'s rows — table below. |
|
||||
| `integration-magma-split` | 0/2 under strict, **2/2 without** | the expected-red step, asserted red *and* asserted on its marker. |
|
||||
| `gens` | all rc=0 | incl. `--check` and `--self-test` (18 negative + 13 derivation controls). The one `check_doc_citations` line (`CONTRACT-P5.md:524`) is pre-existing in a file I did not touch. |
|
||||
| `flavours` | **rc=1, not mine** | breaks in `DirectGLES/DirectGLES.cpp:5575,6716` and `Managers.cpp:9081,9344` on `keysMatch`, `ComputeShaderStorageBlockBindingSignatureOf`, `StagedTextureTargetForPipeTarget`. My diff contains **no DirectGLES file**; `git log -S` puts those symbols in `49aab57f` / `72e79020`, both ancestors of my base. ID-124's finding, unchanged. |
|
||||
|
||||
## The marker table (this head — base `7c6f6886`, so *before* `pa` and `mv`)
|
||||
|
||||
Two independent instruments agreeing exactly: my in-lane `split_log_paths.py markers` (reads the
|
||||
entries' own private logs) and the integrator's `strict_census3.py` (re-runs each entry under its
|
||||
own command and environment). 113 of 113 log-declaring entries read; 117 lane entries.
|
||||
|
||||
**`Fatal{` — must be only what `pa` and `mv` owe. It is:** `GetProgramForDraw@DrawArrays` 52
|
||||
(**pa**), `GetBoundVertexArray@DrawArrays` 9 (**mv**), `GetProgramForDispatch@DispatchCompute` 7
|
||||
(**pa**). Nothing else. `GetFramebufferBindingSlot@Clear` (Magma, 2) has left this table — item 7.
|
||||
|
||||
**`Admitted{`, by the generated table:**
|
||||
|
||||
| pair | entries | admitted by |
|
||||
|---|---|---|
|
||||
| `GetBufferBindingSlot@ReadPixels` | 29 | disjunct 2 (P8/P9/P13) |
|
||||
| `GetFramebufferBindingSlot@ReadPixels` | 29 | disjunct 1 (`read_pixels` is `kWaitReply`) |
|
||||
| `GetTransformFeedbackProgram@DrawArrays` | 11 | disjunct 2 (P3b/P4b), also 3 |
|
||||
| `GetTextureObject@CopyImageSubData` | 6 | disjuncts 1 **and** 2, independently |
|
||||
| `GetProgramObject@ShaderStorageBlockBinding` | 2 | disjunct 2 (P9) |
|
||||
| `GetTextureUnitObject@CopyTexImage2D` | 2 | disjunct 1 (`kWaitApplied`) |
|
||||
| `ValidateProgramName@ShaderStorageBlockBinding` | 2 | disjuncts 1 and 2 |
|
||||
|
||||
**`ADMITTED-ESCALATED` (disjunct 3 only):** `GetProgramForDraw@DrawArrays` 13,
|
||||
`GetBufferBindingPoint@DrawArrays` 11, `GetBoundVertexArray@DrawArrays` 2.
|
||||
|
||||
The first is not a contradiction with the Fatal table: the same pair is Fatal in 52 entries and
|
||||
admitted in 13. The 13 are draws the client is parked behind because the *payload* escalated them
|
||||
(open XFB span, or client arrays); the 52 are ordinary draws. That is exactly the distinction
|
||||
ID-128 exists to draw, and no table indexed by (field, verb) could have drawn it.
|
||||
|
||||
### Reconciling with ID-128's census of the merged tree
|
||||
|
||||
ID-128 measured 180 entries at `3c13fa4b`; I measure 117 at `7c6f6886`. Differences, all accounted
|
||||
for, none of them a rule I bent:
|
||||
|
||||
- `pa`/`mv` are not in my base, so their three Fatal rows are still here.
|
||||
- `GetFramebufferBindingSlot@Clear` is absent from my Espryt table **by item 7**, not by admission
|
||||
(0/2 red in `integration-magma-split` with its marker asserted).
|
||||
- `GetBufferBindingSlot@ReadPixels`, `GetProgramObject@ShaderStorageBlockBinding` and
|
||||
`GetBufferBindingPoint@DrawArrays` appear in mine and not in ID-128's table. I believe this is
|
||||
instrument, not disagreement — both of mine record *every* marker per entry, a first-fault census
|
||||
records one — but I cannot check that from here. Flagging rather than assuming.
|
||||
|
||||
## Item by item
|
||||
|
||||
**1 · ID-111** (`PipeApplier.h/.cpp`). The stamp is now
|
||||
`MGPipeApplierStampsBarriered(waitRuleLanded, serverPublishesRunAhead, wireSaysBarriered)`, a pure
|
||||
function; both predicates still computed unconditionally, as arguments rather than short-circuit
|
||||
arms (ID-103 extended to the capability probe). `ServerPublishesRunAhead` promoted out of the
|
||||
anonymous namespace, body unchanged, so the red-once can say "this session lacks bit 10" in its own
|
||||
words (ID-102). **It is a pure function because the brief's red-once needs it to be:**
|
||||
`kMGPipeP5eClientWaitRuleLanded` is false today, so a case that only drove `ApplyOne` would pass
|
||||
with or without the conjunct — and keep passing until the integration commit, at which point Magma
|
||||
SIGSEGVs with the lane green. So the case drives a real `DrawVbo` through `ApplyOne` on a
|
||||
`SetCapabilityBits(0)` session and asserts the stamp **at the post-flip value of the constant**.
|
||||
Red-once, deleting `serverPublishesRunAhead &&`:
|
||||
`../MobileGL/MG_Test/Wire/RemoteClientControls.inc:143: Failure / Expected: true / exited 124`.
|
||||
|
||||
**2 · ID-112** (`PipeFill.cpp`, +45 lines after the existing assertion; I did not touch
|
||||
`EmittedCallSuppliesTheWholeField` itself). The old assertion is keyed on the emitter's
|
||||
*subsystem*, so it covered five of seven; `GetBoundVertexArray` and `GetBufferBindingPoint` are
|
||||
outside `kMGPipeP4aFamilySubsystems`. All seven are now named in one list with their own assertion,
|
||||
a size assertion, and a comment saying where a fired assertion sends you (P7/P8, not this table).
|
||||
Red-once, deleting the `GetBoundVertexArray` case:
|
||||
`PipeFill.cpp:2720:23: error: static assertion failed due to requirement
|
||||
'NoPointerBackedRowIsWhollySupplied()': a pointer-backed residual row stopped being pulled (ID-112).`
|
||||
**The pre-existing `NoP4aFamilyFieldIsWhollySupplied` stayed silent on that same edit** — the gap
|
||||
ID-112 names, now measured.
|
||||
|
||||
**3 · ID-116** (generator +394, `.inc` +126, `test.yml` hand-kept 13 rows deleted, one unit case +
|
||||
skip twin). The generator reads `kMGPipeWaitClasses`, `kMGPipeVerbClass` and
|
||||
`kMGPipeClassFieldMask` and emits `kMGPipeAdmittedPullMask` + `MGPipeBarrierPullAdmitted`, with a
|
||||
`static_assert` that every admitted bit is a BARRIER-PULLED field of its verb's class;
|
||||
`--print-admitted` hands CI the same table. Final rule after ID-125/128: `BARRIER_PULLED` ∧ the verb
|
||||
has a stamp row ∧ in the class mask ∧ (statically barriered ∨ retiring phase ≠ P5e ∨ escalated at
|
||||
runtime). Static part: **174 pairs across 23 stamped verbs**. Three new negative controls (each
|
||||
source renamed away must stop the script — a missing source yields a silently **empty** allowlist,
|
||||
which reads as rigour and is blindness) and nine derivation controls. Red-once, dropping the
|
||||
wait-class conjunct: `self-test: 3 admission-derivation control(s) did not hold: unbarriering
|
||||
ReadPixels' op removes every @ReadPixels pair; …` plus the unit case's
|
||||
`GetBoundVertexArray@DrawArrays is admitted on a verb no barriered op stamps`.
|
||||
|
||||
**ID-125.** Implemented as ruled; the phase column is matched as a **token** (`\bP\d+[a-z]*\b`), not
|
||||
a substring, so a `P5` or a future `P5e2` cannot answer for `P5e`. 111 → 174 pairs. All six
|
||||
survivors and all three rejections verified (§Rulings for the sixth). **One consequence you should
|
||||
know:** not one of the seven sticky forwards names P5e (P7, P7/P9, P7/P13, P9), so after ID-125 no
|
||||
sticky forward can produce a `Fatal{` on a stamped verb — they are all admitted.
|
||||
`StrictErrorsAlsoPromotesTheStickyForwards` therefore stopped going red. That is the "check, do not
|
||||
assume" instruction in item 4 paying off. I renamed it
|
||||
`StrictErrorsReachTheStickyForwardsAndNameThemByField` and restated it around the claim that still
|
||||
has teeth — the detector *reaches* them (asserted by `rsp` moving and by the marker naming field and
|
||||
phase), so "did not abort" cannot pass for "never detected". The Fatal half keeps its own case next
|
||||
door on `GetBoundVertexArray`, a P5e row; `StrictErrorsTurnsABarrierPulledReadIntoANamedAbort` still
|
||||
goes red, unchanged.
|
||||
|
||||
**ID-128.** `PipeApply.h/.cpp` gain `MGPipeApplierCurrentRecordIsBarrieredByEscalation()` and its
|
||||
setter — a second `thread_local` defaulting **false**, the answer that admits nothing;
|
||||
`ApplyOne` stamps it as `wireSaysBarriered && MGPipeWaitClassFor(op) == kWaitNone`; the strict arm
|
||||
reads it as disjunct 3. **The marker says which disjunct** (`ADMITTED` vs `ADMITTED-ESCALATED`), in
|
||||
the slot the grammar already had for the reason, so `Fatal{UnmigratedPipeInput` filters are
|
||||
untouched. That is what keeps the lane exact: an `ADMITTED` pair is checked against
|
||||
`--print-admitted`, an escalated one is not — it is a runtime fact about the payload, and widening
|
||||
the static list to hold it would forgive the ordinary draw path too. Red-once, dropping
|
||||
`&& !escalated`: `FieldOwnershipTest.cpp:938: Failure / Actual: false / signal 6` with
|
||||
`Fatal{UnmigratedPipeInput, "GetBoundVertexArray@DrawArrays"} [BARRIER-PULLED,
|
||||
MOBILEGL_IPC_STRICT_ERRORS=1, retires in P5e (Espryt unbarriered), P7 (Magma)]`. Its control is
|
||||
`StrictErrorsTurnsABarrierPulledReadIntoANamedAbort`, the identical pull with the flag at default.
|
||||
|
||||
**4 · ID-117** (`PipeInputs.cpp`). Third state exactly as sketched, both existing arms untouched;
|
||||
`AdmittedBarrierPullOnce` deduped per `(field, verb)` in a static bitset — plain, not atomic, for
|
||||
the file's existing reason (reachable only on the apply thread; `g_residualPulls` beside it is a
|
||||
plain `Uint64`). Red-once, making the strict arm unconditional again:
|
||||
`FieldOwnershipTest.cpp:867: Failure / Actual: false / signal 6`.
|
||||
|
||||
**5 · ID-118.** `PipeCalls.def`: `kWaitNone` → **`kWaitApplied`**. Chosen because the row posts no
|
||||
reply slot (so there is nothing to wait for but the apply, and `gen_pipe.py` refuses a `kWaitReply`
|
||||
row without a slot); because `copy_framebuffer_to_texture` — same `kBlitOrCopy` class — already
|
||||
carries that wait; and because `glCopyImageSubData` is zero per frame in the measured scene.
|
||||
`PipeCatalogueTest`'s census moves in the same commit (9 → 10 applied, offset 24 → 25). Red-once,
|
||||
reverting the row: the allowlist loses `@CopyImageSubData` and `PipeCatalogueTest` goes red on three
|
||||
counts. **After ID-125 the pair is admitted by disjunct 2 as well**, so the allowlist alone no
|
||||
longer sees the revert — I restated the unit assertion to check the wait class itself beside the
|
||||
admission. Both disjuncts hold independently, as ID-128 asked me to confirm.
|
||||
|
||||
**6 · ID-119 / ID-115.** *(a)* `split_log_paths.py` gains `marker_log_paths()` and a `markers` mode
|
||||
driven from ctest's own map: **113 of 113** log-declaring entries read, against 90 for the old
|
||||
`split-logs/` grep — the missing 26 were the `F1.` block, both `NamedBlit` pairs, the four `Ct.`
|
||||
entries and `PersistentMapArm`, i.e. the readback population the allowlist is about. The CI step
|
||||
resets those logs first (a stale file reads as this run's evidence) and runs the census in **both**
|
||||
arms. The **two-sided ratchet** is `markers` + `Harness/strict-expected-markers.txt`: unadmitted
|
||||
marker fails; `ADMITTED` outside `--print-admitted` fails; a pair not in the expected set fails;
|
||||
**and an expected pair that no longer appears fails**, so the lane cannot rot green.
|
||||
*(b)* The old `rsp` check grepped for a counter no entry in that directory emits, testing a sentence
|
||||
true of every possible implementation (the unbarriered arm is `[[noreturn]]` and runs before
|
||||
`++g_residualPulls`). Replaced by an assertion where the counter is: `DirectGLES.Split.StrictArming.`
|
||||
(`MOBILEGL_PIPE_STATS=1`, `PERIOD=1`, own log path, `RESOURCE_LOCK`), asserting
|
||||
`rsp == 0 || rsp >= draws` — the device evidence's shape. Measured window: `draws=1 … rsp=3 vbs=3`.
|
||||
*(c)* New push-only counter `vbs` (`ServerVerbBoundaries`) at `MGPipeServerStampVerbBoundary` behind
|
||||
`Enabled()`; the same entry asserts `vbs > 0`. Deliberately not `rsp`: `rsp` reaches zero when the
|
||||
phase *succeeds*, so a control built on it would fail on the day the debt is paid. The entry skips
|
||||
loudly in the monolith arms and in any lane that is not the counting one
|
||||
(`MGITEST_STRICT_ARMING_LANE=1`); without that second guard it is discovered by `TriangleScenario.*`
|
||||
in three other blocks and asserts on a summary line nobody enabled. The CI step also fails if the
|
||||
arming entry did not run — a positive control that can be skipped away is not one.
|
||||
|
||||
**7 · Magma's lane.** *Why the split and not admitting the row:* `FieldOwnership.def` carries **one**
|
||||
retiring-phase string for both backends, so any rule admitting `GetFramebufferBindingSlot@Clear` for
|
||||
Magma admits it for Espryt, where it is *this phase's* debt — turning exactly the regression fb's
|
||||
handle arm prevents into a warning line. The split costs two entries; the admission costs the gate.
|
||||
A per-backend phase column is a `FieldOwnership.def` schema change, far outside this package.
|
||||
**Finding:** `ctest -L` takes a **regex**, so `-L integration-split` matches a label spelled
|
||||
`integration-split-magma`. I built the briefed spelling first and measured it —
|
||||
`ctest -N -L integration-split` still listed both DirectVulkan entries, i.e. the split looked done
|
||||
in every listing and had not happened. The label is `integration-magma-split`, which no existing
|
||||
`-L` matches. The step asserts red **and** the named marker, so "expected red" cannot decay into
|
||||
"did not run".
|
||||
|
||||
**8 · ID-120.** Struck through in place with a blockquote naming P7/P13 and the argument; code
|
||||
untouched. **Measured, not inherited:** ID-120 says 10 pairs would change; on this head it is **23**
|
||||
(`--print-admitted | grep -c '^GetBufferBindingPointCount@'`). The 10 predates ID-125's widening;
|
||||
the note records the command as well as the number.
|
||||
|
||||
## G1 / monolith impact
|
||||
|
||||
`vbs` and its line are inside `#if MOBILEGL_PIPE_PUSH`; `PipeInputs.cpp` and `PipeApply.cpp` are
|
||||
compiled only under `MOBILEGL_PIPE_PUSH` (the header gains declarations only, which emit no symbol);
|
||||
`PipeFieldOwnership.inc` is included only from `PipeInputs.h`, which its banner keeps out of the
|
||||
pull build's include closure, and nothing there odr-uses the new table; `PipeFill.cpp`'s trip wire is
|
||||
`constexpr` + `static_assert`. **The one shared-code delta is `PipeCalls.def`'s wait class**, and
|
||||
that column is read only on a server publishing `kCapRunAheadApply` — inert until the integration
|
||||
commit. The `flavours` step could not serve as the empirical G1 check because it is already red at
|
||||
my base (above), so this argument is by construction rather than by build.
|
||||
|
||||
G2/G14: the one new non-fork unit case has its skip twin beside the other seven; the new integration
|
||||
case skips loudly in the monolith arms with its reason recorded; the `Wire/` suite is registered only
|
||||
under `MOBILEGL_BUILD_DISAGGREGATED`, so its case needs none.
|
||||
|
||||
**Kimi audit rows:** not applicable — I migrate no field family and retired no apply-thread read of
|
||||
client memory. Every row I touched is left **barriered**; that is the whole of items 3-5.
|
||||
|
||||
## Seams, assumptions, rulings I need
|
||||
|
||||
1. **The expected-marker file must be refreshed by the wave-3 integration commit.** It carries three
|
||||
`ADMITTED-ESCALATED` rows that `pa`/`mv` may retire; the ratchet will name them. That failure is
|
||||
the ratchet working, not breaking.
|
||||
2. **`MG_IntegrationTest/CMakeLists.txt` merge** (per your note): my new block is at the **very end
|
||||
of the file**, after the `NamedBlit` loop, and is the only thing there; my other change in that
|
||||
file is *inside* the `NamedBlit` loop (the `LABELS` variable). `pa`'s `StrictProgramArm` and
|
||||
`mv`'s tiers are in the big disaggregated section above, so the three should not overlap.
|
||||
3. **`test.yml`**: I rewrote the strict step's whole body from `ready=` down, and added one step
|
||||
before "Upload strict lane logs".
|
||||
4. **RULING WANTED — "a verb with no stamp row admits nothing".** That restriction is mine, not
|
||||
ID-125's, and it is the difference between **174** and **491** pairs. The table is read only from
|
||||
`CountBarrierPull`, reachable only after `MGPipeServerStampVerbBoundary`, and the server stamps
|
||||
only `MGP_VERB_OP_LIST`'s ops — so a bit for any other verb is an allowlist row nothing can
|
||||
exercise and nobody can retire. I believe it is right; please confirm.
|
||||
5. **RULING WANTED — the lane count.** ID-128 defines done as 180/180. With item 7 the Espryt lane
|
||||
cannot hold the two Magma entries, so the merged number is `180 − 2 + 1 = 179` on
|
||||
`integration-split` plus `2` on `integration-magma-split`. I did **not** adjust the admission rule
|
||||
to reach 180; wanting 180 on one label means admitting `GetFramebufferBindingSlot@Clear` globally,
|
||||
which I have argued against in item 7.
|
||||
6. I assumed `pa` does not touch `EmittedCallSuppliesTheWholeField` (ID-112 forbids it); if it did,
|
||||
item 2's assertion is what says so.
|
||||
7. Housekeeping: the `flavours` step left a gitignored `build-push/` in my tree. `git status` is
|
||||
clean. I ran the census to `~/w7/p5e-logs/strict-census-gl/` and `strict-census3-gl/`; the shared
|
||||
`strict-census/` is untouched.
|
||||
|
||||
## Is "the strict lane is hard green" now a statement a script can evaluate?
|
||||
|
||||
**Yes — the mechanism is complete, and every part of it is exercised on this branch.** One step now
|
||||
decides all five things the phrase has to mean: (1) every entry completed (ctest rc); (2) no `Fatal{`
|
||||
marker anywhere in the lane — over the log set ctest itself declares, so the 26 entries the old
|
||||
check could not see are in it; (3) every `Admitted{` marker is one the tables admit, compared against
|
||||
the same table the C++ answers from, so shell and runtime cannot drift; (4) no admitted pair appeared
|
||||
and none silently vanished — the two-sided ratchet; (5) strict was actually armed on something that
|
||||
draws — `vbs > 0` on an inproc drawing entry, and the step fails if that entry did not run.
|
||||
|
||||
**What is missing is not mechanism. It is two rows of debt and one flip:**
|
||||
|
||||
- On my head the script evaluates to **RED, correctly**, naming three rows in three lines:
|
||||
`GetProgramForDraw@DrawArrays` (52), `GetBoundVertexArray@DrawArrays` (9),
|
||||
`GetProgramForDispatch@DispatchCompute` (7) — `pa`'s and `mv`'s, both now merged upstream.
|
||||
- **The post-flip arm has never executed.** It is gated on `kMGPipeP5eRunAheadReady`, still false, so
|
||||
the `no-fatal` call is code no CI run has taken. I exercised it by hand; CI has not.
|
||||
- **The expected-marker set is a measurement, and it is mine, not the merged tree's.** The first
|
||||
integration run will fail the ratchet on the rows the merge retires. That is the design — but it
|
||||
means "hard green" is not evaluable by a fresh clone until that refresh lands.
|
||||
- **One place I read a ruling as intent rather than text.** ID-119 says `rsp` "must equal the
|
||||
admitted-marker tally". It cannot: markers are deduped per `(field, verb)` per process and `rsp`
|
||||
counts every pull, so count-equality is not a true statement about either number. I implemented the
|
||||
*set* equality (which pairs `rsp` counts — that is what the ratchet checks) and the *shape*
|
||||
(`rsp == 0 || rsp >= draws`). If you meant literal count equality, the dedupe has to go, and an
|
||||
852-draw frame writes 852 lines.
|
||||
@@ -0,0 +1,215 @@
|
||||
# P5e package `id` — identity: handle-keyed twins, the guard, the two scopes (v1)
|
||||
|
||||
Branch `p5e/id`, base `2fde7034`, head **`0117d157`**, worktree `~/w7/p5e-id`. Five commits, no
|
||||
attribution trailers. Lockstep behaviour is unchanged: `MGPipeBarriered` answers `true` for every
|
||||
record until ra lands, so every site that must one day ask the question already asks it and every
|
||||
answer is today's.
|
||||
|
||||
## 1 What changed, per file (ranges at HEAD)
|
||||
|
||||
| file | ranges | what |
|
||||
|---|---|---|
|
||||
| `MG_Pipe/PipeApply.h` | `747-763`, `813-844` | `MGPipeApplierState::CurrentRecordBarriered` (inside the existing `#if MOBILEGL_BUILD_DISAGGREGATED` block, so the push-monolith layout does not move); opaque `enum class MGPWireOp : Uint16;`; `MGPipeBarriered(MGPWireOp, const void*, const MGPipeApplierState&)`; `MGPipeApplierCurrentRecordIsBarriered()`. |
|
||||
| `MG_Pipe/PipeApply.cpp` | `1215-1238` | both bodies. `MGPipeBarriered` returns `true` (today's rule restated, not a stub); the reader answers the field under split, the constant otherwise. |
|
||||
| `MG_Remote/Server/PipeApplier.cpp` | `1058-1066` | `ApplyOne` stamps the flag from `MGPipeBarriered(...)` before `StampVerbBoundary`/`DecodeAndApply`. |
|
||||
| `MG_Impl/Pipe/SlotAllocator.h` | `176-206`, `222-272` | `MGPipeApplierIsUnbarrieredApply()`, `MGPipeRefuseFrontendKeyedRegistryFromUnbarrieredApply()`; `MGPipeReverseAnnouncementScope` → `MagmaP7AllocatorDebtScope`; both scope comments re-derived for §4.4. |
|
||||
| `MG_Impl/Pipe/SlotAllocator.cpp` | `14-22`, `26-86`, `105-140` | the guard (§2 below), the non-allocator refusal, the renamed depth. Adds `#include <MG_Pipe/PipeApply.h>` (declarations only). |
|
||||
| `MG_Backend/DirectGLES/SlotTables.h` | `61-103`, `176-203`, `218-260`, `292-297`, `336-342`, `405-447`, `464-508`, `588-651`, `665-724`, `761-764` | the composite band (`m_band`, `kHasCompositeBand`, `EntryOrNull`/`IndexOfSlot`/`EntryAt`, `CompositeLiveCount` + two capacity readers); `ForEachLive` re-typed `fn(MGPipeHandle, const BackendPtr&)`; the frontend-keyed half kept as monolith glue, each surface a named Fatal. |
|
||||
| `MG_Backend/DirectGLES/Managers.h` | `469-489`, `534-548`, `1428-1445`, `1840-1855`, `2579-2595` | `NoteStateForHandle`/`StateForHandle` move `BUILD_DISAGGREGATED` → `PIPE_PUSH`; `ForEachLive` handle-arm-only; the three resolver declarations. |
|
||||
| `MG_Backend/DirectGLES/Managers.cpp` | `226-264`, `336-358`, `2966-2978`, `4919-4939`, `9160-9181`, `10842-10862` | death path (§3), §4.2/§4.3 written down, `HandleOfBuffer`'s scope, the three resolvers. |
|
||||
| `MG_Backend/DirectGLES/DirectGLES.cpp` | `8847-8915` | the single `ForEachLive` caller adapted (ruling R2). |
|
||||
| `MG_Backend/DirectVulkan/.../VulkanRenderer.cpp` | `4554-4559`, `4638-4640`, `8983-8995` | scope rename, Magma's three sites. |
|
||||
| `MG_Impl/Pipe/ResourceTracker.h` | `720-728` | scope rename, Magma's fourth site. |
|
||||
| `MG_Test/SanityTest.cpp` | `3413-3418`, `4941-5006`, `5087-5090` | `FakeShaderCsoSlotTable`; `ACompositeHandleDoesNotGrowTheOrdinaryTable`; its G2/G14 skip twin. |
|
||||
| `MG_Test/Wire/RemoteClientTest.cpp` | `1861-1872`, `1887-1927` | `...IsAllowed` deleted; new `...FromTheApplyThreadIsFatalEvenAtTheOldDebtSites`. |
|
||||
|
||||
The three resolvers — `ResolveVaoTwin` / `ResolveTextureTwin` / `ResolveProgramTwin`, each taking
|
||||
`MGPipeHandle` — are `ResolveSamplerCsoTwin`'s shape exactly: record first (a handle with no record
|
||||
is a loud null, never an adopted slot), then `AdoptTwinByHandle`, then a twin if the slot is empty.
|
||||
No frontend touch, no allocator probe, **and no sync** — which serials gate a VAO/texture/program
|
||||
sync belongs to vi/tx2/pg. `ResolveProgramTwin` resolves through the band-aware
|
||||
`PipeShaderCsoRecordForHandle` and adopts into `m_band`: after the rekey a composite's bind is the
|
||||
ordinary path through it, which is why the band had to land in this package.
|
||||
|
||||
## 2 The guard and the two scopes (§4.4, ruling 12)
|
||||
|
||||
`MGPipeRefuseAllocatorFromApplyThread` exempts a probe **iff a named scope is open AND the record
|
||||
being applied is barriered**. A named exemption is a debt the CLIENT'S WAIT pays for — behind a
|
||||
barriered record the client is parked in `WaitForApplied` and its free list and `lifetimeId -> slot`
|
||||
map stand still; behind an unbarriered one the same probe reads memory the client is concurrently
|
||||
mutating, so the value is wrong by construction and `MOBILEGL_IPC_STRICT_ERRORS` is not consulted
|
||||
(rule F). Every record is barriered this phase, so the guard reads as it did at `2fde7034`.
|
||||
`MagmaP7AllocatorDebtScope` exempts only when `ActiveBackendType == DirectVulkan`; the depth itself
|
||||
is **not** backend-keyed (the guard reads the kind once, at the decision — keying the counter would
|
||||
make its meaning depend on a global a test can move between ctor and dtor, `m_counted`'s bug one
|
||||
level out). `MGPipeRefuseFrontendKeyedRegistryFromUnbarrieredApply` is the non-allocator half, for
|
||||
`NoteStateForHandle` / `StateForHandle`, which answer from a frontend `SharedPtr` without ever
|
||||
calling the allocator; same `Fatal{RoleViolation, "MGPipeSlots"}` name, because it is one surface.
|
||||
|
||||
## 3 The death path, and ID-96 answered by measurement
|
||||
|
||||
The NoSession mailbox hop (`Managers.cpp:224-246` at base) and the scope at `:256` are deleted; that
|
||||
arm ran `DestroyByLifetimeId`, i.e. a probe **and a `Free`** in the client's allocator from the apply
|
||||
thread — not a read any barrier could make safe.
|
||||
|
||||
**ID-96: the set of fixtures that lose death delivery is EMPTY.** Method: a probe that aborted in
|
||||
exactly the deleted branch (`EmitObjectDeathRecord` answered `NoSession` **and**
|
||||
`ServerLoopInstance().Running()`) was run over the whole unit lane (2204 entries) and the whole
|
||||
`integration-split` lane (111). It **never fired** (`grep -c P5E-ID-PROBE` = 0 and 0), both lanes
|
||||
green. Analytically: the tree's only server role with no client session is `ServerLoopTest.cpp`'s
|
||||
`ServerFixture` / `EglServerFixture`; its one case that lets a re-keyed frontend object die off the
|
||||
apply thread, `ServerLoopEglTest.FrontendFramebufferDeathDeletesOnTheContextOwner`, is already
|
||||
refused at its FIRST step by P5c's guard, so its `framebuffer.reset()` was unreachable at `2fde7034`
|
||||
too. **Nothing rewritten, nothing deleted** — integrator to confirm at landing.
|
||||
|
||||
§4.2's death moment and §4.3's ABA answer are written into `ReleaseTwinsForWireObjectDeath`'s
|
||||
comment: the ring ordering is the argument, the Gen compare is the proof (forward re-mints, a stale
|
||||
handle resolves to null, a backward generation is refused), so even a skipped death is answered by
|
||||
the forward-Gen reset alone and no wait is added at any delete. Pinned by
|
||||
`AGenerationBehindTheLiveTwinIsRefusedRatherThanAdopted` and the band case's recycle clause.
|
||||
|
||||
## 4 Kimi audit rows
|
||||
|
||||
**List (a), scope construction sites.**
|
||||
- *Retired*: `M:256` (deleted with the mailbox hop).
|
||||
- *Re-homed*: `VulkanRenderer.cpp:4554, :4634, :8986` and `ResourceTracker.h:723` → the renamed
|
||||
`MagmaP7AllocatorDebtScope`. `M:2938` (`BufferImpl::HandleOfBuffer`) →
|
||||
`MGPipeFrontendKeyedRegistryScope` (see ruling R3).
|
||||
- *Left barriered* (unchanged; now exempt only while the record is barriered), vi/sb/pg/tx2/fb's to
|
||||
delete with the probes they wrap: `D:1609 :1734 :2588 :3303 :4236 :4329 :4585 :4926 :4993 :5328
|
||||
:5689 :6166 :6729 :6775 :8837 :9161 :9216 :9695 :10029 :11884` (20) and `M:4544 :5882 :7087 :8481
|
||||
:8717 :9256 :9310 :9709 :10382 :10403 :12949 :13273 :13570` (13).
|
||||
- *Correction to the audit*: list (a) omits `VulkanRenderer.cpp:4554/:4634/:8986`, which construct
|
||||
`MGPipeFrontendKeyedRegistryScope` at base; it attributes Magma's debt to
|
||||
`MGPipeReverseAnnouncementScope` alone. All four sites exist; none was "not found". Test sites
|
||||
`:1883`/`:1885` went with the deleted `...IsAllowed` case; `:1903` is untouched.
|
||||
|
||||
**List (b), frontend pointers held across records.** id owns two rows. `ST:156-167, ST:362-378`
|
||||
(`Entry::stateRef`, `NoteStateForHandle`/`StateForHandle`) is **left, as named monolith glue** per
|
||||
ruling 1 / §5.8, each surface now a named Fatal from an unbarriered apply; what *is* retired is the
|
||||
row's worst form — `ForEachLive` no longer hands a frontend `SharedPtr` out of server memory on
|
||||
every step (`D:8904`). `Managers.h:320-324` + the six registry globals (legacy `m_entries`, raw
|
||||
address key) is left: it is the `MOBILEGL_PIPE_LEGACY_MEMOS` arm, unreachable under a transport.
|
||||
Every other row in list (b) belongs to vi/sb/pg/tx2/fb/ra and is untouched here.
|
||||
|
||||
## 5 Red-once evidence (executed, reverted, verbatim)
|
||||
|
||||
**(1) §4.4 — the exemption stops exempting an unbarriered apply.** Green first (1/1 passed).
|
||||
Revert = `if (MGPipeApplierCurrentRecordIsBarriered())` → `if (true)` in `SlotAllocator.cpp`:
|
||||
```
|
||||
0% tests passed, 1 tests failed out of 1
|
||||
2139 - RemoteGuards.AnAllocatorProbeInsideAnExemptionScopeFromTheApplyThreadIsFatalEvenAtTheOldDebtSites (Failed)
|
||||
../MobileGL/MG_Test/Wire/RemoteClientControls.inc:139: Failure
|
||||
Value of: DiedOfAbort(child) Actual: false Expected: true (exited 0)
|
||||
```
|
||||
Restored → 1/1 passed.
|
||||
|
||||
> **A FALSE GREEN WAS FOUND AND FIXED HERE; other packages should expect the same trap.** The first
|
||||
> version built `TextureObject2D tex(46)` *on the apply thread*. That constructor MINTS a resource
|
||||
> handle, so the child aborted with the same `Fatal{RoleViolation, "MGPipeSlots"}` at the mint and
|
||||
> passed with the guard reverted too. It now builds the texture and the table on the CLIENT thread
|
||||
> and posts only the probe — the `MGL_TEXTURE_GUARD_TEST` shape.
|
||||
|
||||
**(2) §4.3 — skip the Gen reset in the ABA case.** Revert = delete
|
||||
`if (entry.Live && entry.Gen != handle.Gen) entry.backend.reset();` from `GetOrCreate(handle)`:
|
||||
```
|
||||
../MobileGL/MG_Test/SanityTest.cpp:4932: Failure
|
||||
next Which is: (ptr = 0x55884178bd80, value = 4-byte object <EE-FF C0-00>) vs nullptr
|
||||
a successor at a recycled slot inherited its predecessor's twin
|
||||
../MobileGL/MG_Test/SanityTest.cpp:5001: Failure
|
||||
recycled Which is: (ptr = 0x57dcfaad5c50, value = 4-byte object <5A-00 00-00>) vs nullptr
|
||||
a successor at a recycled composite slot inherited its predecessor's driver program
|
||||
```
|
||||
Restored → 2/2 passed.
|
||||
|
||||
**(3) the composite band (extra, beyond the task's two).** Revert = `EntryAt` indexes `m_slots`
|
||||
unconditionally:
|
||||
```
|
||||
../MobileGL/MG_Test/SanityTest.cpp:4967: Failure
|
||||
table.OrdinaryCapacityForTest() Which is: 983044 vs 0u
|
||||
a composite slot grew the ORDINARY table - one program pipeline is ~40 MB of twin entries for a single live program
|
||||
```
|
||||
Restored → 1/1 passed. 983044 entries is the number the band exists to prevent.
|
||||
|
||||
## 6 Gate
|
||||
|
||||
`build` rc=0. **`unit` 2204 / 2204** (base 2203; the one new name is
|
||||
`ACompositeHandleDoesNotGrowTheOrdinaryTable`, real + skip twin). **`isplit` 111 / 111** (exactly
|
||||
base). `gens`: `gen_pipe --check/--self-test`, `gen_pipe_field_ownership --check/--self-test`,
|
||||
`check_include_closure` (4 probes, 0 problems), `gen_pipe_dirty_surface --check/--self-test` all
|
||||
rc=0; `check_doc_citations` prints `CONTRACT-P5.md:524: 'Core.cpp:39' -> ambiguous`, which is
|
||||
**pre-existing** in a file this package does not touch. `strict`: 3% passed, 108 failed of 111 —
|
||||
identical to base.
|
||||
|
||||
**Strict-lane markers, before/after** (first marker per entry; `split-logs` cleared before each
|
||||
run; copies in `~/w7/p5e-logs/split-logs-{before,after}`):
|
||||
|
||||
| `field@verb` | BEFORE | AFTER | owner |
|
||||
|---|---|---|---|
|
||||
| `GetFramebufferBindingSlot@Clear` | 39 | 39 | fb |
|
||||
| `GetBoundVertexArray@DrawArrays` | 14 | 14 | vi |
|
||||
| `GetImageTextureBinding@BindImageTexture` | 13 | 13 | fb |
|
||||
| `GetTextureUnitObject@Clear` | 9 | 9 | tx2 |
|
||||
| `GetTextureObject@CopyImageSubData` | 6 | 6 | tx2 (barriered, §7 allowlist) |
|
||||
| `GetProgramForDispatch@DispatchCompute` | 3 | 3 | pg |
|
||||
| `ValidateProgramName@ShaderStorageBlockBinding` | 2 | 2 | pg (barriered, §7 allowlist) |
|
||||
| *(88 entries have a private log; 2 carry no marker)* | 2 | 2 | — |
|
||||
|
||||
Unchanged is the expected result: id retires no BARRIER-PULLED field — it lands the spine the
|
||||
per-family packages retire them with. The table is richer than `STRICT-BASELINE-2fde7034.md`'s
|
||||
22-entry slice (88 entries now carry a private log) and agrees with it on every shared field, so it
|
||||
supersedes rather than contradicts it.
|
||||
|
||||
**G1 / monolith.** 0/0/0/0 **by construction, not measured**: every new symbol is inside
|
||||
`#if MOBILEGL_PIPE_PUSH` or `#if MOBILEGL_BUILD_DISAGGREGATED`, `CurrentRecordBarriered` sits inside
|
||||
the applier state's existing `BUILD_DISAGGREGATED` block, and the `TwinRegistry` alias is untouched.
|
||||
The p5e gate configures the split flavour only, so neither the pull build nor the `PIPE_PUSH=ON,
|
||||
BUILD_DISAGGREGATED=OFF` push-monolith build was compiled here. The one deliberate widening in that
|
||||
direction is `NoteStateForHandle`/`StateForHandle` moving from `BUILD_DISAGGREGATED` to `PIPE_PUSH`
|
||||
— availability added, never removed — because the re-typed `ForEachLive`'s caller needs them there.
|
||||
|
||||
## 7 Seams assumed from c0e
|
||||
|
||||
- `MGPipeBarriered(MGPWireOp op, const void* payload, const MGPipeApplierState& st)` and
|
||||
`MGPipeApplierCurrentRecordIsBarriered()`, both declared in `MG_Pipe/PipeApply.h`. **c0e owns the
|
||||
final declaration**; the integrator resolves the textual overlap at landing (one hunk).
|
||||
- Two things c0e may spell differently: (a) `Bool CurrentRecordBarriered = true;` on
|
||||
`MGPipeApplierState` is the storage the predicate reads and `ApplyOne`'s "one line" writes;
|
||||
(b) `MGPWireOp` is **opaquely forward-declared** (`enum class MGPWireOp : Uint16;`) rather than
|
||||
pulled in by including `MGPipe.h`, which would have moved that header's include closure.
|
||||
- My three resolver spellings win per the task. Nothing else is assumed: `MGPipeWaitClassFor`,
|
||||
`kCapRunAheadApply`, `kDrawClientArrays` and c0e's other rows are unreferenced here.
|
||||
|
||||
## 8 Rulings I need
|
||||
|
||||
1. **Range widening.** BRIEF-P5E gives id `Managers.h:309-640` and `Managers.cpp:188-372`. The three
|
||||
resolvers are declared beside each family's registry `extern` (`Managers.h:1428, 1840, 2579`) and
|
||||
defined beside each registry global (`Managers.cpp:4919, 9160, 10842`), so they read exactly like
|
||||
`SamplerImpl::ResolveSamplerCsoTwin` instead of needing three forward declarations at `:640`.
|
||||
2. **`DirectGLES.cpp:8847-8915` is outside id's scope** (fb's `:8837-8935`). Re-typing `ForEachLive`
|
||||
is deliverable 1 and its one caller had to move in the same commit or the build breaks; the
|
||||
lambda takes `(MGPipeHandle, twin)` and calls `StateForHandle(fbo)` inside the scope already open
|
||||
at `:8837`, which fb replaces with its reverse index. Confirm or re-land in c0e.
|
||||
3. **"kept under the old scope name"** (TASK-id deliverable 4, `Managers.cpp:2933`): I read "the old
|
||||
scope" as the *surviving* one, `MGPipeFrontendKeyedRegistryScope`. The other reading — leave
|
||||
`HandleOfBuffer` under the renamed Magma scope — would abort Espryt on every indexed draw, since
|
||||
that exemption is now DirectVulkan-keyed. Confirm.
|
||||
4. **Names beyond BRIEF-P5E's G2/G14 list for id** (all `PIPE_PUSH` / `BUILD_DISAGGREGATED`):
|
||||
`MGPipeApplierIsUnbarrieredApply`, `MGPipeRefuseFrontendKeyedRegistryFromUnbarrieredApply`,
|
||||
`MGPipeApplierState::CurrentRecordBarriered`, `BackendSlotTable::CompositeLiveCount` /
|
||||
`OrdinaryCapacityForTest` / `CompositeCapacityForTest` (last two test-only). Extend the list?
|
||||
5. **`StateBackendObjectRegistry::ForEachLive` is handle-arm-only now** — the legacy map fallback is
|
||||
deleted (a frontend-address key has no handle to hand over, and its one caller has always had its
|
||||
own `#if MOBILEGL_PIPE_LEGACY_MEMOS` walk beside the call). A narrowing, not a lost walk.
|
||||
6. **ID-96's empty answer** (§3) — confirm at landing.
|
||||
|
||||
## 9 What I did not do
|
||||
|
||||
- **`SanityTest.cpp:3499-3960, :4061, :4241, :4378` were NOT moved onto the legacy arm or rewritten
|
||||
by handle.** Deliverable 6 inherits that from scout-S7 §6.4, which assumed S7's design (the
|
||||
frontend-keyed members *deleted*). Ruling 1 / §5.8 keeps them as monolith glue, so those cases
|
||||
still compile, still exercise the surface they name, and run on the test's own thread where no
|
||||
guard can fire; moving them would be churn against a base-green count with no gate behind it.
|
||||
Flagged rather than done — a mechanical follow-up on request.
|
||||
- No device work; no strict-lane allowlist edit (`test.yml` is ra's); no `docs/` or ROADMAP row (c0e
|
||||
owns `CONTRACT-P5E.md`). The pull and push-monolith builds were not compiled here (§6).
|
||||
@@ -0,0 +1,237 @@
|
||||
# mv-v1 — the multi-draw path stops reading the frontend VAO
|
||||
|
||||
Branch `p5e/mv`, head `5c777b49`, base `7c6f6886`, tree `~/w7/p5e-mv`. Two commits:
|
||||
`98ea1604` (the migration) and `5c777b49` (the tier lanes, added on the coordinator's ruling —
|
||||
§6b). **`integration-split` is now 176, not 116; `integration-gpu` 1354, not 1294.**
|
||||
|
||||
## 1 Site inventory — what I actually found in `MultiDraw.cpp`
|
||||
|
||||
The task named `MultiDraw.cpp:93-98` and its caller. The read is one helper, but it had **five**
|
||||
call sites, not the two the Kimi audit's row 128 lists (`MD:909, MD:930`):
|
||||
|
||||
| line (base) | caller | what it asked of the bound VAO |
|
||||
|---|---|---|
|
||||
| 413 | `RunIndirect` | presence only (`if (!indexBuffer) return false;`) |
|
||||
| 505 | `RunRebasedDrawElements` | presence + `SyncPersistentMappedRange` / `SyncGpuWrites` / `MappedData()` / `GetSize()` |
|
||||
| 553 | `RunRebasedDrawElements` | `BoundIndexBufferId()` — the restore name |
|
||||
| 717/724 | `FlattenWithCompute` | presence + `EnsureBufferResource(...)->id` + `GetSize()` |
|
||||
| 909 | `DrawElementsBatch` | presence (`BoundIndexBuffer() != nullptr`) |
|
||||
| 930 | `DrawElementsBatch` | `BoundIndexBufferId()` — the restore name |
|
||||
|
||||
So the helper answers exactly **three** questions: *is one bound*, *what GL name is bound (and how
|
||||
big is its store)*, *give me its bytes on the CPU*. That is the shape the migration took.
|
||||
|
||||
**Audit of the other apply-thread frontend reads in this file** (§2 of the task), all left alone:
|
||||
`:46` `GetPrimitiveRestartIndex()` and `:52-53` `IsCapabilityEnabled(PrimitiveRestart /
|
||||
…FixedIndex)` are filled for the draw verbs (no marker at base, none now). `:88`
|
||||
`GetBufferBindingSlot(BufferTarget::DrawIndirect)` in `BoundDrawIndirectBufferId()` is a **latent
|
||||
row and not mine**: `FieldOwnership.def:78` carries it as `BARRIER_PULLED, "P8 (indirect), P9
|
||||
(readback), P13 (transfer)"`. It is unreachable in the lane because this driver resolves the `ext`
|
||||
tier and `RunIndirect` never runs; forcing `MOBILEGL_ESPRYT_MULTIDRAW_MODE=indirect` under the
|
||||
strict lane would abort `GetBufferBindingSlot@DrawArrays`. It retires with P8's indirect row.
|
||||
|
||||
## 2 What changed, per file (commit `98ea1604`; the test registration is §6b / `5c777b49`)
|
||||
|
||||
**`MobileGL/MG_Backend/DirectGLES/MultiDraw.cpp`** (+150/-25, the block at `:94-250` plus the five
|
||||
call sites at `:553`, `:644-670`, `:849-862`, `:1046`)
|
||||
|
||||
* `enum class IndexBufferQuestion { Presence, DriverName, DriverNameAndSize, HostBytes }` +
|
||||
`struct BoundIndexBufferView { Present, Id, Size, HostBytes }` + one resolver,
|
||||
`ResolveBoundIndexBuffer(question, entry)`.
|
||||
* The four question values are **deliberately not nested levels**: each is exactly the work its
|
||||
original call site did, in its original order, so the monolith arm issues the same calls in the
|
||||
same sequence (requirement 3). `DriverName` does not read `GetSize()` because `BoundIndexBufferId`
|
||||
never did; `HostBytes` does not `Ensure` because `RunRebasedDrawElements` never did.
|
||||
* Record arm: `MGPipeApplier().IndexBuffer.Res` via `BufferImpl::ResolveDrawIndexBufferFromRecord`
|
||||
(vi's own accessor, not a new one) → `EnsureBufferResourceForHandle(nullptr, res)->id` for the
|
||||
name, `ResourceWidthForHandle(res)` for the size, `FindBufferResourceForHandle(res)->hostBytes` +
|
||||
`RequireStagedCoverage` for the CPU bytes. **No wire row was added.** This is the identical set of
|
||||
calls `ScopedRestartIndexSubstitution`'s transport arm (`DirectGLES.cpp:8317-8372`) already makes
|
||||
for the single-draw restart rewrite, including the `HasDefinedContent` M-3 rule.
|
||||
* `ResolveSubDrawIndices` takes `Bool hasIndexBuffer` instead of the frontend `SharedPtr`:
|
||||
presence was the only thing it ever asked of it. `FlattenWithCompute` asks twice (Presence, then
|
||||
DriverNameAndSize) so the ensure stays **behind** the `IsCaptureSpanOpen()` check, where it was.
|
||||
|
||||
**`MobileGL/MG_Backend/DirectGLES/Managers.h`** (+32 at `:1096`) and
|
||||
**`MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp`** (-25/+4 at `:524`)
|
||||
|
||||
`BufferImpl::VertexInputReadsRecords()` **moved** from `DirectGLES.cpp:542` to `Managers.h`, body
|
||||
and rationale unchanged, plus a paragraph saying why. `MultiDraw.cpp` is a second translation unit
|
||||
on the same draw path and has to select the *same* arm; the addendum's rule ("state the transport
|
||||
test where you rely on it") is met by a **shared** definition rather than by a second copy of the
|
||||
conjunction that can drift. This is the only delta to shared code.
|
||||
|
||||
### Arm selection, against the addendum's checklist
|
||||
|
||||
* Decided by `BufferImpl::VertexInputReadsRecords()` ⇒ `Transport != Monolith && VertexInputSubsystemEnabled()`.
|
||||
Never by "a handle was noted", never by a null pointer. The null-`Res` test inside the record arm
|
||||
is *"no element buffer bound"*, the same statement as a null frontend slot on the other arm — and
|
||||
it runs **after** the arm has already been chosen.
|
||||
* A missing record on the handle arm is a named refusal, `RefuseMissingIndexBufferRecord` →
|
||||
`Fatal{RoleViolation, "multidraw-index-buffer-arm"}`, shaped on
|
||||
`RefuseNullFrontendTextureOffTheHandleArm`, and entirely under
|
||||
`#if MOBILEGL_BUILD_DISAGGREGATED` so the pull build gains no call (D-P).
|
||||
* Nothing passes a null object into a body that can still read one: on the record arm no frontend
|
||||
object is produced at all, and the three answers are values, not pointers into frontend state.
|
||||
|
||||
## 3 Rows of my family — retired / barriered / not found
|
||||
|
||||
* **Retired:** Kimi audit **row 128** (`MD:909`, `MD:930`, `BoundIndexBuffer()` / `BoundIndexBufferId()`,
|
||||
carrier `IndexBuffer` at `AP:620`) — retired, and with it the three sites the audit did not list
|
||||
(`MD:413`, `MD:505`, `MD:717`), which are the same helper.
|
||||
* **Left barriered (named, with an owner):** `BoundDrawIndirectBufferId`'s
|
||||
`GetBufferBindingSlot(DrawIndirect)` — P8's indirect row, §1 above.
|
||||
* **Not found:** the audit's rows 12/13 (`D:6729`, `D:6768/6777`) are the *arrays* multi-draw and
|
||||
never enter this file, and `PipeApplier.cpp:628` collapses `drawcount == 1` onto the single-range
|
||||
arm — so the nine entries are exactly "an indexed multi-draw whose record carries `NumDraws != 1`".
|
||||
|
||||
## 4 Red-once, verbatim
|
||||
|
||||
**(1) Revert the arm selection.** `if (false /* P5E-MV-RED1 */ && BufferImpl::VertexInputReadsRecords())`,
|
||||
rebuilt, censused. Exactly the nine entries come back, nothing else moves
|
||||
(`~/w7/p5e-logs/strict-census-mv/red1/census.tsv`: 9 × `GetBoundVertexArray@DrawArrays`,
|
||||
7 × `GetProgramForDraw@DrawArrays` — the seven are other `MultiDraw*` entries that were already pa's):
|
||||
|
||||
```
|
||||
[11:41:05] [Linux mgl-srv-apply/FATAL]: MGPipe: Fatal{UnmigratedPipeInput, "GetBoundVertexArray@DrawArrays"} [BARRIER-PULLED, MOBILEGL_IPC_STRICT_ERRORS=1, retires in P5e (Espryt unbarriered), P7 (Magma)]
|
||||
```
|
||||
|
||||
**(2) Make the record lookup miss on the handle arm.** `resource = nullptr` after each by-handle
|
||||
lookup, `MultiDrawScenario.PlainBatchMatchesUnrolledDraws`, split-lane env,
|
||||
`MOBILEGL_LOG_FILE_PATH` set (`~/w7/p5e-logs/strict-census-mv/red2/`). Both entry points abort by
|
||||
name, rc=134:
|
||||
|
||||
```
|
||||
[11:41:59] [Linux mgl-srv-apply/FATAL]: MGPipe: Fatal{RoleViolation, "multidraw-index-buffer-arm"} - RunRebasedDrawElements found no backend resource for the index buffer {2, 0} this batch's record named. The index buffer of this family is MGPipeApplier().IndexBuffer.Res (CONTRACT-P5E §5.1) and the arm is selected by Transport != Monolith AND the vertex-input subsystem bit (§5.8, ID-81); falling back to the frontend VAO's element slot here would draw this multi-draw from whatever the CLIENT has bound now
|
||||
[11:41:59] [Linux mgl-srv-apply/FATAL]: MGPipe: Fatal{RoleViolation, "multidraw-index-buffer-arm"} - FlattenWithCompute found no backend resource for the index buffer {2, 0} this batch's record named. The index buffer of this family is MGPipeApplier().IndexBuffer.Res (CONTRACT-P5E §5.1) and the arm is selected by Transport != Monolith AND the vertex-input subsystem bit (§5.8, ID-81); falling back to the frontend VAO's element slot here would draw this multi-draw from whatever the CLIENT has bound now
|
||||
```
|
||||
|
||||
The `FlattenWithCompute` line does double duty: `FlattenWithCompute` returns before any of this
|
||||
unless `ResolvedTier() == Compute`, and `Auto` never yields `Compute`. It is therefore the proof
|
||||
that `MOBILEGL_ESPRYT_MULTIDRAW_MODE` really selects the tier in §6's sweep below.
|
||||
|
||||
**(3) Both put back.** `git diff` empty against `98ea1604`; rebuild rc=0; the nine entries are back
|
||||
on pa's row (`~/w7/p5e-logs/strict-census-mv/green/census.tsv`), `isplit` 116/116.
|
||||
|
||||
## 5 Strict marker census, before and after
|
||||
|
||||
`~/w7/p5e-logs/strict-census/census2.tsv` (base) vs `~/w7/p5e-logs/strict-census-mv/census2.tsv`
|
||||
(head). Copied to a per-slug directory so pa's reads of the shared one are undisturbed.
|
||||
|
||||
| marker | before | after | owner |
|
||||
|---|---|---|---|
|
||||
| `GetProgramForDraw@DrawArrays` | 61 | **70** | **pa** |
|
||||
| `GetFramebufferBindingSlot@ReadPixels` | 21 | 21 | allowlist (readback) |
|
||||
| `GetBoundVertexArray@DrawArrays` | **9** | **0** | **mv — retired** |
|
||||
| `GetProgramForDispatch@DispatchCompute` | 7 | 7 | **pa** |
|
||||
| `GetTextureObject@CopyImageSubData` | 6 | 6 | allowlist (P7) |
|
||||
| `ValidateProgramName@ShaderStorageBlockBinding` | 2 | 2 | allowlist (P9) |
|
||||
| `GetTextureUnitObject@CopyTexImage2D` | 2 | 2 | allowlist (CopyTex) |
|
||||
| `<no-marker>` (census artifact, addendum §4) | 1 | 1 | — |
|
||||
| total | 109 | 109 | |
|
||||
|
||||
The full `diff` of the two tables is exactly 9 lines out of my row and the **same 9 entries** into
|
||||
`GetProgramForDraw@DrawArrays`: `MultiDrawElementsBaseVertexPaintsEverySubDraw` and the eight
|
||||
`MultiDrawScenario` cases now get past the index buffer and stop on pa's row instead. **No row that
|
||||
is not mine changed count for any other reason, and no new marker appeared.** When pa lands, these
|
||||
nine go green with no further work here.
|
||||
|
||||
## 6 Gate
|
||||
|
||||
Final numbers, at head `5c777b49` (i.e. **with** the new lanes):
|
||||
|
||||
| step | result |
|
||||
|---|---|
|
||||
| `build` | rc=0 |
|
||||
| `unit` | **2250/2250** |
|
||||
| `isplit` | **176/176** (was 116/116; +60 new entries, §6b) |
|
||||
| `gpu` (ID-109) | **1354/1354** (was 1294/1294; the same +60) |
|
||||
| `gens` | all seven rc=0; doc citations only the pre-existing `CONTRACT-P5.md:524` ambiguity |
|
||||
| `strict` (count) | 7/**176** (was 7/116): the 9 moved to pa's row, the 60 new ones land on it too |
|
||||
| `strict` (per-entry census) | table in §5, unchanged — no backend source moved after it was taken |
|
||||
|
||||
## 6b The tier lanes (coordinator's ruling — done, commit `5c777b49`)
|
||||
|
||||
**Evidence first, because an entry that silently resolves to `ext` is worse than no entry.** I
|
||||
temporarily promoted `MultiDraw.cpp`'s two `MGLOG_D` tier lines to `MGLOG_I` (`ResolveTierOnce`'s
|
||||
resolution line and `NoteTierExecuted`'s "first batch executed via tier"), rebuilt, swept, reverted.
|
||||
Every mode resolves to **itself** on this driver — no fallback:
|
||||
|
||||
| mode | `ResolveTier` says | tiers a batch actually executed | cases |
|
||||
|---|---|---|---|
|
||||
| `ext` | `ext -> ext` | `ext` | 17/17 |
|
||||
| `basevertex` | `basevertex -> basevertex` | `basevertex` | 17/17 |
|
||||
| `multiindirect` | `multiindirect -> multiindirect` | `multiindirect` | 17/17 |
|
||||
| `indirect` | `indirect -> indirect` | `indirect` | 17/17 |
|
||||
| `drawelements` | `drawelements -> drawelements` | `drawelements` | 17/17 |
|
||||
| `compute` | `compute -> compute` | `compute` + `basevertex` | 17/17 |
|
||||
|
||||
Each line ends `(driver supports: ext, basevertex, multiindirect, indirect, drawelements, compute
|
||||
(opt-in))`, so **no tier is refused here and none is skipped**. The `compute` row executing
|
||||
`basevertex` as well is `ResolveTierForBatch` demoting the batch shapes the flattening tier declines
|
||||
by design (strips, primitive restart, per-sub-draw base vertex) — the tier was selected, and three
|
||||
of its cases fell through to the unrolled floor, which is the documented behaviour.
|
||||
|
||||
**Registered:** five blocks in `MobileGL/MG_IntegrationTest/CMakeLists.txt:2017-2087`, one per tier
|
||||
`auto` cannot reach, prefix `DirectGLES.Split.MultiDrawTier{BaseVertex,MultiIndirect,Indirect,DrawElements,Compute}.`,
|
||||
labels `integration-gpu;integration-split`, and `MOBILEGL_ESPRYT_MULTIDRAW_MODE` pinned as a ctest
|
||||
`ENVIRONMENT` property (verified on a live entry with `ctest -N -V`, which prints the full
|
||||
split environment plus `MOBILEGL_ESPRYT_MULTIDRAW_MODE=compute`). Filter:
|
||||
`MultiDrawScenario.*:IndexedDrawFamilyScenario.MultiDraw*` minus the client-indices case the d1
|
||||
block already excludes by name — 12 entries × 5 tiers = **60 new entries**, all green.
|
||||
|
||||
* **`ext` is deliberately not a sixth block:** `auto` already resolves to it, so the d1 block *is*
|
||||
the ext lane and a sixth would run it twice. Stated in the block comment so nobody re-adds it.
|
||||
* **The filter is narrowed to the tier-sensitive workload**, this file's own stated rule for an
|
||||
armed `Split.` entry: `IndexedDrawFamilyScenario`'s other five cases are single draws that never
|
||||
enter `MultiDrawImpl`, so five copies of them would be five copies of the d1 lane. One word in
|
||||
`MGL_SPLIT_MULTIDRAW_TIER_FILTER` widens it to the whole scenario (+25 entries) if you prefer.
|
||||
* **`Harness/SplitLogPaths.cmake.in`** gains a matching loop: every `DirectGLES.Split.` entry must
|
||||
own one private log path or `SplitLogPaths.PrivateAndDistinct` is red — it caught this on my
|
||||
first run, the only thing that failed, and it was the guard doing its job. For these lanes it also
|
||||
**repairs addendum §4's blind spot**: their third name segment means `strict_census2.sh` would
|
||||
re-run them without the very pin under test, so their markers are read from
|
||||
`build-split/…/split-logs/<entry>.log` instead (`~/w7/p5e-mv/.p5e/strict-new.sh`).
|
||||
* **Strict-lane effect of the 60:** all 60 abort on `GetProgramForDraw@DrawArrays` — pa's existing
|
||||
row, because `PrepareForDraw` runs before the tier dispatch. **No new marker class, mv's row stays
|
||||
at 0.** Per-entry table: `~/w7/p5e-logs/strict-census-mv/tiers.tsv`.
|
||||
|
||||
## 7 G1 / monolith impact
|
||||
|
||||
* Every record-arm line is under `#if MOBILEGL_BUILD_DISAGGREGATED`. The monolith arm's body is the
|
||||
original text, and the four question values exist so that its *call sequence* is unchanged too.
|
||||
* `gpu` (the `Transport == Monolith` runtime arm, ID-109) is 1294/1294.
|
||||
* **Finding for the integrator, pre-existing and not mine:** the pull flavour
|
||||
(`MOBILEGL_PIPE_PUSH=0`, `MOBILEGL_BUILD_DISAGGREGATED=0`) does not compile at `7c6f6886` either.
|
||||
Syntax-checking the touched TUs with the split build's own compile line and the two flavour
|
||||
defines flipped (`~/w7/p5e-mv/.p5e/pullcheck.sh`): `MultiDraw.cpp` rc=0, `Managers.cpp` rc=0,
|
||||
`DirectGLES.cpp` rc=1 on two identifiers that predate this package —
|
||||
`DirectGLES.cpp:5554` calls `ComputeShaderStorageBlockBindingSignatureOf`, declared only inside
|
||||
`#if MOBILEGL_PIPE_PUSH` (`Managers.h:3154-3160`, pg's), and `DirectGLES.cpp:6675` declares
|
||||
`const Bool keysMatch` inside `#if MOBILEGL_BUILD_DISAGGREGATED` while the `:` else-arm and the
|
||||
use at `:6695` are outside it. Both are verbatim at the base commit (`git show
|
||||
7c6f6886:…DirectGLES.cpp` → `:5575` and `:6696`). So G1 for this package is "no new break, and my
|
||||
own TU is clean"; the tree's pull build is already red and nothing in the gate notices.
|
||||
|
||||
## 8 Seams, assumptions, and what I need from the integrator
|
||||
|
||||
1. **Seam with pa.** My nine entries now stop on `GetProgramForDraw@DrawArrays`. I touched no
|
||||
program row and no file pa works in; my only shared-code edit is `VertexInputReadsRecords()`
|
||||
moving out of `DirectGLES.cpp:524-549` into `Managers.h`, ~4000 lines from pa's region. If pa
|
||||
also moved something out of that `BufferImpl` block, that is the one place to check at merge.
|
||||
2. **Assumed from vi/sb:** `ResolveDrawIndexBufferFromRecord`, `EnsureBufferResourceForHandle`,
|
||||
`FindBufferResourceForHandle`, `ResourceWidthForHandle`, `RequireStagedCoverage` and
|
||||
`GLESBufferResource::hostBytes` mean on the multi-draw path exactly what they mean in
|
||||
`ScopedRestartIndexSubstitution` and in `SyncNeccessaryBuffers`' record arm. Minted nothing.
|
||||
3. **Tier coverage — ruled on, done (§6b).** The five unreachable tiers now have gated entries.
|
||||
Two consequences for the merge: `integration-split` is **176** and `integration-gpu` **1354**,
|
||||
and the strict lane's denominator moves with them (7/176). One judgement call is mine to flag:
|
||||
I narrowed `IndexedDrawFamilyScenario` to its `MultiDraw*` cases — one word to widen.
|
||||
4. **Ruling wanted — the pull build.** §7. Noted as yours to verify; I have not touched it.
|
||||
5. **Not done, deliberately:** `BoundDrawIndirectBufferId` (§1, P8's row — confirmed out of phase
|
||||
scope); no wire row; no change to the tier ladder, the scratch ring, or the restore semantics at
|
||||
`:102-105`, which the migration preserves by answering the *same* GL name from the record.
|
||||
|
||||
Scripts used, all under `~/w7/p5e-mv/.p5e/` (gitignored): `strict_census_mv.sh` (per-slug census,
|
||||
output `~/w7/p5e-logs/strict-census-mv/`), `census9.sh`, `red2.sh`, `tier-sweep.sh`, `pullcheck.sh`,
|
||||
`strict-new.sh` (markers of the 60 new entries, read from their own lane logs).
|
||||
@@ -0,0 +1,234 @@
|
||||
# pa-v1 — the program family leaves the frontend on the draw and dispatch paths
|
||||
|
||||
Tree `~/w7/p5e-pa`, branch `p5e/pa`, base `7c6f6886`, head **`dd899510`**.
|
||||
`53b83469` (MG_Backend, MG_Remote) + `dd899510` (MG_Test). 4 files, +392/−20.
|
||||
|
||||
## 1 Read-site inventory (what is actually there)
|
||||
|
||||
All five accessor sites the kimi index names are accounted for
|
||||
(`GetProgramForDraw` D:4781/5308/5679/5734, `GetProgramForDispatch` D:6126):
|
||||
|
||||
| site (head line) | kimi | at base | now |
|
||||
|---|---|---|---|
|
||||
| `DirectGLES.cpp:6229` `PrepareForDraw` | 91 | unconditional pull | arm-selected (pa) |
|
||||
| `:7032` `BindCurrentTextures()` no-arg, exported at `DirectGLES.h:25` | index D:5308 | unconditional pull | arm-selected (pa) |
|
||||
| `:8145` `PrepareForCompute` | 92 | unconditional pull | arm-selected (pa) |
|
||||
| `:7675` `GetCurrentBackendProgram` | 107 | already gated | pg, untouched |
|
||||
| `:7747` `CurrentProgramMayNeedPerSubDrawBuiltins` | 108 | already gated | pg, untouched |
|
||||
|
||||
The consumers of the hoisted value — **this is where the brief's §3 differs from the tree**:
|
||||
|
||||
- **`SyncCurrentVertexAttributeValues` (kimi 106) is the only one that still genuinely needs the
|
||||
object**: `GetActiveAttributeLocationMask` + `GetAttribType`.
|
||||
- **`ResolveAndBindUnitTextures`' reads are on its LEGACY arm.** `sampledTargetForUnit` is declared
|
||||
*after* tx2's `if (UnitTexturesByHandle()) { … return; }`, so the handle arm never reaches it.
|
||||
§3.2(a) reads as if the miss path still needed serving; it does not — but see §2.
|
||||
- **`BindCurrentTextures`' memo key (kimi 100)** was already by-handle (ID-86); what was left is the
|
||||
unconditional `programKey = currentProgram.get()` load and three `currentProgram ? … : 0` memo
|
||||
stores. Retired.
|
||||
- **`BindCurrentProgramWithResources` (kimi 101–105)** needed no code change: every read is on the
|
||||
`:` side of a `handleArm ? <record> :` pick or inside the `else` of `if (handleArm)`. The one pair
|
||||
that is *guarded* rather than picked — `globalConstants ? … : currentProgram->{GetUBOContentVersion,MapUBO}()`
|
||||
— is unreachable on that arm because the `set_global_constants` refusal above it is `[[noreturn]]`
|
||||
**in the same function**; I added that sentence to its comment rather than restructuring pg's lines.
|
||||
|
||||
Kimi rows: **retired** 91, 92, 106 and the residue of 100. **Left barriered** 109
|
||||
(`ValidateProgramName`, P9) and the XFB row D:1387 (§5.7). **Not as the audit has it**: row 106's
|
||||
`dup` column says "none" — wrong now, the archive carries both fields; that column predates pg.
|
||||
No row of this family was found not to exist.
|
||||
|
||||
## 2 Design
|
||||
|
||||
`DrawProgramFromRecords()` (`:6173`) states the arm once, as a **conjunction**:
|
||||
`ProgramHandleArm() && TextureImpl::UnitTexturesByHandle()`. One hoisted value serves four callees,
|
||||
so the arm must name every consumer, not this family alone; the second conjunct is
|
||||
`BindCurrentTextures`'. **The family bits are independently settable A/Bs** (`0x0ff` is supported),
|
||||
so "the program family is on the handle arm" is *not* "no consumer needs the object" — reading the
|
||||
first as the second is the shape that cost the phase 137 scenarios (ID-107/109/110). Both conjuncts
|
||||
reduce to `Transport != Monolith && <family bit>`, so push-monolith is false here and keeps the
|
||||
frontend hoist token for token. In the **mixed A/B** (program on, textures off) the hoist keeps
|
||||
pulling and the row stays red — deliberate, smallest, and stated at the selector (ruling R-2).
|
||||
|
||||
`SyncCurrentVertexAttributeValues` gains a **second overload** taking `MGPipeHandle cso` (`:2380`,
|
||||
under `#if MOBILEGL_PIPE_PUSH`), per §5.8's "two overloads, not an `#if` inside one body". It makes
|
||||
the same three-part test `SyncCurrentProgramByHandle` makes (`record == nullptr ||
|
||||
Desc.LinkStatus == 0 || Desc.SpirvStatus == 0` → return; ID-88's reason — that is the record-arm
|
||||
spelling of the frontend's `if (!program) return;`), computes the mask from
|
||||
`record->Archive->Link.attribs` with ProgramObject's own rule (`min(size,32)`, bit where the name is
|
||||
non-empty), reads the type from `…->Link.attribTypes[location]` **bounds-checked** (the frontend
|
||||
form is not, because its mask came off the same instance; here the two vectors arrived over a wire),
|
||||
and logs `cso.Slot/Gen` rather than a GL name (`ProgramArchiveSource::Identity`'s rule).
|
||||
**Nothing added to the wire, no record changed, no catalogue regenerated.**
|
||||
|
||||
A live, linked record with **no archive** on that arm is `Fatal{RoleViolation, "program-handle-arm"}`,
|
||||
never a fall-back — the shape of `RefuseNullFrontendTextureOffTheHandleArm`.
|
||||
|
||||
Two deliberate deviations from the wave-3 scout note: I did **not** build a `ProgramArchiveSource`
|
||||
per draw (its `FromRecord` allocates a vector and a map) — the hot path reads `record->Archive->Link`
|
||||
directly — and I did **not** add the two accessors to `ProgramArchiveSource`, because no caller would
|
||||
use them. And the overload **copies** vi's memo arm rather than sharing a tail: a shared tail would
|
||||
rewrite the frontend overload's preprocessed text, which G1 measures at 0/0/0/0
|
||||
(`SyncCurrentProgramByHandle` / `SyncCurrentVAOFromRecords` are the same precedent).
|
||||
|
||||
Also: the ledger at `:6239` now adds `(vertexInputFromRecords ? 0 : 1) + (programFromRecords ? 0 : 1)`
|
||||
— **zero accessor calls per draw** on the record arm — and the stale comment in
|
||||
`PipeApplier::OnLaunchGrid` (`PipeApplier.cpp:782`) saying the compute program is pulled is corrected.
|
||||
|
||||
## 3 Composite and relink
|
||||
|
||||
**Composite.** `ProgramEmit.h:126` takes `drawProgram = ctx.GetProgramForDraw()` (the flattened
|
||||
composite when a pipeline is bound), `:129` acquires its CSO via `AcquireShaderCso`, which `:635`
|
||||
routes through `MGPipeSlots().AllocateComposite` for a composite, and `:180`
|
||||
`MGPipeRouteSetDrawProgram(HandleOnly(drawCso))` names *that* handle — so `set_draw_program` names
|
||||
the composite and pg archives it like any other CSO. Server side `PipeShaderCsoRecordForHandle`
|
||||
(`Managers.cpp:4483`) is band-aware. Green lane evidence: `ProgramPipelineScenario.*` (2 split
|
||||
entries) and `TessellationXfbCaptureScenario.CapturesFromASeparableEvaluationProgramInAPipelineObject`.
|
||||
|
||||
**Relink.** The overload holds no pointer across calls — it re-resolves the record and re-reads
|
||||
`Archive->Link` every draw, and `MGPipeApplyCreateShaderState` replaces `Archive` wholesale — so a
|
||||
draw after a relink reads the new archive by construction. A failed relink is `Desc.LinkStatus == 0`
|
||||
(ID-88) and declines before the archive is consulted.
|
||||
|
||||
**One behavioural delta between the arms, named not hidden:** for a program the frontend reports
|
||||
*unlinked*, the monolith arm may still issue `glVertexAttrib*` current values (its guard is
|
||||
`if (!program)`, not link status) while the record arm returns early. No program is bound in that
|
||||
state on either arm (`SyncCurrentProgram*` binds 0), so it is unobservable.
|
||||
|
||||
**Gap:** the split lane has **no relink scenario**. `RelinkStageSetScenario`, `PostLinkAttachScenario`,
|
||||
`HandleRecycleScenario`, `ImageLoadStoreSsoScenario` are `DirectGLES.` (monolith-arm) entries only,
|
||||
covered by `gpu` 1294/1294. Named as debt, not claimed as record-arm evidence.
|
||||
|
||||
## 4 Red-once, verbatim
|
||||
|
||||
**(1) Arm reverted** (`DrawProgramFromRecords()` → `false`, vertex-attribute call site back on the
|
||||
frontend overload), rebuilt, full census: lane back to **7 passed / 109 red**, marker back at
|
||||
**62 + 7** — not 61 + 7, confirming the coordinator's correction in my own tree.
|
||||
|
||||
```
|
||||
[11:48:24] [Linux mgl-srv-apply/FATAL]: MGPipe: Fatal{UnmigratedPipeInput, "GetProgramForDraw@DrawArrays"} [BARRIER-PULLED, MOBILEGL_IPC_STRICT_ERRORS=1, retires in P5e (Espryt unbarriered), P7 (Magma)]
|
||||
[11:47:57] [Linux mgl-srv-apply/FATAL]: MGPipe: Fatal{UnmigratedPipeInput, "GetProgramForDispatch@DispatchCompute"} [BARRIER-PULLED, MOBILEGL_IPC_STRICT_ERRORS=1, retires in P5e (Espryt unbarriered), P7 (Magma)]
|
||||
```
|
||||
|
||||
The 62nd is `…PersistentMapArm.PersistentCoherentMapScenario.TheMapLandsInTheArmItsLaneDeclares`,
|
||||
taken under its own lane environment (`~/w7/p5e-logs/pa-census-red1/`).
|
||||
|
||||
**(2) Archive lookup forced to answer null** on the handle arm
|
||||
(`if (true /* P5E-PA-RED-ONCE-2 */ || !record->Archive)`), entry
|
||||
`TriangleScenario.AVboBackedTriangleReachesReadPixels`, log `~/w7/p5e-logs/pa-red2.log`:
|
||||
|
||||
```
|
||||
[11:49:20] [Linux mgl-srv-apply/FATAL]: MGPipe: Fatal{RoleViolation, "program-handle-arm"} - SyncCurrentVertexAttributeValues needs the active-attribute mask and the attribute types of ShaderCso {1, 0} and that record carries no server-owned archive. The arm is selected by Transport != Monolith AND the program subsystem bit (CONTRACT-P5E §5.8, ID-81), so this record's create_shader_state was applied under a transport and must have adopted one; the frontend ProgramObject is not a fall-back here, it IS the client memory this row retires
|
||||
```
|
||||
|
||||
**(3) Both put back** → `build rc=0`, `unit 2250/2250`, `isplit 120/120`.
|
||||
|
||||
**(4) The new pin's own negative control (R-16):** with the arm reverted all four
|
||||
`DirectGLES.Split.StrictProgramArm.` entries abort — `GetProgramForDraw@DrawArrays` in the MultiDraw
|
||||
one, `GetProgramForDispatch@DispatchCompute` in the three AtomicCounter ones, each from its own
|
||||
private log.
|
||||
|
||||
## 5 Marker census, before and after
|
||||
|
||||
Both tables are from **my own tree** with a corrected census (`.p5e/census_pa.sh`): the gtest filter
|
||||
and the whole `ENVIRONMENT` come from `ctest -N -V` per entry instead of the last two dot components
|
||||
plus one hard-coded env block — the blind spot addendum §4 names. "Before" is the red-once-1 build.
|
||||
|
||||
| marker | before | after | owner |
|
||||
|---|---|---|---|
|
||||
| `GetProgramForDraw@DrawArrays` | **62** | **0** | **pa** |
|
||||
| `GetProgramForDispatch@DispatchCompute` | **7** | **0** | **pa** |
|
||||
| `GetFramebufferBindingSlot@ReadPixels` | 19 | 67 | allowlist (readback, P7) |
|
||||
| `GetTransformFeedbackProgram@DrawArrays` | 0 | 11 | XFB §5.7 — no P5e package retires it |
|
||||
| `GetBoundVertexArray@DrawArrays` | 9 | 11 | mv |
|
||||
| `GetTextureObject@CopyImageSubData` | 6 | 6 | allowlist (P7) |
|
||||
| `ValidateProgramName@ShaderStorageBlockBinding` | 2 | 2 | allowlist (P9) |
|
||||
| `GetTextureUnitObject@CopyTexImage2D` | 2 | 2 | allowlist (CopyTex) |
|
||||
| `GetFramebufferBindingSlot@Clear` (DirectVulkan) | 2 | 2 | Magma, ID-90 / P7 |
|
||||
| **red / lane** | **109 / 116** | **101 / 116** | |
|
||||
|
||||
**Eight entries went fully green** — exactly my seven dispatch entries plus
|
||||
`MultiDrawScenario.BaseVertexDrawsRejectMalformedArguments`. Three rows moved that are **not mine**,
|
||||
all of them *unmasking* and none of them new reads (my marker fired first at base and hid them):
|
||||
|
||||
- `…@ReadPixels` +48: the draw scenarios that read pixels back.
|
||||
- `GetBoundVertexArray@DrawArrays` +2: both `ClientVertexArrayScenario` entries. **mv's.**
|
||||
- `GetTransformFeedbackProgram@DrawArrays` +11 (7 `TessellationXfbCaptureScenario`, 4
|
||||
`XfbCaptureBufferReuseScenario`): read at `DirectGLES.cpp:1892` from
|
||||
`StartPendingTransformFeedback`, the **last** statement of `PrepareForDraw`, which is why nothing
|
||||
ever reached it. `kBarrierPulled`, retirement "P3b/P4b (Espryt), P7 (Magma)", and §5.7 calls it
|
||||
"an object row no package retires". **Missing from the addendum's allowlist table** (R-4).
|
||||
|
||||
`GetFramebufferBindingSlot@Clear` (DirectVulkan `NamedBlit.F1WireScenario.*`) is **identical before
|
||||
and after in my census**: a census-method artefact of the shared script (those entries' real lane is
|
||||
Magma; the shared script re-ran them as DirectGLES), not anything I caused. Out of scope (ID-90).
|
||||
|
||||
## 6 Gate
|
||||
|
||||
| step | result |
|
||||
|---|---|
|
||||
| `build` | rc=0 |
|
||||
| `unit` | **2250 / 2250** |
|
||||
| `isplit` | **120 / 120** (116 + four new pin entries) |
|
||||
| `gpu` | **1294 / 1294** (run twice, before and after the pin commit; the pin is `integration-split`-labelled so the count is unchanged) |
|
||||
| `gens` | all seven rc=0; `check_doc_citations` rc=0 with 3 pre-existing problems in `CONTRACT-P5.md`, a file I did not touch |
|
||||
| `strict` | 19 passed / 101 failed of 120 (was 7 / 109 of 116); per-entry census §5 |
|
||||
| `flavours` (ID-124) | **rc=1 — both halves pre-existing, proved below** |
|
||||
|
||||
`flavours` printed `pull ARM CHECK FAILED (compile_commands says MOBILEGL_PIPE_PUSH=1)` and
|
||||
`nodisagg build rc=1 (726 TUs)` with two errors, `ComputeShaderStorageBlockBindingSignatureOf`
|
||||
(`:5749`) and `keysMatch` (`:6981`). `.p5e/nodisagg_base_tu.sh` compiles the **base revision's**
|
||||
`DirectGLES.cpp` with the `nodisagg` flavour's own command from its `compile_commands.json` and gets
|
||||
`rc=1` with **the same two errors and no others**. Cause of the second is in the base text:
|
||||
`const Bool keysMatch =` sits inside `#if MOBILEGL_BUILD_DISAGGREGATED` (base `:6695`) while
|
||||
`if (!keysMatch || …)` does not. That is tx2's line, inside the block pa edits; I left it rather
|
||||
than fixing another package's line under an already-red gate (R-7).
|
||||
|
||||
## 7 G1 / monolith impact
|
||||
|
||||
Every added token is inside `#if MOBILEGL_PIPE_PUSH` / `#if MOBILEGL_BUILD_DISAGGREGATED`, except
|
||||
three constructs copied deliberately from **vi's already-cleared shape**: the
|
||||
`inline Bool DrawProgramFromRecords()` selector with the `#if` inside it (vi's
|
||||
`VertexInputReadsRecords`), the `const SharedPtr<ProgramObject> noFrontendProgram;` local (vi's
|
||||
`noFrontendVao`), and the `x ? noFrontend : MGB_CTX->Get…()` ternary — all three constant-fold to
|
||||
the pre-change expression in a pull build. No other shared-code delta; the push-monolith arm takes
|
||||
the frontend branch everywhere, token for token. **I did not run `symbol_report.py`** (no pull
|
||||
baseline here, and the flavour does not build at the base either way); the evidence I do have is
|
||||
§6's: base and head fail `nodisagg` with the same two pre-existing errors, so my diff added no
|
||||
pull-build text that fails to compile.
|
||||
|
||||
## 8 Rulings wanted
|
||||
|
||||
- **R-1** `Fatal{RoleViolation, "program-handle-arm"}` follows `…OffTheHandleArm`'s
|
||||
`"texture-handle-arm"`. Confirm the vocabulary (alternative: `Fatal{UnmigratedVerb, "create_shader_state"}`).
|
||||
- **R-2** The hoist's second conjunct. Keep the mixed A/B pulling, or have tx2 give
|
||||
`sampledTargetForUnit` an archive arm so the conjunct can go?
|
||||
- **R-3** The new `DirectGLES.Split.StrictProgramArm.` lane (4 entries, `integration-split` only,
|
||||
private log paths). It exists because **nothing gated my marker** — pg declared this red-once and
|
||||
it never landed. mv and gl will want to extend it and all three of us touch
|
||||
`MG_IntegrationTest/CMakeLists.txt`, so **expect a conflict** and consider re-homing it to the
|
||||
integration commit. Name, labels and scenario choice are yours to overrule.
|
||||
- **R-4** Add `GetTransformFeedbackProgram@DrawArrays` (11) to the allowlist table in the addendum /
|
||||
`STRICT-WORKLIST.md`; §5.7 already rules it out of P5e.
|
||||
- **R-5** Pre-existing, not mine: on the **dispatch** path `BindCurrentTextures`' by-handle memo key
|
||||
uses `st.DrawProgram` although the caller's program is `st.DispatchProgram`. Benign today (the
|
||||
by-handle resolution does not consult the program at all, so it only over-keys) but it is a key
|
||||
naming the wrong row.
|
||||
- **R-6** `~/w7/notes/tools/p5e_gate.sh` was edited **while my `gpu` run was reading it** (mtime
|
||||
11:55:45, new `flavours` step). The ctest log is unaffected (1294/1294) but the driver printed a
|
||||
parse error from the half-written file; I ran `flavours` from `.p5e/p5e_gate_snapshot.sh`. Pin the
|
||||
driver for the wave.
|
||||
- **R-7** Two `flavours` findings that are the integrator's: (a) the `pull` arm cannot exist as
|
||||
specified — `MOBILEGL_BUILD_DISAGGREGATED=ON` forces `MOBILEGL_PIPE_PUSH=ON`
|
||||
(`CMakeLists.txt:496-500`), so only `nodisagg` is a real pull build; (b) `nodisagg` is red at
|
||||
`7c6f6886`. Both are one-line fixes; say the word and pa takes them.
|
||||
|
||||
## 9 What I did not do
|
||||
|
||||
- No device run, no adb, no push, no merge; no other tree touched.
|
||||
- No accessors added to `ProgramArchiveSource`, no shared-tail refactor of
|
||||
`SyncCurrentVertexAttributeValues` (§2, G1).
|
||||
- No DirectVulkan `GetProgramForDraw` sites (`VulkanRenderer.cpp:6384/6815/6853/7424/7476`): Magma
|
||||
keeps the lockstep for all of P5e (ID-90).
|
||||
- No relink scenario added to the split lane (§3's gap).
|
||||
- Left in the tree: `build-nodisagg/` and `build-pull/`, both untracked, created by the `flavours`
|
||||
step (which `rm -rf`s them itself on the next run).
|
||||
@@ -0,0 +1,198 @@
|
||||
# pg — programs (P5e wave 2), v1
|
||||
|
||||
Branch `p5e/pg`, head **4d1499ef**, base **f6cfcbd3**. 3 commits, 18 files, +2071/-316.
|
||||
Gate: build 0 · unit **2210/2210** · integration-split **111/111** · gens all rc=0 ·
|
||||
`one` on the six named scenarios **212/212**. Strict lane run before AND after (§5).
|
||||
|
||||
## 1 What changed, per file
|
||||
|
||||
| file | region | what |
|
||||
|---|---|---|
|
||||
| `ProgramArtifactsCodec.{h,cpp}` | header note, `:242` note, +55 tail | names the skipped member + reads the libc++ caveat (§2); `ProgramArchive`, `kProgramArchiveMaxStages`, `Encode/DecodeProgramArchive` — the FRAME `[stageCount][stages][codec stream]`, bounded before it multiplies, refusing a stage count that disagrees with the module count |
|
||||
| `MG_Pipe/PipeApply.h` | `:41-52`, `:384-420`, `:1327-1345` | `ProgramArchive` fwd-decl; `MGPipeShaderCsoRecord::Archive`; `MGPipeApplyCreateShaderState`'s 4th argument |
|
||||
| `MG_Pipe/PipeApply.cpp` | `:2854-2918`, `:3000-3060` | `MGPipeApplySetProgramBindings`'s body; the create ADOPTS the archive and clears the three tails + `Signature`, advancing `BindingsSerial` |
|
||||
| `MG_Pipe/PipeRoute.{h,cpp}` | escape table + 2 sites | the FIFTH escape (§7.3); `CreateShaderState` grows the stage list; `MGPipeRouteSetProgramBindings` |
|
||||
| `MG_Remote/Client/WireTables.cpp` | `:488-600` | the create frames the archive and counts its bytes into PipeStats; new `Wire_Escape_SetProgramBindings` (three tails, per-name SEG_STAGE staging) |
|
||||
| `MG_Remote/Wire/PipeWireCodec.cpp` | the two arms | decodes onto the heap into the record's own archive; op 80 resolves and NUL-checks every name span and calls the applier |
|
||||
| `MG_Impl/Pipe/ProgramEmit.h` | `:90-110`, `:106-180`, `:215-330` | `MGPipeStorageOverrideSignatureEntry`; `EmitProgramBindings` + latch; `Desc.LinkStatus`; the stage list; the bindings latch cleared on re-issue |
|
||||
| `Managers.h` | `:2341-2480` new + 6 signatures | `ProgramArchiveSource`, `ProgramBuildSource`, `ProgramHandleArm()`, `m_syncedBindingsSerial`, `ProgramBlockBindingFromRecord` / `ProgramSamplerUnitFromRecord` |
|
||||
| `Managers.cpp` | `:745`, `:10913-11060`, `:11123-11370`, `:11907-13400` | the source's two constructors and its accessors; every helper of the build re-typed; `SyncToBackendFromSource` + the two public heads; the seam stub deleted |
|
||||
| `DirectGLES.cpp` | `:4097`, `:4230-4620`, `:4800-4830`, `:5460-5800`, `:5900-6030`, `:6400-6430` | the handle stash; `ResolveGlobalConstantsRecordForHandle` + the MapUBO refusal; `ResolveFragColorBroadcastCount`'s policy; `SyncCurrentProgramByHandle`; both Prepare lines; `BindCurrentProgramWithResources`; `GetCurrentBackendProgram`; `CurrentProgramMayNeedPerSubDrawBuiltins` |
|
||||
| tests | `ProgramEmitTest` +4 cases; 5 files mechanical | §7.5 |
|
||||
|
||||
**The one-body decision (G1).** `SyncToBackend`'s ~1070-line body is written ONCE against a
|
||||
reference `src` whose TYPE is `PrgramImpl::ProgramBuildSource` — `ProgramArchiveSource` in a push
|
||||
build, `ProgramObject` in a pull build. The view's accessors carry ProgramObject's names one for
|
||||
one, so the pull build compiles the same text through the same accessors. The alternative was an
|
||||
`#if`-duplicated 1100-line body. **Exact pull deltas: §6.**
|
||||
|
||||
## 2 Codec completeness (CONTRACT-P5E §5.5)
|
||||
|
||||
The skipped member is **`LinkArtifacts::program`**, the live `SharedPtr<glslang::TProgram>` that
|
||||
`VisitFields` omits (57 of 58). **Proven unread by either twin, by closed grep:** every read in
|
||||
the tree is inside `ProgramLinkTask.cpp` (`DoReflection`) plus the three `reset()` sites;
|
||||
`MG_Backend/` contains none, and `ProgramTranslationCache` asserts it null at insert. It could not
|
||||
be carried in any case — it points into a glslang arena no archived instance owns.
|
||||
`ProgramArtifactsCodec.cpp:242`'s "libc++ caveat" is about the **struct-size ECHO**, not a member:
|
||||
under the NDK's unpinned branch the word is 0, which is exact for an in-process split (one build
|
||||
writes and reads) and becomes a real check at P6's process boundary. Both verdicts are written
|
||||
where they were asked for.
|
||||
|
||||
## 3 Kimi audit rows 91-110
|
||||
|
||||
**Retired** (record/handle answers them now): 93 (`Desc.LinkStatus`/`SpirvStatus`), 94
|
||||
(`ResolveProgramTwin`), 96 (`record.Serial`/`BindingsSerial`), 97 (`record.Signature`), 98
|
||||
(`SyncToBackendByHandle`), 99 (`ResolveGlobalConstantsRecordForHandle`), 101, 102
|
||||
(`Desc.GlobalUboSize`/`GlobalConstantsVersion`), 103 (**`MapUBO` is Fatal now**, gap G-C), 104
|
||||
(`ProgramBlockBindingFromRecord`), 105 (`BindingsSerial` + `ProgramSamplerUnitFromRecord`), 107,
|
||||
108, 110 (handle arm; kept as the monolith stamp).
|
||||
|
||||
**Left pulled, and why:** 91/92 (`GetProgramForDraw`/`ForDispatch` — my sync no longer reads them,
|
||||
but the accessor CALL stays for vi's and tx2's consumers, §4.3); 100 (`BindCurrentTextures`' memo —
|
||||
tx2's line range, §4.1); 106 (vi's); 95 (`MOBILEGL_PIPE_LEGACY_MEMOS`, unreachable under a
|
||||
transport); **109 left barriered BY CONTRACT §5.5** — `GetBackendProgramId` is a GL-thread entry
|
||||
point (P9) and `ShaderStorageBlockBinding` is reached from the barriered
|
||||
`set_storage_block_binding` (ID-85, pg's trailing item).
|
||||
|
||||
**Not found: none** — all twenty rows exist at this head.
|
||||
|
||||
**The five scope sites → three retired, two kept.** `ResolveGlobalConstantsRecord`,
|
||||
`SyncCurrentProgram` and `BindCurrentProgramWithResources` are unreachable under a transport (the
|
||||
scopes stay as the monolith glue's, ruling 1); the other two are row 109's contract exceptions.
|
||||
|
||||
## 4 Red-once evidence (executed, quoted verbatim, reverted)
|
||||
|
||||
**(1) Empty the applier's block-binding tail.** The two named scenarios are NOT in
|
||||
`integration-split` (they are `DirectGLES.*`, the monolith lane), and with the tail emptied the
|
||||
split lane stays **111/111 green** — no split scenario binds a named uniform block to a non-zero
|
||||
point. The statement moved to the unit case the brief also names:
|
||||
```
|
||||
../MobileGL/MG_Test/Pipe/ProgramEmitTest.cpp:894: Failure
|
||||
Which is: 0
|
||||
Which is: 3
|
||||
[ FAILED ] ProgramEmit.TheThreeBindingTailsAreWholeSetsAndAReIssuedCreateDropsThem
|
||||
```
|
||||
**(2) Blob refs at Size 0, companion pointers removed** (decoder passes `nullptr,nullptr,nullptr`);
|
||||
`Split.TriangleScenario.AVboBackedTriangleReachesReadPixels` aborts:
|
||||
```
|
||||
[Linux mgl-srv-apply/FATAL]: MGPipe: Fatal{ProtocolCorruption} create_shader_state {slot=1, gen=0}: the record declares no blobs and carries no artefacts (stages=0x11, globalUboSize=0, bound 16777216)
|
||||
```
|
||||
**(3) The frontend-keyed resolution back, id's hook forcing "unbarriered".** `PrepareForDraw`
|
||||
routed to `SyncCurrentProgram` + `MGPipeApplierSetCurrentRecordBarriered(false)` at its top —
|
||||
ID-102 kept: the probed action IS the registry lookup, not an object built on the apply thread.
|
||||
```
|
||||
[Linux mgl-srv-apply/FATAL]: MGPipe: Fatal{RoleViolation, "MGPipeSlots"} - the apply thread called MGPipeSlots().HandleOf. With an active transport the client slot allocator is client-only memory (CONTRACT-P5C §3.1, rule E; CONTRACT-P5E §4.4): a handle arrives already minted in a record, and a server that resolves or mints one off a frontend object's lifetime id is reading memory that will not exist on its side of a real split. A named exemption scope admits it only while the record being applied is BARRIERED (barriered=0) and, for Magma's P7 debt, only on a DirectVulkan server
|
||||
```
|
||||
**(4) `strict` names `GetProgramForDraw@draw_vbo` — NOT DEMONSTRABLE AT THIS HEAD**, and the
|
||||
reason is structural rather than a miss: see §5. The marker is in NEITHER table.
|
||||
**(5) The global-constants record declines under run-ahead** (what forcing bit 12 off does to the
|
||||
record arm); 8 split entries abort:
|
||||
```
|
||||
[Linux mgl-srv-apply/FATAL]: MGPipe: Fatal{UnmigratedVerb, "set_global_constants"} - the ShaderCso record {1, 0} does not answer the default uniform block for a draw of a program that declares 16 bytes of it, and MapUBO() is the client's live scratch array
|
||||
```
|
||||
|
||||
### ID-87's measurement — numbers, not an argument
|
||||
|
||||
`EncodeProgramArchive` instrumented at the one place the bytes exist; whole split lane, **80
|
||||
links**, then reverted:
|
||||
```
|
||||
us: min=3.2 p50=4.5 p90=5.4 max=6.4 mean=4.6
|
||||
bytes: mean=2516, max observed 6070
|
||||
```
|
||||
PipeStats over `TriangleScenario.*` independently: `cso-blob-bytes = 4538` for 2 links.
|
||||
**Links per steady frame = 0** — the re-issue latch is `GetLinkVersion()`, which only a real
|
||||
`glLinkProgram` moves, so the cost lands on loading frames. Slope ≈ **1 µs per KB**, so ruling 8's
|
||||
0.2 ms/frame trigger needs ~200 KB of archive linked in ONE frame (~33 of the largest measured).
|
||||
|
||||
**The half ID-87 actually asked for — MC + a shader pack on the Redmi — IS NOT DONE:** no device
|
||||
here and adb is forbidden by the package instructions. These are lavapipe with the lane's small
|
||||
programs, and I will not extrapolate a ruling trigger from a 6 KB sample. **Blocker for declaring
|
||||
ruling 8 settled**: run the device arm at the phase gate, or land lazy-encode as a precaution.
|
||||
|
||||
## 5 The strict lane, before and after
|
||||
|
||||
Run on this tree at **f6cfcbd3** and at **4d1499ef**. Both: **108/111 failed, 3 passed**; 88 of
|
||||
111 entries keep a private log (the ID-53 baseline saw 22 — the per-entry log path now covers the
|
||||
whole lane, so this is a wider slice than `STRICT-BASELINE-2fde7034.md`'s).
|
||||
|
||||
| marker | before | after | owner |
|
||||
|---|---|---|---|
|
||||
| `GetFramebufferBindingSlot@Clear` | 39 | 39 | fb |
|
||||
| `GetBoundVertexArray@DrawArrays` | 14 | 14 | vi |
|
||||
| `GetImageTextureBinding@BindImageTexture` | 13 | 13 | fb |
|
||||
| `GetTextureUnitObject@Clear` | 9 | 9 | tx2 |
|
||||
| `GetTextureObject@CopyImageSubData` | 6 | 6 | tx2/fb (trailing) |
|
||||
| `GetProgramForDispatch@DispatchCompute` | 3 | 3 | **pg**, blocked on tx2 (§4.3/§7) |
|
||||
| `ValidateProgramName@ShaderStorageBlockBinding` | 2 | 2 | **pg**, allowlisted trailing (ID-85) |
|
||||
|
||||
**IDENTICAL, and that is the honest result.** Each entry aborts on its FIRST pulled row, and in
|
||||
every entry of this lane a framebuffer, VAO, texture or image row precedes any program read — so
|
||||
no program field of mine was ever first, none could disappear, and none surfaced behind one.
|
||||
`GetProgramForDraw@draw_vbo` appears in neither. This lane will only measure this family once fb,
|
||||
vi and tx2 have landed; what pg can show is the three executed Fatals above.
|
||||
|
||||
## 6 G1 / monolith impact — the deltas, named
|
||||
|
||||
Every new symbol is under `MOBILEGL_PIPE_PUSH` / `MOBILEGL_BUILD_DISAGGREGATED`. **I could not run
|
||||
the comparator** (`symbol_report.py` needs pull builds of base and head; the gate script has no G1
|
||||
step). The deltas the pull build WILL see, from the diff:
|
||||
|
||||
1. `SyncToBackend(const SharedPtr<ProgramObject>&)` keeps name and signature; its body gains
|
||||
`const ProgramBuildSource& src = *stateProgramObject;` and every read becomes `src.X()`. Same
|
||||
loads, same inlining **expected — an expectation, not a measurement**.
|
||||
2. `CacheResourceLocations`: `(const SharedPtr<ProgramObject>&)` → `(const ProgramObject&)` —
|
||||
mangled-name change + a dropped `SharedPtr` deref.
|
||||
3. `RebindImageUniformsToFrontendUnits`: likewise, and it loses one null test the caller already made.
|
||||
4. The other six helpers keep their signatures exactly (`ProgramBuildSource` IS `ProgramObject` there).
|
||||
|
||||
Expected pull report: **2 renamed + 2 resized, 0 added, 0 removed**, all in one function family.
|
||||
**Ruling wanted:** accept those four, or ask for the `#if`-duplicated body. I recommend accepting —
|
||||
the duplicate is 1100 lines two arms would have to be kept in step by hand for ever.
|
||||
Push + `Transport=monolith` keeps its frontend arms through
|
||||
`ProgramHandleArm() = Transport != Monolith && ProgramSubsystemEnabled()`.
|
||||
|
||||
## 7 Seams, assumptions and rulings needed
|
||||
|
||||
1. **tx2 — `BindCurrentTextures`' memo key (ruling 6 / ID-86).** Its range, so I left a comment on
|
||||
`ResolvedTextureBindingMemo` instead of editing. **What I expect:** the four program fields
|
||||
replaced on the handle arm by `{DrawProgram.Slot, .Gen, record Serial, BindingsSerial}`, AND-ed
|
||||
with tx2's `SamplerViewsSerial`. Both serials are needed — a relink with unchanged texture
|
||||
resolution still hands the twin new unit assignments.
|
||||
2. **tx2 — `ResolveAndBindUnitTextures`/`sampledTargetForUnit` (`:4834-4948`).** BRIEF gives the
|
||||
range to tx2, §5.5 gives the function to pg; I left it to tx2.
|
||||
`PrgramImpl::ProgramSamplerUnitFromRecord(record, location)` and `ProgramArchiveSource`'s
|
||||
uniform-type accessors are public for it.
|
||||
3. **vi + tx2 — `GetProgramForDraw`/`ForDispatch`.** `:4781` and `:6126` are my lines but their
|
||||
consumers are vi's `SyncCurrentVertexAttributeValues` and tx2's `BindCurrentTextures`; the call
|
||||
can only become conditional once both stop taking a `SharedPtr<ProgramObject>`.
|
||||
4. **sb — the UBO loop.** I own `:5463` (the block binding, from the record's first tail) and left
|
||||
`:5464-5497`; `binding` is still a `Uint` in the same index space.
|
||||
5. **Files touched outside my listed scope, all mergeable:** `PipeWireCodec.cpp` (op 80's own
|
||||
`case` — `PipeApplier.cpp` has no `OnSetProgramBindings`; every non-verb row's dispatch lives in
|
||||
`ApplyChecked`, so the task file's pointer is an estimate); `PipeCatalogueTest.cpp` and
|
||||
`RemoteClientTest.cpp` (escapes 4→5, total 38→39 — op 80's `gMGPipeContext` slot STAYS null, so
|
||||
those pins are unchanged); `PipeWireCodecTest.cpp` (the create stages the FRAMED archive);
|
||||
`ResourceEmitTest.cpp`/`CompositeResolverTest.cpp` (the create's 4th argument, `nullptr`).
|
||||
6. **RULING: the emission ORDER is the opposite of the draft's note.** `MGPipeTypes.h`'s
|
||||
`MGPProgramBindings` comment says "Emitted BEFORE create_shader_state". That is wrong against
|
||||
the applier the same contract specifies: a re-issued create CLEARS all three tails, so bindings
|
||||
published ahead of it are wiped. I emit them AFTER the create at the same validate point and
|
||||
said so in both files. **That c0e comment still says the wrong thing and needs a one-line fix.**
|
||||
7. **RULING: one signature authority per arm** — the handle arm stamps and compares the CLIENT's
|
||||
`record.Signature` verbatim, so the two commutative hashes never have to stay bit-identical.
|
||||
Confirm, or the equality needs a test that can reach both (nothing in `MG_Test` can today:
|
||||
MG_Backend includes nothing from MG_Impl).
|
||||
8. **`MGPipeApplyCreateShaderState` grew a fourth argument, undefaulted**, on PipeRoute.h's stated
|
||||
reasoning; five call sites moved, three in other packages' test files.
|
||||
9. **ID-87 is not settled** (§4).
|
||||
|
||||
## 8 What I did not do
|
||||
|
||||
* `set_storage_block_binding` by `ShaderCso` — the TRAILING item, explicitly not this package
|
||||
(ID-85); `ShaderStorageBlockBinding`'s monolith body is kept verbatim.
|
||||
* `BindCurrentTextures`' memo and `ResolveAndBindUnitTextures` — tx2's ranges (§7.1-2).
|
||||
* The two `GetProgramFor*` accessor calls — blocked on vi and tx2 (§7.3).
|
||||
* The composite uniform-mirror fire rate (BRIEF §5) — still unmeasured. The mechanism is the latch
|
||||
on `(backendStateVersion, blockBindingVersion)` and both setters' equality bail-outs, so a mirror
|
||||
re-setting unchanged values emits nothing; that is the mechanism, not a measurement.
|
||||
* The G1 comparator run (§6) and ID-87's device arm (§4).
|
||||
@@ -0,0 +1,200 @@
|
||||
# ra — the wait rule, present credit, server-owned `gPipeInputs` (P5e)
|
||||
|
||||
Branch `p5e/ra`, head **48b2f56e**, based on **f6cfcbd3** (landed wave 1). Tree `~/w7/p5e-ra`.
|
||||
Five commits; the mechanism is complete and **INERT** — `kMGPipeP5eRunAheadReady` is still `false`,
|
||||
so `RunAheadArmed()` is false everywhere and every gate is exactly as green as the base.
|
||||
|
||||
## 1 Per deliverable: what is wired, and what it does when the bit flips
|
||||
|
||||
| # | deliverable | wired | at the flip |
|
||||
|---|---|---|---|
|
||||
| 1 | the predicate | c0e's `MGPipeBarriered` (all three clauses) is the server's; ra adds the CLIENT's spelling, `ClientVerbIsBarriered(verb, ctx*)` in `PipeFill.cpp` | both roles answer the same for the same record: static `WaitClass` column, XFB-active, (client arrays: vi refuses at emit) |
|
||||
| 2 | the client wait rule | `EmitAndWaitTails` switches on `MGPipeWaitClassFor(op)` under `RunAheadArmed()`, **replacing** the `BatchWaits` skip; `ReleaseFillPins()` after a barriered apply; present credit in `EmitPresent`→`AcquirePresentCredit`; `OnPresent`→`ReturnPresentCredit`; forced waits before every `Server*` EGL forwarder and in `glFinish`; drains at every wait exit incl. the stage bell | `kWaitNone` rows publish and return; the steady draw path stops waiting; presents pace on a credit of 1 |
|
||||
| 3 | `resource_subdata` buffer half | `MGPipeSubDataWantsItsReply(record)` — ONE predicate, read by `MGPipeRouteResourceSubData` and by `Wire_ResourceSubData`; the row keeps `kReplySlot`, the server still posts | the 64 KB persistent-map push stops being a hidden round trip per block |
|
||||
| 4 | `gPipeInputs` ownership | `fillOwed = barriered` in `MGPipeValidateForVerb` gates the serial bump, `SetVerb`, `MGPipeServerClearVerbBoundary` and the whole of step 4; `MGPipeNoteFrontendMutation`/`MGPipeLeaveVerb` return; `CountBarrierPull` aborts unconditionally under an unbarriered record; the layer-2 guard is re-derived | the block is server-role memory for unbarriered records; a missed migration is a named abort, not a wrong picture |
|
||||
| 5 | event-ring flow control | `ReserveEventOrBlock` (all four event kinds), `Drained()` clears **and rings**, `WaitFor{Applied,PresentAck}OrEventBacklog`, `ServerLoop`'s park gains "not while the ring is full" | a full 256 KiB ring is backpressure, not `Fatal{EventRingOverflow}`; two named refusals remain for the impossible cases |
|
||||
| 6 | lifetime | the deferred-destroy queue STAYS; an enqueue from an unbarriered apply logs once and is Fatal under strict | ruling 13 (ID-91) pinned; slot reuse needs no wait (the ring orders `{s,g}` → `death` → `{s,g+1}`) |
|
||||
| 7 | the strict lane | ONE step, TWO arms, and the arm is chosen by grepping `kMGPipeP5eRunAheadReady` out of `Init.cpp` | the lane becomes a hard green gate with §7's `<field>@<verb>` allowlist, in the same commit the runtime flips |
|
||||
| 8 | docs | ARCHITECTURE §11.6, §11.7, §14, new §17.7, 附 A's knob table | — |
|
||||
|
||||
## 2 Files touched (regions, not whole files)
|
||||
|
||||
- `MG_Remote/Client/ClientSession.{h,cpp}` — the wait switch in `EmitAndWaitTails`; `RunAheadArmed`/`LatchRunAheadFromCaps` (latched in `PumpControlPlane`, demote-only); `ReleaseFillPins`, `WaitForApplyToCatchUp`, `Finish`, `AcquirePresentCredit`, `PresentCreditWaits`, `LastPublishedSeq`; the re-derived `RefusePipeInputsTouchWhileApplierOwnsIt(surface, isBarrieredFill)`; drains at the cmd-space wait and the stage bell; `credit-waits` on the wire ledger; the latch reset in `Stop`.
|
||||
- `MG_Remote/Client/EmitTables.cpp` — `EmitPresent` mints `FrameSerial` through `AcquirePresentCredit`.
|
||||
- `MG_Remote/Client/BackendObject_Remote.cpp` — `WaitForApplyBeforeEglForwarder` before the five `Server*` forwarders (NOT `ServerSwapEGLBuffers`).
|
||||
- `MG_Remote/Client/WireTables.cpp` — `Wire_ResourceSubData` takes `wantReply` and posts accept-by-construction for the buffer half.
|
||||
- `MG_Pipe/PipeRoute.h` — `MGPipeSubDataWantsItsReply` + the route's use of it (inside `#if MOBILEGL_PIPE_PUSH`).
|
||||
- `MG_Remote/Server/PipeApplier.cpp` — `OnPresent` returns the credit and refuses `FrameSerial == 0` on a run-ahead server; `ServerPublishesRunAhead` helper; `#include "ServerSession.h"`.
|
||||
- `MG_Remote/Server/ServerSession.cpp` — `ReserveEventOrBlock` replaces the four `Reserve` + Fatal sites.
|
||||
- `MG_Remote/Server/ServerLoop.cpp` — the park predicate's fourth clause and the `DrainRing` gate.
|
||||
- `MG_Remote/Transport/{EventRing.h,SessionRings.h,Ring.cpp}` — `SetServerDoorbell`, the ring-and-clear `Drained()`, the two `…OrEventBacklog` waits, `EventRingIsFull()`.
|
||||
- `MG_Remote/Wire/PipeWireCodec.{h,cpp}` — `SetStageWaitHook`, called around the SEG_STAGE retirement park (**named delta**, see §5).
|
||||
- `MG_Impl/Pipe/PipeFill.cpp` — `ClientRunsAhead`, `WireOpForVerb`, `ClientVerbIsBarriered`, `g_lastFillWasBarriered`, the `fillOwed` gate, `MGPipeReleaseResidualFillPins`, `MGPipeClientFinish`, the deferred-destroy finding, the vertex-attrib-defaults mirror read skipped under run-ahead (§3.4).
|
||||
- `MG_Backend/MGPipe/PipeInputs.cpp` — `CountBarrierPull`'s unconditional arm; `StrictBarrierPullFatal` gains a reason so the lane can tell the two markers apart.
|
||||
- `MG_Pipe/PipeMutation.h` (declarations + the ruling-13 comment), `MG_Pipe/PipeApply.h` (the two-constants ruling, §6).
|
||||
- `MG_Impl/GLImpl/Exporting/Definitions.cpp` — `glFinish` (**named delta**, §5).
|
||||
- `MG_Test/Wire/{RemoteClientTest,SessionTest}.cpp`, `.github/workflows/test.yml`, `docs/Disaggregated/ARCHITECTURE.md`.
|
||||
|
||||
## 3 Red-once evidence (executed, reverted, verbatim)
|
||||
|
||||
**1. Present without the credit wait** (`if (m_presentsSent >= credit)` → `if (false)`),
|
||||
`RemoteRunAhead.ACreditOneClientPaysTheCreditAtEveryPresentAfterTheFirst`:
|
||||
```
|
||||
0% tests passed, 1 tests failed out of 1
|
||||
../MobileGL/MG_Test/Wire/RemoteClientControls.inc:143: Failure
|
||||
Actual: false
|
||||
exited 103
|
||||
```
|
||||
(103 = `PresentCreditWaits() != 2` — red by count, which is the only way to test a wait that is
|
||||
usually already satisfied.)
|
||||
|
||||
**2. Leave the fill in for an unbarriered record** (`const Bool fillOwed = barriered;` → `= true`),
|
||||
`RemoteRunAhead.AnUnbarrieredVerbDoesNotFillPipeInputsAndIsAllowed`:
|
||||
```
|
||||
signal 6
|
||||
[08:09:45] [Linux RemoteClientTes/FATAL]: MGPipe: Fatal{RoleViolation, "gPipeInputs"} - the GL thread touched gPipeInputs (MGPipeValidateForVerb) on a RUN-AHEAD session outside a barriered fill. With the client running a
|
||||
```
|
||||
|
||||
**3. Count instead of Fatal under an unbarriered record** (drop `CountBarrierPull`'s first
|
||||
clause), `RemoteGuards.AResidualPullUnderAnUnbarrieredRecordIsFatalWithoutTheStrictKnob`:
|
||||
```
|
||||
0% tests passed, 1 tests failed out of 1
|
||||
../MobileGL/MG_Test/Wire/RemoteClientControls.inc:139: Failure
|
||||
Actual: false
|
||||
exited 0
|
||||
```
|
||||
(the probe stops aborting; on the lane this is every still-pulling scenario going from a named
|
||||
abort to a wrong picture with a number beside it.)
|
||||
|
||||
**4. Keep `Fatal{EventRingOverflow}`** (`if (!ServerPublishesRunAhead(session)) Fatal…` → always),
|
||||
`RemoteRunAhead.AnEventBurstBehindAnUnwaitedSequenceFlowControlsInsteadOfAborting`:
|
||||
```
|
||||
signal 6
|
||||
[08:11:31] [Linux mgl-srv-apply/FATAL]: MGPipe: Fatal{EventRingOverflow} - the producer of kEventGpuWritten could not reserve 1040 bytes on SEG_EVENT. P5c's events are lossless and a full ring under lockstep is a produce
|
||||
```
|
||||
|
||||
**4b. The drain stops ringing the server** (`Drained()`'s `NotifyIfParked` → `(void)wasFull;`),
|
||||
`SessionTest.DrainingAFullEventRingClearsTheLatchAndRingsTheServer`:
|
||||
```
|
||||
../MobileGL/MG_Test/Wire/SessionTest.cpp:661: Failure
|
||||
Which is: 0
|
||||
Which is: 1
|
||||
```
|
||||
|
||||
**4c. The applied park stops breaking on the ring** (drop the `eventRingFull` clause),
|
||||
`SessionTest.AFullEventRingWakesAClientParkedOnAppliedSeq`:
|
||||
```
|
||||
../MobileGL/MG_Test/Wire/SessionTest.cpp:586: Failure
|
||||
Which is: 4-byte object <02-00 00-00> (TimedOut)
|
||||
Which is: 4-byte object <00-00 00-00> (Reached)
|
||||
```
|
||||
|
||||
**5. Bit 10 for Magma** — c0e already ran and recorded this
|
||||
(`MagmaPipeIdentityTest.AMagmaServerNeverPublishesTheRunAheadCapBit` fails "Which is: 1024 / 0").
|
||||
Re-run here green: `MagmaPipeIdentity` 5/5.
|
||||
|
||||
**6. NOT RUN, and why.** `MOBILEGL_IPC_RUN_AHEAD=0` renders identically is TRIVIALLY true on this
|
||||
tree — the caps bit is unpublished, so both arms are the same code path — and the SSIM arm needs
|
||||
the device. `MOBILEGL_IPC_VERB_BARRIER=0` under run-ahead is likewise unreachable before the flip.
|
||||
Both belong to the integrator's device exit (BRIEF §4).
|
||||
|
||||
## 4 Gate (this tree vs base f6cfcbd3, measured both)
|
||||
|
||||
| step | base f6cfcbd3 | p5e/ra 48b2f56e |
|
||||
|---|---|---|
|
||||
| build | rc=0 | rc=0 |
|
||||
| unit | 2206/2206 | **2222/2222** (+16 cases, all new) |
|
||||
| `integration-split` | 111/111 | 111/111 |
|
||||
| `integration-split-strict` | 3% passed, 108 failed of 111 | **identical** |
|
||||
| gens | 7 rc=0 + the pre-existing `CONTRACT-P5.md:524 Core.cpp:39` ambiguity | identical |
|
||||
|
||||
Strict marker table, from the 88 per-entry private logs, **before and after are the same table**
|
||||
(measured by checking out f6cfcbd3, rebuilding and re-running):
|
||||
|
||||
| marker | count (base) | count (ra) | owner |
|
||||
|---|---|---|---|
|
||||
| `GetFramebufferBindingSlot@Clear` | 39 | 39 | fb |
|
||||
| `GetBoundVertexArray@DrawArrays` | 14 | 14 | vi |
|
||||
| `GetImageTextureBinding@BindImageTexture` | 13 | 13 | fb |
|
||||
| `GetTextureUnitObject@Clear` | 9 | 9 | tx2 |
|
||||
| `GetTextureObject@CopyImageSubData` | 6 | 6 | P5b debt (allowlisted) |
|
||||
| `GetProgramForDispatch@DispatchCompute` | 3 | 3 | pg |
|
||||
| `ValidateProgramName@ShaderStorageBlockBinding` | 2 | 2 | pg (allowlisted) |
|
||||
|
||||
**G1: 0 delta.** Every edit to shared code is under `MOBILEGL_BUILD_DISAGGREGATED` or
|
||||
`MOBILEGL_PIPE_PUSH` (`PipeRoute.h`'s route is at line 270, inside the file's push guard).
|
||||
|
||||
## 5 Kimi audit cross-check (my family is list (b), not an object family)
|
||||
|
||||
- **RETIRED:** `PI:807, PI:812-814` — the four O-class `SharedPtr` rows (`m_boundVertexArray`,
|
||||
the three programs). `ReleaseFillPins` drops them after every barriered apply, and an
|
||||
unbarriered verb never re-fills them, so the apply thread can no longer become a frontend
|
||||
object's last owner through this block.
|
||||
- **LEFT BARRIERED:** `PI:808-811, PI:815` — the raw pointer bases into the frontend tables.
|
||||
They are written only by a barriered fill; an unbarriered apply that reads through them takes
|
||||
§3.3's abort by field and verb. Their retirement is the family packages' (list (c)).
|
||||
- **NOT FOUND / not mine:** every row of list (c) is an `MGB_CTX->` accessor whose retirement
|
||||
belongs to vi/sb/pg/tx2/fb. ra changes not who reads them but what a read costs.
|
||||
|
||||
## 6 Rulings I need from the integrator
|
||||
|
||||
1. **`kMGPipeP5eClientWaitRuleLanded` flips with `kMGPipeP5eRunAheadReady`, not when ra lands.**
|
||||
ID-103 says "ra flips it in the same commit that lands the wait rule". That cannot be right:
|
||||
`RunAheadArmed()` needs the server's caps bit, so between ra landing and the bit being
|
||||
published the client still blocks after every record — and a `false` stamp there withdraws
|
||||
§4.4's exemptions from probes that wait still makes safe, which is the "refusal with no defect
|
||||
behind it" ID-103 itself refused. I left BOTH constants `false` and amended the comment at the
|
||||
constant. **The integration commit throws both.** (Had I flipped it, `integration-split` would
|
||||
be near-totally red on this tree: the family packages have not landed.)
|
||||
2. **§3.2's "the stamp moves to applier-owned storage" is implemented as an OWNERSHIP rule, not
|
||||
as moved storage.** Physically moving `m_filled`/`m_currentVerb`/`m_serverStampedVerb` out of
|
||||
`gPipeInputs` means re-pointing the freshness check in all 63 generated accessors
|
||||
(`generated/PipeFilled.inc`), which is c0e's file and a much larger blast radius. What ra
|
||||
landed is the rule the move existed for: under run-ahead the GL thread writes those fields
|
||||
only inside a barriered fill, so the E-note hazard (b.4) — a GL thread withdrawing the
|
||||
server's stamp while an apply depends on it — cannot occur. Confirm, or schedule the move.
|
||||
3. **`SetIdentity` is NOT skipped** (§3.1 lists it). `m_live`/`m_contextIdentity` are not fields
|
||||
of the residual model — no ownership row owns them, no record carries them, no server stamp
|
||||
can answer them — they are "does this process still have a GL context", which every
|
||||
null-context guard reads and only the GL thread knows. Two stores per verb, no stamp.
|
||||
4. **The §7 allowlist is my best reading, not a measurement.** It cannot be measured before the
|
||||
flip (every entry still aborts on an unmigrated row). The integrator should re-derive it from
|
||||
the first green run and delete rows rather than widen them.
|
||||
|
||||
## 7 Seams assumed from other packages
|
||||
|
||||
- **vi:** a draw with a client-memory array is refused at emit under run-ahead (`ruling 2` /
|
||||
§5.1). `ClientVerbIsBarriered` therefore does NOT re-compute `kDrawClientArrays` — duplicating
|
||||
vi's "does any enabled attribute lack a buffer" walk is exactly the second spelling ruling 3
|
||||
replaced. If vi's refusal does not land, a client-array draw would be judged unbarriered and
|
||||
its fill skipped. Named in the code comment.
|
||||
- **tx2:** `GenerateMipmap` stays `kWaitApplied` until the `VerbMipRes` arm lands; the wait rule
|
||||
reads the column, so tx2 flipping the row is all that is needed.
|
||||
- **pg/sb/fb/tx2:** the strict allowlist's rows are theirs to delete.
|
||||
- **c0e (landed):** `MGPipeWaitClassFor`, `kCapRunAheadApply`, `MGPipeRunAheadCapBitsFor`,
|
||||
`IpcTable::RunAhead/PresentCredit`, `MGPipeBarriered`, the barriered-record flag + setter.
|
||||
- **id (landed):** `ApplyOne`'s stamp line — untouched by ra, as the brief assigns.
|
||||
|
||||
## 8 Named deltas and what I did not do
|
||||
|
||||
- **`PipeWireCodec.{h,cpp}` (not in my scope list):** the SEG_STAGE retirement park is a CLIENT
|
||||
wait and the deadlock argument needs every client wait to drain. The encoder cannot drain
|
||||
SEG_EVENT itself, so it gained a `StageWaitHook` the session installs. Null in every standalone
|
||||
codec; the park is otherwise byte-identical.
|
||||
- **`MG_Impl/GLImpl/Exporting/Definitions.cpp` (not in my scope list):** `glFinish` was a pure
|
||||
no-op. Under run-ahead "the commands issued so far have completed" is a promise the queue can
|
||||
break, and this is the only place an application can ask for it. Two lines, under
|
||||
`#if MOBILEGL_BUILD_DISAGGREGATED`, calling `MG_Pipe::MGPipeClientFinish`.
|
||||
- **The server half of the present credit is not unit-pinned.** The `RemoteClient` fixture has no
|
||||
backend object, so `ServerVerbSink::OnPresent` declines before it can reach
|
||||
`ReturnPresentCredit`; the cases substitute a peer sink and assert the CLIENT's half. That the
|
||||
server returns exactly one credit per swap after `Present()` returns is three lines in
|
||||
`PipeApplier::OnPresent` and the device exit's `credit-waits` reading.
|
||||
- **No device numbers.** The measurement arms of BRIEF §4 (fps, per-thread ms/frame, simpleperf,
|
||||
SSIM) are the integrator's; no adb from here.
|
||||
- **`MOBILEGL_IPC_EVENT_KB`** stays a trailing item: flow control makes 256 KiB correct rather
|
||||
than fast, and the ring size is a measurement, not a correctness input.
|
||||
- **G2/G14 skip twins:** the new public names are all in split-only translation units
|
||||
(`MG_Remote/*`, the push-only half of `PipeFill.cpp`) and the new cases live in
|
||||
`MG_Test/Wire/*`, which is a split-only binary. No monolith twin is possible or needed; unit
|
||||
count moves 2206 → 2222 on the split build only.
|
||||
@@ -0,0 +1,394 @@
|
||||
# ra2-v1 — make run-ahead actually correct
|
||||
|
||||
Tree `~/w7/p5e-ra2`, branch `p5e/flip`, base `985ae62d`, head **`efe58eac`** (three commits).
|
||||
|
||||
## 1 Verdict (TASK-ra2 §3.2)
|
||||
|
||||
**Fixable inside P5e, and fixed. The P11 deferral was not needed for this defect.** With the flip
|
||||
still thrown the lane that must be green is green — `integration-split` **179/179**, from 112/181
|
||||
on the base — and the two lanes that must be red are red for their named reasons. Every one of the
|
||||
four fields / eleven verbs / 70 markers ID-132 measured is gone, and no wait was added to the
|
||||
shipping path to get there.
|
||||
|
||||
### 1.1 The most reusable thing in this package
|
||||
|
||||
**A wait added to satisfy a lane is a real cost on a real path. The check on any escalation is
|
||||
"which arm pays for it", not "which lane goes green".**
|
||||
|
||||
ID-133 escalated a plain multi-draw so that a pull in Espryt's indirect multi-draw tier became
|
||||
legal. It turned 18 entries green and it charged **every `glMultiDraw*` on the `auto` → `ext`
|
||||
default tier** with a per-batch rendezvous — because there is one draw opcode and the tier is
|
||||
chosen server-side per batch, so the narrowest predicate both roles could compute could not name
|
||||
the arm that actually needed it. The lane could not see that; only asking who pays could. ID-136
|
||||
then retired the pull instead (§4.1) and the escalation went away with it. Both halves landed in
|
||||
one commit, so neither intermediate state was ever a head.
|
||||
|
||||
That question generalises past this phase: every escalation is a rendezvous, every rendezvous is
|
||||
paid by some arm, and the lane that motivated it is usually not the arm that pays.
|
||||
|
||||
**ID-132 was right about the object and wrong about the mechanism, and that distinction is the
|
||||
most useful thing in this package.** The ruling suspected `gPipeInputs`' *field values* racing.
|
||||
They do not: the values are already partitioned — the client's fill writes only fields no record
|
||||
supplies (`SuppliedFieldMask`), the applier writes only record-supplied ones. What races is the
|
||||
**metadata**: the four shared scalars `CurrentVerbSerial`, `FilledGen[63]`, `m_currentVerb` and
|
||||
`m_serverStampedVerb`, which both roles write and which no partition covers. That is why a
|
||||
P5e-sized fix existed at all, and it is the sentence P11's scope should be written in (§5).
|
||||
|
||||
Three things landed on top of the diagnosis: the fix (§3), the indirect-binding pull's retirement
|
||||
(§4.1, ID-133 escalated then ID-136 retired instead) and ID-134's lane (§4.2). Two of ID-133's
|
||||
premises did not survive measurement; they are corrected in §4.1 and they are what ID-136 acted
|
||||
on.
|
||||
|
||||
Commits: `2d03565f` (the fix), `f2865480` (ID-133 / ID-134 / the contract), `efe58eac` (ID-136).
|
||||
|
||||
## 2 The diagnosis, with evidence
|
||||
|
||||
### 2.1 What the marker's verb proved before any instrumentation
|
||||
|
||||
Of ID-132's 70 red entries, 54 abort with the **plain** poison (no `[BARRIER-PULLED]` bracket).
|
||||
For a `kRecordSupplied` / `kApplierDerived` field that branch of `MGPipeInputUnfreshRead`
|
||||
(`MG_Backend/MGPipe/PipeInputs.cpp:311-345`) is reachable **only when `serverStamped == false`** —
|
||||
with the stamp up those two ownerships take the `Fatal{RoleViolation}` arm instead, and
|
||||
`GetTextureContextId`'s accessor (`PipeInputs.h:524`) short-circuits to
|
||||
`MGPipeApplierContextSerial()` before the check can fire. All 54 are on those two ownerships, so
|
||||
all 54 read the block with the **server's own stamp withdrawn**.
|
||||
|
||||
And the verb in the marker is the *client's*. The applier can only ever write a verb that has a
|
||||
row in `MGP_VERB_OP_LIST` (`FieldOwnership.def:256-276`). `DrawElements`,
|
||||
`DrawElementsBaseVertex`, `DrawElementsIndirect`, `DrawElementsInstancedBaseVertex`,
|
||||
`MultiDrawElementsBaseVertex`, `GetIntegeri_v` and `GetSyncStatus` have no row — and 40 of the 54
|
||||
name one of those. Nothing but the GL thread can have put them there.
|
||||
|
||||
### 2.2 The interleaving, verbatim
|
||||
|
||||
Two temporary probes (fill site and `MGPipeInputUnfreshRead`; both removed before the commit), one
|
||||
run of `DirectGLES.Split.MultiDrawTierDrawElements.MultiDrawScenario.PlainBatchMatchesUnrolledDraws`,
|
||||
consecutive lines of `~/w7/p5e-logs/ra2-P/…PlainBatchMatchesUnrolledDraws.01.log:580-585`:
|
||||
|
||||
```
|
||||
[MobileGLIntegra/ERROR]: RA2-PROBE fill verb=DrawElements wireop=81 waitclass=-1 applierInside=1
|
||||
[MobileGLIntegra/ERROR]: RA2-PROBE fill verb=DrawElements wireop=81 waitclass=-1 applierInside=1
|
||||
[mgl-srv-apply/ERROR]: RA2-PROBE unfresh field=IsCapabilityEnabled verb=DrawElements serverStamped=0 ownership=RECORD-SUPPLIED
|
||||
[mgl-srv-apply/FATAL]: MGPipe: Fatal{UnmigratedPipeInput, "IsCapabilityEnabled@DrawElements"}
|
||||
```
|
||||
|
||||
- **writer**: the GL thread, in `MGPipeValidateForVerb`'s residual fill, with `applierInside=1` —
|
||||
the apply thread is inside `PipeApplier::ApplyOne` for an earlier record.
|
||||
- **the write that did it**: `MGPipeServerClearVerbBoundary()` (`PipeFill.cpp:3343`), setting
|
||||
`m_serverStampedVerb = false`; hence `serverStamped=0` at the reader. Two more in the same
|
||||
window: `++CurrentVerbSerial` (un-freshens every stamp the applier made) and `SetVerb` (renames
|
||||
the verb the abort prints).
|
||||
- **reader**: the apply thread, mid-`DecodeAndApply` of an unbarriered `draw_vbo`, reading
|
||||
`IsCapabilityEnabled`.
|
||||
- **why four fields over eleven verbs, flakily**: the field is whichever the applier touches next
|
||||
after the window opens.
|
||||
|
||||
### 2.3 Why the existing guard never fired
|
||||
|
||||
`RefusePipeInputsTouchWhileApplierOwnsIt`'s run-ahead arm was `if (isBarrieredFill) return;`.
|
||||
`isBarrieredFill` is the caller's own sentence *"this touch is the residual fill of a record this
|
||||
thread is about to park behind"* — a claim about the **future**. The order at the validate point
|
||||
is fill → emit → park, so at the instant of the write the applier is still draining the backlog.
|
||||
The exemption was unconditional, so the guard was unfireable on exactly the class it was written
|
||||
for. That is the answer to the brief's question.
|
||||
|
||||
### 2.4 A second, independent defect underneath it
|
||||
|
||||
`ClientVerbIsBarriered` inverts `MGP_VERB_OP_LIST`, which joins the **whole draw family through
|
||||
one row** (`DrawVbo -> DrawArrays`). So the inverse answers `kOpCount` for nineteen draw verbs,
|
||||
and the file's default — *"an op with no verb row answers BARRIERED: fill it, wait for it"* —
|
||||
filled for each. **The fill happens and the wait does not**: the wait is decided per *record* by
|
||||
`MGPipeBarriered(op, …)` at the publish, and the record is a `draw_vbo` (`kWaitNone`).
|
||||
`wireop=81 waitclass=-1` in the probe above is that, measured.
|
||||
|
||||
## 3 The fix (commit `2d03565f`)
|
||||
|
||||
| file | hunks | what |
|
||||
|---|---|---|
|
||||
| `MobileGL/MG_Impl/Pipe/PipeFill.cpp` | `397-429`, `439-472`, `706-713`, `3392-3402`, `3718-3731` | the kDraw fallback in `ClientVerbIsBarriered` (+ a `static_assert` tying it to the generated row); new `QuiesceApplierBeforeFill`; its three call sites — validate-point phase 1, step 4, `MGPipeNoteFrontendMutation`. |
|
||||
| `MobileGL/MG_Remote/Client/ClientSession.cpp` | `1319-1352` | the run-ahead arm becomes `isBarrieredFill && !ApplyThreadIsInsideApplier()`; the Fatal names which shape fired. |
|
||||
| `MobileGL/MG_Remote/Client/ClientSession.h` | `211-222` | the block's rationale updated, not deleted. |
|
||||
| `MobileGL/MG_Test/Wire/RemoteClientTest.cpp` | `2300-2303`, `2314-2376` | the two regression cases and a note on the existing green control. |
|
||||
|
||||
**Two waits per filling verb, and that is the shape of the block, not belt-and-braces.** The
|
||||
validate point writes `gPipeInputs` in two phases that straddle publication: the serial bump,
|
||||
`MGPipeServerClearVerbBoundary()` and `SetVerb` **before** the fourteen emitters, and step 4's
|
||||
63-field walk **after** them — and the records those emitters published are records whose apply
|
||||
reads the block. One wait cannot cover both halves.
|
||||
|
||||
Everything added reduces to `MG_Config::Transport != Monolith` through `WaitForApplyToCatchUp`'s
|
||||
own first test (`m_runAheadArmed && m_started`), stated rather than inferred (ID-81). Under
|
||||
lockstep, monolith and `MOBILEGL_IPC_RUN_AHEAD=0` every added line is a call that returns; the
|
||||
refusal is a named `Fatal{RoleViolation, "gPipeInputs"}`, never a fall-back (ID-110).
|
||||
|
||||
### 3.1 Controls and red-onces
|
||||
|
||||
**A/B control (TASK-ra2 §2).** Same binary, same records, entry's own ctest `ENVIRONMENT`, knob
|
||||
layered on last (`.p5e/one_entry.py`), on base `985ae62d`: default arm **2/6 runs red**
|
||||
(`Fatal{UnmigratedPipeInput, "GetRenderStateParametersVersion@DrawElements"}`);
|
||||
`MOBILEGL_IPC_RUN_AHEAD=0` **0/8 red**. The defect is in the wait rule, not in a record's content.
|
||||
(`MOBILEGL_IPC_VERB_BARRIER=0` was not used — ID-114.)
|
||||
|
||||
**Control C1 — which half is load-bearing.** With the forced wait in place but the kDraw fallback
|
||||
reverted, `isplit` is **161/181 as well**. So the wait is the correctness fix and the fallback is
|
||||
the **performance** half: without it every indexed draw takes a forced drain and run-ahead is
|
||||
lockstep by another name on the draw path. Measured the other way round — fallback alone, no wait
|
||||
— the lane is 133/181 (`~/w7/p5e-logs/ra2-census-E1`).
|
||||
|
||||
**Red-once A** (guard arm back to `if (isBarrieredFill) return;`), 1 of 48 fails:
|
||||
`RemoteGuards.ClientBarrieredFillWhileTheApplierIsInsideUnderRunAheadIsFatalByName`, `Value of:
|
||||
DiedOfAbort(child) Actual: false Expected: true exited 0` — and the green control
|
||||
`ClientPipeInputsTouchInsideABarrieredFillUnderRunAheadIsAllowed` keeps passing, so the pair is a
|
||||
rule and not "abort unconditionally".
|
||||
|
||||
**Red-once B** (kDraw fallback deleted), 1 of 48 fails, `signal 6`:
|
||||
`Fatal{RoleViolation, "gPipeInputs"} - the GL thread touched gPipeInputs (MGPipeValidateForVerb)
|
||||
on a RUN-AHEAD session in a barriered fill that did not first wait for the applier to catch up`.
|
||||
|
||||
**Where the regression test lives** (TASK-ra2 §3.4): both cases are in
|
||||
`MG_Test/Wire/RemoteClientTest.cpp`, in the ordinary **`unit`** lane, and `StartRunAheadSession`
|
||||
arms run-ahead in the child — so they run with the flip's behaviour on **any** head, including
|
||||
heads where `kMGPipeP5eRunAheadReady` is false. The strict lane runs under lockstep and cannot see
|
||||
this class by construction. The probe is the guard call itself and the in-applier flag is raised
|
||||
on the client thread before it (ID-102).
|
||||
|
||||
## 4 The two rulings (commit `f2865480`)
|
||||
|
||||
### 4.1 ID-133 then ID-136 — escalated, then retired instead
|
||||
|
||||
ID-133 landed as ruled (commit `f2865480`): `MGPipeBarriered` gained a fourth clause — a
|
||||
`draw_vbo` with `NumDraws > 1` that is **not** `kDrawIsIndirect` is barriered — with the client's
|
||||
verb-keyed half in `ClientVerbIsBarriered` and a row in contract §2.1. The 18 entries went green.
|
||||
**ID-136 then withdrew all of it and retired the pull instead** (commit `efe58eac`). Both halves
|
||||
of that withdrawal are in one commit, by ruling, so no head ever carried one without the other.
|
||||
What follows is why, because the two premise corrections are the substance.
|
||||
|
||||
**First: I did NOT measure the default differently from mv.** `MultiDraw.cpp:391`'s `kAutoLadder`
|
||||
is `{Ext, BaseVertex, MultiIndirect, Indirect, DrawElements}`, first supported wins, and
|
||||
`ResolveTierForBatch` can only DEMOTE a batched tier toward BaseVertex/DrawElements — never
|
||||
promote into an indirect one. My own confirmation is in the gate itself: the **un-prefixed**
|
||||
`MultiDrawScenario.*` entries were green throughout, and only the `MultiDrawTierIndirect.` /
|
||||
`MultiDrawTierMultiIndirect.` lanes failed. `auto` → `ext`, and the default tier never reaches the
|
||||
read.
|
||||
|
||||
**But there is no indirect multi-draw OP to escalate.** All twenty draw entry points collapse onto
|
||||
one opcode, `draw_vbo` (`MGPDrawInfo`'s own header says so; `PipeCalls.def:261` is the single
|
||||
row), and the tier is resolved on the SERVER, per batch, from driver caps the client does not
|
||||
hold. So the ruling's granularity does not exist on the wire, and the narrowest predicate both
|
||||
roles can compute is `NumDraws > 1 && !kDrawIsIndirect`. **Consequence the ruling's cost argument
|
||||
did not anticipate: this is not confined to the opt-in tier lanes.** A plain `glMultiDraw*` now
|
||||
takes a wait on *every* tier including the `auto` → `ext` default. `kDrawIsIndirect` is excluded
|
||||
precisely so Sodium's `glMultiDrawElementsIndirect` — which resolves its buffer from the handle in
|
||||
the record's second tail and pulls nothing — keeps running ahead.
|
||||
|
||||
**Second, and this is the one worth acting on: the pull is not a data dependency.** Backtrace of
|
||||
the aborting thread (`gdb --batch`, entry run under its own ctest command and `ENVIRONMENT`):
|
||||
|
||||
```
|
||||
#4 MG_Pipe::(anonymous namespace)::CountBarrierPull(...)
|
||||
#5 MG_Backend::DirectGLES::MultiDrawImpl::(anonymous namespace)::RunIndirect(...)
|
||||
#6 MG_Backend::DirectGLES::MultiDrawImpl::DrawElementsBatch(...)
|
||||
#7 MG_Remote::Server::ServerVerbSink::OnDrawVbo(...)
|
||||
#10 MG_Remote::Server::PipeApplier::ApplyOne(...)
|
||||
```
|
||||
|
||||
and the site is `MultiDraw.cpp:87`:
|
||||
|
||||
```cpp
|
||||
Uint BoundDrawIndirectBufferId() {
|
||||
const auto& indirect = MGB_CTX->GetBufferBindingSlot(BufferTarget::DrawIndirect).GetBoundObject();
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
called once at `:584` as `const Uint previousIndirectBinding = BoundDrawIndirectBufferId();`,
|
||||
immediately before the tier binds **its own scratch buffer** (`BindBufferId(GL_DRAW_INDIRECT_BUFFER,
|
||||
g_indirectCommands.id)`) and restored at `:603`. **The tier does not want the client's indirect
|
||||
buffer; it wants to put back whatever GL name was bound.** That is a question the server can answer
|
||||
from its own binding record, and it is the same question mv already retired one function lower —
|
||||
`ResolveBoundIndexBuffer` (`:167`) has a stated handle arm; `BoundDrawIndirectBufferId`, twenty
|
||||
lines above it, was missed.
|
||||
|
||||
**ID-136: done, and the escalation withdrawn with it.** `BoundDrawIndirectBufferId` now has the
|
||||
handle arm, in mv's own idiom rather than a second one beside it:
|
||||
|
||||
- the arm is `MG_Config::Transport != MG_Config::TransportMode::Monolith`, **stated** (ID-81) and
|
||||
never inferred from a null handle (ID-110);
|
||||
- a null `MGPipeApplier().VerbIndirectBuffer` is *"this verb bound no indirect buffer"* — the same
|
||||
`0` the monolith arm returns for an empty slot, and explicitly **not** the arm test;
|
||||
- a missing backend resource is a **named refusal**,
|
||||
`Fatal{RoleViolation, "multidraw-indirect-buffer-arm"}`, a sibling of mv's
|
||||
`RefuseMissingIndexBufferRecord` placed beside it, never a quiet fall-back to the frontend;
|
||||
- the monolith body below is unchanged token for token, and the function moved down beside
|
||||
`BoundIndexBufferId` — the same question about the other target, now with the same two arms.
|
||||
|
||||
**Why a handle arm and not a migration.** The tier never reads a byte of the client's indirect
|
||||
buffer. With a transport, the only other writer of this process's `GL_DRAW_INDIRECT_BUFFER` is
|
||||
`DirectGLES.cpp`'s `DrawSyncBit::IndirectBuffer` arm, which binds from `VerbIndirectBuffer` and
|
||||
nothing else — so *"what was bound"* **is** *"what the verb's record named"*, and restoring it is
|
||||
a question the server answers about itself.
|
||||
|
||||
`MG_Backend/DirectGLES/MultiDraw.cpp` is **mv's file per ID-113**; I edited it under ID-136, which
|
||||
overrode that boundary for this one change so the two halves could not land apart. The commit
|
||||
message says so, and the boundary has not otherwise moved.
|
||||
|
||||
### 4.2 ID-134 — the client-array lane
|
||||
|
||||
`DirectGLES.Split.ClientVertexArrayScenario.*` now carry the single label
|
||||
**`integration-clientarrays-split`** (`MG_IntegrationTest/CMakeLists.txt`), and
|
||||
`.github/workflows/test.yml` gains an expected-red step shaped like gl's Magma one: it asserts the
|
||||
**marker**, not merely a failure, and it fails both when the lane goes green with run-ahead armed
|
||||
and when it goes red without `Fatal{UnmigratedVerb, "(Multi)DrawArrays+CLIENT_ARRAYS"}` in the
|
||||
entries' private logs (they already had private, distinct log paths via `SplitLogPaths.cmake.in`).
|
||||
|
||||
**ID-131 heeded by counting, not by assuming**, on the built tree:
|
||||
|
||||
| `ctest -N -L …` | before | after |
|
||||
|---|---|---|
|
||||
| `integration-split` | 181 | **179** |
|
||||
| `integration-gpu` | 1359 | **1357** |
|
||||
| `integration-clientarrays-split` | — | **2** |
|
||||
| `integration-magma-split` | 2 | 2 |
|
||||
|
||||
`integration-clientarrays-split` contains neither `integration-split` nor `integration-gpu` as a
|
||||
substring, and the drop is exactly two on each.
|
||||
|
||||
**One deliberate deviation from "an expected-red step", and it is not hedging.** The step branches
|
||||
on whether run-ahead is actually ARMED, read from the client's own log line. `kMGPipeP5eRunAheadReady`
|
||||
is a **build** constant: on a head where it is false no environment can arm run-ahead, ID-82's
|
||||
refusal is unreachable, and the entries are legitimately green — they are still vi's positive
|
||||
control for the lockstep arm. A step that demanded red unconditionally would fail on
|
||||
`feat/disaggregated` today for the one reason that is not a defect. With the flip landed for good
|
||||
the green branch is dead and its comment says to delete it.
|
||||
|
||||
### 4.3 The contract
|
||||
|
||||
`CONTRACT-P5E.md` §3.5 amended to what the code does, with the reason the old formulation could
|
||||
not be checked (a guard whose exemption cannot be false on the class it exists for reads as
|
||||
coverage and is not); §2.1 carries escalation (iii) with the "why the record and not the tier"
|
||||
argument and the withdrawal condition. **And §3.2 is marked UNLANDED** — nobody had noticed: it
|
||||
says "the server's stamp is server-private … never into the shared block", which describes
|
||||
applier-owned storage, and `MGPipeServerStampVerbBoundary` still writes `m_filled` /
|
||||
`m_currentVerb` / `m_serverStampedVerb` into `gPipeInputs` itself. **That gap is what made the
|
||||
race possible**: the contract already specified the P11 shape and the phase shipped the shared one.
|
||||
|
||||
## 5 What P11 still owes, and why the halves cannot be split
|
||||
|
||||
The fix works by re-establishing the quiescent window the lockstep barrier used to give for free.
|
||||
It does **not** make the block safe to share: `gPipeInputs` is still one copy with unpartitioned
|
||||
metadata, and the price of the current answer is a forced drain at every filling verb.
|
||||
|
||||
**Smallest sufficient form, both parts required:**
|
||||
|
||||
- **(a) per-role stamp state** — the applier gets its own `{CurrentVerbSerial, FilledGen[],
|
||||
m_currentVerb, m_serverStampedVerb}`, i.e. contract §3.2 actually landed, so the GL thread
|
||||
cannot withdraw the server's stamp at all;
|
||||
- **(b) a generation on the ~15 `BARRIER_PULLED` values the applier still reads**, keyed to the
|
||||
record's produce-generation.
|
||||
|
||||
**(a) without (b) is worse than today, and this is the load-bearing paragraph.** Today a read of a
|
||||
value the client has since moved aborts loudly on the withdrawn stamp. Give the applier its own
|
||||
stamp and that read succeeds — against whatever the client's latest fill happens to have left in
|
||||
the shared value. A loud `Fatal{UnmigratedPipeInput}` becomes a silent stale read, which is the
|
||||
failure mode this campaign has twice paid for. So: both, or (b) discharged by retirement
|
||||
(P7/P8/P9/P13) first and then (a) alone suffices. The values are already partitioned by
|
||||
`SuppliedFieldMask`, which is why (b) is small — it is 15 rows, not the 63-field block.
|
||||
|
||||
## 6 Gate (head `efe58eac`, flip thrown, `.p5e/p5e_gate_frozen.sh` — a frozen copy per ID-127)
|
||||
|
||||
| step | base `985ae62d` | head `efe58eac` |
|
||||
|---|---|---|
|
||||
| `build` | rc=0 | rc=0 |
|
||||
| `unit` | 2254/2254 | **2256/2256** (+2 new cases) |
|
||||
| `isplit` (`-L integration-split`) | 112/181 | **179/179 — hard green** |
|
||||
| `gpu` (`-L integration-gpu`) | 1290/1359 | **1357/1357 — hard green** |
|
||||
| `integration-clientarrays-split` | — | **2/2 red by design**, `Fatal{UnmigratedVerb, "DrawArrays+CLIENT_ARRAYS"}` and `"MultiDrawArrays+CLIENT_ARRAYS"` |
|
||||
| `integration-magma-split` | 2 expected-red | unchanged, not touched |
|
||||
| `gens` | rc=0 | rc=0; doc citations rc=0 with 3 pre-existing problems, all in `CONTRACT-P5.md`, none introduced here |
|
||||
| `flavours` | rc=0 | rc=0 — `pull` 915 TUs (push=absent), `push` 929 TUs (push=1), effective-macro assertion held |
|
||||
| census (`.p5e/census_flip.py`, per-entry own command + own ENVIRONMENT) | 70 red / 17 pairs / 4 fields | **179/179 green, 0 red, zero `Fatal{UnmigratedPipeInput}`** |
|
||||
|
||||
The two expected-red lanes, run as themselves:
|
||||
|
||||
```
|
||||
integration-clientarrays-split rc=8 0% passed, 2 failed of 2
|
||||
Fatal{UnmigratedVerb, "DrawArrays+CLIENT_ARRAYS"}
|
||||
Fatal{UnmigratedVerb, "MultiDrawArrays+CLIENT_ARRAYS"}
|
||||
run-ahead ARMED present in both private logs
|
||||
integration-magma-split rc=8 0% passed, 2 failed of 2
|
||||
Fatal{UnmigratedPipeInput, "GetFramebufferBindingSlot@Clear"}
|
||||
```
|
||||
|
||||
**The one `Fatal{` the census still prints is `RoleViolation{g_applier}` at `rc=0`** — it is
|
||||
`Ct.CtWireScenario.TheDirectApplierResetCallOnTheGLThreadIsRoleViolation`, a death test asserting
|
||||
its own abort. The census reports markers from passing entries too, which is why it appears.
|
||||
|
||||
### 6.1 The admitted set is ID-128's eight rows — which is how ID-136 checks out
|
||||
|
||||
Under `MOBILEGL_IPC_STRICT_ERRORS=1`, with `Fatal{` at zero:
|
||||
|
||||
| n | pair | why admitted |
|
||||
|---|---|---|
|
||||
| 140 | `GetFramebufferBindingSlot@ReadPixels` | ID-116 disjunct 1 |
|
||||
| 140 | `GetBufferBindingSlot@ReadPixels` | ID-116 disjunct 1 |
|
||||
| 11 | `GetBufferBindingPoint@DrawArrays` | ID-125 disjunct 2 |
|
||||
| 11 | `GetTransformFeedbackProgram@DrawArrays` | ID-125 disjunct 2 |
|
||||
| 6 | `GetTextureObject@CopyImageSubData` | ID-125 disjunct 2 / ID-118 |
|
||||
| 2 | `GetProgramObject@ShaderStorageBlockBinding` | ID-125 disjunct 2 |
|
||||
| 2 | `ValidateProgramName@ShaderStorageBlockBinding` | ID-125 disjunct 2 |
|
||||
| 2 | `GetTextureUnitObject@CopyTexImage2D` | ID-116 disjunct 1 |
|
||||
|
||||
**The ninth row ID-133 introduced is gone, and its absence is the test.** Under the escalation the
|
||||
census showed a ninth pair, `GetBufferBindingSlot@DrawArrays` (18), tagged:
|
||||
|
||||
```
|
||||
Admitted{UnmigratedPipeInput, "GetBufferBindingSlot@DrawArrays"} [BARRIER-PULLED, ADMITTED,
|
||||
retires in P8 (indirect), P9 (readback), P13 (transfer)]
|
||||
```
|
||||
|
||||
`ADMITTED` rather than `ADMITTED-ESCALATED`, i.e. the **static** table answered and no admission
|
||||
rule was widened (`gen_pipe_field_ownership.py --self-test` reports the same 174 derived pairs
|
||||
throughout). That row existed only because the escalation had moved the pull onto the barriered
|
||||
arm where the allowlist already covered it. With ID-136 the pull **does not happen at all**, so
|
||||
the row disappears rather than being forgiven — which is the difference between retiring a read
|
||||
and legalising it, and the reason to prefer the former.
|
||||
|
||||
G1: **not verified locally** (ID-123) — the gate compares no symbols. Every line added is inside
|
||||
`#if MOBILEGL_BUILD_DISAGGREGATED` or in a split-only translation unit, and both non-split
|
||||
flavours build clean with the effective-macro assertion held.
|
||||
|
||||
Kimi audit cross-check: ra2 owns no field family, so there are no `kimi-audit.md` rows to retire,
|
||||
barrier or report missing. The four fields ID-132 named are untouched; what moved is who may write
|
||||
the block and when, plus one wait class.
|
||||
|
||||
### 6.2 Red-once for both halves of ID-136
|
||||
|
||||
**Retiring the pull alone leaves the lane green, so the escalation is provably unnecessary** —
|
||||
that is this head: escalation (iii) is gone from `MGPipeBarriered`, from `ClientVerbIsBarriered`
|
||||
and from contract §2.1, and `isplit` is 179/179 with the strict census back to eight admitted rows
|
||||
(§6.1). Nothing on the lane needs it.
|
||||
|
||||
**Reverting the handle arm puts the marker back**, `if (false && …)` on the new arm, 3/3 runs,
|
||||
deterministic:
|
||||
|
||||
```
|
||||
Fatal{UnmigratedPipeInput, "GetBufferBindingSlot@DrawArrays"} [BARRIER-PULLED, UNBARRIERED,
|
||||
the client did not fill it, retires in P8 (indirect), P9 (readback), P13 (transfer)]
|
||||
```
|
||||
|
||||
So the arm is necessary and, with the escalation withdrawn, sufficient.
|
||||
|
||||
## 7 What I did not do
|
||||
|
||||
- **The device measurement of the forced wait's cost** — the coordinator's, not mine, per their
|
||||
message. The lane runs in ~12 s either way and cannot see it. My falsifiable expectation, now
|
||||
that ID-136 has removed the multi-draw rendezvous: draws no longer fill, so the client's forced
|
||||
waits should fall to the Clear / readback / blit / XFB / query count and nothing on the steady
|
||||
draw path — including plain `glMultiDraw*`, which after ID-136 is an ordinary unbarriered draw
|
||||
again.
|
||||
- **Anything in P11's shape.** §5 states what it must provide instead.
|
||||
- **Any other part of mv's file.** ID-136's override covers `BoundDrawIndirectBufferId` and the
|
||||
refusal beside it; nothing else in `MultiDraw.cpp` was touched.
|
||||
|
||||
Artefacts: `~/w7/p5e-logs/ra2-{A,B,P,red1}` (controls, probes, red-onces),
|
||||
`~/w7/p5e-logs/ra2-census-{E1,E2,E3,final,final-strict}`, scripts in `~/w7/p5e-ra2/.p5e/`.
|
||||
@@ -0,0 +1,213 @@
|
||||
# sb — `set_shader_buffers`: the binding-point tables cross the wire (P5e wave 2)
|
||||
|
||||
Branch `p5e/sb`, head **b004e5dc**, base `f6cfcbd3` (wave 1). 25 files, +1708/-92, two commits:
|
||||
`1ebe6abe` (wire + applier + route + client emitter + gates + tests) and `b004e5dc` (the four
|
||||
Espryt consumers).
|
||||
|
||||
## Gate
|
||||
|
||||
| step | result |
|
||||
|---|---|
|
||||
| `build` | rc=0 |
|
||||
| `unit` | **2216/2216** (2206 at base; +10 new names, each with a pull-build skip twin) |
|
||||
| `isplit` | **111/111** |
|
||||
| `gens` | all 7 rc=0; `check_doc_citations` rc=0 with 3 pre-existing warnings in `CONTRACT-P5.md` |
|
||||
| `one` SSBO/atomic | `DirectGLES.Split.(AtomicCounter\|ProgramPipeline)` 5/5; `DirectGLES.(SsboArrayLength\|SsboArrayDynamicIndex\|StorageBufferRegrow)` 6/6 |
|
||||
| `one` XFB | `Split\..*Xfb` **11/11** |
|
||||
| A/B bit 13 cleared | `MOBILEGL_PIPE_PUSH=0x1fff` on `integration-split`: **111/111** — today's picture reproduced |
|
||||
| `strict` | 3/111 pass, identical to the base (red by design, CONTRACT-P5C §6) |
|
||||
|
||||
**Strict marker table, before and after — IDENTICAL, nine rows, same counts:**
|
||||
`GetFramebufferBindingSlot@Clear` 45 · `GetTextureUnitObject@Clear` 22 ·
|
||||
`GetBoundVertexArray@DrawArrays` 14 · `GetImageTextureBinding@BindImageTexture` 13 ·
|
||||
`GetTextureObject@CopyImageSubData` 6 · `GetProgramForDispatch@DispatchCompute` 3 ·
|
||||
`ValidateProgramName@ShaderStorageBlockBinding` 2 · `GetTextureUnitObject@GenerateMipmap` 2 ·
|
||||
`GetTextureUnitObject@ReadPixels` 1.
|
||||
**No `GetBufferBindingPoint@*` marker exists at this head, before or after.** Every split
|
||||
scenario that binds an indexed buffer aborts on an EARLIER row — pg's `GetProgramForDispatch`
|
||||
or the allowlisted `ValidateProgramName` — so my family never gets to abort first. That is the
|
||||
baseline document's own "lower bound" property, and it is why red-once (a) had to be executed
|
||||
in a different, equivalent form (below). The A/B at `0x1fff` on the **unit** lane has two
|
||||
failures, `DirectGLESTextureSync.{UnitMemoRefusesToDriveATwinFromAnotherTexture,
|
||||
AnAttachmentOnlyTexturesParametersReachTheDriverWithNoSamplerView}` (SanityTest.cpp:3112) —
|
||||
NOT this package's: they fail identically with the P5e tracker shutter reverted, and they are
|
||||
texture-unit-memo cases. The arm the gate asks for (`integration-split`) is green.
|
||||
|
||||
## What changed, per file
|
||||
|
||||
**Wire / apply** — `MGPipeTypes.h` (`MGPShaderBuffers::WritableMask` → `Uint32[3]`, POD 32→40,
|
||||
`kMGPipeShaderBufferWritableMaskWords`, `MGPipeShaderBufferMaskHas/Set`); `PipeApply.h`
|
||||
(`ShaderBufferWritableMask[3][3]`); `PipeApply.cpp` (`MGPipeApplySetShaderBuffers` bodied,
|
||||
`ClearShaderBufferWindows`, both resets); `PipeRoute.{h,cpp}` + `Client/WireTables.cpp` (op 38,
|
||||
both arms); `Wire/PipeWireCodec.cpp` (the decode arm applies; Class/Count bounded in the layout
|
||||
arm); `CapsCodec.cpp` (one static_assert).
|
||||
|
||||
**Client** — new `MG_Impl/Pipe/ShaderBufferEmit.h`; `BufferState.h` (`NoteBindPointChanged` /
|
||||
`GetBindPointGeneration`, push-only); `GLState/Core.{h,cpp}` (the two forwarders, and the DSA
|
||||
`SetNamedTransformFeedbackBinding` bump); `GL_Buffer.cpp` (the bumps in `BindBufferBase_State` /
|
||||
`BindBufferRange_State`); `Tracker.h` (bits 15/16/17 rewritten); `PipeFill.cpp` (wired constant,
|
||||
`P5eFamilyIsLive`, the two adapters, the validate order, the reset list); `MG_Backend/Init.cpp`
|
||||
(consumer bit 13, ID-106).
|
||||
|
||||
**Backend** — `DirectGLES.cpp`: `ResolveBufferBindingSubsystemArm` /
|
||||
`BindingPointsComeFromRecords` / `SyncBufferBindingPointsByRecord` (all file-local), the two
|
||||
call sites, `MarkShaderStorageBuffersGpuWritten`'s deletion under a transport,
|
||||
`SyncAtomicCounterBuffers`' record arm, the UBO loop's point half.
|
||||
|
||||
**Gates / tests** — `gen_pipe_dirty_surface.py` (`Touch` prefix, control 6 re-pointed);
|
||||
`DirtySurface.def` (two rows + the undecided mark); `MG_Test/Pipe/CMakeLists.txt`; new
|
||||
`ShaderBufferEmitTest.cpp` (8 cases); `TrackerTest.cpp` (2); `PipeCatalogueTest.cpp`,
|
||||
`PipeWireCodecTest.cpp`, `RemoteClientTest.cpp` (the pins that invert).
|
||||
|
||||
**ID-104:** `Uint32 WritableMask[3]`, not `Uint64 + Uint32`. 96 ≥ 84 either way, but ONE word
|
||||
type means one shift width, so the set and the test are a single expression each rather than a
|
||||
low half and a high half that have to agree — and the applier's per-class copy goes through the
|
||||
same two helpers as the payload's. POD 32 → 40, pinned in `PipeCatalogueTest`.
|
||||
|
||||
## kimi-audit rows 111–124
|
||||
|
||||
| row | site | verdict |
|
||||
|---|---|---|
|
||||
| 111 | `SyncBufferBindingPoints` point + `GetBoundObject` | **RETIRED** → `SyncBufferBindingPointsByRecord` |
|
||||
| 112 | same: ensure probe, `GetRange`, `obj->GetSize` | **RETIRED** → `EnsureBufferResourceForHandle(nullptr, Res)`, the record's extent, `resource->storageSize` |
|
||||
| 113 | `MarkShaderStorageBuffersGpuWritten` | **RETIRED BY DELETION** under a transport; the client owns the set |
|
||||
| 114 | `SyncTransformFeedbackBindingPoints` | **LEFT BARRIERED** (XFB, §5.7) |
|
||||
| 115 | `SyncAtomicCounterBuffers` (count, point, ensure, range, mark) | **RETIRED**; its `MarkBufferGpuWritten` deleted |
|
||||
| 116 | `SyncBoundBuffer` `GetBufferBindingSlot` | **NOT MINE** — the generic slot, `FieldOwnership.def:78` (P8/P9/P13); untouched |
|
||||
| 117 | UBO loop point + `GetBoundObject` + `GetRange` | **RETIRED** → `BoundShaderBuffers[Uniform][binding]` |
|
||||
| 118 | UBO loop `GetBufferResource` / `IsBufferDrawClean` / `EnsureBufferResource` | **RETIRED** → the three by-handle twins |
|
||||
| 119–124 | `StartPendingTransformFeedback`, `ReadbackCapturedRanges`, `ScatterCapturedRecords` | **LEFT BARRIERED** (XFB, §5.7) |
|
||||
|
||||
Not found as written: nothing. `MGPipeFrontendKeyedRegistryScope` at `Managers.cpp:2938`
|
||||
(`HandleOfBuffer`) is NOT retired by this package — the draw path no longer reaches it for
|
||||
binding points, but `EnsureBufferResource` / `IsBufferDrawClean` still do for the monolith arm
|
||||
and for other families.
|
||||
|
||||
## Red-once, executed, reverted, quoted verbatim
|
||||
|
||||
**(b) the shutter** — reverted bits 15/16/17 to the pre-P5e content aggregate, rebuilt, ran:
|
||||
```
|
||||
../MobileGL/MG_Test/Pipe/TrackerTest.cpp:615: Failure
|
||||
Expected: (m_tracker.LastDirty() & MGPipeDirtyBit(MGPipeDirty::NewConstBuffers)) != (0u), actual: 0 vs 0
|
||||
NEW_CONST_BUFFERS did not fire when a uniform binding point moved onto another buffer - the emitted window would still name the first one
|
||||
../MobileGL/MG_Test/Pipe/TrackerTest.cpp:624: Failure
|
||||
Expected: (m_tracker.LastDirty() & MGPipeDirtyBit(MGPipeDirty::NewConstBuffers)) != (0u), actual: 0 vs 0
|
||||
NEW_CONST_BUFFERS did not fire for an unbind
|
||||
../MobileGL/MG_Test/Pipe/TrackerTest.cpp:652: Failure
|
||||
Expected equality of these values:
|
||||
m_tracker.LastDirty() & family
|
||||
Which is: 229376
|
||||
0u
|
||||
Which is: 0
|
||||
a write to a buffer bound to no binding point republished the binding-point sets
|
||||
```
|
||||
Both directions in one revert: the old shutter UNDER-fires on a rebind and an unbind and
|
||||
OVER-fires on an unrelated `glBufferSubData` (229376 = bits 15|16|17). Restored → 2/2 pass.
|
||||
|
||||
**(a) the record arm.** The brief's form is not executable at this head (see the strict table
|
||||
above, and §"rulings"). Executed the equivalent that IS available: keep the server's record arm
|
||||
and withhold the CLIENT's emission (`kMGPipeWiredBufferBindingSubsystem` back to 0), so the
|
||||
server's window is empty and nothing else can fill it:
|
||||
```
|
||||
0% tests passed, 5 tests failed out of 5
|
||||
3464..3466 DirectGLES.Split.AtomicCounterScenario.* (Subprocess aborted)
|
||||
3467..3468 DirectGLES.Split.ProgramPipelineScenario.* (Subprocess aborted)
|
||||
[08:18:24] [Linux MobileGLIntegra/FATAL]: MGPipe: Fatal{UnimplementedWritebackWait} - a ClientSession is
|
||||
active and buffer 1 still has an outstanding GPU write after its readback was emitted.
|
||||
```
|
||||
Restored → 5/5 pass. Also ran the mirror (`BindingPointsComeFromRecords()` → `false`, the
|
||||
frontend walk under a live wire): green picture, marker table unchanged — the finding in §2 of
|
||||
"rulings".
|
||||
|
||||
**(c) the sticky forward.** `rsp` is a process-wide residual-pull tally on the apply thread's
|
||||
stats line, not a per-field one, so the measurable form is the delta on
|
||||
`DirectGLES.Split.AtomicCounterScenario` (`MOBILEGL_PIPE_STATS=1 MOBILEGL_PIPE_STATS_PERIOD=1`):
|
||||
```
|
||||
=== AFTER (record arm live) === rsp values: 2 x rsp=196, 1 x rsp=588 (max 588)
|
||||
=== BEFORE (frontend walk) === rsp values: 2 x rsp=199, 1 x rsp=597 (max 597)
|
||||
```
|
||||
9 and 3 pulls per case removed — `GetBufferBindingPointCount` plus the per-point
|
||||
`GetBufferBindingPoint` reads of the counter walk. It does not reach 0 because other families
|
||||
still pull on the same thread.
|
||||
|
||||
**(d) no double marking.** The backend marks are deleted; the client's are the only producer.
|
||||
Withheld `MarkShaderStorageBindings` + `MarkAtomicCounterBindings` on the client:
|
||||
```
|
||||
0% tests passed, 3 tests failed out of 3
|
||||
../MobileGL/MG_IntegrationTest/Scenarios/AtomicCounterScenario.cpp:186: Failure
|
||||
Expected equality of these values: Which is: 5 Which is: 13
|
||||
../MobileGL/MG_IntegrationTest/Scenarios/AtomicCounterScenario.cpp:189: Failure
|
||||
Expected equality of these values: Which is: 100 Which is: 116
|
||||
```
|
||||
Restored → 3/3 pass, and `SplitBufferTest`'s existing
|
||||
`ProducerMarkCount(ShaderStorageBinding) == 1` / `AtomicCounterBinding == 1` pins stay green
|
||||
(24/24). A revert of the backend DELETION cannot go red by construction — it is a duplicate —
|
||||
so this is the honest form of (d).
|
||||
|
||||
**(e) the catalogue inverts.** `PipeCatalogue.{UninstalledTablesAreAllNull,
|
||||
ExactlyTheRoutedRowsAreInstalledAndTheRestAreStillNull}` now assert `SetShaderBuffers != nullptr`; installed rows
|
||||
34 → 35, the escape total 38 → 39, `PipeRouting...EveryRoutedRowMoved` 34 → 35.
|
||||
|
||||
## G1 / G2 / G14
|
||||
|
||||
Every new client symbol is under `MOBILEGL_PIPE_PUSH` (`BufferState`'s two members and the two
|
||||
`GLContext` forwarders included, so the pull build's objects do not resize) and every new server
|
||||
arm under `MOBILEGL_BUILD_DISAGGREGATED`, with the frontend arm kept token for token for
|
||||
`Transport=monolith` (ruling 1). The only shared-code deltas are `MGPShaderBuffers`' size (a
|
||||
push-only payload) and two `static_assert`s. 10 new ctest names, all with pull-build skip twins.
|
||||
|
||||
## Seams I assumed
|
||||
|
||||
- **pg** owns `currentProgram->GetUniformBlockBinding(i)` (`DirectGLES.cpp`, the line above my
|
||||
arm). I index `BoundShaderBuffers[Uniform][binding]` with its result and did not touch it; if
|
||||
pg moves the binding source to `MGPipeShaderCsoRecord::BlockBindings`, `binding` keeps its
|
||||
meaning and my arm is unaffected.
|
||||
- **fb** owns the third GPU-write mark, `MarkWritableImageBufferTexturesGpuWritten`
|
||||
(`DirectGLES.cpp`, kimi row S3). I deleted my two under a transport and left it; the brief
|
||||
calls the pair "one edit split across two files".
|
||||
- **ra** flips `kMGPipeP5eClientWaitRuleLanded`. `SetShaderBuffers` is `kWaitNone` in c0e's
|
||||
static column, so it goes fire-and-forget on that day with no change here.
|
||||
- **tx2 / fb** own the rows that abort ahead of mine in the strict lane.
|
||||
|
||||
## Rulings I need
|
||||
|
||||
1. **`GetBufferBindingPointCount`'s forward → FATAL under split (§5.6, §8.8) CONFLICTS WITH §6.**
|
||||
`MG_Backend/DirectVulkan/Renderer/UniformManager.cpp:1200` and `:2030` are live Magma
|
||||
readers, `FieldOwnership`'s class is unconditional, and §6 keeps Magma's P5C semantics — so
|
||||
the flip would abort a split Magma server. **I left both rows `BARRIER_PULLED`** and removed
|
||||
Espryt's only caller instead (the measured `rsp` drop above). A backend-keyed class would be
|
||||
a new mechanism and an integrator ruling.
|
||||
2. **Red-once (a)'s scenarios do not exist in the split lane.** `SsboArrayDynamicIndexScenario`,
|
||||
`StorageBufferRegrowScenario` and `SsboArrayLengthScenario` carry only `integration-gpu`;
|
||||
there is no `DirectGLES.Split.` twin. In the split scenarios that DO bind indexed buffers the
|
||||
strict lane aborts on pg's row first, so `Fatal{UnmigratedPipeInput,
|
||||
"GetBufferBindingPoint@DrawVbo"}` is unreachable until tx2/fb/pg land. Re-run this red on the
|
||||
integrated tree (BRIEF §3.5) — it should be reachable there.
|
||||
3. **The sink named in the brief does not exist.** `MG_Remote/Server/PipeApplier.cpp`'s
|
||||
`ServerVerbSink` has methods for the five class-B VERBS only; a `kCtxState` row's sink is the
|
||||
decode arm in `MG_Remote/Wire/PipeWireCodec.cpp`. I extended scope to two arms of that file
|
||||
(the decode case and the layout bound). pg will touch the neighbouring `SetProgramBindings`
|
||||
case — separate `case` labels, so the merge is textual only.
|
||||
4. **`PipeFill.cpp` needed a conjunct outside the named ranges.** `P4aFamilyHasItsConsumer` asks
|
||||
R-8 for the RESOURCE bit and answers `true` for any non-P4a family, so ID-106's consumer bit
|
||||
13 would have had no reader. I added `P5eFamilyIsLive` (bit 13's own R-8 question + bit 13
|
||||
requires bit 7) beside it and one conjunct in `FamilyIsLive` and in `wants()`.
|
||||
5. **`CONTRACT-P5E.md` §5.6 still says the `WritableMask` question is "an integrator ruling sb
|
||||
must ask for rather than pick".** ID-104 answered it; the landed contract text wants that
|
||||
paragraph replaced at landing. I did not edit c0e's file.
|
||||
6. `Fatal{ProtocolCorruption, "SetShaderBuffers.Class"}` is spelled in the file's existing shape
|
||||
(`Fatal{ProtocolCorruption} SetShaderBuffers.Class - …`, as `ApplyUnitWindow` spells its
|
||||
own), not with the contract's comma-and-quotes. Say if the contract's literal form is wanted.
|
||||
|
||||
## What I did not do
|
||||
|
||||
- The program-derived `set_shader_buffers` window (BRIEF §5, trailing): the window is the
|
||||
touched high-water mark, per ruling 10. A program binding block 0 at GL point 83 still pays an
|
||||
84-entry record on its first emission after a bind.
|
||||
- `set_stream_output_targets` stays unemitted and XFB stays lockstep (§5.7). Dirty bit 17 is
|
||||
computed, shutters correctly on the new generation, and names the subsystem.
|
||||
- `FieldOwnership.def:80-81` stays `BARRIER_PULLED` with phase "P5e (Espryt unbarriered), P7
|
||||
(Magma)": Magma still reads `GetBufferBindingPoint`, so the four consumers are not all gone.
|
||||
- No `PipeStats::CallClass` row for binding-point emissions — that would grow the counter arrays
|
||||
and the stats line for every build. The emitter keeps its own per-class tally
|
||||
(`EmissionCount(cls)`), which is what the unit suite reads.
|
||||
@@ -0,0 +1,213 @@
|
||||
# tx2 — textures and samplers by handle and window (P5e wave 2)
|
||||
|
||||
Branch `p5e/tx2`, head **1c872710**, base **f6cfcbd3** (landed wave 1). Tree `~/w7/p5e-tx2`.
|
||||
Five commits: 72e79020 (the family by handle), 85959090 (two the lane found), a08b3379 (tests),
|
||||
99211a48 (the ABA case re-aimed), 1c872710 (a comment fix).
|
||||
|
||||
## 1 What changed, per file
|
||||
|
||||
**`Managers.h`** — `BackendTextureObject` gains `m_pushedSyncHandle` (§4.1's `m_handle`) +
|
||||
`NotePushedSyncHandle/PushedSyncHandle` (`:1940-1960`, push-only, so the pull layout does not
|
||||
move); `IsDrawSyncCleanByRecord` (`:1740-1775`); `RequireImageBindableStorageByHandle`
|
||||
(`:1675-1695`); `SyncTextureViewToBackendByRecord` (`:1645-1665`); `ResolveOwnRecord` +
|
||||
`ResolvePushedBuiltinSampler`'s record parameter (`:1895-1910`).
|
||||
|
||||
**`Managers.cpp`** — `ResolveOwnRecord` (`:8752-8772`) is the whole of "the handle first, the
|
||||
client allocator only failing that", and the two prologues lose their `HandleOf` probes; the three
|
||||
sync bodies tolerate a null frontend object on the handle arm and answer `GetTarget` from
|
||||
`Desc.Target`, the ~20 `GetExternalIndex` log reads from `Desc.GlNameForDiag`, the storage-kind
|
||||
backstop from `Desc.StorageKind` (three macros beside the P4a/P5c ones);
|
||||
`SyncMipmapsToBackend`'s record resolution is hoisted to the top so the VIEW test can read
|
||||
`Desc.ViewOf` (`:7285-7310`); the buffer arm reads `Desc.BufferForTexBuffer / BufOffset / BufSize`
|
||||
and passes `nullptr` to `EnsureBufferResourceForHandle` (`:8415-8600`);
|
||||
`RequireImageBindableStorageByHandle` (`:5879-5930`); `SyncTextureViewToBackendByRecord`
|
||||
(`:7015-7065`); the two c0e seams bodied (`:14100-14200`).
|
||||
|
||||
**`DirectGLES.cpp`** — `UnitTexturesByHandle()` (`:2170-2185`) is the one arm selector
|
||||
(`Transport != Monolith && SamplerSubsystemEnabled() && TextureResourceSubsystemEnabled()`);
|
||||
`UnitTextureSyncByHandleEntry` + its list and keys (`:2186-2215`); the unit half of
|
||||
`SyncNeccessaryTextures` (`:2420-2485`); `CurrentUnitBindingsEpoch`'s decline → refusal
|
||||
(`:2092-2112`); `ResolveAndBindUnitTextures`' window arm (`:4990-5065`);
|
||||
`ResolveUnitSamplerBackend` → refusal at the entry (`:5205-5230`); `BindCurrentUnitSamplers`'
|
||||
decline → refusal (`:5330-5350`); `BindCurrentTextures`' ruling-6 key, entry selection included
|
||||
(`:5460-5600`); the sampler pass by record (`:5880-5960`); `NeedsRawDepthFetchSampler`'s
|
||||
values-taking overload (`:286-310`); `GenerateMipmapByRecord` (`:10062-10112`) and
|
||||
`GenerateMipmap`'s `VerbMipRes` arm (`:10120-10145`); the two mip-shape `HandleOf` sites deleted
|
||||
in favour of `Generate{Depth,Color}Texture2DMipmapByRecord` (`:9660-9700`);
|
||||
`ScopedDetachedTextureFramebufferAttachments`' by-handle constructor over the applier's
|
||||
framebuffer records (`:9215-9290`); both CopyTex destinations synced by handle (`:9780`, `:9900`).
|
||||
|
||||
**`MG_State/GLState/TextureState/MipmapStorage.cpp`** — the guard list gains the seven read-only
|
||||
shape accessors through `RefuseLegacyTextureShapeReadFromApplyThread`, which is keyed on the
|
||||
server backend being DirectGLES (ruling 12's shape). The mutator rows stay unconditional.
|
||||
|
||||
**`MG_Remote/Server/PipeApplier.cpp`** — `CheckUnitWindows(st, verb)` (`:437-495`) called from
|
||||
`OnDrawVbo` (`:515`) and `OnLaunchGrid` (`:738`).
|
||||
|
||||
**Tests** — `RemoteClientTest.cpp` seven new `MGL_TEXTURE_GUARD_TEST` rows; `SanityTest.cpp`
|
||||
`ARecycledTextureSlotReMintsTheTwinOnTheHandleArm` + its pull-build skip twin.
|
||||
|
||||
## 2 The kimi audit's texture/sampler rows (35-67)
|
||||
|
||||
RETIRED under a transport: **35, 36, 37** (the snapshot walk is now unreachable: the decline that
|
||||
led to it is a named refusal) · **38, 39, 40, 42** (the unit list is `st.BoundSamplerViews[]`,
|
||||
the gate is `IsDrawSyncCleanByRecord`) · **47, 48, 49** on the by-handle entry (the frontend entry
|
||||
survives as monolith glue and is still reached from fb's three attachment lists) · **50, 51, 52,
|
||||
53** (`ResolveAndBindUnitTextures` is one pass over the window; the target is the view CSO's; the
|
||||
unbind walks the fixed `TextureTarget` enum against `g_boundTexturesCache`) · **54, 55, 56, 57,
|
||||
58** (the identity sampler family) · **59, 60, 62** (`VerbMipRes` + the descriptor) · **63** (the
|
||||
detach sweep by handle over the framebuffer records) · **66** (the four `HandleOf` probes; they
|
||||
survive only as the no-handle-noted fallback).
|
||||
|
||||
LEFT BARRIERED / trailing: **61** `GenerateThreeChannelFloatMipmapOnCpu` — named
|
||||
`Fatal{UnmigratedEmulation, "generate-mipmap-cpu-filter"}` at the entry of the arm that would use
|
||||
it; the pull is P8/P9's · **64** `UpdateTextureBindingAtTarget`'s `GetTextureUnitObject` (CopyTex
|
||||
is `kWaitApplied`) · **65** already monolith-only at the base.
|
||||
|
||||
NOT MINE (fb's rows, untouched): **41, 43, 44, 45, 46, 67**. NOT FOUND: none — every row of 35-67
|
||||
exists at this head.
|
||||
|
||||
## 3 Named behaviour deltas (G1 §)
|
||||
|
||||
- **P5e-5, the narrowing.** The unit list syncs the PROGRAM-RESOLVED texture per unit; the
|
||||
frontend walk syncs every slot of every touched unit. What stops being synced as a side effect is
|
||||
a texture bound to a touched unit that the program does not sample. Coverage is unchanged because
|
||||
the union covers it — views ∪ image units ∪ attachment lists ∪ the waited texture ops — **and the
|
||||
lane proved the last term is load-bearing rather than rhetorical**:
|
||||
`F1WireScenario.CopyTexSubImage2DPixels` went black, because a copy DESTINATION is bound to the
|
||||
active unit and sampled by nobody. Both CopyTex endpoints now sync themselves by handle — the
|
||||
only case the 111-entry lane found, and the shape any future "bound but not sampled" consumer
|
||||
has to copy.
|
||||
- **Ruling 1 / G1.** Every handle arm is selected by `Transport != Monolith` AND the two family
|
||||
bits; the push-monolith build keeps the frontend view test, `RequireImageBindableStorage`, the
|
||||
unit walk and the `GenerateMipmap` body token for token. The pull build compiles none of the new
|
||||
members, so `BackendTextureObject`'s pull layout does not move and the admitted resize set stays
|
||||
empty.
|
||||
- **`UnitTextureSyncEntry` is NOT re-shaped in place.** A second push-only struct
|
||||
(`UnitTextureSyncByHandleEntry`) and a second list are added beside it, because the same struct
|
||||
is also the draw-FBO and read-FBO attachment lists' — those are fb's, and one name carrying two
|
||||
shapes across two worktrees is the merge trap the contract package exists to avoid. Deviation
|
||||
from the brief's "re-shape, push-only"; the observable effect is identical.
|
||||
- **Scout R4, made explicit in code and here.** `IsDrawSyncCleanByRecord` reads BOTH
|
||||
`Params.ForceResync` / `Params.SamplerResync` (the client's bits, read and never written back)
|
||||
AND `m_forceTextureParamsResync` / `m_forceSamplerResync` (the server's, set by
|
||||
`RecreateBackendTexture` / the image-bindable transition and cleared only by the prologue that
|
||||
consumed them). Neither side clears the other's. A gate that read one side would skip the sync
|
||||
the other is asking for, and for the sampler half that is not mis-filtering but an INCOMPLETE
|
||||
texture sampling (0,0,0,1).
|
||||
- **Scout R5, resolved.** The buffer-texture arm passes `nullptr` to
|
||||
`EnsureBufferResourceForHandle`: that function's three frontend reads are all inside its
|
||||
monolith arm (kimi row 29), so `nullptr` is the whole of the split answer and is what §4.2's
|
||||
Buffer row prescribes. Whole-vs-range stops asking the buffer for its size — `kMGPipeWholeBuffer`
|
||||
IS the question.
|
||||
|
||||
## 4 Red-once evidence (executed, quoted, reverted)
|
||||
|
||||
1. **Revert the handle arm** (`UnitTexturesByHandle() → false` and `MGB_STAGED_TEXTURE_LIVE →
|
||||
false`), `ctest -R DirectGLES.Split.TriangleScenario` → 0/2 passed:
|
||||
`MGPipe: Fatal{RoleViolation, "texture-legacy-arm"} - the apply thread called
|
||||
TextureObjectMipmap::GetMipmapLevelCount on a frontend object. With an active transport the
|
||||
server reads the staged-texture store and the resource descriptor (CONTRACT-P5C §2, rule E); a
|
||||
frontend texture's level storage is client memory and this arm is monolith-only`
|
||||
2. **Revert the unit work list's handle arm**, full strict lane →
|
||||
`MGPipe: Fatal{UnmigratedPipeInput, "GetTextureUnitObject@Clear"} [BARRIER-PULLED,
|
||||
MOBILEGL_IPC_STRICT_ERRORS=1, retires in P5e (Espryt unbarriered), P7 (Magma)]` on 9 entries —
|
||||
byte for byte the BEFORE table below. **Reverting `ResolveAndBindUnitTextures`' window arm
|
||||
ALONE changes nothing in the lane** (48/14/13/6/3/2, identical to the after table): with fb and
|
||||
vi unlanded, no entry survives to a draw's unit walk, so `GetTextureUnitObject@DrawVbo` cannot
|
||||
be any entry's FIRST pulled row. The brief's expected marker is therefore unreachable on this
|
||||
tree and the unit-list form above is the one that names the field.
|
||||
3. **ABA**: drop the forward-Gen reset in `BackendSlotTable::GetOrCreate(handle)` →
|
||||
`ARecycledTextureSlotReMintsTheTwinOnTheHandleArm` fails:
|
||||
`Expected equality of these values: *secondSlot / Which is: (ptr = 0x592a99c35310, ...) /
|
||||
nullptr` and `Value of: MG_Pipe::MGPipeHandleIsNull((*secondSlot)->PushedSyncHandle()) /
|
||||
Actual: false / Expected: true`.
|
||||
4. **Narrow `SamplerEmit.h`'s `Count` by one** → isplit 80% (22 of 111 red):
|
||||
`MGPipe: Fatal{ProtocolCorruption, "SetSamplerViews.Count"} - draw_vbo applies with units 0..0
|
||||
touched, so set_sampler_views must carry Start=0 and Count >= 1 (CONTRACT-P5E.md §5.3); the
|
||||
applied window is Start=0 Count=0, which drops the sync of at least one texture this draw
|
||||
samples` — and the dispatch twin, verbatim, with `launch_grid` in place of `draw_vbo`.
|
||||
5. **Revert `GenerateMipmap`'s `VerbMipRes` arm**, strict on the three split F1 GenerateMipmap
|
||||
entries → `MGPipe: Fatal{UnmigratedPipeInput, "GetTextureUnitObject@GenerateMipmap"}
|
||||
[BARRIER-PULLED, ...]` in `p5b-f1-GenerateMipmapDepth.log` and
|
||||
`p5b-f1-GenerateMipmapPackedFloat.log`; with the arm present those two abort on fb's
|
||||
`GetFramebufferBindingSlot@ReadPixels` instead. Plain isplit also goes 2/3 red with the arm
|
||||
reverted.
|
||||
|
||||
## 5 Gate
|
||||
|
||||
| step | result |
|
||||
|---|---|
|
||||
| build | rc=0 |
|
||||
| unit | **2214/2214** (2206 at the base + 8 new: 7 guard rows + the ABA case) |
|
||||
| `integration-split` | **111/111** |
|
||||
| gens | all 7 rc=0; the one doc-citation line (`CONTRACT-P5.md:524 Core.cpp:39 ambiguous`) is pre-existing and not mine |
|
||||
| `one` | 242/242 on `SampledSetStalenessScenario|TextureParamsWithoutASamplerView|F1WireScenario|UnboundImageDescriptorScenario|HandleRecycleScenario` |
|
||||
| strict | 3 passed / 108 failed, **unchanged from the base** (the lane is red by design until fb, vi, pg and sb land) |
|
||||
|
||||
**Strict markers, before and after, measured on THIS tree's own base (f6cfcbd3), 88 private logs:**
|
||||
|
||||
| marker | before | after |
|
||||
|---|---|---|
|
||||
| `GetFramebufferBindingSlot@Clear` (fb) | 39 | **48** |
|
||||
| `GetBoundVertexArray@DrawArrays` (vi) | 14 | 14 |
|
||||
| `GetImageTextureBinding@BindImageTexture` (fb) | 13 | 13 |
|
||||
| **`GetTextureUnitObject@Clear` (tx2)** | **9** | **0** |
|
||||
| `GetTextureObject@CopyImageSubData` (P5b debt) | 6 | 6 |
|
||||
| `GetProgramForDispatch@DispatchCompute` (pg) | 3 | 3 |
|
||||
| `ValidateProgramName@ShaderStorageBlockBinding` (pg) | 2 | 2 |
|
||||
|
||||
The only field that disappeared is mine; the only field that grew is fb's, by exactly the nine
|
||||
entries that used to abort at mine first. `GetTextureUnitObject` is gone from the lane entirely.
|
||||
|
||||
## 6 Seams assumed, and what I coded against
|
||||
|
||||
- **`SyncMipmapsToBackendByHandle(handle)`** is bodied as c0e declared it (handle only): it
|
||||
resolves the record itself and stamps `m_pushedSyncHandle`, so fb's attachment sync and image
|
||||
sweep can call it with nothing but a `MGPSurface::Res` / `MGPImageView::Res`.
|
||||
**`SyncTextureToBackendByHandle`** returns `SharedPtr<...>&`; a decline is a reference to a NULL
|
||||
twin, so callers must test it. **`ResolveTextureTwin`** (id's) is used unchanged and NOT edited -
|
||||
it does not stamp the handle; the two by-handle SYNC entries do.
|
||||
- **fb's reverse index** was not available, so `ScopedDetachedTextureFramebufferAttachments`'
|
||||
handle arm walks `MGPipeApplierState::FramebufferRecordFor()` directly; if fb lands an index,
|
||||
that constructor is one call site to re-point.
|
||||
- **pg's half of ruling 6**: keyed on `{DrawProgram.{Slot,Gen}, ShaderCso.Serial, BindingsSerial}`
|
||||
through `PipeShaderCsoRecordForHandle(st.DrawProgram)`; if pg moves `BindingsSerial`'s writer the
|
||||
key follows with no edit here. `BindCurrentTextures` still RECEIVES pg's `currentProgram` and no
|
||||
longer reads it on the handle arm, entry selection included.
|
||||
|
||||
## 7 Rulings I need
|
||||
|
||||
1. **Texture VIEWS have no wire carrier for the view window.** `Desc.ViewOf` names the storage
|
||||
owner, but `minLevel/numLevels/minLayer/numLayers` are on no record. The STEADY question is
|
||||
answered server-side (sync the storage twin by handle, compare
|
||||
`m_viewSourceBackendTextureId`, stamp the serial); the CREATION of the view still needs the
|
||||
frontend object and takes it when the monolith-glue note reaches one, with a named
|
||||
`MGLOG_E_ONCE` when it does not. `TextureViewScenario` is not in `integration-split`, so
|
||||
nothing goes red today. Ruling wanted: four `Uint16`s on `MGPResourceDesc` (it has no spare
|
||||
pad, so this grows it) in a later package, or the view arm stays barriered and trailing.
|
||||
2. **`GenerateMipmap`'s `WaitClass` is NOT flipped**, per ruling 14's escape. The unit read is
|
||||
gone, but the RGB16F/RGB32F CPU filter still reaches the client's level shadows (kimi 61), so
|
||||
the arm is not complete. Trailing item for tx2 or P8.
|
||||
3. **`CheckUnitWindows` admits one silence**: both counts still 0 means the client's sampler
|
||||
subsystem bit is clear and the backend runs its frontend walk, so there is no window to
|
||||
check. Narrowing carries a non-zero-but-too-small count and is refused. Confirm this is the
|
||||
intended reading of ID-95, or the check has to be armed off the caps/subsystem mask instead.
|
||||
4. **The widened `MipmapStorage` rows are backend-kind-keyed.** The unconditional widening
|
||||
aborted Magma's `BlitNamedFramebuffer` → `ResolveColorBlitBinding` → `IsComplete()` (two
|
||||
isplit entries). Ruling 12's shape applied: the new READ rows abort on DirectGLES and are
|
||||
silent on DirectVulkan; the MUTATOR rows stay unconditional. Confirm, or Magma's blit path
|
||||
opens `MGPipeTextureLegacyArmScope` instead (VulkanRenderer.cpp is not in my scope).
|
||||
|
||||
## 8 What I did not do
|
||||
|
||||
- **The `PipeSlotPeek` zero-scope-entries-per-frame assertion.** `PipeSlotPeek` reads the CLIENT
|
||||
allocator's occupancy; there is no per-frame counter of `MGPipeFrontendKeyedRegistryScope`
|
||||
entries and adding one would be hot-path instrumentation the roadmap forbids. The stronger
|
||||
observable already exists and is unconditional: once ra lands, ANY frontend-keyed probe from an
|
||||
unbarriered apply is `Fatal{RoleViolation, "MGPipeSlots"}`. The family's remaining scope sites
|
||||
(`DirectGLES.cpp:1745, :5137, :5223`, `Managers.cpp:5996, :8757`) are all monolith-glue halves
|
||||
the transport arms return in front of; the draw path reaches none of them.
|
||||
- The CopyTex ENDPOINT resolve and `GetTexImage` — barriered and trailing, as the brief scopes
|
||||
them. `set_texture_params`' reply and the `resource_subdata` texture half — likewise untouched.
|
||||
- No measurement of this family's apply-thread share (scout R6): it belongs with the device exit.
|
||||
@@ -0,0 +1,235 @@
|
||||
# vi — VAO / vertex input / index, v1
|
||||
|
||||
Branch `p5e/vi`, head **112c1d8d**, base `f6cfcbd3`. Three commits, no trailers. Tree clean.
|
||||
|
||||
## 1 What changed, per file (line ranges at the BASE head)
|
||||
|
||||
**`DirectGLES.cpp`** — `:490` `VertexInputReadsRecords()` (arm selector: `Transport != Monolith` AND
|
||||
the family bit, ruling 1 / ID-81) + `AnyClientSideVertexArrayInRecord()` (reads BOTH views: a null
|
||||
`Res` is "client-sourced" only for an attribute the CSO declares ENABLED, since the window also
|
||||
carries nulls for disabled slots below the high-water mark). `:786`
|
||||
`SyncVaoAttributeBuffersByRecord(memo, epoch)` beside the existing `...ByHandle` — same memo, same
|
||||
three-value key, walk over `st.VertexBuffers[Start..+Count).Res`, dedupe on `{slot,gen}`,
|
||||
`EnsureBufferResourceForHandle(nullptr, Res)`, probe with `frontend == nullptr` — plus the two
|
||||
named source decisions `ResolveDrawVertexBuffersFromRecord` / `ResolveDrawIndexBufferFromRecord`
|
||||
(§3: they exist so a unit case drives the production decision, not a copy of it). `:807, :827-831`
|
||||
the null-VAO early return no longer fires on the record arm and the dispatch takes it first.
|
||||
`:896-941` the IBO arm reads `st.IndexBuffer.Res` + `st.IndexBufferSerial`; the legacy and
|
||||
push-monolith arms unchanged inside a new brace block. `:1602-1639` `ResolveVaoTwin(SharedPtr)`
|
||||
keeps its body and LOSES its `MGPipeFrontendKeyedRegistryScope` (§4.4's `:1609`). `:1655` new
|
||||
`SyncCurrentVAOFromRecords(twin)`. `:1667-1694` `SyncCurrentVertexAttributeValues` reads neither
|
||||
`GetBoundVertexArray` nor `GetConfigVersion`; memo keyed `{elementsHandle, ContentSerial,
|
||||
activeMask}` over `rec->Attributes[i].Enabled`. `:4770-4795` `PrepareForDraw`'s VAO lines only, and
|
||||
`AccessorCalls` is 1 per draw on the record arm (it was 2 and one of the two reads is gone — the
|
||||
ledger has to say so). `:6446-6461` `RefuseElementArrayBufferFromTheFrontend` in both restart
|
||||
helpers. `:6718-6788` the two client-array arms folded into one file-local `static`
|
||||
`SyncClientSideVertexArraysForDrawArrays`; both scopes (`:6729`, `:6775`) deleted, twin by handle.
|
||||
|
||||
**`Managers.h`** — `ResolvedDrawBuffers::iboSerial` (push-only); `Entry::frontend`/`::attribIndex`
|
||||
re-documented as monolith glue / diagnostics; `PendingAttribValueMask` gains `{elementsHandle,
|
||||
elementsSerial}` (push-only); `SyncToBackendFromApplier` private → public (§4.1: "the object
|
||||
parameter is deleted from the transport overload, not defaulted to null");
|
||||
`BufferMutationEpochBumpsOffTheApplyThread()`; the two `Resolve*FromRecord` declarations.
|
||||
**`Managers.cpp`** — `BumpBufferMutationEpoch` only (§4b); `SyncToBackendFromApplier`'s body is
|
||||
UNCHANGED and is this family's existence proof.
|
||||
|
||||
**`EmitTables.{h,cpp}`** — `RemoteDrawBindings::ClientVertexArrays`, answered inside
|
||||
`ReadDrawBindings`' one binding read; `PlanDrawInfo` sets `kDrawClientArrays` for every draw shape
|
||||
(a `glDrawElements` can fetch its VERTICES from client memory); `EmitDrawRecord` and the reduced
|
||||
`EmitDrawArrays` path refuse under run-ahead.
|
||||
|
||||
**Tests** — `MG_Test/SanityTest.cpp` (+ pull skip twins), `MG_Test/Pipe/VertexInputEmitTest.cpp`,
|
||||
new `MG_IntegrationTest/Scenarios/ClientVertexArrayScenario.cpp` with its `CMakeLists.txt` block and
|
||||
its `Harness/SplitLogPaths.cmake.in` entry.
|
||||
|
||||
## 2 The kimi-audit rows of this family, 1–34
|
||||
|
||||
**RETIRED** (not read under a transport): **1** (`GetBoundVertexArray@PrepareForDraw`), **2**, **3**
|
||||
(twin probe + mint), **5** (`GetConfigVersion`), **6** (the VAO handoff), **9**, **10**'s
|
||||
`:1683`/`:1688` halves (`:1700` was already RECORD_SUPPLIED), **12**, **13** (the `Find(vao.get())`
|
||||
probe is gone unconditionally; the VAO itself is taken only when the record says an enabled
|
||||
attribute is client-sourced), **16**, **17**, **19**, **20**, **21**, **23**, **24**; and **25** /
|
||||
**27** *for this family's callers* (`HandleOfBuffer` inside `IsBufferDrawClean` /
|
||||
`EnsureBufferResource` is no longer reached from the vertex-input arm; sb/tx2/fb keep their own).
|
||||
Row **18**'s frontend argument is gone (the record arm passes `nullptr`).
|
||||
|
||||
**LEFT BARRIERED**: **14** / **34** — `SyncClientSideAttributesForDrawArrays` still dereferences
|
||||
`attrib.Offset` as a client pointer (§4a). **15** — `MultiDraw.cpp:96`, see R2.
|
||||
Rows **4**, **7**, **8**, **22**, **26** are legacy-arm-only bodies and die with the legacy arm, not
|
||||
with this package.
|
||||
|
||||
**NOT FOUND** as a live split read: **11** (the restart helpers were already unreachable under a
|
||||
transport — the P5c substitution sets `serverElementBinding >= 0` before its null test; now they
|
||||
refuse by name instead of being unreachable-by-reading), **28**, **29** (monolith-only already;
|
||||
passing `nullptr` changes nothing), **33** (already `Transport == Monolith`-gated).
|
||||
**NOT vi's**: **30**, **31**, **32** (sb's).
|
||||
|
||||
## 3 Red-once evidence, verbatim
|
||||
|
||||
**(1) Twin key.** `PrepareForDraw`'s transport arm reverted to
|
||||
`ResolveVaoTwin(MGB_CTX->GetBoundVertexArray())`; both `DirectGLES.Split.TriangleScenario` entries
|
||||
`Subprocess aborted`:
|
||||
|
||||
```
|
||||
[08:02:07] [Linux mgl-srv-apply/FATAL]: MGPipe: Fatal{RoleViolation, "MGPipeSlots"} - the apply thread called MGPipeSlots().HandleOf. With an active transport the client slot allocator is client-only memory (CONTRACT-P5C §3.1, rule E; CONTRACT-P5E §4.4): a handle arrives already minted in a record, and a server that resolves or mints one off a frontend object's lifetime id is reading memory that will not exist on its side of a real split. A named exemption scope admits it only while the record being applied is BARRIERED (barriered=1) and, for Magma's P7 debt, only on a DirectVulkan server
|
||||
```
|
||||
|
||||
Note `barriered=1`: **no id test hook was needed**. Deleting the scope is what makes the revert loud
|
||||
today rather than after ra flips the wait rule.
|
||||
|
||||
**(2) The buffer walk.** `ResolveDrawVertexBuffersFromRecord` reverted to
|
||||
`MG_State::pGLContext->GetBoundVertexArray()->GetAllAttributes()`:
|
||||
|
||||
```
|
||||
../MobileGL/MG_Test/SanityTest.cpp:5088: Failure
|
||||
Expected equality of these values:
|
||||
count
|
||||
Which is: 1
|
||||
2u
|
||||
Which is: 2
|
||||
the walk did not resolve st.VertexBuffers[Start..+Count): two DISTINCT handles are named there (A twice and B), plus one client-memory array with no store to ensure
|
||||
```
|
||||
|
||||
**(3) The index arm.** `ResolveDrawIndexBufferFromRecord` reverted to the VAO's element slot:
|
||||
|
||||
```
|
||||
../MobileGL/MG_Test/SanityTest.cpp:5149: Failure
|
||||
Expected equality of these values:
|
||||
request.Res
|
||||
Which is: 8-byte object <02-00 00-00 00-00 00-00>
|
||||
publishedHandle
|
||||
Which is: 8-byte object <01-00 00-00 00-00 00-00>
|
||||
the index arm did not read st.IndexBuffer.Res; if it answered the VAO's element slot it is reading a binding the client has already changed
|
||||
../MobileGL/MG_Test/SanityTest.cpp:5152: Failure
|
||||
request.Serial
|
||||
Which is: 0
|
||||
11u
|
||||
IndexBufferSerial did not travel with the handle
|
||||
```
|
||||
|
||||
**(4) Client arrays under run-ahead.** `kMGPipeP5eRunAheadReady` flipped to `true` in
|
||||
`MG_Backend/Init.cpp`, `ClientVertexArrayScenario` run in the split lane — exit 134 and, on the GL
|
||||
thread's own log:
|
||||
|
||||
```
|
||||
[08:03:18] [Linux MobileGLIntegra/FATAL]: MGPipe: Fatal{UnmigratedVerb, "DrawArrays+CLIENT_ARRAYS"}
|
||||
```
|
||||
|
||||
**(ID-95 window pin, extra.)** `EmitVertexBuffers`' count narrowed by one:
|
||||
|
||||
```
|
||||
../MobileGL/MG_Test/Pipe/VertexInputEmitTest.cpp:490: Failure
|
||||
Expected: (i) < (window.Start + window.Count), actual: 7 vs 7
|
||||
create_vertex_elements declares attribute 7 ENABLED but set_vertex_buffers' window ends at 7 - the same skip, at the other end. A narrower window is the sink's Fatal{ProtocolCorruption, "SetVertexBuffers.Count"}
|
||||
```
|
||||
|
||||
Every revert was put back and re-verified green before the commits.
|
||||
|
||||
## 4 The two answers the gate asked for
|
||||
|
||||
**(a) Does any existing scenario exercise a client vertex array under split? NO.** Every
|
||||
`glVertexAttribPointer` in `MG_IntegrationTest/Scenarios` is issued with `GL_ARRAY_BUFFER` bound, so
|
||||
its last argument is a byte offset; `DoublePrecisionScenario` — the brief's candidate — uses
|
||||
`glVertexAttribFormat`/`glVertexAttribBinding`/`glVertexAttribLFormat` against real buffer objects
|
||||
(`DoublePrecisionScenario.cpp:944-959`). `ClientVertexArrayScenario` is therefore new and is the
|
||||
only lane entry that can reach the refusal.
|
||||
|
||||
**A DEVIATION FROM THE BRIEF that needs the integrator's eye.** The brief makes the
|
||||
`DrawArrays`/`MultiDrawArrays` arms *monolith-only*. **They cannot be, before ra lands.** Under split
|
||||
LOCKSTEP a client vertex array is not refused (ID-82: lockstep unchanged), so a monolith-only arm
|
||||
would silently drop the attribute upload and render wrong *today*. What landed instead: the arm
|
||||
stays on both, resolves the twin BY HANDLE (so the probe and both scopes go either way), takes the
|
||||
frontend VAO only when `AnyClientSideVertexArrayInRecord()` is true — which is what actually retires
|
||||
`GetBoundVertexArray@DrawArrays` for ordinary draws — and aborts by name if it is ever reached from
|
||||
an UNBARRIERED apply, which escalation (ii) of §2.1 and the client refusal both make unreachable.
|
||||
The new scenario passes on all four arms (DirectGLES / DirectVulkan / DirectGLES.Split × 2 cases),
|
||||
which is the evidence that the arm is load-bearing. `SyncClientSideAttributesForDrawArrays` is
|
||||
likewise NOT made monolith-only.
|
||||
|
||||
**(b) Does any GL-thread path bump `CurrentBufferMutationEpoch` under a transport? YES — exactly one
|
||||
class, and it is before the apply thread exists.** An unconditional refusal in
|
||||
`BumpBufferMutationEpoch` took the whole split lane down in EGL bring-up, which is how this was
|
||||
found rather than reasoned: `BackendObject_DirectGLES::Initialize()` runs on the APP thread by
|
||||
design and ends in `RegisterBufferBackendOps()`, whose last act is a bump. At that moment
|
||||
`ServerLoop::Detail::g_applyThreadKey == 0` — no record applied, no twin, no memo stamp for it to
|
||||
slide under. What landed is the narrower pin: a bump off the apply thread *while one is running* is
|
||||
counted (`BufferMutationEpochBumpsOffTheApplyThread()`) and **Fatal under
|
||||
`MOBILEGL_IPC_STRICT_ERRORS`**; across the 113-entry split lane it never fires. Not Fatal by default
|
||||
because `StagedShadowProductionTest`/`ServerLoopTest` drive the real op tables from the test thread
|
||||
beside a started loop — 7 unit cases went red on the wider form, and policing a fixture is not what
|
||||
this pin is for.
|
||||
|
||||
## 5 Gate
|
||||
|
||||
| step | result |
|
||||
|---|---|
|
||||
| `build` | rc=0 |
|
||||
| `unit` | **2209/2209** (base 2206; +3, each with a pull skip twin) |
|
||||
| `isplit` | **113/113** (base 111; +2 `ClientVertexArrayScenario` split entries) |
|
||||
| `gens` | all 7 rc=0; `check_doc_citations.py --strict` rc=0 (its three printed lines are pre-existing `CONTRACT-P5.md` ambiguities) |
|
||||
| `one`, the eight named scenarios | **274/274**, covering BOTH the monolith `DirectGLES.*` arm and `DirectGLES.Split.*`, so ruling 1's A/B is exercised and `ObjectSubsystemControlScenario`'s `0x0ff`/`0x17f` verdicts are unchanged |
|
||||
| `strict` | red by design (110/113 abort), markers below |
|
||||
|
||||
**Strict markers, before → after** (per-entry private logs, ID-53; counts are log lines):
|
||||
|
||||
| `field@verb` | base (111) | after (113) | owner |
|
||||
|---|---|---|---|
|
||||
| `GetBoundVertexArray@DrawArrays` | **14** | **0 — GONE** | vi |
|
||||
| `GetProgramForDraw@DrawArrays` | 0 | **14 (new)** | pg — the next field in *those same 14 entries* |
|
||||
| `GetFramebufferBindingSlot@Clear` | 39 | 41 | fb (+2 = my two new lane entries, which clear first) |
|
||||
| `GetImageTextureBinding@BindImageTexture` | 13 | 13 | fb |
|
||||
| `GetTextureUnitObject@Clear` | 9 | 9 | tx2 |
|
||||
| `GetTextureObject@CopyImageSubData` | 6 | 6 | tx2 (barriered, allowlisted) |
|
||||
| `GetProgramForDispatch@DispatchCompute` | 3 | 3 | pg |
|
||||
| `ValidateProgramName@ShaderStorageBlockBinding` | 2 | 2 | pg (barriered) |
|
||||
|
||||
This family's only visible field is retired; the field that surfaced behind it is pg's.
|
||||
|
||||
## 6 G1 / monolith impact
|
||||
|
||||
The pull build is **not rebuilt here** (the gate configures only `build-split`); the delta is named
|
||||
rather than measured. Everything is under `#if MOBILEGL_BUILD_DISAGGREGATED` or
|
||||
`#if MOBILEGL_PIPE_PUSH` except: one new **file-local `static`** function
|
||||
(`SyncClientSideVertexArraysForDrawArrays`) re-homing two byte-identical inline blocks from the two
|
||||
`DrawArrays` entry points (no exported symbol); three constant-folded branches
|
||||
(`VertexInputReadsRecords()` is `return false` there, so the null-VAO guard, `PrepareForDraw`'s
|
||||
selector and the `AccessorCalls` count all fold) plus two default-constructed null `SharedPtr`
|
||||
locals; and `RefuseElementArrayBufferFromTheFrontend` compiling to `(void)entry;`. No struct layout
|
||||
moves — `iboSerial` and the `PendingAttribValueMask` fields are `MOBILEGL_PIPE_PUSH`-only. G2/G14:
|
||||
the new unit cases have pull skip twins; the new scenario's ctest entries appear in both arms
|
||||
symmetrically. **Please re-run the pull configure at landing.**
|
||||
|
||||
## 7 Seams assumed, and what I need
|
||||
|
||||
1. **ra — `ClientSession::RunAheadArmed()`** does not exist yet. `EmitTables.cpp`'s
|
||||
`RunAheadWouldSkipTheWait(session)` spells the same conjunction `MGPipeTypes.h:148` states
|
||||
(`BarrierArmed() && Ipc.RunAhead && Caps().HasCap(kCapRunAheadApply)`). **ra should collapse that
|
||||
body into the latch**: a duplicated predicate that can disagree with the wait rule about which
|
||||
arm the session is on is the one failure mode here. Inert until the caps bit is published.
|
||||
2. **tx2 — `CheckUnitWindows(st)`.** I pinned the PRODUCER half of ID-95 / ruling 19 only; the sink
|
||||
check and its `Fatal{ProtocolCorruption, "SetVertexBuffers.Count"}` are tx2's. My test names that
|
||||
exact string so the two halves meet.
|
||||
3. **pg.** `SyncCurrentVertexAttributeValues` still reads `program->GetActiveAttributeLocationMask()`
|
||||
and `GetAttribType(location)` (kimi row 106, S1's R3). My half is done; it stays a frontend reader
|
||||
— a BARRIERED one — until pg carries the mask and types in the `ShaderCso` record.
|
||||
`GetProgramForDraw@DrawArrays` is now the marker those 14 entries die on, so pg will see it.
|
||||
|
||||
**Rulings needed:** **R1** — the "monolith-only" wording for the two `DrawArrays` arms and for
|
||||
`SyncClientSideAttributesForDrawArrays` (§4a); confirm my reasoning or tell me to take the
|
||||
regression. **R2** — `MultiDraw.cpp:96 BoundIndexBuffer()` / `:105 BoundIndexBufferId()` (kimi rows
|
||||
15, 128) read `MGB_CTX->GetBoundVertexArray()` on every multi-draw with no transport arm, and
|
||||
`MultiDraw.cpp` is in no package's scope in BRIEF-P5E; it is a two-line change of exactly §5.1's
|
||||
shape. **Left as-is** — widen vi's range or take it. **R3** — `BumpBufferMutationEpoch` is in
|
||||
`Managers.cpp` outside my declared range; the gate asked for the pin and there was nowhere else for
|
||||
it. **R4** — `SyncToBackendFromApplier` moved private → public in `Managers.h` (a declaration, not a
|
||||
body), for the reason §4.1 gives.
|
||||
|
||||
## 8 What I did not do
|
||||
|
||||
- `ResolvedDrawBuffers`' deletion (S1 R7) — trailing by instruction, measurement first. It is now
|
||||
cheap to measure: the memo's entries are `{handle, resource, bindingIndex}` over a window that is
|
||||
1–3 entries on the measured workload.
|
||||
- Staging client vertex arrays (P8).
|
||||
- A `RemoteClientTest` unit twin for `PlanDrawInfo`'s `kDrawClientArrays` flag — that file is not in
|
||||
vi's scope; the flag is covered end to end by the scenario's red-once instead.
|
||||
- No pull-build configure (§6).
|
||||
@@ -0,0 +1,239 @@
|
||||
# S1 — VAO / vertex input / index, under run-ahead
|
||||
|
||||
Head `2fde7034`. Paths under `MobileGL/`. Arm assumed throughout: `MOBILEGL_PIPE_PUSH` with bits 7
|
||||
and 8 set (`ResourceSubsystemEnabled()` / `VertexInputSubsystemEnabled()`, `Managers.h:911-918`),
|
||||
`EsprytSlotTablesEnabled()`, `Transport != Monolith`. The E note's a.1 is the starting map; the
|
||||
site set below is re-resolved and differs from it in three places, marked **[new]**.
|
||||
|
||||
## 1. The live reads of this family, at 2fde7034
|
||||
|
||||
Legend as the E note's: **live** = frontend object/array dereference; **id** = `GetLifetimeId()` +
|
||||
a probe of `MGPipeSlots()`; **mint** = a write into the client allocator; **rec** = record arm.
|
||||
"hit" / "miss" is the memo state of the site's own memo.
|
||||
|
||||
| # | site | what it dereferences | kind | when |
|
||||
|---|---|---|---|---|
|
||||
| 1 | `DirectGLES.cpp:4772` `ResolveVaoTwin(currentVAO)` → `:1617-1618` | `g_backendVertexArrayObjects.Find(vao.get())` → `SlotTables.h:411-414` → `HandleOf` `:436-449`: `stateObj->GetLifetimeId()`, then the table's one-entry front memo (`:444`) or `MGPipeSlots().FindByLifetimeId` (`:445-446`); a miss takes `GetOrCreate(vao)` `:215-266`, which is `MGPipeSlots().Acquire` `:247-248` | live + id (mint on a first sight) | every draw; the `GetLifetimeId()` read runs on the memo hit too |
|
||||
| 2 | `DirectGLES.cpp:4775` | `currentVAO->GetConfigVersion()` | live | every draw, unconditional |
|
||||
| 3 | `SyncVaoAttributeBuffersByHandle` memo hit, `:733` | `IsBufferDrawCleanByHandle(entry.handle, entry.resource, entry.frontend)`; under a transport `Managers.cpp:3148-3150` does NOT dereference `frontend` | none (handle-only) | per distinct VBO, only when `memo->vboCleanEpoch != bufferEpoch` (`:730`) |
|
||||
| 4 | same, dirty repair `:735-736` | `currentVAOObject->GetAttribute(entry.attribIndex).Buffer` → `EnsureBufferResource(obj)` → `HandleOfBuffer` (`Managers.cpp:3444`, `:2922-2941`, scope `:2938`) | live + id | on a dirty probe |
|
||||
| 5 | same, memo miss `:744-772` | `GetAllAttributes()` (32 `VertexAttribute`, each a `SharedPtr<BufferObject>` + 10 scalars), `attrib.Buffer`, `EnsureBufferResource(bufferObject)` `:764`, `HandleOfBuffer(bufferKey)` `:769` | live + id (twice per distinct buffer) | memo key miss |
|
||||
| 6 | IBO arm `:896-925` | `currentVAOObject->GetIndexBufferBindingSlot().GetBoundObject()` `:897`; `HandleOfBuffer(possibleIBO.get())` `:907`; `EnsureBufferResource(possibleIBO)` `:917` | live + id | every indexed draw; `:897` and `:907` run on the hit too |
|
||||
| 7 | `SyncCurrentVAO` `:1641-1652` → `SyncToBackend` (`Managers.cpp:4881-4892`) → `SyncToBackendFromApplier` (`:5160-5350`) | nothing frontend — every field is `st.BoundVertexElements` / `rec->Attributes[]` / `st.VertexBuffers[]` / `st.IndexBuffer.Res` (`:5220-5345`) | rec | every draw |
|
||||
| 8 | `SyncCurrentVertexAttributeValues` `:1662-1719` | `MGB_CTX->GetBoundVertexArray()` `:1668`; `program->GetActiveAttributeLocationMask()` `:1672` (S4); `vao->GetConfigVersion()` `:1683`; miss: `vao->GetAttribute(location).Enabled` `:1688`; `program->GetAttribType(location)` `:1701`,`:1715` (S4) | live | `:1668,:1672,:1683` every draw with a program; `:1688` on memo miss |
|
||||
| 9 | `:1700` | `MGB_CTX->GetCurrentVertexAttribute(location)` | rec (`set_vertex_attrib_defaults`, RECORD_SUPPLIED — `PipeFill.cpp:2304`, `:2594-2660`) | pending-mask draws only |
|
||||
| 10 | `DrawArrays` `:6724-6735` (scope `:6729`), `MultiDrawArrays` `:6767-6782` (scope `:6775`) | `g_backendVertexArrayObjects.Find(currentVAO.get())`, then `SyncClientSideAttributesForDrawArrays(currentVAO, first, count)` (`Managers.cpp:5364-5468`): `GetAllAttributes()`, and **`attrib.Offset` dereferenced as a raw CLIENT POINTER** `:5382,:5430` | live + id + **client memory** | every `glDrawArrays` / `glMultiDrawArrays` with a VAO bound |
|
||||
| 11 | **[new]** `BoundElementArrayBuffer()` `:6447-6452` / `BoundElementArrayBufferId()` `:6456-6461`, reached from `ScopedRestartIndexSubstitution` `:6591`, `:6687` | `MGB_CTX->GetBoundVertexArray()`, `GetIndexBufferBindingSlot().GetBoundObject()`, `EnsureBufferResource(ibo)` → `HandleOfBuffer` | live + id | every `DrawElements`-family call whose `ResolveRestartSubstitution` (`:6464-6480`) is not `None`; also `MultiDraw.cpp:45,:905` |
|
||||
| 12 | **[new]** `:1646` `g_backendVertexArrayObjects.CollectGarbageIfNeeded()` | no-op on the slot arm (`Managers.h:558-563`) | — | — |
|
||||
|
||||
`EnsureBufferResourceForHandle` (`Managers.cpp:3193-3435`) holds the `SharedPtr` but reads nothing
|
||||
from it under a transport: the shadow base is `resource->hostBytes` (`:3208-3222`),
|
||||
`SyncPersistentMappedRange` is skipped (`:3334-3341`), definedness comes from the descriptor plus
|
||||
staged coverage (`:3376-3385`). `(nullptr, h)` is already the live shape at `DirectGLES.cpp:953`.
|
||||
|
||||
Scope sites this family owns: `DirectGLES.cpp:1609`, `:6729`, `:6775` — 3 of the 20; plus every
|
||||
`HandleOfBuffer` reached from rows 4, 5, 6, 11 (`Managers.cpp:2938`).
|
||||
|
||||
## 2. What the records and the applier already carry
|
||||
|
||||
- `create_vertex_elements` / `bind_vertex_elements` / `delete_vertex_elements` —
|
||||
`PipeCalls.def:151-153`, all `kCtxCso`, therefore already published without a wait
|
||||
(`ClientSession.cpp:915-922`). Emitter `VertexInputEmit.h:158-189` (`EmitVertexElements`) and
|
||||
`:352-397` (`EmitCreate`, **all 32 attributes and all 32 binding points**, `MGPVertexAttribWire`
|
||||
`MGPipeTypes.h:497-508`). Applier record `MGPipeVertexElementsRecord` (`PipeApply.h:389-400`):
|
||||
`Attributes[32]`, `BindingPoints[32]`, server-owned `ContentSerial` bumped on every applied
|
||||
create, including a re-create on the same handle.
|
||||
- `set_vertex_buffers` — `PipeCalls.def:168` (`kCtxState`, `kVarTail`), emitter
|
||||
`VertexInputEmit.h:200-247`, record `MGPVertexBuffers` / `MGPVertexBuffer`
|
||||
(`MGPipeTypes.h:805-836`). Applier: `VertexBuffers[32]`, `VertexBufferStart/Count`,
|
||||
`VertexFetchBaseInstance`, `VertexBuffersSerial` (`PipeApply.h:598-616`), bumped at
|
||||
`PipeApply.cpp:2376-2377`.
|
||||
- `set_index_buffer` — `PipeCalls.def:169`, emitter `VertexInputEmit.h:255-270`, record
|
||||
`MGPIndexBuffer` (`MGPipeTypes.h:839-845`). Applier `IndexBuffer` + `IndexBufferSerial`
|
||||
(`PipeApply.h:620-622`), bumped at `PipeApply.cpp:2391-2392`.
|
||||
- `set_vertex_attrib_defaults` — `PipeCalls.def:177`, `PipeFill.cpp:2594-2660`; all three views
|
||||
verbatim since P5c rv, so `GetCurrentVertexAttribute` is RECORD_SUPPLIED.
|
||||
- Client-side dirty rules: bit 8 `NewVertexElements` = `mix(lifetimeId, configVersion)`
|
||||
(`Tracker.h:294-298`); bit 9 `NewVertexBuffers` = `mix(mix(AnyVaoAttributeGeneration,
|
||||
vaoIdentity), pendingBaseInstance)` (`Tracker.h:542-543`); bit 10 `NewIndexBuffer` =
|
||||
`mix(vaoIdentity, mix(indexSlotVersion, boundLifetimeId))` (`Tracker.h:558-566`). All three emit
|
||||
at the validate point, order elements → buffers → index (`PipeFill.cpp:3225-3233`).
|
||||
- Twin lifetime, already handle-shaped: `ReleaseTwinsForWireObjectDeath(handle,
|
||||
VertexElementsCso)` → `g_backendVertexArrayObjects.ReleaseByHandle(handle)`
|
||||
(`Managers.cpp:352-353`), plus the client's own `MGPipeEmitVertexElementsDestroyAndFree`
|
||||
(`PipeFill.cpp:1050`) and `NoteRecordDestroyed` (`VertexInputEmit.h:319-329`).
|
||||
- `SyncToBackendFromApplier` (`Managers.cpp:5160-5350`) is the existence proof: the whole driver-VAO
|
||||
configuration is already produced from records with zero frontend reads, and its dirty gate is
|
||||
three server-owned serials plus the backend's own `g_bufferBackendIdGeneration`.
|
||||
|
||||
So the records cover the family in full **except** client-memory vertex arrays (§7).
|
||||
|
||||
## 3. The gap — what does not exist yet
|
||||
|
||||
**G1. Nothing.** For rows 1–9 and 11 there is no missing field: every value the server needs is
|
||||
already in `MGPipeApplierState`. This family's P5e work is a re-key and a re-source, not a record
|
||||
addition. That is the headline and it is what makes S1 cheap next to S2/S3/S5.
|
||||
|
||||
**G2. Client-memory vertex arrays have no wire form.** `EmitVertexBuffers` publishes
|
||||
`Res = kMGPipeNullHandle` for them by design (`VertexInputEmit.h:196-199`, `:211-213`) and the
|
||||
SERVER uploads the bytes by dereferencing the client pointer (`Managers.cpp:5372-5466`). **The
|
||||
brief's "client-side arrays are already refused under split" is NOT confirmed — they are not
|
||||
refused.** `EmitTables.cpp` refuses only client INDEX arrays for the multi-draw forms
|
||||
(`:651` `CLIENT_INDICES`) and `CLIENT_COMMANDS` / `UNBOUND_PARAMETER` (`:682,:685`); nothing
|
||||
refuses a client vertex array. Options, in P5e order:
|
||||
- **(a) refuse**, `Fatal{UnmigratedVerb, "DrawArrays+CLIENT_ARRAYS"}` raised on the GL thread in
|
||||
`EmitDrawRecord`'s array arm, gated on the run-ahead caps bit so the lockstep arm is unchanged;
|
||||
- **(b) stage**, a new tail on `draw_vbo` shaped exactly like `kDrawHasUserIndices`
|
||||
(`MGPipeTypes.h:1430`, codec `PipeWireCodec.cpp:1985-1998`): a per-attribute
|
||||
`{BindingIndex, MGHostSpan}` array staged whole from the draw's known `[first, first+count)`
|
||||
range. This is P8's `HostResolve.cpp` territory and is the honest answer.
|
||||
P5e should take (a) and name (b) as P8's, because (a) is two lines and makes visible a path that
|
||||
was never split-clean; (b) is a record and belongs with the index-array flattening it mirrors.
|
||||
|
||||
**G3. One pin, not a field.** The twin key below is only 1:1 while the vertex-elements CSO stays
|
||||
IDENTITY-addressed (`VertexInputEmit.h:19-28`, D-G1). If P7 ever content-addresses it, two frontend
|
||||
VAOs share a handle — and therefore one driver VAO name and its 64 scratch buffer ids
|
||||
(`Managers.h:1204-1300`). P5e must state that as a requirement of the key and pin it in a test, not
|
||||
leave it as a performance remark.
|
||||
|
||||
## 4. The retirement design
|
||||
|
||||
**4.1 The twin key is `st.BoundVertexElements`.** The handle `ResolveVaoTwin` resolves today is
|
||||
`MGPipeSlots().Acquire(VertexElementsCso, vao->GetLifetimeId())` (`SlotTables.h:247-248`) — the
|
||||
SAME handle `EmitVertexElements` mints (`VertexInputEmit.h:172`) and the applier stores as
|
||||
`BoundVertexElements` (`PipeApply.h:594`). So:
|
||||
|
||||
```
|
||||
BackendVertexArrayObject* ResolveVaoTwinByHandle() { // split arm, no scope, no allocator
|
||||
const MGPipeHandle cso = MGPipeApplier().BoundVertexElements;
|
||||
if (MGPipeHandleIsNull(cso)) return nullptr; // == "no VAO bound"
|
||||
auto& twin = g_backendVertexArrayObjects.GetOrCreate(cso); // SlotTables.h:294-340
|
||||
if (!twin) twin = MakeShared<BackendVertexArrayObject>();
|
||||
return twin.get();
|
||||
}
|
||||
```
|
||||
`PrepareForDraw:4770-4772` stops reading `GetBoundVertexArray()`; the null arm at `:4816-4821`
|
||||
(`BindBackendVAOId(0)`) is reached from the null handle instead. No behaviour change: one driver VAO
|
||||
per frontend VAO, exactly as now. `GetOrCreate(handle)`'s backward-generation refusal
|
||||
(`SlotTables.h:331-339`) is the ABA answer, and `ReleaseByHandle` (`SlotTables.h:394-408`) the death
|
||||
answer — both already written and already called from `Managers.cpp:352`.
|
||||
|
||||
**4.2 The buffer walk reads the applier, not the VAO.** `SyncVaoAttributeBuffersByHandle`
|
||||
(`:699-790`) keeps its shape and loses its frontend argument:
|
||||
- miss walk `:744-772` → iterate `i` in `[st.VertexBufferStart, +st.VertexBufferCount)`, skip
|
||||
`MGPipeHandleIsNull(st.VertexBuffers[i].Res)`, dedupe on `Res` (a `{slot,gen}` compare replaces
|
||||
the pointer compare at `:754-760`), `EnsureBufferResourceForHandle(nullptr, Res)`;
|
||||
- `entry.handle = Res` directly — `HandleOfBuffer` at `:769` deleted;
|
||||
- dirty repair `:735-736` → `EnsureBufferResourceForHandle(nullptr, entry.handle)`;
|
||||
- probe `:733` → `IsBufferDrawCleanByHandle(entry.handle, entry.resource, nullptr)`; the
|
||||
`frontend` parameter is already dead under a transport (`Managers.cpp:3148-3150`) and
|
||||
`ResolvedDrawBuffers::Entry::frontend` (`Managers.h:1223`) leaves the split arm, which also
|
||||
retires the dangling raw pointer the struct's own note warns about (`:1224-1239`);
|
||||
- `attribIndex` (`Managers.h:1241`) becomes the BINDING index, kept only for diagnostics.
|
||||
Memo key is unchanged and already server-owned: `{elementsHandle, elementsSerial, buffersSerial}`
|
||||
(`Managers.h:1263-1265`), i.e. `{BoundVertexElements, rec->ContentSerial, VertexBuffersSerial}`.
|
||||
|
||||
**4.3 The IBO arm.** `:896-925` → `st.IndexBuffer.Res` and `st.IndexBufferSerial`. The identity
|
||||
compare `memo->iboHandle == iboHandle` stays (the handle is now read from the applier, not probed);
|
||||
the extra `HandleOfBuffer` at `:907` goes. Add `iboSerial` to the memo so a rebind that moved the
|
||||
serial re-ensures without a frontend read — the client shutter (`Tracker.h:558-566`) already fires
|
||||
on the slot version AND the bound lifetime id, so a redundant rebind is correctly suppressed.
|
||||
|
||||
**4.4 The two config-version reads.** `:4775` is DEAD on this arm already (`SyncNeccessaryBuffers`
|
||||
uses `vaoConfigVersion` only in the legacy branch, `:831-833`): delete it under the transport check.
|
||||
`:1683` is the key of `PendingAttribValueMask` (`Managers.h:1286-1290`); re-key it on
|
||||
`{elementsHandle, elementsSerial, activeMask}` and read `rec->Attributes[location].Enabled`
|
||||
(`PipeApply.h:394`) at `:1688`. Every configuration change re-creates the record and bumps
|
||||
`ContentSerial` (`PipeApply.h:396-399`), so the key is strictly stronger than the wrapping Uint16.
|
||||
|
||||
**4.5 Clean / needs-re-sync, answered from server-owned serials only.** After 4.2–4.4 the family's
|
||||
four questions are: `BoundVertexElements` + `ContentSerial` (configuration), `VertexBuffersSerial`
|
||||
(the buffer set), `IndexBufferSerial` (the element slot), `CurrentBufferMutationEpoch()` +
|
||||
`syncedChangeSerial` vs `record->Serial` (buffer content, `Managers.cpp:3147-3153`). The epoch is a
|
||||
backend atomic (`Managers.cpp:794`) bumped only from backend bodies, i.e. apply-thread memory under
|
||||
a transport — that must be pinned, not assumed (§7).
|
||||
|
||||
**4.6 Scopes.** `DirectGLES.cpp:1609`, `:6729`, `:6775` are deleted with the sites they wrap; the
|
||||
`HandleOfBuffer` scope entries this family reaches (`Managers.cpp:2938`) lose their last
|
||||
vertex-input caller. After that, `GetBoundVertexArray` (`FieldOwnership.def:72`) has no Espryt
|
||||
draw-path reader left except the two client-array arms and the restart substitution (§4.7), so its
|
||||
row's retiring phase moves from "P8" to "P5e (Espryt)".
|
||||
|
||||
**4.7 The restart substitution.** `BoundElementArrayBuffer()` (`:6447-6452`) →
|
||||
`st.IndexBuffer.Res`; `BoundElementArrayBufferId()` (`:6456-6461`) →
|
||||
`FindBufferResourceForHandle(st.IndexBuffer.Res)` (resolve only, exactly as
|
||||
`SyncToBackendFromApplier:5330` does). `:6591`'s read in the substitution body takes the same.
|
||||
|
||||
## 5. Monolith / G1
|
||||
|
||||
Every edit above is inside an existing `#if MOBILEGL_PIPE_PUSH` arm that is already selected by
|
||||
`VertexInputSubsystemEnabled()` / `ResourceSubsystemEnabled()` (`Managers.h:911-918`) — the
|
||||
functions touched (`SyncVaoAttributeBuffersByHandle`, `SyncToBackendFromApplier`,
|
||||
`BindAttributeBufferByHandle`) do not exist in the pull build at all. `ResolveVaoTwin` is the one
|
||||
exception: its three arms (`:1611-1622` slot, `:1623-1636` legacy memo) stay, and the handle arm is
|
||||
added as a fourth guarded by `Transport != Monolith`, so `MOBILEGL_PIPE_PUSH` under
|
||||
`Transport=monolith` keeps `Find(vao.get())` byte for byte. `ResolvedDrawBuffers`'s `frontend` and
|
||||
`configVersion` members stay declared for the legacy arm (they are already outside the
|
||||
`MOBILEGL_PIPE_PUSH` block at `Managers.h:1223,:1251`), so no mangled name and no struct layout the
|
||||
pull build sees is changed. G2/G14: no new name enters the pull build's symbol set; the new
|
||||
`ResolveVaoTwinByHandle` is `MOBILEGL_BUILD_DISAGGREGATED`-only.
|
||||
|
||||
## 6. Red-once
|
||||
|
||||
1. **Twin key.** `SanityTest.cpp:4083-4084` already pins that `VertexElementsCso` resolves through
|
||||
the handle arm. Add: with the twin keyed on `BoundVertexElements`, revert `ResolveVaoTwin` to
|
||||
`Find(vao.get())` with the scope at `:1609` removed → `Fatal{RoleViolation, "MGPipeSlots"}`
|
||||
naming `HandleOf` (`SlotAllocator.cpp:22-38`). The scope deletion is what makes the revert loud.
|
||||
2. **The buffer walk.** New `MG_Test` case beside `VertexInputEmit`: publish `set_vertex_buffers`
|
||||
for buffers A,B, then repoint the frontend VAO's attribute 0 at C WITHOUT re-emitting, then run
|
||||
the sync — the walk must ensure A,B. Revert 4.2 and it ensures C; the case names
|
||||
`st.VertexBuffers`.
|
||||
3. **The index arm.** Same shape on `set_index_buffer` / `st.IndexBuffer.Res`, with the frontend
|
||||
element slot rebound after publish. Revert 4.3 → red naming `IndexBuffer.Res`.
|
||||
4. **The attrib-value memo.** Revert 4.4's key to `GetConfigVersion()` under run-ahead and the
|
||||
strict lane aborts `Fatal{UnmigratedPipeInput, "GetBoundVertexArray@draw_vbo"}`
|
||||
(`PipeInputs.h:137-170`, `MGPipeStickyForwardPull`) — this is P5e-3's detector doing the work.
|
||||
5. **Client arrays.** With §3 G2 (a) in place: a `glDrawArrays` with an enabled client-memory
|
||||
attribute under run-ahead is a named refusal, and reverting the refusal is red by
|
||||
`DoublePrecisionScenario` / a new client-array scenario under `integration-split-strict`.
|
||||
6. **Integration, unchanged suites that must stay green under run-ahead:**
|
||||
`VertexAttribBindingScenario`, `VertexArrayEnableDisableScenario`, `PrimitiveRestartScenario`,
|
||||
`ResidentIndexScenario`, `MultiDrawScenario`, `DrawParametersScenario`, `DoublePrecisionScenario`,
|
||||
`HandleRecycleScenario`, `ObjectSubsystemControlScenario` (the `0x0ff` / `0x17f` A/B at
|
||||
`Managers.h:897-905` must keep its verdicts).
|
||||
|
||||
## 7. Risks and unsettled
|
||||
|
||||
- **R1 (blocking, owned by S6/S8).** Client-memory vertex arrays, §3 G2. Until refused or staged,
|
||||
the apply thread dereferences a raw client pointer per `glDrawArrays` and run-ahead makes the
|
||||
bytes movable. It also GENERATES and fills driver buffers on the apply thread
|
||||
(`Managers.cpp:5392-5399,:5455-5457`) — harmless, but it means `SyncClientSideAttributesForDrawArrays`
|
||||
cannot simply be deleted.
|
||||
- **R2.** `CurrentBufferMutationEpoch()` (`Managers.cpp:794`, `Managers.h`'s site enumeration) is the
|
||||
only non-serial input left in 4.5. It is an atomic and every bump found is in a backend body, but
|
||||
P5e must pin "no GL-thread bump under a transport" — a client-side bump would make the memo's
|
||||
clean stamp a cross-thread read.
|
||||
- **R3.** `SyncCurrentVertexAttributeValues` cannot go run-ahead clean on S1's work alone:
|
||||
`:1672`, `:1701`, `:1715` read the frontend program. S1's edits are a no-op for safety until S4
|
||||
lands. Sequence S4's program twin before or with this function's edit.
|
||||
- **R4.** The `set_vertex_buffers` window: `Count` is "highest ENABLED attribute + 1"
|
||||
(`VertexInputEmit.h:203-207`) while `create_vertex_elements` carries all 32
|
||||
(`VertexInputEmit.h:352-366`). An attribute enabled in the record but outside the window resolves
|
||||
`VertexBufferForAttributeIndex == nullptr` (`Managers.cpp:4795-4809`) and is skipped at `:5262`.
|
||||
Unreachable today because both walks read the same `Enabled` bits in the same validate step; under
|
||||
run-ahead they still do (both are client-side, same step) — but it is the same class as S2's
|
||||
caveat A8 and should be pinned by a test rather than argued.
|
||||
- **R5.** `EnsureBufferResourceForHandle`'s `hostBytes` refresh (`Managers.cpp:3370`) is a
|
||||
self-assignment under a transport (`:3217-3220` returns `resource->hostBytes`). Passing `nullptr`
|
||||
changes nothing — confirmed by reading, not measured. The fp64 narrowing
|
||||
(`SyncFloat64AttributeAsFloat32ByHandle`) reads `resource->hostBytes`, i.e. the server staged
|
||||
store, and is already server-owned.
|
||||
- **R6.** `g_bufferBackendIdGeneration` (`Managers.cpp:5172-5174`) and the reset rule
|
||||
`MGPipeApplierReset` must ADVANCE `VertexBuffersSerial`/`IndexBufferSerial` rather than zero them
|
||||
— the long note at `Managers.cpp:5176-5191` says the twin's whole gate depends on it. Under
|
||||
run-ahead an `applier_reset` is a waited control record (P5e-2), so this holds; if any package
|
||||
makes `applier_reset` fire-and-forget, this gate breaks first.
|
||||
- **R7, not settled.** Whether `ResolvedDrawBuffers` should survive at all once the walk is over
|
||||
`st.VertexBuffers[Start..+Count)`: that array is already a compact, deduped, handle-keyed list
|
||||
bounded by `Count` (1–3 entries on the Minecraft workload, not 32 cold slots). The memo may be
|
||||
pure cost after 4.2. Measure before keeping it.
|
||||
@@ -0,0 +1,250 @@
|
||||
# S2 — textures and samplers under run-ahead (P5e scouting report)
|
||||
|
||||
Head `2fde7034`. Paths under `MobileGL/`. "The record arm" = `MOBILEGL_PIPE_PUSH` +
|
||||
`TextureResourceSubsystemEnabled()` / `SamplerSubsystemEnabled()`.
|
||||
**Headline.** The SAMPLER half is already run-ahead-clean on its record arm, and
|
||||
`SamplerImpl::ResolveSamplerCsoTwin` (`Managers.cpp:13457-13486`) is the exact shape the TEXTURE
|
||||
half needs: handle in, record first, `GetOrCreateByHandle`, serial-gated sync, no frontend touch,
|
||||
no allocator probe. The texture half is one step behind — its three sync bodies already read the
|
||||
record and the staged store, but every one re-enters through
|
||||
`g_backendTextureObjects.HandleOf(frontendObject)` and the per-draw work list borrows frontend
|
||||
binding slots. **No new record and no new wire field on the draw path**; one signature, four
|
||||
line-level substitutions, one ruling.
|
||||
|
||||
## 1. The live reads at `2fde7034`
|
||||
|
||||
**live** = frontend dereference; **id** = `GetLifetimeId()` + client allocator probe; **mint** =
|
||||
`Acquire`, a WRITE into it; **rec** = reads nothing frontend; **hit** = runs on every steady draw.
|
||||
|
||||
### 1.1 The per-draw keys — already server-owned, nothing to do
|
||||
`CaptureDrawTextureSyncKeys` `DirectGLES.cpp:2188-2211` reads `GetTextureContextId` `:2189`,
|
||||
`GetMaxTouchedTextureUnit` `:2203`, `GetSamplingResolutionGeneration` `:2204` — **rec, hit**: the
|
||||
two generations are APPLIER_DERIVED (`FieldOwnership.def:126-131`), answered from
|
||||
`MGPipeApplierTextureShutterSerial()`/`ContextSerial()` under a server stamp
|
||||
(`PipeInputs.h:490-527`); the mark is RECORD_SUPPLIED via `set_context_values` (`Coverage.def:260`,
|
||||
`MGPipeTypes.h:1694`). `CurrentUnitBindingsEpoch`'s record arm `:2044-2071` ->
|
||||
`UnitBindingsEpochFromRecords` `:2003-2042` reads the two counts and the two serials — **rec, hit**.
|
||||
|
||||
### 1.2 `SyncNeccessaryTextures`, unit half (`:2321-2391`)
|
||||
| site | read | kind |
|
||||
|---|---|---|
|
||||
| `:2346` `PairingsIntact(g_unitTextureSyncList)` | per entry `entry.slot->get()`, a `const SharedPtr<ITextureObject>*` borrowed INTO the frontend unit's slot (`:2127-2131`, borrowed at `:2381`) | **live, hit** |
|
||||
| `:2356` `IsDrawSyncClean(entry.slot->get(),...)` -> `Managers.h:1641-1658` | `GetTextureParamsVersion`, `GetContentVersion`, `GetSamplerObject()->GetVersion()`, `GetStorageType()`; then `:2358-2361` hands `*entry.slot` to the three syncs | **live, hit** |
|
||||
| `:2374-2382` memo MISS | `GetTextureUnitObject(index)`/unit, every `GetAllBindingSlots()` slot's `GetBoundObject()`, `IsUndefinedDefaultTexture`, `SyncTextureObjectToBackend(obj)` | live, id, mint |
|
||||
|
||||
### 1.3 `SyncTextureObjectToBackend` (`:1723-1806`) and the three sync bodies
|
||||
| site | read | kind |
|
||||
|---|---|---|
|
||||
| `:1734` scope, `:1736` `Find(obj)`, `:1737` `GetOrCreate(obj)`, and the re-resolve `:1781`,`:1797` | `HandleOf` -> `GetLifetimeId` + `MGPipeSlots().FindByLifetimeId` (`SlotTables.h:430-450`); miss mints (`:244-250`) | id, **mint** |
|
||||
| `:1757-1758` `RequireImageBindableStorage(obj)` -> `Managers.cpp:5816-5975` | `HandleOf` `:5884`, `GetTarget` `:5888`, `GetUploadTargets`/`GetMipmapTexelSize`/`GetMipmapByteSize`/**`MarkStorageDirty`** `:5931-5940` — the last is ALREADY `Fatal{RoleViolation,"texture-legacy-arm"}` from the apply thread (`MipmapStorage.cpp:39-51`) | id, live |
|
||||
| `:1760` -> `SyncTextureParamsToBackend` `Managers.cpp:8803+` | prologue `ResolvePushedTextureParams` `:8712-8743` = scope `:8717` + `HandleOf` `:8719`; body `:8876-8877` `GetTarget()` **on both arms**; `:8841,:8874` `GetExternalIndex` (logs) | id, **live** |
|
||||
| `:1761` -> `SyncBuiltinSamplerToBackend` `:8554+` | prologue `ResolvePushedBuiltinSampler` `:8472-8551` = scope `:8481` + `HandleOf` `:8483`; body `:8620-8621` `GetTarget()` on both arms | id, **live** |
|
||||
| `:1762` -> `SyncMipmapsToBackend` `:7049+` | `:7060` `IsTextureView()` BEFORE the record is resolved; `:7087` scope + `:7089` `HandleOf`; `:8223-8231` the Buffer arm's `GetBufferBindingSlot().GetBoundObject()`; `GetExternalIndex` in ~14 log lines. Everything else on the staged arm is the record + `ServerStagedTexture()` (`:6902-6985`) | id, **live** (4 sites) |
|
||||
|
||||
### 1.4 `BindCurrentTextures` / `ResolveAndBindUnitTextures`
|
||||
- `:5277-5284` memo key: `currentProgram->GetLifetimeId/GetBackendStateVersion/GetLinkStatus` —
|
||||
**live, hit** (S4's rows; this memo is the consumer). `:5290`'s `memcmp` vs
|
||||
`g_boundTexturesCache` is server memory — rec.
|
||||
- `:4861-4948` `ResolveAndBindUnitTextures` (memo MISS) — **live, id**:
|
||||
`GetTextureUnitObject(unit)` `:4860`, two passes over `GetAllBindingSlots()` `:4876`,
|
||||
`GetBoundObject`, `IsUndefinedDefaultTexture` `:4884`, `GetExternalIndex` `:4886`, `GetTarget`
|
||||
`:4890`, the alias arbiter `sampledTargetForUnit` `:4845-4857`
|
||||
(`GetMaxUniformLocation`/`GetUniformSamplerOrImageUnitIndex`/`GetUniformType`), `GetSamplerObject`
|
||||
`:4914-4916`, `SamplesAsIncompleteTexture` `:4918`, scope `:4926` + `Find(obj)` `:4928`, unbind
|
||||
walk `:4945-4947` (`GetTarget` per slot).
|
||||
|
||||
### 1.5 The samplers
|
||||
- `BindCurrentUnitSamplers` gate `:5051-5059` (keys + `g_boundSamplersCache`) and record arm
|
||||
`:5106-5151` (`st.SamplerStateStart/Count/BoundSamplerStates[]`, `UnbindSampler`,
|
||||
`ResolveSamplerCsoTwin`) — **rec, hit; already clean**.
|
||||
- decline arm `:5152-5169`: `GetTextureUnitObject(unit).GetSamplerObject()` `:5157` ->
|
||||
`ResolveUnitSamplerBackend` `:4988-5026` = scope `:4993` + `HandleOf` `:4999` — live, id.
|
||||
- sampler pass in `BindCurrentProgramWithResources` `:5562-5596` — **live**:
|
||||
`GetTextureUnitObject(unit)` `:5562`, `GetSamplerObject` `:5563`,
|
||||
`GetBindingSlot(Texture2D).GetBoundObject()` `:5564-5565`, `samplerObject->GetLodBias()` `:5573`,
|
||||
`boundTexture->GetSamplerObject()->GetLodBias()` `:5580`, `texture2D->GetSamplerObject()` `:5591`,
|
||||
`texture2D->GetFormat()` `:5595`.
|
||||
- `:5609-5620` CSO-twin arm — rec. `:5624-5632` else arm: `ResolveUnitSamplerBackend` (id) then
|
||||
`g_backendSamplerObjects.GetOrCreate(samplerObject)` `:5626` — **mint**, the only one left here.
|
||||
- **Off the steady draw path (waited ops under P5e-2):** `SyncTextureObjectToBackend` from
|
||||
`CopyImageSubData` `:8294-8295`, `GenerateMipmap` `:9575,:9578`, the copy-endpoint resolve
|
||||
`:9735`, the texture ops `:10046+`, readbacks `:11695,:11866`; `Find(texture.get())` at
|
||||
`:8512,:8839,:9305,:9419,:11886`.
|
||||
|
||||
## 2. What the records and applier state ALREADY carry
|
||||
|
||||
| need | carrier | citation |
|
||||
|---|---|---|
|
||||
| which texture each unit samples, PROGRAM-RESOLVED, one per unit, no alias contest, with `IsUndefinedDefaultTexture` + `SamplesAsIncompleteTexture` already applied (entry -> null) | `st.BoundSamplerViews[unit]={View,Texture,Unit}`, `SamplerViewStart/Count/Serial` | `PipeApply.h:673-676`, `MGPipeTypes.h:856-862`, emitter `SamplerEmit.h:733-789`, the two drops `:760-765` |
|
||||
| the frontend TARGET to bind, aliasing format, view restrictions, samples | `SamplerViewCsos[View].View.{Target,InternalFormat,MinLevel..NumLayers,Samples,FixedSampleLocations}` | `MGPipeTypes.h:524-535`, `SamplerEmit.h:899-916` |
|
||||
| which sampler CSO each unit carries, and its 15 values (`lodBias`, filters, `mipmapMode`, `compareMode`, border) with a server-owned `Serial` | `st.BoundSamplerStates[]` + `SamplerCsos[h].Params` | `PipeApply.h:335-341`, `:678-681`, `MGPipeValueTypes.h:462-486` |
|
||||
| a texture's params, built-in sampler CSO, the two resync bits; and its storage shape, target, format, levels, immutability, `ImageBindableHint`, `ViewOf`, texbuffer backing | `TextureResources[h].Params`+`ParamsSerial`, `.Desc` | `PipeApply.h:265-281`, `MGPipeTypes.h:295-356`, `:548-566` |
|
||||
| "did storage/texels move", and the twin's own "what did I last sync" | `.Serial` + `PendingUploads` + `ServerStagedTexture()` defined/GPU-dirty; `m_syncedResourceSerial`, `m_syncedParamsSerial`, `m_syncedBuiltinSamplerSerial`+`m_syncedBuiltinSampler` | `PipeApply.h:240-318`, `Managers.cpp:6902-6985`, `Managers.h:1785-1812` |
|
||||
| texture death by handle on the apply thread, no allocator; the handle-keyed adopt/recycle rule | `object_death` -> `ReleaseTwinsForWireObjectDeath` -> `ReleaseByHandle`; `GetOrCreate(MGPipeHandle)`/`FindByHandle` | `Managers.cpp:328-337`, `SlotTables.h:278-341`, `:420-425`, `:488-506` |
|
||||
|
||||
The brief's two questions: **yes**, `object_death` covers textures since P5c ct
|
||||
(`Managers.cpp:331-332`); and the default texture (name 0) DOES have a record —
|
||||
`TextureEmit.h:806-833` self-heals a create+respecify when its first `set_texture_params` is
|
||||
refused, written for exactly that case.
|
||||
|
||||
## 3. The gap
|
||||
|
||||
- **G-S2-1 (a signature, not a field).** No `SyncTextureToBackendByHandle(MGPipeHandle)`; every
|
||||
entry takes `const SharedPtr<ITextureObject>&` and re-derives the handle with `HandleOf`. Needed:
|
||||
one handle-taking entry point + handle-taking prologues
|
||||
(`ResolvePushedTextureParams(MGPipeHandle)`, `ResolvePushedBuiltinSampler(MGPipeHandle)`).
|
||||
- **G-S2-2 (four live reads inside the handle arm, all with an existing carrier).**
|
||||
`Managers.cpp:8876-8877` and `:8620-8621` `GetTarget()` -> `Desc.Target` (via
|
||||
`StagedTextureTargetForPipeTarget`, `:6905`); `:7060` `IsTextureView()` -> `Desc.ViewOf`
|
||||
(`MGPipeTypes.h:356`), record resolved first; `:8223-8231` -> `Desc.BufferForTexBuffer`
|
||||
(already read at `:8240`). Plus **G-S2-4**: ~20 log lines print `GetExternalIndex()`;
|
||||
`Desc.GlNameForDiag` (`MGPipeTypes.h:349`) is the declared diagnostics carrier. Mechanical.
|
||||
- **G-S2-3 (no handle-arm clean gate).** `IsDrawSyncClean(const ITextureObject*,...)`
|
||||
(`Managers.h:1641-1658`) has no record-keyed sibling, so the memo-HIT path is frontend-bound
|
||||
every draw. Needs no new state — see §4.
|
||||
- **G-S2-5 (RULING).** `RequireImageBindableStorage`'s re-dirty (`Managers.cpp:5930-5962`) reaches
|
||||
back into the client's storage model and already aborts under split; `ImageBindableHint` is the
|
||||
prevention and P9 owns the pull, so P5e should delete the frontend argument and leave the split
|
||||
arm a NAMED refusal at the entry, not build half a terminator.
|
||||
- **G-S2-6 (narrowing, needs the integrator's word).** Driving the unit list off
|
||||
`BoundSamplerViews` syncs only the program-resolved texture per unit, where today the walk syncs
|
||||
every slot of every touched unit. The union of (views + image units + the FBO attachment lists +
|
||||
the waited texture ops) still covers every texture anything reads, so this narrows WORK, not
|
||||
coverage — but it is a behaviour delta against the monolith arm and must be named under G1.
|
||||
|
||||
## 4. The retirement design
|
||||
|
||||
**Twin key.** `g_backendTextureObjects` stays one table; every draw-path resolution becomes
|
||||
`GetOrCreateByHandle(view.Texture)` / `FindByHandle(view.Texture)`. `HandleOf`, `Find(StateObject*)`
|
||||
and `GetOrCreate(const StatePtr&)` become unreachable from the apply thread, so the existing
|
||||
`MGPipeRefuseAllocatorFromApplyThread` guards (`SlotTables.h:255-266`, `:436-441`) stop being
|
||||
scope-exempted here, and this family's `MGPipeFrontendKeyedRegistryScope` sites —
|
||||
`DirectGLES.cpp:1734`, `:4926`, `:4993`, `Managers.cpp:5882`, `:7087`, `:8481`, `:8717` — are
|
||||
deleted, not moved. **Sync shape** (the `ResolveSamplerCsoTwin` template,
|
||||
`Managers.cpp:13457-13486`):
|
||||
```
|
||||
BackendTextureObject* SyncTextureToBackendByHandle(MGPipeHandle res, Bool imageBindable) {
|
||||
const auto* rec = PipeTextureRecordForHandle(res); // record FIRST; null -> named decline
|
||||
auto* slot = rec ? g_backendTextureObjects.GetOrCreateByHandle(res) : nullptr; // adopt/recycle by Gen
|
||||
if (!slot) return nullptr; // backward Gen -> named decline
|
||||
if (!*slot) *slot = MakeShared<BackendTextureObject>();
|
||||
(*slot)->SyncTextureParamsToBackend(res, *rec); (*slot)->SyncBuiltinSamplerToBackend(res, *rec);
|
||||
(*slot)->SyncMipmapsToBackend(res, *rec);
|
||||
if ((*slot)->NeedsParameterResync()) { /* params; builtin */ }
|
||||
return slot->get();
|
||||
}
|
||||
```
|
||||
The by-value twin copy + second `Find` (`:1745-1755`, `:1781-1805`) go with the map arm: a slot
|
||||
entry is an array element, so the nested-`glTextureView` relocation hazard is answered by
|
||||
re-indexing, not by a refcount.
|
||||
**"Is it clean" from server-owned serials.** `IsDrawSyncCleanByRecord(res, rec)` is EXACTLY the
|
||||
conjunction of the three handle-arm prologues' own early-outs — the relation
|
||||
`Managers.h:1626-1640` already states for the frontend version:
|
||||
```
|
||||
m_isInitialized && m_syncedResourceSerial != 0 && m_syncedResourceSerial == rec->Serial // :7133-7139
|
||||
&& rec->PendingUploads.empty()
|
||||
&& m_syncedParamsSerial == rec->ParamsSerial && rec->Params.ForceResync == 0 && !m_forceTextureParamsResync
|
||||
&& m_syncedBuiltinSampler == rec->Params.BuiltinSampler // :8735-8741
|
||||
&& m_syncedBuiltinSamplerSerial == PipeSamplerCsoRecordForHandle(rec->Params.BuiltinSampler)->Serial
|
||||
&& rec->Params.SamplerResync == 0 && !m_forceSamplerResync // :8539-8548
|
||||
&& (TextureStorageType)rec->Desc.StorageKind == TextureStorageType::Mipmap
|
||||
```
|
||||
No new member, no new field. The `contextId`/`samplingGeneration` arguments disappear: the
|
||||
applier's `ContextSerial` and `TextureShutterSerial` (`PipeApply.h:697-717`) are what the keys
|
||||
already carry.
|
||||
|
||||
**The unit work list and the bind.** `UnitTextureSyncEntry` (`:2127-2132`) becomes
|
||||
`{MGPipeHandle Res, BackendTextureObject* backend}`; the memo key becomes `(ContextSerial,
|
||||
SamplerViewsSerial, SamplerViewStart, SamplerViewCount, g_backendContextGeneration)` —
|
||||
`SamplerViewsSerial` moves iff the resolved set moved, which the emitter's content-hash suppressor
|
||||
(`SamplerEmit.h:692-697`) makes sound — and **`PairingsIntact` is deleted**: no borrowed slot is
|
||||
left to go stale. The rebuild walks `st.BoundSamplerViews[Start..Start+Count)` calling
|
||||
`SyncTextureToBackendByHandle`. `ResolveAndBindUnitTextures` collapses to one pass over the same
|
||||
window: `FindByHandle(entry.Texture)`, target from `SamplerViewCsos[entry.View].View.Target`, bind;
|
||||
then unbind every backend target the window did not claim, driven by the fixed `TextureTarget` enum
|
||||
plus `g_boundTexturesCache` (server memory) instead of `GetAllBindingSlots()`. The alias arbiter
|
||||
`sampledTargetForUnit` `:4845-4857` DIES — the client already arbitrated (`SamplerEmit.h:751-757`).
|
||||
|
||||
**The sampler pass** `:5562-5596`. The unit's effective sampler becomes `st.BoundSamplerStates[unit]`
|
||||
if non-null, else `TextureResources[view.Texture].Params.BuiltinSampler`; its values come from the
|
||||
CSO record (`lodBias`, `minFilter`, `magFilter`, `mipmapMode`, `compareMode` all present,
|
||||
`MGPipeValueTypes.h:462-486`), and `texture2D->GetFormat()` becomes
|
||||
`SamplerViewCsos[view.View].View.InternalFormat`. The raw-depth-fetch substitution itself STAYS on
|
||||
the server (`docs/Disaggregated/ARCHITECTURE.md` §5.5 assigns it there by name). `:5624-5632`'s
|
||||
`GetOrCreate(samplerObject)` is deleted; the CSO-twin arm `:5609-5620` is the only arm left.
|
||||
Finally the two decline arms — `BindCurrentUnitSamplers` `:5152-5169` and
|
||||
`CurrentUnitBindingsEpoch` `:2073-2098` — become named refusals under a live wire instead of
|
||||
falls-back to `GetTextureUnitObject`, and with them gone
|
||||
`CaptureUnitBindings`/`UnitBindingsUnchanged`/`g_observedUnitBindings` (`:1867-1957`) are
|
||||
monolith/legacy-only text.
|
||||
|
||||
## 5. Monolith / G1
|
||||
|
||||
Every edit sits inside `#if MOBILEGL_PIPE_PUSH` and, for the run-ahead arms, behind
|
||||
`MG_Config::Transport != MG_Config::TransportMode::Monolith` — the idiom already at
|
||||
`DirectGLES.cpp:3226`, `:4725`, `:6534`. The pull build keeps `:1936-1957`, `:2073-2098`,
|
||||
`:2340-2391`, `:4861-4948`, `:5152-5169`, `:5624-5632` token for token, the D-P rule this family
|
||||
already follows (`Managers.cpp:8613-8618`, `:8791-8800` spell the `#if/#else` arm split and why a
|
||||
shared prologue is a G1 failure). Three obligations: (1) `BackendTextureObject`'s pull-build layout
|
||||
must not move — every member the new gate needs is already inside `#if MOBILEGL_PIPE_PUSH`
|
||||
(`Managers.h:1785-1812`), so the admitted-resize set stays empty; (2) `UnitTextureSyncEntry`'s
|
||||
re-shape is push-only, two structs under one name selected by `#if`, which
|
||||
`g_fboTextureSyncListRecordKeyed` (`:2157-2171`) already does; (3) the push build under
|
||||
`Transport=monolith` must KEEP the frontend walk — no server to answer from — so the run-ahead arm
|
||||
is a THIRD arm, like `MGB_STAGED_TEXTURE_LIVE` (`:6902-6903`). `MOBILEGL_PIPE_VERIFY` forces the
|
||||
lockstep, so the comparator keeps seeing both.
|
||||
|
||||
## 6. Red-once
|
||||
|
||||
1. **Widen the pinned guard list.** `MG_Test/Wire/RemoteClientTest.cpp:1938-1941` deliberately
|
||||
EXEMPTS the shape reads — "GetMipmapTexelSize / GetMipmapByteSize / GetMipmapLevelCount /
|
||||
GetUploadTargets / GetTarget / IsComplete ... the per-draw binding walk reads them every draw".
|
||||
P5e adds those six plus `GetSamplerObject`/`GetTextureParamsVersion`/`GetContentVersion` to
|
||||
`RefuseLegacyTextureArmFromApplyThread` (`MipmapStorage.cpp:39-51`) and its
|
||||
`MGL_TEXTURE_GUARD_TEST` rows `:1942-1978`. Revert the handle arm -> each aborts by name.
|
||||
2. **`Fatal{UnmigratedPipeInput,"GetTextureUnitObject@DrawVbo"}`** under
|
||||
`MOBILEGL_IPC_STRICT_ERRORS=1` (`PipeInputs.cpp:71-77`, `:191-224`), where the row is
|
||||
BARRIER_PULLED and the read today only counts as `rsp`: revert `ResolveAndBindUnitTextures`'
|
||||
window arm -> strict lane red at the named field+verb. **3.** And an integration assertion over
|
||||
`PipeSlotPeek` (`MG_IntegrationTest/Harness/PipeSlotPeek.h`) that
|
||||
`MGPipeFrontendKeyedRegistryScope` entries for this family are **0** over a frame; the mint is
|
||||
already `Fatal{RoleViolation,"MGPipeSlots"}` (`SlotTables.h:255-266`).
|
||||
4. **`DirectGLESTextureSync.UnitMemoRefusesToDriveATwinFromAnotherTexture`**
|
||||
(`MG_Test/SanityTest.cpp:3075-3144`) is the `PairingsIntact` pin: keep it for monolith/pull,
|
||||
and give it a handle-arm sibling whose hazard is ABA — recycle the slot to `{slot, gen+1}`
|
||||
while the old entry is in the work list, assert the twin is re-minted
|
||||
(`SlotTables.h:316-340`'s forward/backward rule answers it).
|
||||
5. **`TextureParamsWithoutASamplerViewScenario`** stays green (the D10/G9 pin), i.e. the view
|
||||
window must not become the ONLY path into `SyncTextureParamsToBackend`; and
|
||||
**`SampledSetStalenessScenario`** — a texture that becomes complete with no rebind must
|
||||
re-enter the sampled set, which under the new key is `SamplerViewsSerial` moving; revert
|
||||
`Tracker.h:605-610`'s `textureParams` mix -> red.
|
||||
|
||||
## 7. Risks and what I could not settle
|
||||
|
||||
- **R1 — the window is not pinned (A8).** Everything in §4 reads
|
||||
`[SamplerViewStart, +SamplerViewCount)`. `SamplerEmit.h:735-737` emits `Start=0,
|
||||
Count=maxTouched+1`, but `PipeApply.h:666-669` says only "the last set as received" and does not
|
||||
require coverage; under run-ahead a too-narrow window silently drops a sync, and a decline is
|
||||
what run-ahead cannot take. **P5e needs a contract sentence**: the window MUST cover
|
||||
`[0, MaxTouchedTextureUnit]`, narrower is `Fatal{ProtocolCorruption,"SetSamplerViews.Count"}` —
|
||||
not a server-side re-derivation.
|
||||
- **R2 — the program key (conflict with S4).** `BindCurrentTextures`' memo `:5277-5284` reads the
|
||||
frontend `ProgramObject`; my design deletes the alias arbiter but not that key. **Ruling needed:**
|
||||
key it on `st.DrawProgram` + `ProgramBindingSerial` (S4's rows), or on `SamplerViewsSerial` alone
|
||||
— which already mixes the program-resolved opaque units (`Tracker.h:605-610`)? I lean to the
|
||||
latter (one fewer cross-family key) but could not rule out that a relink with unchanged
|
||||
resolution must still re-bind.
|
||||
- **R3 — `RequireImageBindableStorage` under run-ahead.** §3 G-S2-5. It aborts today, but three
|
||||
frames deep at a `MarkStorageDirty` guard rather than as a named refusal at the entry; run-ahead
|
||||
turns a decline into a hard stop. How often `ImageBindableHint` fails to prevent it is unmeasured.
|
||||
- **R4 — the twin's mutable flags.** `m_forceTextureParamsResync`/`m_forceSamplerResync` are
|
||||
server-set and read-not-cleared from the wire (D-E2) — server memory, safe — but the new gate
|
||||
reads BOTH them and the wire bits, so "neither side clears the other's" becomes load-bearing for
|
||||
a gate, not just for a push. One contract sentence.
|
||||
- **R5 — buffer textures.** `Managers.cpp:8223-8231` still hands the frontend `BufferObject` to
|
||||
`EnsureBufferResourceForHandle` (D-A4's `frontend` argument). `Desc.BufferForTexBuffer` names the
|
||||
buffer; whether `frontend` may be `nullptr` under split is **S1/S5's call** — the E note says the
|
||||
transport arm reads nothing from the object (`Managers.cpp:3199+`), which suggests yes.
|
||||
- **R6 — unmeasured.** This family's share of the apply thread at `2fde7034` is unknown; the E
|
||||
note's 3.0% `HandleOf<ITextureObject>` is at `85362a85`, pre-round-3. Re-measure before sizing.
|
||||
@@ -0,0 +1,250 @@
|
||||
# S3 - framebuffers, attachments, images (P5e scouting, head `2fde7034`)
|
||||
|
||||
Paths under `MobileGL/` unless they start with `docs/`. Kind legend as the E note's: **live** =
|
||||
dereference of a frontend object/array; **id** = `GetLifetimeId()` + a client-allocator probe;
|
||||
**mint** = an allocator WRITE; **rec** = already answered from a record.
|
||||
|
||||
## 1. The live reads of this family at `2fde7034`
|
||||
|
||||
`GetFramebufferBindingSlot` and `GetImageTextureBinding` are both still BARRIER_PULLED
|
||||
(`MG_Pipe/FieldOwnership.def:85-88`), filled every kDraw (`MG_Impl/Pipe/PipeFill.cpp:175-184`)
|
||||
into `PipeInputs.h:164-165`, read through `PipeInputs.h:628-651`. The backend's door is
|
||||
`GetFramebufferBindingSlotChecked` (`DirectGLES/DirectGLES.cpp:179-197`) - under
|
||||
`EsprytSlotTablesEnabled()` a straight `MGB_CTX->GetFramebufferBindingSlot` (`:182`).
|
||||
|
||||
### 1.1 Framebuffers (a.5)
|
||||
|
||||
| site | dereferenced | kind | when |
|
||||
|---|---|---|---|
|
||||
| `SyncNeccessaryTextures` draw-FBO list `:2405-2409` | slot, `GetBoundObject()`, `GetVersion()`, `currentFBO->GetObjectVersion()` | live | **every draw**, memo hit or miss |
|
||||
| same, memo hit `:2424`, `:2437`, `:2441-2447` | `g_fboTextureSyncListFbo == currentFBO.get()` (identity half is a POINTER COMPARE, `:2162-2165`), `PairingsIntact` -> `entry.slot->get()` on borrowed attachment slots (`:2127-2131`, `:2134-2139`), `IsDrawSyncClean(entry.slot->get())`, `Sync{TextureParams,BuiltinSampler,Mipmaps}ToBackend(*entry.slot)` | live | every draw on a hit |
|
||||
| same, miss `:2452-2457` | `currentFBO->GetAllAttachmentObjects()`, `attachment.GetTexture()`, `SyncTextureObjectToBackend(textureObject)` | live, id, mint | rebuild |
|
||||
| `SyncReadFramebufferTextureAttachments` `:2246-2259`, `:2278`, `:2285`, `:2290-2296`, `:2303-2308` | read slot, `GetBoundObject()`, `readFBO.get() == drawFbo`, both versions, then the draw list's shape verbatim | live, id, mint | **every draw** (push build) |
|
||||
| `FramebufferRecordMatchesBinding` `:3017-3033` | `GetFramebufferBindingSlotChecked(target).GetBoundObject()` `:3019`, compare vs `pDefaultFramebufferInfo->defaultFBO` `:3021`; the `HandleOf` half `:3032` is transport-gated off `:3030` | live | every `SyncCurrentFBO`, both targets |
|
||||
| `SyncCurrentFBOByRecord` `:3058-3274` | `:3178-3179` slot + `GetBoundObject()`; `:3228` `NoteStateForHandle(record.Fbo, currentFBO)`; `:3264` `SyncReadBufferToBackend(currentFBO)`; `:3269` `SyncToBackend(currentFBO, target)` | live (identity + the object handed on) | per target, only when `FramebufferSerial` moved (`:3122`) |
|
||||
| `BackendFramebufferObject::SyncToBackend` `Managers.cpp:10044-10429` record arm | `stateFBOObject->GetExternalIndex()` (logs), **`GetAllAttachmentObjects()` `:10283`**, **`GetAllFramebufferAttachmentVersions()` `:10284`**, `attachmentObject.IsEmpty()` `:10310`/`:10328`, the attachment object handed to `SyncAttachmentSurface` `:10338` | live | every walk the record hash re-arms (`:10277-10281`) |
|
||||
| `SyncAttachmentSurface` `Managers.cpp:9585-9742` | `attachment.GetTexture()` `:9617`, `SyncMipmapsToBackend(textureObject)` `:9657`; `attachment.GetRenderbuffer()` `:9698`, **the renderbuffer cross-check `HandleOf(renderbufferObject.get())` `:9711` is NOT transport-gated** (the texture one at `:9629-9632` is), `BackendRenderbufferObject::SyncToBackend(renderbufferObject)` `:9732` | live, id | per re-armed point |
|
||||
| `BackendRenderbufferObject::SyncToBackend` `Managers.cpp:13550-13584` | `g_backendRenderbufferObjects.HandleOf(stateRBOObject.get())` `:13574` inside the scope `:13570`; the four VALUES are already record-supplied `:13535-13548` | id | per attached RBO sync |
|
||||
| `SyncReadBufferToBackend` `Managers.cpp:9834-9953` record arm `:9853-9936` | only `GetExternalIndex()` in logs; `m_pushedSyncHandle` is the key `:9856-9862` | rec | - |
|
||||
| `SyncCurrentFBO` pre-handle arm `:3294-3377` | scope `:3303`, slot/`GetBoundObject` `:3305-3306`, versions `:3317-3318`, `defaultFBO` compare `:3336`, `Find(currentFBO.get())` `:3358`/`:3367`, `GetOrCreate(currentFBO)` `:3369` | live, id, mint | only when the record arm declines |
|
||||
| `BindCurrentFBO` `:4514-4623` | record arm `:4528-4564` reads NOTHING frontend (`FindByHandle(record.Fbo)` `:4543`); decline `:4568-4622`: slot, `GetBoundObject`, `defaultFBO` `:4581`, scope `:4585`, `Find(currentFBO.get())` `:4592` | rec / live+id | per bind |
|
||||
| `ForceBindCurrentFBO` `:4716-4754` | `:4720-4721` slot + `GetBoundObject()` **before** the handle arm `:4725-4730`, and `:4734-4738` stamp `GetVersion()/GetObjectVersion()/.get()` **after it** | live | every DSA clear, both blits |
|
||||
| `SyncCurrentProgram` broadcast count `:4347-4410` | record arm `:4353-4382`; decline `:4386-4389`: slot, versions, `GetDrawBuffers()` | rec / live | per draw |
|
||||
| `BlitFramebuffer` bound arm `:8398-8410` | `GetFramebufferBindingSlot(Read/Draw).GetBoundObject()` `:8408-8409` | live | per bound blit |
|
||||
| `BlitFramebuffer` named arm `:8335-8382` | `StateForHandle` `:8361` + `pDefaultFramebufferInfo->defaultFBO` `:8358-8359`; then `ForceBindCurrentFBO` x2 `:8375-8376` | rec + live via the note | per named blit |
|
||||
| `BlitLayeredDestinationAspects` `:8182-8320` | `GetDrawBuffers()` `:8210`, `GetReadBuffer()` `:8227`, `GetAttachment()` `:8241-8242`, `IsTexture/GetTextureLayer/IsLayered/GetTexture/GetFormat/GetSamples` `:8244-8263`, `SyncTextureObjectToBackend` `:8294-8295` | live, id, mint | both blit arms |
|
||||
| `Clear` `:6180-6192` | `SyncNeccessaryTextures()` + `SyncCurrentFBO()` + `BindCurrentFBO(Draw)` - all of the above | live | per clear |
|
||||
| `GetReadColorAttachment` `Managers.cpp:9395-9405`, `IsFixedPointFallbackReadAttachment` `:9773-9796` | read slot, `GetReadBuffer()`, `GetAttachment()`, format | live | readbacks, off the draw path |
|
||||
|
||||
### 1.2 Images (a.4)
|
||||
|
||||
| site | dereferenced | kind | when |
|
||||
|---|---|---|---|
|
||||
| `SyncImageTextureBindingsForDraw` `:2902-2914` | `g_imageUnitHighWaterMark == 0` early-out `:2903` | - | zero reads on a Minecraft draw |
|
||||
| `SyncImageTextureBindings` `:2783-2867` | record arm `:2829-2854` reads `st.ShaderImageStart/Count`; the walk is `[0, max(Start+Count, highWaterMark))` | rec | per sweep |
|
||||
| `SyncImageTextureBinding` `:2646-2749` | `MGB_CTX->GetImageTextureBinding(unit)` `:2650` (LIVE, unconditional); `IsWritableImageBufferTexture` `:2651` -> `binding.Texture->GetStorageType()` `:2523-2525`; `imageBinding.Texture` `:2652-2660`; `SyncTextureObjectToBackend(.., true)` `:2660`; `Texture->GetTarget()` `:2682`, `:2723`; `Texture->GetFormat()` `:2724`, `:2736`; **`imageBinding.Access` always frontend `:2744`** | live, id, mint, rec (4 of 5 values `:2670-2681`) | per swept unit |
|
||||
| `ResolveShaderImageRecord` `:2582-2643` | scope `:2588`; `g_backendTextureObjects.HandleOf(boundTexture)` `:2634` | id | per swept unit |
|
||||
| `MarkWritableImageBufferTexturesGpuWritten` `:2763-2781` | gate `:2764`; `GetImageTextureBinding` `:2767`; `Texture.get()` cast to `TextureObjectBuffer` `:2772-2773`; `GetBufferBindingSlot().GetBoundObject()` `:2774`; `MarkBufferGpuWritten` -> `HandleOfBuffer` (`Managers.cpp:2947-2978`, `:2922-2941`, scope `:2938`) | live, id | **every draw and dispatch** when any writable buffer image exists (`PrepareForDraw:4804`) |
|
||||
| `BoundImageUnitFormat` `Managers.cpp:10847-10850` | live image binding's `Format`, reached per draw from `!twin->ImageUnitFormatsStillMatch()` (`DirectGLES.cpp:4472` -> `Managers.cpp:11227-11238`, `:11231`) and at bake `:11071` | live | only for programs with format-less image uniforms |
|
||||
|
||||
## 2. What the records and applier state already carry
|
||||
|
||||
- `MGPFramebufferState` (`MG_Pipe/MGPipeTypes.h:750-782`, 304 B): `Fbo`, `Color[8]`, `Depth`,
|
||||
`Stencil`, `ReadSurface` (RESOLVED, per object, under every Target), `DrawBuffers[8]` (Int8
|
||||
index, -1 = None), `Width/Height/Layers/Samples`, `FixedSampleLocations`, `IsDefault`,
|
||||
`Complete`, `Target`, `ContentHash`. `MGPSurface` (`:628-655`): `Res`, `InternalFormat`
|
||||
(inline), `Kind`, `Layered`, `Level`, `Layer`, `UploadTarget`, `TextureTarget` (added by ID-12
|
||||
DV-5 so the four cross-object masks fall out with no lookup, `:636-653`).
|
||||
- Applier: `FramebufferRecords` keyed by `Fbo.Slot` with the generation checked, and NOT
|
||||
cleared by `MGPipeApplierReset` (`MG_Pipe/PipeApply.h:512-524`); `BoundFramebuffer[2]`
|
||||
`:646`; `FramebufferSerial`, advanced on every applied record including `Named` `:647-652`;
|
||||
`StaleFramebufferRecordLookups` `:653-663`; `FramebufferRecordFor` `:777`; the backend's
|
||||
door `BoundFramebufferRecord` (`DirectGLES.cpp:238-241`). Blit workspace
|
||||
`VerbBlitReadFbo/DrawFbo/NamedConsumed` `PipeApply.h:733-735`.
|
||||
- Emitter `MG_Impl/Pipe/FramebufferEmit.h`: `EmitFramebufferState` `:261-321` (both bindings, one
|
||||
`Both` record when shared), `EmitFramebufferByName` `:340-389` (every DSA entry point),
|
||||
`BuildFramebufferState` `:480-559`, `SurfaceOf` `:579-605`, `FillGeometry` `:610-638`,
|
||||
`ContentHash` `:216-238`, the two wire-width refusals `:489-520`, `NoteFramebufferDied`
|
||||
`:401-405`. Dirty rule: `NEW_FRAMEBUFFER` off `m_anyAttachmentGeneration` + object/slot version
|
||||
(`docs/Disaggregated/ARCHITECTURE.md:165`).
|
||||
- `object_death` (`MG_Pipe/PipeCalls.def:259-265`) is the framebuffer family's wire delete; client
|
||||
`MG_Remote/Client/WireTables.cpp:569`, server `MG_Remote/Server/PipeApplier.cpp:988-1013` ->
|
||||
`ReleaseTwinsForWireObjectDeath`. Textures and renderbuffers ride the same opcode.
|
||||
- Twin table already handle-capable: `FindByHandle` (`DirectGLES/SlotTables.h:420-426`),
|
||||
`GetOrCreateByHandle` (`Managers.h` ~453, used at `DirectGLES.cpp:3197`, `:4687`), `LiveGenAt`
|
||||
`:347-351`, `NoteStateForHandle`/`StateForHandle` `:362-378`, `ReleaseByHandle` `:394-405`;
|
||||
`m_pushedSyncHandle` (`Managers.h:1857`) keys the twin's record lookup off the caller's handle
|
||||
under a transport (`Managers.cpp:10095-10101`).
|
||||
- Images: `MGPImageView` (`MGPipeTypes.h:877-886`, 24 B, no pad) = `{Res, Unit, InternalFormat,
|
||||
Layer, Level, Layered, Access}`; `MGPShaderImages` `:888-892`; applier `BoundShaderImages`,
|
||||
`ShaderImageStart/Count`, `ShaderImagesSerial` (`PipeApply.h:683-686`). Emitter
|
||||
`MG_Impl/Pipe/ImageEmit.h:91-144`.
|
||||
- **`Access` IS encoded already**: `MGPipeEncodeImageAccess` (`ImageEmit.h:163-176`), 0/1/2 for
|
||||
`GL_READ_ONLY`/`WRITE_ONLY`/`READ_WRITE`, asserting on anything else. The server comment saying
|
||||
the encoding "does not exist at the contract commit" (`DirectGLES.cpp:2662-2669`) is STALE.
|
||||
- Buffer-texture backing: `MGPResourceDesc::BufferForTexBuffer` (`MGPipeTypes.h:357`) and
|
||||
`Target == MGPipeResourceTarget::TexBuffer` (`:188`, `:226-227`) already cross; renderbuffers
|
||||
get the same discriminated descriptor (`MG_Impl/Pipe/TextureEmit.h:269-274`, `:851-882`).
|
||||
|
||||
## 3. The gap - what does not exist yet
|
||||
|
||||
1. **A server decode of `MGPImageView::Access`** - one pure function beside
|
||||
`ResolveShaderImageRecord` plus a Table 0 line pinning 0/1/2. No wire or client change;
|
||||
`DirectGLES.cpp:2744` is the only reader.
|
||||
2. **No per-surface extent in `MGPSurface`** - but none is needed: the RBO descriptor already
|
||||
carries format/width/height/samples (`Managers.cpp:13535-13548`). What is missing is a
|
||||
handle-taking `SyncToBackendByHandle(MGPipeHandle)` so `surface.Res` replaces `HandleOf(object)`
|
||||
at `:13574`; same shape for `SyncMipmapsToBackend` (S2's file).
|
||||
3. **No record says which attachment POINTS exist.** The walk at `Managers.cpp:10283-10296` uses
|
||||
the frontend's 41-point array for membership and for the per-point version memo. No new field:
|
||||
`BuildFramebufferState` refuses any record whose framebuffer holds a point at or above the wire
|
||||
width (`FramebufferEmit.h:489-501`) and the FRONT/BACK tokens exist only on the default
|
||||
framebuffer (`:527-532`), so the record's 11 surfaces ARE the total point set. The rule needs
|
||||
contract text, because the detach (`:10310`) and the N-6 refusal (`Managers.cpp:9601-9606`)
|
||||
both read `attachmentObject.IsEmpty()` today.
|
||||
4. **The two attachment texture-sync lists are keyed on a frontend pointer**
|
||||
(`DirectGLES.cpp:2424`, `:2278`) with entries BORROWING the attachment's own `SharedPtr` slot
|
||||
(`:2127-2131`). No new record field - `record.Fbo` + `ContentHash` is already a complete key
|
||||
(`:2158-2169`) and the surfaces carry the texture handles - but the entry becomes
|
||||
`{MGPipeHandle Res, BackendTextureObject*}` and `PairingsIntact` a handle compare.
|
||||
5. **The image sweep's gate is a FRONTEND counter** - `keys.samplingGeneration` (`:2904-2906`),
|
||||
deliberately so (`:2890-2901`), and the server cannot read it under run-ahead. P5c rv already
|
||||
moved the three texture shutters to APPLIER_DERIVED serials (`PipeApply.h:696-700`); the gate
|
||||
must be re-keyed onto `ShaderImagesSerial` + the texture params/content serials, and the "a
|
||||
texture bound only to an image unit is re-minted INSIDE this sweep" property re-argued (§7).
|
||||
6. **No handle form of `MarkBufferGpuWritten`** (`Managers.h:1005` takes the object) - needed:
|
||||
`MarkBufferGpuWrittenByHandle(MGPipeHandle)` that skips `HandleOfBuffer`.
|
||||
7. **`ForceBindCurrentFBO` reads the binding slot on both sides of its own handle arm**
|
||||
(`:4720-4721`, `:4734-4738`); under run-ahead it must be handle-only and stamp nothing
|
||||
frontend.
|
||||
|
||||
## 4. The retirement design
|
||||
|
||||
**Key.** The framebuffer twin is ALREADY handle-keyed at its record-driven entries
|
||||
(`GetOrCreateByHandle(record.Fbo)` `:3197`, `FindByHandle(record.Fbo)` `:4543`,
|
||||
`GetOrCreateByHandle(fbo)` `:4687`). P5e makes that the ONLY key: under a live wire the
|
||||
`Find(currentFBO.get())` / `GetOrCreate(currentFBO)` arms at `:3358`, `:3367-3369`, `:4592`,
|
||||
`Managers.cpp:10101`, `:9711`, `:13574` go, and `NoteStateForHandle`/`StateForHandle` go with them
|
||||
- the twin's sync body takes the RECORD, so there is no frontend object to reach.
|
||||
**`SyncCurrentFBO` becomes `SyncCurrentFBOByRecord` only:** the pre-handle arm (`:3294-3377`) is
|
||||
unreachable and a decline is `Fatal{UnmigratedPipeInput, "GetFramebufferBindingSlot"}` rather than
|
||||
a fallback, which is P5e-3's detector. `FramebufferRecordMatchesBinding` (`:3017-3033`) loses its
|
||||
remaining half - the record was resolved from `BoundFramebuffer[target]`, so it IS that binding by
|
||||
construction (`:3025-3030` already says so) - and becomes monolith-only.
|
||||
|
||||
**`BackendFramebufferObject::SyncToBackend(record, asTarget)`.** A signature change, not a body
|
||||
change: `pushedRecord` becomes the parameter (`Managers.cpp:10082-10111` collapses), the draw
|
||||
buffers are `DecodePushedDrawBuffers` output (`:10118-10119`, already) and the four masks the
|
||||
record's surfaces (`:10189-10214`, already); the walk at `:10283-10296` becomes a walk over
|
||||
`Color[0..7] + Depth + Stencil` (just `Color[0]` when `IsDefault`).
|
||||
`m_syncedFrontendAttachmentVersions` is replaced by the record hash alone (`:10277-10281`) - the
|
||||
"over-firing is free" second gate at `:10269-10276` hedged against a frontend attachment moving
|
||||
without the record, which is unrepresentable once the record is the only statement. The re-entry
|
||||
on `g_attachmentBackendIdGeneration` (`:10426-10428`) stays; it is server-owned.
|
||||
|
||||
**`SyncAttachmentSurface(glFBOTarget, surface, glBackendAttachment)`** - the `attachmentObject`
|
||||
parameter goes. The empty point is `Kind == None || MGPipeHandleIsNull(Res)` (`:9588-9589`) and
|
||||
the detach at `:10310` takes the SAME test, so N-6's "record empty, frontend still holding" hole
|
||||
(`:9593-9606`) becomes unrepresentable. Both cross-checks (`:9629-9632`, `:9711-9718`) become
|
||||
monolith-only - the renderbuffer one is not transport-gated today and must be, in the same edit.
|
||||
Storage goes through `SyncMipmapsToBackendByHandle` / `SyncToBackendByHandle(surface.Res)`.
|
||||
|
||||
**"Is it clean" is already server-owned:** `SyncedFramebufferSerialIsCurrent(target,
|
||||
st.FramebufferSerial)` (`:3035-3040`, `:3122`) plus `g_attachmentBackendIdGeneration` and
|
||||
`g_backendContextGeneration`. Nothing new for the FBO twin. The two attachment texture lists key
|
||||
on `(record.Fbo, ContentHash, contextId, g_backendContextGeneration)` with `PairingsIntact` as
|
||||
`entry.Res == surface.Res`; `IsDrawSyncClean` is S2's to re-key.
|
||||
|
||||
**`BindCurrentFBO` / `ForceBindCurrentFBO`.** The record arm at `:4528-4564` becomes the only arm.
|
||||
`ForceBindCurrentFBO` becomes: read `st.BoundFramebuffer[target]`, call
|
||||
`SyncAndBindFramebufferByHandle` (`:4670-4713`, handle-only once `StateForHandle` gives way to the
|
||||
record), invalidate `g_fboSyncedSerials[target]` (`:4750-4752`); the three frontend stamps at
|
||||
`:4734-4738` are deleted under a live wire.
|
||||
|
||||
**Named blit.** `BlitLayeredDestinationAspects` takes two `const MGPFramebufferState&`: draw
|
||||
buffers from `DrawBuffers[]`, the read buffer from `ReadSurface` (matched against `Color[]` as
|
||||
`SyncReadBufferToBackend:9900-9912` does), `IsTexture` from `Kind`, layer/level/layered/format
|
||||
from the surface, samples from `record.Samples`, the two textures by `FindByHandle(surface.Res)`.
|
||||
That retires `StateForHandle` `:8361` and the `defaultFBO` pointer `:8358-8359` (use
|
||||
`kMGPipeDefaultFramebuffer`). `ReadFbo`/`DrawFbo` are already in the workspace
|
||||
(`PipeApply.h:733-735`); the bound arm's `:8408-8409` becomes
|
||||
`FramebufferRecordFor(st.BoundFramebuffer[t])`.
|
||||
|
||||
**Images.** `SyncImageTextureBinding(unit)` becomes `SyncImageTextureBinding(const MGPImageView&)`:
|
||||
`Res` is the texture (twin by `FindByHandle`), `Level/Layer/Layered/InternalFormat` are already
|
||||
the record's (`:2670-2681`), `Access` is `MGPipeDecodeImageAccess(view.Access)`, and the two
|
||||
texture-property reads (`GetTarget()` `:2682`/`:2723`, `GetFormat()` `:2724`/`:2736`) come off the
|
||||
**twin**, which owns its target and storage format after tx's sync - not off a new wire field
|
||||
(`MGPImageView` is 24 B with no pad). `ResolveShaderImageRecord`'s identity test (`:2634`) and its
|
||||
I5 seam log go: no second answer is left. `g_imageUnitHighWaterMark`, `g_writableImageBufferUnits`
|
||||
and `g_imageSweepValid` are already server-owned (`:2519-2547`, `:2877-2880`) and stay.
|
||||
`MarkWritableImageBufferTexturesGpuWritten` becomes: per tracked unit take
|
||||
`st.BoundShaderImages[unit]`, require `Access != 0` and the descriptor's `Target == TexBuffer`,
|
||||
call `MarkBufferGpuWrittenByHandle(desc.BufferForTexBuffer)` - no frontend read, no
|
||||
`HandleOfBuffer`, and `MGPipeReverseAnnouncementScope` loses one of its two draw-path callers.
|
||||
|
||||
## 5. Monolith / G1
|
||||
|
||||
Every site above already has a `MOBILEGL_PIPE_PUSH` record arm and a pre-handle arm, and the
|
||||
split-only decisions are already spelled as `MG_Config::Transport != Monolith` (`:3030`, `:3226`,
|
||||
`:4725`, `Managers.cpp:9629`, `:10097`). P5e keeps that shape: the pre-handle arms stay compiled
|
||||
and stay the monolith path; what changes under a live wire is that a decline becomes Fatal
|
||||
instead of a fallback. The pull build sees no token move - the handle-taking forms live inside
|
||||
`#if MOBILEGL_PIPE_PUSH`, and the frontend-object overloads of `SyncToBackend` /
|
||||
`SyncMipmapsToBackend` / `SyncAttachmentObject` are kept verbatim for it. `SyncToBackend` gains an
|
||||
OVERLOAD rather than a changed signature, so the `#else` arms at `Managers.cpp:10120-10122` and
|
||||
`:10348-10350` are textually unchanged (the discipline `MGB_RBO_*` uses at `:13534-13548`).
|
||||
G2/G14: no new name enters `MGPipeTypes.h`; the new public names are `MGPipeDecodeImageAccess`,
|
||||
`SyncToBackendByHandle`, `SyncMipmapsToBackendByHandle`, `MarkBufferGpuWrittenByHandle`.
|
||||
|
||||
## 6. Red-once evidence
|
||||
|
||||
| arm reverted | goes red as |
|
||||
|---|---|
|
||||
| `SyncAttachmentSurface` takes the frontend attachment again | `Fatal{UnmigratedPipeInput, "GetFramebufferBindingSlot"}` on the strict lane at the first attached draw (`SnormAttachmentScenario`, `ThreeChannelAttachmentScenario`) |
|
||||
| the draw-FBO list key back to the pointer compare (`:2424`) | `Fatal{RoleViolation, "MGPipeSlots"}` from `HandleOf` inside the rebuild (`SlotTables.h:441`) - the scope is gone by then |
|
||||
| `MGPipeDecodeImageAccess` mapped 1<->2 | `FormatlessImageBakeScenario` / `ImageLoadStoreSsoScenario` red (a `writeonly` image read back) - and a new unit case in `MG_Test/Pipe/ImageEmitTest.cpp` beside `TheApplicationsFormatAndAccessTravelUnrecast` (`:452`) pinning the three constants on BOTH sides |
|
||||
| `MarkWritableImageBufferTexturesGpuWritten` off the descriptor's `BufferForTexBuffer` | `BufferTextureScenario` reads the pre-dispatch shadow |
|
||||
| the named blit's aspect plan back on the frontend objects | `CopyImageLayeredScenario`, `LayeredAttachmentShapeScenario` |
|
||||
| the FBO twin's per-point version memo kept as a second gate | `CrossFrameBufferScenario` / `P4aSeamAuditScenario` F-3 (a re-storaged attached RBO) - it must stay green WITHOUT the memo, which is the proof the record hash is sufficient |
|
||||
| `record.Color[]` used as membership while a point above the wire width exists | `FramebufferEmitTest.AnAttachmentPointAboveTheWireWidthIsRefusedNotTruncated` (`:558`) is the existing guard; add its twin on the SERVER side |
|
||||
|
||||
Exit gate: unit (`MG_Test/Pipe/FramebufferEmitTest.cpp`, `MG_Test/Pipe/ImageEmitTest.cpp`) +
|
||||
`integration-split` + `integration-split-strict` green with the framebuffer/sampler bits set, and
|
||||
the seam greps (`DirectGLES.cpp:3086-3106`, `:2607-2610`, `:2636-2638`) silent.
|
||||
|
||||
## 7. Risks and what I could not settle
|
||||
|
||||
1. **The image sweep's gate is the one genuinely frontend-owned thing here.** `:2890-2901` argues
|
||||
a server-owned epoch is bumped AFTER the gate has declined, because a texture bound only to an
|
||||
image unit is re-minted inside the sweep. That survives the re-key only if the new gate mixes
|
||||
the applier's texture content/params serials (`PipeApply.h:696-700`), never a backend re-mint
|
||||
counter. I could not prove it without S2's serial design. **Ruling needed.**
|
||||
2. **A8 is still open and P5e makes it load-bearing.** The image walk unions the record window
|
||||
with `g_imageUnitHighWaterMark` (`:2811-2821`) because nothing pins the window's membership.
|
||||
Under run-ahead the mark is still server-owned, so the union survives - but if a later package
|
||||
narrows the walk to the window, an image established eagerly and never revisited is stranded
|
||||
on a deleted driver name. Keep the union and say so in the contract.
|
||||
3. **`Complete` and the frontend's `CheckCompleteness`.** `MGPFramebufferState::Complete`
|
||||
(`MGPipeTypes.h:762-770`) is deliberately the frontend-only answer.
|
||||
`glCheckFramebufferStatus` still answers from the frontend on the client, so nothing on the
|
||||
apply path reads it - but any P5e code tempted to use `Complete` as a "may I draw" gate would
|
||||
be reading the weaker answer. Do not.
|
||||
4. **`ForceBindCurrentFBO`'s pre-handle stamps** (`:4734-4738`) are also read by the legacy
|
||||
`SyncCurrentFBO` arm; deleting them under a live wire leaves that memo permanently invalid in
|
||||
a mixed build. Skip the stamp and the legacy arm together under the transport test, as
|
||||
`:4750-4752` already does for the serial memo.
|
||||
5. **Default-framebuffer geometry.** `FillGeometry` (`FramebufferEmit.h:610-638`) takes the extent
|
||||
from the first non-empty attachment, `BackLeft` for the default one (`:531-532`). I did not
|
||||
verify that an EGL surface resize re-emits the record: the shutter is
|
||||
`m_anyAttachmentGeneration` + the object version (`ARCHITECTURE.md:165`), and a resize moving
|
||||
neither would be suppressed. **S6/S7 should check** - under run-ahead there is no other
|
||||
extent source.
|
||||
6. **`SyncReadFramebufferTextureAttachments` is deliberately NOT gated on the framebuffer
|
||||
subsystem bit** (`:2227-2230`), so its retirement changes behaviour in BOTH arms of the object
|
||||
A/B. The A/B baseline moves with it; tell the integrator.
|
||||
7. **Whether a blit is a run-ahead op is unsettled.** Both arms end in `ForceBindCurrentFBO` x2,
|
||||
which restores state that is all server-owned once the design above lands, so I see no reason
|
||||
it must wait. The readbacks (`GetReadColorAttachment`, `IsFixedPointFallbackReadAttachment`)
|
||||
are S6's: waited today by their reply slot, and their frontend reads should stay refused
|
||||
rather than migrated.
|
||||
@@ -0,0 +1,246 @@
|
||||
# S4 - programs / shader state (E note a.2) at head `2fde7034`
|
||||
|
||||
Paths under `MobileGL/`. `DirectGLES.cpp` / `Managers.*` = `MG_Backend/DirectGLES/`.
|
||||
Kinds: **live** = dereference of the frontend `ProgramObject`; **id** = `GetLifetimeId()` +
|
||||
client-allocator probe; **mint** = `MGPipeSlots().Acquire`; **rec** = record-only arm.
|
||||
"hit" = runs on every draw, memo hit included.
|
||||
|
||||
## 1. The exact live reads of this family
|
||||
|
||||
### 1.1 The row itself
|
||||
| site | read | kind | hit |
|
||||
|---|---|---|---|
|
||||
| `DirectGLES.cpp:4781` `PrepareForDraw` | `MGB_CTX->GetProgramForDraw()`, the BARRIER_PULLED SharedPtr row (`MG_Pipe/FieldOwnership.def:92`) | live | yes |
|
||||
| `:6126` `PrepareForCompute` | `GetProgramForDispatch()` (`FieldOwnership.def:100`) | live | dispatch |
|
||||
| `:5308`, `:5679` `GetCurrentBackendProgram`, `:5734` `CurrentProgramMayNeedPerSubDrawBuiltins` | three more `GetProgramForDraw()` pulls in the same entry point; `:5680` link/SPIR-V status, `:5736` `GetLinkVersion()` | live | per draw-parameter update / per multi-draw |
|
||||
|
||||
### 1.2 `SyncCurrentProgram` (`:4321`, scope `:4329`)
|
||||
| site | read | kind | hit |
|
||||
|---|---|---|---|
|
||||
| `:4339` | `GetLinkStatus()`, `GetSpirvStatus()` | live | yes |
|
||||
| `:4350-4380` / `:4383-4404` | broadcast count: record arm off `BoundFramebufferRecord(Draw)` (`:238`) / decline arm reads the draw-FBO slot (S3's) | rec / live | yes / latch off |
|
||||
| `:4415-4416` | `g_backendProgramObjects.Find(currentProgram.get())` -> `HandleOf` (`SlotTables.h:436-449`), miss -> `GetOrCreate(const StatePtr&)` (`:209-252`); legacy arm repeats it at `:4427-4429` | id, mint | yes |
|
||||
| `:4437-4439` | `GetBackendProgramId()`, `GetLinkVersion()`, `GetImageUnitVersion()` | live | yes |
|
||||
| `:4463-4464` | `ComputeShaderStorageBlockBindingSignature(*currentProgram)` -> `Managers.cpp:10819-10842`, walks `GetShaderStorageBlockBindingOverrides()` (an `UnorderedMap<String,Int>` inside `LinkArtifacts`) | live | yes |
|
||||
| `:4472` | `ImageUnitFormatsStillMatch()` -> `Managers.cpp:10846+` -> `GetImageTextureBinding` (S3's row) | live | yes |
|
||||
| `:4501-4506` | `GetPatchVertices()/GetPatchDefault{Outer,Inner}Level()` - VALUE rows in the block, not object memory | - | yes |
|
||||
| `:4508` | `twin->SyncToBackend(currentProgram)` -> `Managers.cpp:11922-12971`: ~40 accessors, incl. `GetGeneratedSpirv` `:12028`, `GetLinkedShaderStages` `:12027`, `GetLinkedShaderSnapshot` `:12049` (GL-thread-owned vector; `MGLOG_D` only), `GetTransformFeedbackVaryings` `:12067,:12711`, `ReseedShaderStorageBlockBindings` `:12925` (`Managers.cpp:10809-10817`), `CacheResourceLocations` `:12918` (`:12995-13078`: `GetActiveUniformBlocksCount`, `GetUniformBlockName`, `GetMaxUniformLocation`, `GetUniformName`, `GetUniformType`, `GetUniformLocation`) | live | rebuild only - cold, but on the apply thread |
|
||||
| `:4509-4510` | the per-draw stash is keyed by the RAW FRONTEND POINTER (`:4097-4098`) | live | yes |
|
||||
|
||||
### 1.3 `BindCurrentTextures` (`:5245`)
|
||||
`:5257` memo entry selected by `currentProgram.get()`; `:5279` `GetLifetimeId()`, `:5281`
|
||||
`GetBackendStateVersion()`, `:5282` `GetLinkStatus()` - **live on every draw, memo hit
|
||||
included**; re-read at `:5295-5297` on a store. Miss -> `ResolveAndBindUnitTextures` `:4834`,
|
||||
whose `sampledTargetForUnit` `:4845-4857` reads `GetLinkStatus` / `GetMaxUniformLocation` /
|
||||
`GetUniformSamplerOrImageUnitIndex` / `GetUniformType` (live, alias conflict only).
|
||||
|
||||
### 1.4 `BindCurrentProgramWithResources` (`:5317`, scope `:5328`)
|
||||
| site | read | kind | hit |
|
||||
|---|---|---|---|
|
||||
| `:5320` | `GetLinkStatus()`, `GetSpirvStatus()` | live | yes |
|
||||
| `:5332-5339` | stash compare against `currentProgram.get()`; fallback `Find(currentProgram.get())` | id | fallback |
|
||||
| `:5349` | `GetUBOSize() > 0 && HasGlobalUboBlock()` | live | yes |
|
||||
| `:5365` -> `ResolveGlobalConstantsRecord` `:4230-4318` | scope `:4236`, `HandleOf(program)` `:4242`, `FindShaderCsoRecord` `:4157`, `GetUBOSize()` `:4280,:4297,:4305,:4313` | id + live | yes |
|
||||
| `:5371-5373` | `record->GlobalConstantsVersion` ELSE `GetUBOContentVersion()`; `GetUBOSize()` always | rec / live | yes |
|
||||
| `:5379-5382` | `MGB_UBO_BYTES` = record bytes ELSE `currentProgram->MapUBO()` (`MG_State/GLState/ProgramState/ProgramObject.h:734`, the live `globalUboScratch` every `glUniform*` writes) | rec / live | no record only |
|
||||
| `:5425,:5430` | `GetUBOSize()` on the `glBufferSubData` fallback | live | no-ring devices |
|
||||
| `:5448,:5463` | twin's `GetUniformBlockBackendIndices()`, then `currentProgram->GetUniformBlockBinding(i)` (`ProgramObject.h:1029` = `Artifacts().uniformBlockBinding[i]`, moved post-link) - the point read at `:5464` is S5's | live | per named block per draw |
|
||||
| `:5504-5506` | `SyncAtomicCounterBuffers(twin.GetAtomicCounterBindings(), ...)` -> `:617-660` (S5's rows) | twin | counter programs |
|
||||
| `:5522` | `GetBackendStateVersion()` - the sampler-pass memo key | live | yes |
|
||||
| `:5544-5546` | on a miss, `GetUniformSamplerOrImageUnitIndex(frontendLocation)` per sampler binding (`ProgramObject.h:857`); `:5561-5596` are S2's unit/sampler reads | live | miss |
|
||||
|
||||
### 1.5 Off the steady path, still apply-thread
|
||||
`GetBackendProgramId` `:6151-6178`: `ValidateProgramName` `:6152` + `GetProgramObject` `:6157`
|
||||
(sticky BARRIER_PULLED, `FieldOwnership.def:149,155`), scope `:6166`, `Find`/`GetOrCreate`
|
||||
`:6168-6170`, `SyncToBackend` `:6174`. `ShaderStorageBlockBinding` `:10020-10042`: the same
|
||||
two forwards `:10022-10023`, scope `:10029`, `Find` `:10031`, `GetLinkVersion()` `:10038`.
|
||||
|
||||
## 2. What records and applier state ALREADY carry
|
||||
|
||||
* `MGPipeApplierState::DrawProgram / DispatchProgram / BoundShaderCso` + `ProgramBindingSerial`
|
||||
(`MG_Pipe/PipeApply.h:691-695`), written by `MGPipeApplyBindShaderState`
|
||||
(`PipeApply.cpp:2919`), `...SetDrawProgram` (`:2980`), `...SetDispatchProgram` (`:2995`),
|
||||
cleared by `...DeleteShaderState` (`:2941`) and `MGPipeApplierReset`. Catalogue:
|
||||
`MG_Pipe/PipeCalls.def:162-164,180-181`.
|
||||
* `MGPipeShaderCsoRecord` (`PipeApply.h:370-380`): `Gen/Live`, `MGPProgramDesc Desc`
|
||||
(`MG_Pipe/MGPipeTypes.h:585-597` - `Cso`, `StageMask`, `GlobalUboSize`,
|
||||
`ReservedNumSamplesOffset`, `SpirvStatus`, `NativeFloat64`, `PointSizeDemoted`,
|
||||
`EnableSpirvValidation`, `MGPBlobRef Spirv[6]`, `MGPBlobRef Reflection`), `GlobalConstants`
|
||||
+ `GlobalConstantsVersion` + `GlobalConstantsSerial`, `Serial`. Two tables, ordinary and
|
||||
composite band (`PipeApply.h:503,511`). `Serial` moves on every applied
|
||||
`create_shader_state` including a re-issue on the same handle - that is how a RELINK
|
||||
travels - and a re-issue clears the block and bumps `GlobalConstantsSerial`
|
||||
(`PipeApply.cpp:2895-2914`).
|
||||
* Emitters: `MG_Impl/Pipe/ProgramEmit.h` `EmitShaderState` `:105-159`, `AcquireShaderCso`
|
||||
`:212-292`, `EmitGlobalConstants` `:169-209`; driven from `MG_Impl/Pipe/PipeFill.cpp:3162`
|
||||
(`NewShader`/`NewShaderBindings`) and `:3188` (`NewGlobalConstants`). The shutters
|
||||
(`MG_Impl/Pipe/Tracker.h:364-371` plain, `:419-448` pipeline) ALREADY mix
|
||||
`GetBackendStateVersion`, `GetBlockBindingVersion`, `GetImageUnitVersion`,
|
||||
`GetUniformWriteSetVersion` and the identity into bit `NewShaderBindings`.
|
||||
* **A server-owned clean key that exists and is never read:** `m_syncedShaderCsoSerial`
|
||||
(`Managers.h:2415,2517`), stamped from the record at `Managers.cpp:12944-12966`. Nothing in
|
||||
the tree calls `GetSyncedShaderCsoSerial()` at this head - P4a's D-B3 landed the producer
|
||||
without the consumer. P5e is its first caller.
|
||||
* Death: `object_death` covers ShaderCso by handle (`Managers.cpp:328-345`);
|
||||
`delete_shader_state` is emitted at `PipeFill.cpp:1807-1827`.
|
||||
* Handle-keyed twin machinery already on this registry (`Managers.cpp:10757`
|
||||
`TwinRegistry<ProgramObject, BackendProgramObjectImpl, MGPipeKind::ShaderCso>`):
|
||||
`FindByHandle` (`Managers.h:429`), `GetOrCreateByHandle` (`:453`), `ReleaseByHandle`
|
||||
(`:505`), `NoteStateForHandle`/`StateForHandle` (`:473-484`).
|
||||
|
||||
## 3. The gap
|
||||
|
||||
**G-A. The archive is not server-owned.** `MGPipeApplyCreateShaderState` stores the
|
||||
DESCRIPTOR and deliberately not the artefacts (`PipeApply.cpp:2915-2918`); all seven
|
||||
`MGPBlobRef`s are `Size 0` and `LinkArtifacts`/`SpirvArtifacts` ride beside the record as
|
||||
companion pointers (`ProgramEmit.h:230-260`). So every read in 1.2's `SyncToBackend` row is a
|
||||
read of `ProgramObject::m_artifacts`/`m_spirv`, which `Link()` REPLACES in place
|
||||
(`ProgramObject.h:1104`, `ProgramObject.cpp:348-356,518-522`). *Fix:* fill the refs - the
|
||||
client encodes once per link with the existing codec
|
||||
(`MG_State/GLState/ProgramState/ProgramArtifactsCodec.h`; the verify build already pins the
|
||||
round trip at `PipeApply.cpp:1171-1202`) into `SEG_STAGE`, the applier decodes into
|
||||
record-owned `LinkArtifacts`/`SpirvArtifacts`. **No new fields** - `Desc.Reflection` and
|
||||
`Desc.Spirv[6]` simply stop declaring 0.
|
||||
|
||||
**G-B. Three POST-LINK mutable reflection fields have no wire form.** They live inside
|
||||
`LinkArtifacts`, so an archive snapshot alone is wrong:
|
||||
| field | setter | counter | server reader |
|
||||
|---|---|---|---|
|
||||
| `uniformBlockBinding[i]` | `SetUniformBlockBinding` `ProgramObject.h:1017-1027` | `m_backendStateVersion`, `m_blockBindingVersion` | `:5463` |
|
||||
| `uniformSamplerOrImageUnitIndex[loc]` | `SetUniformSamplerOrImageUnitIndex` `:830-850` | `m_backendStateVersion` (+`m_imageUnitVersion` for images) | `:4851`, `:5546` |
|
||||
| `shaderStorageBlockBinding[name]` | `SetShaderStorageBlockBinding` `:1035-1048` | `m_blockBindingVersion` ONLY | `:4464`, `Managers.cpp:10811,10821` |
|
||||
|
||||
*Fix:* one new record **`set_program_bindings`**, `kCtxState`, `kVarTail|kHostSpan`, head
|
||||
`MGPProgramBindings { MGPipeHandle Cso; Uint64 Signature; Uint32 BlockBindingCount,
|
||||
SamplerUnitCount, StorageOverrideCount, Pad; }` and three tails: `Int32 BlockBindings[]`
|
||||
(dense, GL uniform-block index order), `{Uint32 Location, Int32 Unit}[]` (sparse), and
|
||||
`{MGHostSpan Name, Int32 Binding}[]` for the storage overrides - a name span because the
|
||||
override map is name-keyed BY DESIGN (`ProgramObject.h:1030-1034`: three index spaces, one
|
||||
coordinate). `Signature` is computed CLIENT-side with the same commutative hash as
|
||||
`Managers.cpp:10832-10841`, so the rebuild clause is a `Uint64` compare and the name tail is
|
||||
touched only on a rebuild. Record gains `BlockBindings`, `SamplerUnits`, `StorageOverrides`,
|
||||
`Signature`, `BindingsSerial`; a re-issued create clears all of them for
|
||||
`GlobalConstants`' reason (`PipeApply.cpp:2903-2909`). Dirty rule: bit `NewShaderBindings`
|
||||
already exists and its shutter already reads all three counters; the emitter is a fourth
|
||||
method on `MGPipeProgramEmitterInstance()`, latched on
|
||||
`(Cso, backendStateVersion, blockBindingVersion)`, emitted BEFORE `EmitShaderState` (a
|
||||
rebuild inside the verb must already see the bindings).
|
||||
|
||||
**G-C. `MapUBO()` has no run-ahead answer.** `:5380/:5382` runs when
|
||||
`ResolveGlobalConstantsRecord` declines (bit 12 off, sentinel, short block) and is a torn
|
||||
read of `globalUboScratch`. Under a live wire with run-ahead that arm is
|
||||
`Fatal{UnmigratedVerb,"set_global_constants"}`, not a fall-back.
|
||||
|
||||
**G-D. Frontend-pointer keys.** The stash (`:4097-4098`) and both memos (`:5257`, `:5279`)
|
||||
key on the object address; re-key on `{slot,gen}` + server serials. No record needed.
|
||||
|
||||
## 4. The retirement design
|
||||
|
||||
1. **Twin key = the ShaderCso handle.** `SyncCurrentProgram` takes an `MGPipeHandle` on the
|
||||
run-ahead arm; `PrepareForDraw` reads `MGPipeApplier().DrawProgram`, `PrepareForCompute`
|
||||
`.DispatchProgram` (`PipeApply.h:691-693`). Twin = `GetOrCreateByHandle(h)`
|
||||
(`Managers.h:453`). The `Find`/`GetOrCreate(StatePtr)` pairs at `:4415-4416`, `:5337`,
|
||||
`:6168`, `:10031` and `ResolveGlobalConstantsRecord`'s `HandleOf` `:4242` go, and with
|
||||
them scopes `:4236, :4329, :5328, :6166, :10029` - five of the twenty S7 must retire.
|
||||
2. **The record replaces the object in `SyncToBackend`**, whose signature becomes
|
||||
`(MGPipeHandle, const MGPipeShaderCsoRecord&)`: artefact reads answered from the record's
|
||||
owned archive (G-A), binding reads from its tails (G-B). `GetLinkedShaderSnapshot`
|
||||
`:12049` is a debug log and is deleted on this arm; `GetExternalIndex()` in messages
|
||||
becomes the handle.
|
||||
3. **"Clean" from server-owned serials.** The nine-clause condition `:4437-4507` keeps its
|
||||
clause count and moves its inputs: `GetLinkVersion` -> `record.Serial` vs
|
||||
`twin->GetSyncedShaderCsoSerial()` (the stamp that already exists);
|
||||
`GetImageUnitVersion` -> `record.Serial` + `BindingsSerial` (a `glUniform1i` on an image
|
||||
uniform moves `m_imageUnitVersion`, a `NewShaderBindings` shutter input, so the bindings
|
||||
record re-fires); `ComputeShaderStorageBlockBindingSignature` -> `record.Signature`;
|
||||
`GetLinkStatus/GetSpirvStatus` -> `Desc.SpirvStatus` plus a new explicit `Desc.LinkStatus`
|
||||
byte (today "linked" is only implied by the create existing, which is not the same
|
||||
statement); `ImageUnitFormatsStillMatch` and the patch clauses are S3's / value rows.
|
||||
4. **Memos.** `BindCurrentTextures`' key (`:5274-5283`) becomes
|
||||
`{handle.Slot, handle.Gen, record.Serial, BindingsSerial}`; the sampler-pass memo's
|
||||
`backendStateVersion` (`:5522`) becomes `BindingsSerial`; `sampledTargetForUnit`
|
||||
(`:4845-4857`) reads the sampler-unit tail plus the archive's uniform types.
|
||||
5. **The stash** (`:4097-4098,:4509-4510,:5332-5335,:5678-5695`) holds
|
||||
`{MGPipeHandle, BackendProgramObjectImpl*}` and consumers compare against
|
||||
`MGPipeApplier().DrawProgram` instead of `GetProgramForDraw().get()`.
|
||||
6. `GetProgramObject` / `ValidateProgramName` keep their P9 row: both call sites (`:6151`,
|
||||
`:10020`) are GL-thread entry points, not run-ahead ops (7.2).
|
||||
7. After this the family's only remaining readers are `GetProgramForDraw:92` and
|
||||
`GetProgramForDispatch:100`, which flip to FATAL under run-ahead (P5e-3) - the strict
|
||||
lane's expected red for this family becomes a gate.
|
||||
|
||||
## 5. Monolith / G1
|
||||
|
||||
* The pull build compiles none of it: every new site sits under `MOBILEGL_PIPE_PUSH`, and the
|
||||
registry alias already drops the kind parameter there (`Managers.h:626-640`), so mangled
|
||||
names stay pre-P2. The record, the applier fields and the emitter method are push-only.
|
||||
**G1 byte-identity holds by construction.**
|
||||
* Push + `Transport=monolith` keeps today's behaviour: the run-ahead arm is selected by a
|
||||
*transport + caps* predicate (`ProgramRunAheadArm()` beside `ProgramSubsystemEnabled()`),
|
||||
false under monolith and false for DirectVulkan (P5e-4). Under monolith `SyncCurrentProgram`
|
||||
keeps the frontend overload verbatim, and with it `MapUBO`, `GetBackendProgramId` and
|
||||
`ShaderStorageBlockBinding`.
|
||||
* Two overloads, not an `#if` inside one body - the frontend one should be visibly the
|
||||
monolith-glue half, as `GetOrCreate(const StatePtr&)` is (`SlotTables.h:236-244`).
|
||||
* G2/G14: one new `PipeCalls.def` row, no new dirty bit, so `gen_pipe_dirty_surface` needs
|
||||
only the new emitter's shutter row.
|
||||
|
||||
## 6. Red-once
|
||||
|
||||
1. **The bindings record is consumed.** Empty the applier's block-binding tail and run
|
||||
`UniformInitializerScenario` / `Glsl420DeclarationScenario`: a named UBO lands on the
|
||||
wrong point -> wrong pixels + `RefusedObjectCalls`. Unit: a `ProgramEmitTest` case beside
|
||||
`MG_Test/Pipe/ProgramEmitTest.cpp:251` ("a glUniformBlockBinding after the link travels on
|
||||
its own record").
|
||||
2. **The archive is server-owned.** Run the run-ahead arm with the blob refs left at `Size 0`
|
||||
and the companion pointers removed: the existing trip wire "the record declares no blobs
|
||||
and carries no artefacts" (`PipeApply.cpp:2858-2871`) fires `Fatal{ProtocolCorruption}`.
|
||||
3. **No frontend probe survives.** Delete the five scopes of 4.1 without re-keying:
|
||||
`MGPipeRefuseAllocatorFromApplyThread` (`MG_Impl/Pipe/SlotAllocator.cpp:22-38`) aborts
|
||||
`Fatal{RoleViolation,"MGPipeSlots"}` on the first `integration-split` draw.
|
||||
4. **`GetProgramForDraw` is never pulled.** `integration-split-strict`
|
||||
(`MOBILEGL_IPC_STRICT_ERRORS=1`, `ConfigLoader.cpp:382`) with the row still
|
||||
BARRIER_PULLED: `StrictBarrierPullFatal` (`MG_Backend/MGPipe/PipeInputs.cpp:60-66`) names
|
||||
`GetProgramForDraw@draw_vbo`. Green after the re-key = P5e-1 for this family.
|
||||
5. **Relink / identity under run-ahead:** `RelinkStageSetScenario`, `PostLinkAttachScenario`,
|
||||
`ProgramPipelineScenario`, `AsyncCompileScenario` with the client a present ahead;
|
||||
`CsoContentAddressingScenario` + `HandleRecycleScenario` for the {slot,gen} ABA.
|
||||
6. **`MapUBO` refusal:** force bit 12 off under run-ahead and assert G-C's
|
||||
`Fatal{UnmigratedVerb,"set_global_constants"}` rather than a torn upload.
|
||||
|
||||
## 7. Risks and what I could not settle
|
||||
|
||||
1. **Archive cost per link.** MC + shader packs link hundreds of programs, some mid-frame.
|
||||
`EncodeProgramArtifacts` over a full `LinkArtifacts`
|
||||
(`MG_State/GLState/ProgramState/ProgramArtifacts.h:160-342`: several `String` maps, a
|
||||
`std::set<String>`, seven index vectors) runs only in the verify build today. Needs a
|
||||
measurement before the package is sized. The cheap alternative - the client publishes an
|
||||
immutable `SharedPtr<const LinkArtifacts>` per link and the record pins it - keeps inproc
|
||||
fast but makes inproc a different code path from a real split, which is against P5e's
|
||||
point. **Integrator ruling.**
|
||||
2. **A FAILED relink of a bound program** keeps the previous executable running, and the
|
||||
emitter's re-issue rule (`ProgramEmit.h:220-226`, keyed on `GetLinkVersion`) fires anyway
|
||||
because `BumpLinkObservableVersions` runs in `Link()`'s prologue
|
||||
(`ProgramObject.cpp:348-356`). Whether the applier keeps the PREVIOUS record live or holds
|
||||
a dead-but-bound one is unsettled. It must NOT be modelled as an `object_death` - that
|
||||
would collide with S7's "the twin dies at object_death".
|
||||
3. **Composite programs.** `GetProgramForDraw` flattens a bound pipeline into a client-built
|
||||
composite (`MG_State/GLState/Core.cpp:609-628`, `MG_Impl/Pipe/CompositeResolver.h`); the
|
||||
flattening stays on the GL thread at emit and the band handle is fine. What is unsettled
|
||||
is the uniform mirror (`Core.cpp:590-606`): it rewrites the composite's block bindings
|
||||
every draw, so `set_program_bindings` may fire per draw for a pipeline workload unless the
|
||||
equality bail-out at `ProgramObject.h:1018-1022` absorbs it. Unmeasured.
|
||||
4. **Sampler-unit tail size.** `uniformSamplerOrImageUnitIndex` is indexed by LOCATION and
|
||||
`maxUniformLocation` can be in the thousands. The sparse encoding assumes few sampler
|
||||
locations - true for every program `CacheResourceLocations` walks
|
||||
(`Managers.cpp:13040-13077`, which skips image uniforms outright) - but a large sampler
|
||||
array is the counter-example. Needs a declared bound and a counted refusal.
|
||||
5. **Boundary with S5.** `:5463` (`GetUniformBlockBinding`) is mine, `:5464` onward (the
|
||||
binding point) is S5's, and neither lands alone: `set_shader_buffers` and
|
||||
`set_program_bindings` belong to ONE package or the UBO loop keeps a live read either way.
|
||||
Same split at `:5504-5506` (the gate is program state, the body is binding points).
|
||||
6. **Codec completeness.** `GetUniformType` / `GetMaxUniformLocation` on the alias path
|
||||
(`:4849-4852`) are covered by G-A only if the archive's `uniformIndexInTProgram` and type
|
||||
tables survive the codec. `ProgramArtifactsCodec.cpp:242` already carries a libc++-branch
|
||||
caveat about a member the codec skips; that member must be named before the design may
|
||||
claim "every reflection question is answered from the archive". Unverified at this head.
|
||||
@@ -0,0 +1,250 @@
|
||||
# S5 — buffer binding points and the remaining rows (P5e scouting report)
|
||||
|
||||
Head `2fde7034`. Paths under `MobileGL/` unless they start with `docs/`. `DirectGLES.cpp` =
|
||||
`MG_Backend/DirectGLES/DirectGLES.cpp`, `Managers.cpp` = `MG_Backend/DirectGLES/Managers.cpp`.
|
||||
Kinds: **live** = frontend deref; **id** = lifetime id + client allocator probe; **rec** = record.
|
||||
|
||||
## 1. The family's live reads at this head
|
||||
|
||||
`GetBufferBindingPoint` is one row (`FieldOwnership.def:80-81`, BARRIER_PULLED, "P3b/P4b, P7")
|
||||
whose storage is four raw bases into `Array<Array<BindingSlotRange1D,84>,4>`
|
||||
(`PipeInputs.h:809`, filled `PipeFill.cpp:126-131`, `BufferState.h:29`, `:84-86`).
|
||||
|
||||
| site | reads | kind | when |
|
||||
|---|---|---|---|
|
||||
| `SyncBufferBindingPoints` `DirectGLES.cpp:491-531`, called `:979` (draw) / `:988-989` (compute) | count `GetTouchedBufferBindingPointCount` `:493`; `GetBufferBindingPoint(target,i)` `:510`; `point.GetBoundObject()` `:511`; `EnsureBufferResource(obj)` `:517`; `point.GetRange()` `:523` → `obj->GetSize()` (`Types.h:220-229`); `obj->GetSize()` `:524,:527-528` | rec (count, P5c rv); live + id (body) | count on EVERY draw; body 0 iterations on Minecraft (touched SSBO count 0) |
|
||||
| `MarkShaderStorageBuffersGpuWritten` `:600-615`, called `:980`, `:990` | count `:601`; point + `GetBoundObject()` `:604-605`; `MarkBufferGpuWritten(obj)` `:606` → `HandleOfBuffer` (`Managers.cpp:2922-2941`, scope `:2933`) | rec; live + id | every draw AND every dispatch |
|
||||
| UBO loop in `BindCurrentProgramWithResources` `:5447-5497` | `currentProgram->GetUniformBlockBinding(i)` `:5463`; `GetBufferBindingPoint(Uniform,binding)` `:5464`; `GetBoundObject()` `:5465`; `GetRange()` `:5466`; `GetBufferResource(bufferObj.get())` `:5472`; `IsBufferDrawClean(bufferObj.get(),…)` `:5475` → `HandleOfBuffer` (`Managers.cpp:3155-3159`); `EnsureBufferResource` `:5478` | live + id | **1–3 per draw on Minecraft, memo hit or miss** — `drawCleanEpoch` (`:5457,:5473-5479`) short-circuits the STORAGE work only, never the point read or the bind |
|
||||
| `SyncAtomicCounterBuffers` `:617-673`, called `:5504-5506` | `GetBufferBindingPointCount(AtomicCounter)` `:621` (**sticky forward**, `PipeFill.cpp:1870-1874`); point `:628`; `GetBoundObject()` `:630`; `EnsureBufferResource` `:636`; `GetRange`/`GetSize` `:642-650`; `MarkBufferGpuWritten` `:658` | live + id | only for programs with counter blocks |
|
||||
| `SyncTransformFeedbackBindingPoints` `:562-592`, called `:1420` | point `:569`; `GetBoundObject()` `:570`; `EnsureBufferResource` `:574`; `GetRange`/`GetSize` `:583-589` | live + id | only on a pending span |
|
||||
| `StartPendingTransformFeedback` `:1381-1510`, called `:4829` | returns at `:1386` with no pending span; else `GetTransformFeedbackProgram()` `:1387` (`FieldOwnership.def:106`), `program->GetTransformFeedbackBufferCount()` `:1406`, point walk `:1407-1417`, and `xfb.targets.push_back({bufferObject,…})` `:1417` **holds the frontend `SharedPtr` past the verb** | live | tail of EVERY draw (one bool test in steady state) |
|
||||
| `ReadbackCapturedRanges` `:1118-1160` (from `EndTransformFeedback` `:1527`) | under a transport still `HandleOfBuffer(target.buffer.get())` `:1138` | live + id | per span close |
|
||||
| `GetBufferBindingSlot` `PipeInputs.h:808`, filled `PipeFill.cpp:116-124`, in kDraw's mask (`FillPoints.def:162`) | 15 pointers copied at every kDraw fill; **no inproc draw-path reader** — `:948-957` is the record arm (`MGPipeApplier().VerbIndirectBuffer`), `:961-966` the monolith `else` | cost only | every draw |
|
||||
| `RecordError` | already a `kEventGlError` post under a transport (`PipeFill.cpp:1915-1931`); no frontend write from the apply thread | rec | — |
|
||||
| `HasOpenTransformFeedbackSpan`, `GetProgramObject`, `ValidateProgramName`, `GetTextureObject` | sticky forwards, off the steady draw path (`FieldOwnership.def:147-165`) | — | — |
|
||||
|
||||
Every `id` above runs inside `MGPipeReverseAnnouncementScope` — CONTRACT-P5C §3.1's **first
|
||||
named exemption**, granted verbatim because "`set_shader_buffers` and
|
||||
`set_stream_output_targets` sit in the catalogue but are P4b's to emit"
|
||||
(`CONTRACT-P5C.md:157-176`, guard `MG_Impl/Pipe/SlotAllocator.cpp:22-38`). This family IS that
|
||||
exemption; retiring it retires the scope.
|
||||
|
||||
## 2. What the records and the applier already carry
|
||||
|
||||
- **The counts, and only the counts.** `MGPContextValues::TouchedBufferBindingPointCount[15]`
|
||||
(`MGPipeTypes.h:1692-1705`), emitted by `EmitContextValues` (`PipeFill.cpp:2679-2704`),
|
||||
RECORD_SUPPLIED since P5c rv. `:493`, `:601` and the client's own sweep
|
||||
(`GpuWritePending.cpp:61`, `:77`) all read it.
|
||||
- **`set_shader_buffers` is catalogued and dead.** `PipeCalls.def:174`, `MGPShaderBuffers`
|
||||
(`MGPipeTypes.h:910-919`), `MGPBufferRange` (`:901-906`), wire op 38
|
||||
(`generated/PipeWire.inc:110,:211,:310,:698-704`), thunk (`PipeThunks.inc:168`), table slot
|
||||
(`PipeTables.inc:62`), codec layout + bounds + host-span honesty pass
|
||||
(`PipeWireCodec.cpp:204`, `:648-661`, `:1778-1801`) — and then `return false`: **no route row
|
||||
(`PipeRoute.h`/`.cpp` have none), no `Mono_`/`Wire_` binding, no
|
||||
`MGPipeApplySetShaderBuffers`, no applier state, no emitter.** `PipeCatalogueTest.cpp:170-171`
|
||||
and `:242-243` pin both slots null. `set_stream_output_targets` is identical
|
||||
(`PipeCalls.def:175`, `MGPipeTypes.h:922-928`, `PipeWireCodec.cpp:1805`).
|
||||
- **The dirty bits exist and own nothing.** `MGPipeDirty::NewConstBuffers/NewShaderBuffers/
|
||||
NewSoTargets` (`Tracker.h:97-99`), `MGPipeSubsystemForDirty` answers 0 for all three
|
||||
(`Tracker.h:204-209`), pinned by `TrackerTest.cpp:385-387`. `SetHashSuppressor.h:65-66` marks
|
||||
both slots "P4b".
|
||||
- **The buffer twin is already handle-capable.** `IsBufferDrawCleanByHandle`
|
||||
(`Managers.cpp:3109-3153`) reads the frontend only under monolith (`:3143-3145`);
|
||||
`EnsureBufferResourceForHandle(nullptr, h)` (`Managers.cpp:3193-3222`) needs no object and is
|
||||
already called that way at `DirectGLES.cpp:953`.
|
||||
- **The GPU-write set already moved sides.** `MarkShaderStorageBindings`
|
||||
(`GpuWritePending.cpp:55-66`), `MarkAtomicCounterBindings` (`:68-81`),
|
||||
`MarkTransformFeedbackTargets` (`:37-53`), driven from `MarkGpuWritesForDraw` (`:145-151`) in
|
||||
`BeforeDrawVerb`. `GpuWritePending.h:9-55` is the ruling. The backend's `:606`, `:658`,
|
||||
`:2775` are a **duplicate** under a transport.
|
||||
|
||||
## 3. The gap
|
||||
|
||||
**3.1 The shutter is not merely unowned, it is wrong.** Bits 15/16/17 read
|
||||
`ctx.GetAnyBufferChangeGeneration()` (`Tracker.h:525`, `:636-639`) — the buffer CONTENT
|
||||
aggregate (`BufferState.h:69-72`). `glBindBufferBase/Range` mutate the point through a returned
|
||||
reference (`GL_Buffer.cpp:1501-1520`, `:1624-1650`: `point.Bind()`, `point.SetRange()`), which
|
||||
moves `BindingSlot::m_version` (`Types.h:189-194`) and nothing the tracker reads. So
|
||||
`glBindBufferBase(UNIFORM,1,A); draw; glBindBufferBase(UNIFORM,1,B); draw` fires no bit — the
|
||||
same defect class as P4a's `glBindSampler` hole (`Tracker.h:612-621`).
|
||||
**And the mutation is invisible to the dirty-surface gate**: `MUTATOR_PREFIXES`
|
||||
(`scripts/gen_pipe_dirty_surface.py:87-90`) has no `Touch`, and the point write is not a
|
||||
`pGLContext->` call at all, so `BindBufferBase_State`/`BindBufferRange_State` have no row in
|
||||
`DirtySurface.def` (83 rows; the nearest is `SetNamedTransformFeedbackBinding` →
|
||||
`kPulledEveryVerb`, `:295`).
|
||||
|
||||
**3.2 New frontend state (push-build only).** `BufferState::NoteBindPointChanged(target)` beside
|
||||
`NoteBufferChanged` (`BufferState.h:69-75`), one `Uint64` per `BufferBindPointTargets` entry,
|
||||
bumped by the two entry points above and by `SetNamedTransformFeedbackBinding`. `#if
|
||||
MOBILEGL_PIPE_PUSH` so the pull build's object does not resize (G1) — the licence
|
||||
`TextureState::NoteImageUnitTouched` took at P5d r3 (`GpuWritePending.cpp:96-108`).
|
||||
|
||||
**3.3 Shutters.** bit 15 `Mix(bindPointGen[Uniform], programIdentity)` (the emitted window is
|
||||
resolved FOR THE PROGRAM IN USE, 3.4/7.2 — `UseProgram`'s row `DirtySurface.def:311` already
|
||||
carries this pattern); bit 16 `Mix(bindPointGen[ShaderStorage], bindPointGen[AtomicCounter])`;
|
||||
bit 17 `Mix(bindPointGen[TransformFeedback], ctx.GetTransformFeedbackGeneration())`. The content
|
||||
aggregate LEAVES all three — it is the resource family's business, and mixing it in fires on any
|
||||
`glBufferSubData` anywhere. That is exactly the narrowing bit 10 already took
|
||||
(`Tracker.h:545-553`).
|
||||
|
||||
**3.4 The record.** One `MGPShaderBuffers` + `MGPBufferRange[Count]` per **Class**
|
||||
(`Uniform=0 | ShaderStorage=1 | AtomicCounter=2`, `MGPipeTypes.h:911`). `Start = 0`;
|
||||
`Count` = the class's window (7.2) clamped to a new `kMGPipeMaxBufferBindingPoints`, pinned
|
||||
against `BufferState.h:29`'s 84 in `PipeFill.cpp` where both are visible — the shape
|
||||
`kMGPipeMaxVertexAttribs` is pinned with at `PipeFill.cpp:2093-2095`.
|
||||
Entry: `Res = MGPipeSlots().Acquire(MGPipeKind::Buffer, obj->GetLifetimeId())` or null;
|
||||
`Offset/Size` from `point.GetRange()` resolved CLIENT-side, with `Size = kMGPipeWholeBuffer`
|
||||
(`MGPipeTypes.h:406`) for a base binding so the SERVER re-resolves against its own descriptor
|
||||
(7.3). `WritableMask` (`MGPipeTypes.h:914`) set per entry for ShaderStorage/AtomicCounter — it
|
||||
is what replaces the backend mark's membership question.
|
||||
`HostSpanCount = 0` **always** for Espryt: `kCapNeedsHostUboBytes` is 0 for the whole of P5 by
|
||||
ruling (`CONTRACT-P5.md:64`, `MG_Backend/Init.cpp:150`, `PipeWireCodec.cpp:1786`) and the bit is
|
||||
Magma's named-UBO ring (`docs/Disaggregated/ARCHITECTURE.md:113`, `:121`, `:140`). The codec's
|
||||
honesty pass (`PipeWireCodec.cpp:1783-1799`) stays the guard that says so if it ever is not.
|
||||
**XFB is NOT this record**: `set_stream_output_targets` carries a `Generation`
|
||||
(`MGPipeTypes.h:922-928`) this payload has no field for, and capture points are span-scoped
|
||||
state latched at Begin. Keep the catalogue's split.
|
||||
|
||||
**3.5 Hash + suppressor.** `XXH64` over the tail with `Class/Start/Count` mixed —
|
||||
`MGPipeShaderImageSetContentHash`'s shape (`ImageEmit.h:53-58`). `SetHashSuppressor.h:65` has
|
||||
**one** slot for the call while the record is per class; three classes sharing it would make
|
||||
each emission cancel the others'. Split into three slots (see 7.1).
|
||||
|
||||
**3.6 Subsystem bit.** Bit 13 is free (`MGPipe.h:105-109`: "bits 13..62 reserved"). Add
|
||||
`kMGPipeSubsystemBufferBindings = 1ull << 13`; the three dirty bits leave
|
||||
`MGPipeSubsystemForDirty`'s `default: return 0` arm (`Tracker.h:204-209`);
|
||||
`SubsystemForEmitter` (`PipeFill.cpp:1989-2028`) gains a `SetShaderBuffers` row with the pairing
|
||||
`static_assert`s beside P4a's (`PipeFill.cpp:2104-2126`). `TrackerTest.cpp:385-387` is rewritten,
|
||||
not deleted.
|
||||
|
||||
**3.7 Coverage / ownership.** `Coverage.def`'s EMITTED list gains
|
||||
`GetBufferBindingPoint → SetShaderBuffers`; SHAPE-ONLY like P4a's six (`Coverage.def:199-213`),
|
||||
landing in `EmittedCallSuppliesTheWholeField`'s FALSE arm — the field is a pointer no applier can
|
||||
produce. `FieldOwnership.def:80-81` stays BARRIER_PULLED until the four Espryt consumers are
|
||||
gone, then becomes RECORD_SUPPLIED. `GetBufferBindingPointCount` (`:147-148`, `:179-180`) is
|
||||
answered from the applier's `Count[Class]` and its forward becomes FATAL under split — the
|
||||
`InvalidateCompileEnv` shape (`FieldOwnership.def:163-165`).
|
||||
|
||||
## 4. The retirement design (server shape)
|
||||
|
||||
**4.1 Applier state**, beside the three unit sets (`PipeApply.h:673-686`):
|
||||
`Array<MGPBufferRange, kMGPipeMaxBufferBindingPoints> BoundShaderBuffers[3]`, `Uint32 Start[3]`,
|
||||
`Count[3]`, `WritableMask[3]`, and ONE `Uint64 ShaderBuffersSerial` advanced on every applied
|
||||
record and **never zeroed by `MGPipeApplierReset`** — `VertexBuffersSerial`'s rule, stated at
|
||||
`PipeApply.h:609-616`. Entry point `MGPipeApplySetShaderBuffers(hdr, ranges)` validating
|
||||
`Class < 3` and `Start + Count <= capacity`; the codec's bounds gate already runs
|
||||
(`PipeWireCodec.cpp:648-661`).
|
||||
|
||||
**4.2 `SyncBufferBindingPoints` → `SyncBufferBindingPointsByRecord(Class, glTarget)`.** Count
|
||||
from `st.Count[Class]`; per entry `EnsureBufferResourceForHandle(nullptr, entry.Res)`; the
|
||||
whole-vs-range test becomes `entry.Offset == 0 && entry.Size == kMGPipeWholeBuffer`, so
|
||||
`obj->GetSize()` disappears from the file. The clean probe is
|
||||
`IsBufferDrawCleanByHandle(entry.Res, resource, nullptr)`, which
|
||||
`Managers.cpp:3109-3153` already accepts with a null frontend. **No twin key is introduced**: a
|
||||
binding point is not an object, it names one by handle. "Is it clean" is answered from
|
||||
`resource->syncedChangeSerial` vs `ResourceRecordOf(res)->Serial` (`Managers.cpp:3151`) — both
|
||||
server-owned — plus `ShaderBuffersSerial` for the SET.
|
||||
|
||||
**4.3 The GPU-write marks are deleted under a live wire.** `:606`, `:658` and `:2775`
|
||||
(`MarkWritableImageBufferTexturesGpuWritten` `:2763-2781`). The client already owns the set
|
||||
(2., `GpuWritePending.h:9-55`), and under run-ahead the server's walk is over client memory, so
|
||||
keeping it is the one thing that cannot work. `WritableMask` survives as the server's record of
|
||||
which points P9's narrowing channel will name.
|
||||
|
||||
**4.4 The UBO loop** `:5463-5480`: `GetUniformBlockBinding(i)` is **S4's** (the reflection
|
||||
archive). Given the binding index, `point` becomes `st.BoundShaderBuffers[Uniform][binding]` in
|
||||
the SAME index space — `Start` is 0 and a binding at or above `Count` means "nothing bound",
|
||||
which is what the frontend array's default says too. `GetBufferResource(bufferObj.get())` `:5472`
|
||||
becomes `FindBufferResourceForHandle(entry.Res)`.
|
||||
|
||||
**4.5 `SyncAtomicCounterBuffers`**: `pointCount` from `st.Count[AtomicCounter]`; the `glBindings`
|
||||
list stays the backend program's (server-owned since link).
|
||||
|
||||
**4.6 XFB stays LOCKSTEP.** `StartPendingTransformFeedback` `:1381`,
|
||||
`SyncTransformFeedbackBindingPoints` `:562`, the `targets` vector `:1417` and
|
||||
`ReadbackCapturedRanges`' `HandleOfBuffer` `:1138` are not migrated by this package, because
|
||||
(i) `GetTransformFeedbackProgram` is an object row no scout migrates, (ii) `xfb.targets` HOLDS
|
||||
frontend `SharedPtr`s across two verbs, which rule C forbids an applier entry point outright,
|
||||
and (iii) `ROADMAP.md:32` puts "XFB scatter 搬到 client" in P3b/P4b. Cost on the Espryt steady
|
||||
path is zero: `:1386` returns on every draw. **The wait rule S6 needs from me:** a draw waits
|
||||
`appliedSeq == seq` iff `ctx.IsTransformFeedbackActive()` — the flag already crosses in
|
||||
`MGPContextValues` (`MGPipeTypes.h:1698`) and is client state, so the client can decide without
|
||||
asking. Same for a dispatch whose program declares atomic counters, until 4.5 lands.
|
||||
|
||||
**4.7 `GetBufferBindingSlot`**: drop the 15-pointer copy from the kDraw residual fill under a
|
||||
live wire (`PipeFill.cpp:116-124`, a class-and-transport test in the walk at `:3252-3269`). No
|
||||
inproc draw-path reader exists; kReadback/kBlitOrCopy/kTextureOp keep it. **Not** a
|
||||
`Coverage.def` row — that would claim the whole 15-target field is supplied, the half-truth
|
||||
`Coverage.def:62-70` already refuses.
|
||||
|
||||
## 5. Monolith / G1
|
||||
|
||||
- Everything new is `#if MOBILEGL_PIPE_PUSH` and gated on
|
||||
`(PipePush & kMGPipeSubsystemBufferBindings)`, so the **pull build is byte-identical** and the
|
||||
new `BufferState` counter does not resize the pull build's object.
|
||||
- Under `Transport=monolith` the record still crosses and the applier still stores it; the
|
||||
BACKEND keeps the frontend walk behind `MG_Config::Transport != Monolith`, the exact
|
||||
`if (…) else` shape `DirectGLES.cpp:948-966` already uses for the indirect buffer. The push
|
||||
build under monolith therefore renders through the same code as today.
|
||||
- The residual-fill skip for `GetBufferBindingPoint` is gated on a live wire, so under monolith
|
||||
the pointer rows are still copied and `MOBILEGL_PIPE_VERIFY`'s comparator
|
||||
(`PipeFill.cpp:470-510`) still compares them.
|
||||
- G2/G14: no new backend entry point and no new exported symbol —
|
||||
`SyncBufferBindingPointsByRecord` is a file-local function inside `BufferImpl`.
|
||||
|
||||
## 6. Red-once
|
||||
|
||||
- **R-S5-a (record).** Revert the handle arm to the frontend walk under a live wire:
|
||||
`SsboArrayDynamicIndexScenario` / `StorageBufferRegrowScenario` / `AtomicCounterScenario` under
|
||||
`integration-split-strict` must abort with
|
||||
`Fatal{UnmigratedPipeInput, "GetBufferBindingPoint@DrawVbo"}` — the server stamp withdraws the
|
||||
row (`MG_Backend/MGPipe/PipeInputs.cpp:155-175`), message shape
|
||||
`PoisonOmissionScenario.cpp:85-88`.
|
||||
- **R-S5-b (shutter).** `TrackerTest`: `glBindBufferBase(UNIFORM,1,A); Update();
|
||||
glBindBufferBase(UNIFORM,1,B); Update();` must set bit 15 on the second `Update`. Against
|
||||
`Tracker.h:636` today it does not — that is the red.
|
||||
- **R-S5-c (the sticky forward).** `rsp` for `GetBufferBindingPointCount` must be non-zero on
|
||||
`AtomicCounterScenario` before and **0** after, with the forward aborting.
|
||||
- **R-S5-d (no double marking).** Delete the backend marks (4.3) and
|
||||
`ProducerMarkCount(GpuWriteProducer::ShaderStorageBinding)` (`GpuWritePending.h`) must stay
|
||||
non-zero while `SsboArrayLengthScenario`'s readback still sees the shader's writes.
|
||||
- **R-S5-e (catalogue).** `PipeCatalogueTest.cpp:170-171`, `:242-243` invert; the inversion is
|
||||
itself the proof the route landed.
|
||||
- Quick gate: unit + `integration-split` + `integration-split-strict` on the four SSBO/atomic
|
||||
scenarios and the three XFB ones; an A/B with bit 13 cleared must reproduce today's picture.
|
||||
|
||||
## 7. Risks and what I could not settle
|
||||
|
||||
1. **One suppressor slot, three classes** (`SetHashSuppressor.h:65`). Needs a ruling: three
|
||||
slots (my recommendation — the per-family A/B and fire tallies stay meaningful) or a
|
||||
`(slot, Class)` key.
|
||||
2. **The emitted window.** Minecraft reaches UBOs through the PROGRAM's block bindings `:5463`,
|
||||
not through the touched high-water mark. A high-water window makes `Count` 84 for a program
|
||||
that binds block 0 at GL point 83 — 2 KB per emission (suppressed while nothing moves, but
|
||||
paid on the first emission after any bind). A program-derived sticky window
|
||||
(`ImageEmit.h:88-97`'s shape) is cheaper and is why bit 15 mixes program identity in.
|
||||
**Unsettled:** whether a narrow window covers `SyncComputeBuffers`' frontend-indexed Uniform
|
||||
pass (`:988`), which exists precisely because compute does NOT go through the per-program
|
||||
remap (`:967-978`).
|
||||
3. **`GetRange()` resolution moves to the client** (`Types.h:220-229`). A base binding resolved
|
||||
at emit freezes the size; GL resolves at use. Hence `Size = kMGPipeWholeBuffer` and a
|
||||
server-side re-resolve. That token needs a table-0 row in CONTRACT-P5E; without it a
|
||||
`glBufferData` between emission and apply silently binds the old extent under run-ahead.
|
||||
4. **The dirty-surface gate will go red** the moment `Touch` joins `MUTATOR_PREFIXES`
|
||||
(`gen_pipe_dirty_surface.py:87-90`): every `Touch*` mutator in `MG_Impl/GLImpl` and
|
||||
`MG_State/GLState` then needs a row. I did not enumerate them.
|
||||
5. **Reset discipline.** `MGPipeApplierReset` clears the three windows but ADVANCES
|
||||
`ShaderBuffersSerial`; the emitter's latch must reset with it, in `PipeFill.cpp:3129-3143`'s
|
||||
list, or the first emission after a make-current is suppressed as unchanged.
|
||||
6. **Capacity on the wire.** 84 (the frontend's, `BufferState.h:29`) or the ES-clamped
|
||||
`MaxUniformBufferBindings` (`DirectGLES.cpp:500-504` clamps at the backend)? Keeping 84 on the
|
||||
wire and clamping at the backend preserves today's behaviour exactly; a client-side clamp
|
||||
would read a device capability from the wrong side.
|
||||
7. **`MarkWritableImageBufferTexturesGpuWritten`** `:2763-2781` straddles S3 and S5: its unit
|
||||
walk is an image row, its `textureBuffer->GetBufferBindingSlot().GetBoundObject()` `:2775` is
|
||||
a buffer row. The client twin already covers it (`GpuWritePending.cpp:83-115`), so the server
|
||||
site is simply deleted under a live wire — but that deletion must be ONE edit with S3's.
|
||||
8. **Conflict to flag for S8:** S6 will want "everything but reply rows is fire-and-forget".
|
||||
4.6 says XFB spans and (until 4.5 lands) counter-carrying dispatches are exceptions, decided
|
||||
from `MGPContextValues`' `IsTransformFeedbackActive` on the CLIENT. If S6's design instead
|
||||
asks the caps snapshot or the server, the two disagree.
|
||||
@@ -0,0 +1,107 @@
|
||||
# S6 - transport mechanics of run-ahead (head `2fde7034`, paths under `MobileGL/`)
|
||||
|
||||
## 1. The exact sync points of the transport family today (live = a wait or a cross-role write that exists only because of the lockstep; rec = already safe)
|
||||
|
||||
| site | what it does | kind |
|
||||
|---|---|---|
|
||||
| `MG_Remote/Client/ClientSession.cpp:840-846` | `Fatal{BarrierViolation}` if the apply thread is inside the applier at emit - **only when `BatchWaits==0`**; dead in the default config | live (guard) |
|
||||
| `:848-872` | `EncodeRecord`; on `kInvalidSeq` `WaitForCmdSpace(needed, 30 s)` -> `Fatal{RetirementWaitFailed,"SEG_CMD"}` | rec (the only byte backpressure) |
|
||||
| `:877` `PublishAndNotify(seq)` | publish -> submittedSeq -> ring (Ring.cpp:437-462) | rec |
|
||||
| `:883-884` | `ownsReplySlot` from `kMGPipeCallFlags` (14 rows) | rec |
|
||||
| `:915-922` | the batch skip: `kCtxState`/`kCtxCso`/`kCtxObject` without a reply, and not `GenerateMipmap`, return without waiting | rec |
|
||||
| `:924-930` | `VerbBarrier==0` negative control: nothing but reply rows waits | live (control) |
|
||||
| `:932-959` | `WaitForAppliedBudget(seq)` - every `kCtxVerb` (18 rows, PipeCalls.def:200-236), every `kScreen` (12) and `kCtxQuery` (8) row, every reply row, `GenerateMipmap` | **live: R-1** |
|
||||
| `:966` `DrainEventRing(m_events)` | the ONLY steady-state drain of SEG_EVENT, inside the wait ("the one instant the apply thread is known not to be inside the applier", :961-965) | live |
|
||||
| `:968-998` | the reply read; `Fatal{ReplyMissing}` if the slot does not stamp seq | rec |
|
||||
| `:1015-1056` `RefusePipeInputsTouchWhileApplierOwnsIt` | returns at `:1037` whenever `BatchWaits!=0`: the layer-2 gPipeInputs guard is disarmed by default | live (guard, dead) |
|
||||
| `MG_Impl/Pipe/PipeFill.cpp:2962-3306` `MGPipeValidateForVerb` | client WRITES into `gPipeInputs`: `:2989` `++CurrentVerbSerial`, `:2997` `MGPipeServerClearVerbBoundary()` (withdraws the SERVER's stamp from the GL thread), `:2999-3001` `SetVerb/SetIdentity`, `:3252-3270` step 4 `CopyField` + `FilledGen[i]` stamps; `:3304` verify `EntryCompare` | live: the block is shared |
|
||||
| `PipeFill.cpp:84-86` `VertexAttribDefaultsOf` | client READ of `gPipeInputs.m_currentVertexAttribute` (what the applier left) to diff `EmitVertexAttribDefaults` | live: client reads server memory |
|
||||
| `PipeFill.cpp:546-556` `MGPipeNoteFrontendMutation`, `:1955+` `MGPipeLeaveVerb` | further client writes into the block | live |
|
||||
| `PipeFill.cpp:815-839` -> `MG_Pipe/PipeRoute.h:270-276` -> `Client/WireTables.cpp:332-352` | `resource_subdata` carries `kReplySlot` (PipeCalls.def:188): every record `EmitAndWait`s; the Bool is **discarded** at `PipeFill.cpp:839`. This is the persistent-map push path (`PersistentMapTracker.cpp:735,:850` `PushMappedSpanBlock` -> `BufferObject.cpp:142`) - one lockstep round trip per 64 KB block, answer never read | **live, hidden** |
|
||||
| `Client/EmitTables.cpp:222-234` `BeforeDrawVerb/BeforeReadOnlyVerb` | pmap push, deferred-destroy drain, GPU-write marks, before the verb record | rec |
|
||||
| `EmitTables.cpp:977-1053` `EmitPresent` | `FrameSerial = 0` (:1040, "the server stamps its own"), `EmitAndWait(Present)` waits as a `kCtxVerb`; `PumpControlPlane` :1049 | live: present is a full barrier |
|
||||
| `Server/PipeApplier.cpp:269-293` `OnPresent` | `table->Present()`; `m_lastPresentSerial`; **never** calls `ServerSession::ReturnPresentCredit` (ServerSession.cpp:677-682 has zero production callers; `WaitForPresentAck` Ring.cpp:495-502 is exercised only by SessionTest.cpp:522-549) | gap |
|
||||
| `PipeApplier.cpp:1043-1082` `ApplyOne` | `ScopedApplierEntry` :1057, `StampVerbBoundary` :1061 -> `MG_Backend/MGPipe/PipeInputs.cpp:155-184` (writes `m_filled`, `m_currentVerb`, `m_serverStampedVerb`), `LeaveApplier` :1080 -> `:186` | rec on the server side; races the client rows above |
|
||||
| `PipeInputs.cpp:191-224` `MGPipeInputUnfreshRead` | BARRIER_PULLED read in class -> `CountBarrierPull` :71-77: `rsp++`, `Fatal{UnmigratedPipeInput,...}[BARRIER-PULLED, STRICT]` only under `StrictErrors`; otherwise the read is SERVED from the client's last fill | live: the non-strict arm serves a torn value under run-ahead |
|
||||
| `Transport/SessionRings.h:410-451`, `Server/ServerLoop.cpp:559-631` | `appliedSeq` +1 per record; `RetireThrough` once per drain batch (:624); the park predicate :380-383 | rec |
|
||||
| `MG_State/.../BufferObject.cpp:571-651` `SyncGpuWrites` -> `Client/GpuWritePending.cpp:202-228` `AwaitBufferWriteback` | readback = reply row -> waits -> the drain at `:966` lands the writeback; `Fatal{UnimplementedWritebackWait}` if still pending | rec (stays a wait) |
|
||||
| `Client/BackendObject_Remote.cpp:200,208,216,245` | the four RPC-side `DrainPublishedEvents` (surface create/resize/pbuffer, make-current) | rec |
|
||||
| `ClientSession.cpp:691-786` `Stop` | `LastPublishedSeq` :739, `WaitForApplied(submitted, 5 s)` :742, `Shutdown` :755, `ServerLoop::Stop` :760, free after the join | rec |
|
||||
| `MG_Pipe/PipeMutation.h:216-236`, `PipeFill.cpp:984+` | deferred destroys: an apply-thread last-owner death is queued, replayed at the next verb hook | rec (belt) |
|
||||
| `Server/ServerSession.cpp:174-181,:183-254,:634-666` | SEG_EVENT producers: lossless, `Fatal{EventRingOverflow}` on a full 256 KiB ring (SessionRings.h:96) - "a full ring under lockstep is a burst no workload has" | live: premise dies with the lockstep |
|
||||
| `MG_Impl/Pipe/SlotAllocator.cpp:22-38` | `MGPipeRefuseAllocatorFromApplyThread` exempts the two scopes at `:28-29` | live (the exemption) |
|
||||
| `ConfigLoader.cpp:377` | `PipeVerify -> BatchWaits = 0`: the verify build forces the per-record barrier (confirmed) | rec |
|
||||
|
||||
Sizes for §3(2): DrawVbo = 8 B header (Ring.h:164) + 56 (`MGPDrawInfo`, MGPipeTypes.h:1441) + 12 per range (:1448) -> 80 B padded; Present 16 B; `resource_subdata` 72 B + its SEG_STAGE run.
|
||||
|
||||
## 2. What the transport already carries for run-ahead
|
||||
|
||||
- Five watermarks on `RingControl` (Ring.h:138-139 `completedFrameSerial`, `presentAckSerial`); `SessionProducer::WaitForPresentAck` (Ring.cpp:495-502, bounded, `ShutDown` result), `SessionConsumer::ReturnPresentCredit` (Ring.cpp:607-613, advances AND rings), `ServerSession::ReturnPresentCredit` (:677-682), `MGPPresent::FrameSerial` (client sends 0), `m_lastPresentSerial` on the sink.
|
||||
- The class/flag tables at the emit site (`MGPipeCallClassFor`, `MGPipeCallFlagsFor`, `ClientSession.cpp:884,:917`) - the wait rule is already table-driven for one class.
|
||||
- `SEG_CMD` backpressure (`WaitForCmdSpace`), `SEG_STAGE` retirement on `retiredSeq` (Wire/PipeWireCodec.cpp:826-842, 5 s bell wait; `ReclaimStagedBytes` :1126-1163 is already written for "pipelining deeper than fully drained", :1138-1144).
|
||||
- `EventRingConsumer::RingIsFull()` / `Drained()` clear the `eventRingFull` latch (Transport/EventRing.h:185-212); the producer latches it at `:135-143`; ARCHITECTURE.md §11.7 (`:419`) already specifies the two-sided protocol (server stops applying at a record boundary, rings; client drains, clears, rings).
|
||||
- The server stamp's constexpr answerable mask (PipeInputs.cpp:104-141) and the strict detector (`:61-67`); `MGPipeServerClearVerbBoundary`; `ScopedApplierEntry` (ClientSession.h:155-160); `InBarrierWait`/`ApplyThreadIsInsideApplier` (:1010-1013).
|
||||
- `CapsMirror::HasCap` (Client/CapsMirror.h:71-72) over `MGPCaps::CallMask`; bits 0..9 used (MGPipeTypes.h:108-135); the server sets the mask by backend type (ARCHITECTURE §17.2).
|
||||
- `IpcTable` (Config.h:465-518) + `InitIpc` (ConfigLoader.cpp:356-403); `PRESENT_CREDIT` is already in the planned inventory (Config.h:462, ARCHITECTURE.md:469 "default 1", :619).
|
||||
- Deferred-destroy queue, `object_death` (kCtxObject - already batched), `applier_reset` (kScreen - waits), `DrainPublishedEvents`, the wait ledger (`Waits()/Parks()`).
|
||||
|
||||
## 3. The gap - knobs, fields, records, rules that do not exist
|
||||
|
||||
1. **`IpcTable::RunAhead`** = `MOBILEGL_IPC_RUN_AHEAD` (default 1; forced 0 by `PipeVerify` beside `:377`; meaningless when `VerbBarrier==0`). **`IpcTable::PresentCredit`** = `MOBILEGL_IPC_PRESENT_CREDIT` (default **1**, range 1..8 - see §4(2)).
|
||||
2. **`kCapRunAheadApply = 1ull << 10`** in `MGPCapBit`; set in the DirectGLES arm of the server's `CallMask`, never in the Magma arm. Client predicate `ClientSession::RunAheadArmed()` = `m_barrierArmed && Ipc.RunAhead && Caps().HasCap(kCapRunAheadApply)`, latched at the first CapsSnapshot adoption after `Start` (a later snapshot may only turn it OFF - a caps re-run cannot make a lockstep server run-ahead mid-frame).
|
||||
3. **A wait class per op**, generated beside `kMGPipeCallFlags` (`MGPipeWaitClassFor(op)`): `kWaitReply` (every `kReplySlot` row), `kWaitApplied` (`ApplierReset`, `FenceWaitServer`? - no: GPU-side, fire-and-forget; only `ApplierReset` and `GenerateMipmap` until S2 retires the `GetActiveTextureUnit` read at DirectGLES `GenerateMipmap`, ClientSession.cpp:900-914), `kWaitPresent` (`Present`), `kWaitNone` (everything else, including `ResourceDestroy`, `UnmapPersistent`, `FenceCreate/Destroy`, the five non-reply query rows, all `kCtxVerb` rows but `ReadPixels`/`Present`). Row-level override, not a per-op runtime guess.
|
||||
4. **`resource_subdata` without a reply for the buffer half.** The row keeps `kReplySlot` on the wire (the server posts; an unread slot is harmless: the client reads a slot only after `appliedSeq >= seq`, and a slot is rewritten only by a record 8 seqs later, ReplySlot.h:16,:105); `Wire_ResourceSubData` (WireTables.cpp:332-352) takes a `wantReply` from the route: `MGPipeRouteResourceSubData` passes `nullptr` for buffers (the Bool at PipeFill.cpp:839 is discarded today) and the texture drain's D-D5 acceptance is a ruling for S2/S8 (see §7). Without this the pmap push stays lockstep.
|
||||
5. **`MGPPresent::FrameSerial` minted by the client** (`++m_presentsSent`, 1-based); `OnPresent` calls `ServerSession::Active()->ReturnPresentCredit(present.FrameSerial)` after `table->Present()` returns (m-1's 1:1 holds: one credit per swap). Client: `WaitForPresentAck(m_presentsSent - PresentCredit)` BEFORE encoding present N when `m_presentsSent - PresentCredit >= 1`.
|
||||
6. **`gPipeInputs` client-side skip.** In `MGPipeValidateForVerb`, when `RunAheadArmed()`: skip `:2989`, `:2997`, `:2999-3001`, the whole of step 4 (`:3252-3270`), and `MGPipeLeaveVerb`'s writes; `MGPipeNoteFrontendMutation` returns at `:554`; step 2 (tracker walk) and step 3 (emitters) run unchanged. `VertexAttribDefaultsOf` (:84) must diff against the emitter's own last header (`g_attribDefaultLastHeader`, :2949) - a client mirror, never the block. **One-time release of the four O-class SharedPtr rows** (`PipeInputs.h:801-809` `m_boundVertexArray`, the three programs) at the switch, on the GL thread, or the last lockstep fill pins those objects for the process life and the apply thread can become their last owner. `SetIdentity` (:3001) moves to the server (`ApplyOne` sets it once from its own backend).
|
||||
7. **Server stamp under run-ahead.** `MGPipeServerStampVerbBoundary(verb, runAhead)`; `MGPipeInputUnfreshRead` under `runAhead` takes `StrictBarrierPullFatal` **regardless of `StrictErrors`** (the value in the row is torn or stale by construction, P5e-3); `CountBarrierPull` stays for lockstep. The sticky forwards (`MGPipeStickyForwardPull` :251-257) are the same: Fatal under a run-ahead verb.
|
||||
8. **Event-ring flow control** (ARCHITECTURE §11.7 made real): server `Reserve==nullptr` -> latch `eventRingFull` (exists), publish, `NotifyClient`, then park in `ServerLoop::ApplyThreadMain`'s loop with `eventRingFull==0` added to `ready` (:380-383) - NOT `Fatal{EventRingOverflow}` when `RunAheadArmed`; client: every `Park` exit in `ClientSession` (applied, present-ack, cmd-space, and the stage bell at PipeWireCodec.cpp:836, which is the same `SelfDoorbell`) re-checks `m_events.RingIsFull()` and drains before re-parking. Deadlock argument: the server blocks only on the event ring; the client blocks only on watermarks the server advances; the client's every wait drains; so at most one side is parked at any instant.
|
||||
9. **Deferred destroy under run-ahead**: keep the queue; `MGPipeDeferDestroyAndFreeIfOnApplyThread` under `RunAheadArmed` logs `MGLOG_E_ONCE` with the kind (after S1-S7 the server holds no frontend SharedPtr; an enqueue is a finding) - Fatal in strict.
|
||||
10. **`RefusePipeInputsTouchWhileApplierOwnsIt`** is re-derived: under run-ahead the rule is "the GL thread never touches the block", so the guard becomes unconditional on the surfaces named in (6) when `RunAheadArmed()` (the `BatchWaits` early return at `:1037` goes; the check no longer consults `ApplyThreadIsInsideApplier`). `Fatal{BarrierViolation}` (:840) stays for `BatchWaits==0 && !RunAhead`.
|
||||
|
||||
## 4. The retirement design
|
||||
|
||||
**(1) The wait rule.** `EmitAndWaitTails` after `PublishAndNotify`:
|
||||
```
|
||||
if (ownsReplySlot) -> WaitForAppliedBudget + DrainEventRing + ReadReply (unchanged)
|
||||
else if (RunAheadArmed()) switch (MGPipeWaitClassFor(op)) {
|
||||
kWaitNone: return seq;
|
||||
kWaitApplied: WaitForAppliedBudget + DrainEventRing; return seq; // applier_reset, generate_mipmap (until S2)
|
||||
kWaitPresent: (credit wait happens in EmitPresent BEFORE encode; here: return seq) }
|
||||
else -> today's :915-959 shape, byte for byte
|
||||
```
|
||||
`VerbBarrier==0` keeps its meaning (nothing but reply rows waits) and stays the R-1 negative control for the lockstep arm; under run-ahead its expected red is `applier_reset` ordering (`Fatal{ProtocolCorruption,"ApplierReset.ContextSerial"}` cannot fire - the ring orders it - so the control has to be re-pointed at the strict detector: §6). Magma: `kCapRunAheadApply` absent -> `RunAheadArmed()==false` -> today's path; the negative control for the switch is `MOBILEGL_IPC_RUN_AHEAD=1` on Magma, which must log "run-ahead requested, server does not publish kCapRunAheadApply" and run lockstep.
|
||||
|
||||
**(2) Present pacing.** `EmitPresent`: `BeforeReadOnlyVerb(); if (m_presentsSent >= credit) WaitForPresentAck(m_presentsSent + 1 - credit, 30 s) [ShutDown -> return; TimedOut -> Fatal{PresentCreditTimeout}]; DrainEventRing; encode/publish; PumpControlPlane`. With credit 1 the client publishes frame N+1's records while the server applies and swaps frame N and blocks at present N+1 until swap N returned - one full frame of overlap, the shape ARCHITECTURE §14 defaults to; credit 2 adds one frame of end-to-end latency for no CPU gain on a CPU-bound client. **Default 1.** Ring budget at ~850 draws + ~0.36 MB pmap/frame: SEG_CMD in flight per frame is ~68 KB of draws + the set/CSO records (bounded by the same frame) - well under 1 MiB, so 8 MiB holds 8+ frames; SEG_STAGE at 0.36 MB/frame + subdata/texture blobs holds 32 MiB / ~1 MB = ~30 frames; SEG_REPLY unchanged (reply rows still one deep). Backpressure is therefore the present credit, never the bytes; `WaitForCmdSpace`/the stage bell are the safety net and both must drain events on exit (§3(8)).
|
||||
|
||||
**(3) Drains and forced waits.** Drain points: every wait exit (reply rows, present credit, cmd-space, stage), the four RPC sites, and `Stop`. Client operations that force a wait: `MapBuffer(READ)` / `GetBufferSubData` / `CopyBufferSubData` source -> `SyncGpuWrites` (reply row, unchanged); `glFinish` -> emits `Flush`? No: `Flush`/`Finish` stay no-ops on the wire (ARCHITECTURE:415); `glFinish` under run-ahead = `WaitForApplied(LastPublishedSeq)` + drain, spelled in the client `Finish` slot (new, one line); `glClientWaitSync` / `GetSyncStatus` / `QueryAvailable` / `QueryResult` are reply rows (wait); `glGetError`: **the relaxation** - server-side GL errors (`kEventGlError`, DirectGLES.cpp:8804 -> ServerSession.cpp:634-666) are observed at the next drain, so `glGetError` reports a run-ahead verb's error at or after the next wait point rather than at the call after it; CONTRACT-P5C §4.2 already assigns the ordering to P9; P5e names the window as "<= one present credit". `eglMakeCurrent` / surface RPCs: `RunOnApplyThread` already serialises with the ring? NO - the mailbox is pumped between `DrainRing` batches (ServerLoop.cpp:385-390), so a make-current can land between two run-ahead records. Rule: the client waits `WaitForApplied(LastPublishedSeq)` before every `Server*` EGL forwarder (BackendObject_Remote.cpp) - the "control records that need it" of P5e-2; `applier_reset` is the same, it is a `kWaitApplied` row.
|
||||
|
||||
**(4) `gPipeInputs` ownership.** Under a live wire and `RunAheadArmed()` the block is server-role memory: the client executes steps 2 and 3 of `MGPipeValidateForVerb` and nothing else; the server stamps at `ApplyOne` (unchanged), `SetIdentity` once per session; the detector is (§3(7)); the verify build forces `RunAhead=0` (comparator needs a client-filled block, PipeFill.cpp:3304). The residual-value trip wire (`:3284-3294`) still emits - it compares on the SERVER against the applier-derived mirror, which is the honest half. The `MGP_FILL` call sites (GL_Drawing.cpp:540-640) do not change.
|
||||
|
||||
**(5) Object lifetime.** ABA: the client frees a slot right after emitting the destroy (PipeFill.cpp:979-980) and the next `Acquire` bumps Gen; every record naming `{slot,gen}` precedes `destroy{slot,gen}` on the ring and every record naming `{slot,gen+1}` follows `create{slot,gen+1}`; the in-order ring plus a `Gen` compare in every server twin table (S7's rule) closes it - no drain wait is needed at delete. `object_death` is already batched; `resource_destroy` becomes `kWaitNone`. The published latch is keyed `{kind,slot,gen}` (PipeMutation.h:294-310). Persistent maps: `Forget()` (PersistentMapTracker.cpp:599-606) drops tracker state only; the pushed bytes were COPIED into SEG_STAGE at `StageOptional` (WireTables.cpp:342) and reclaim waits on `retiredSeq`, so a map released while blocks are in flight is safe; a `glBufferData` respecify after in-flight subdata is ordered by the ring. Client memos holding frontend->handle maps (`MGPipeResourceTracker::Find`, `g_fenceProxies`, the emitters' latches) are GL-thread-only and untouched. Fence: `EmitDeleteSync` frees the Fence slot after emitting (EmitTables.cpp:1507-1519), same ABA answer.
|
||||
|
||||
**(6) The two scopes.** After S7 the guard at SlotAllocator.cpp:22-38 loses `:28-29`: `MGPipeSlots()` from the apply thread is unconditionally `Fatal{RoleViolation,"MGPipeSlots"}`. The 36 sites (DirectGLES.cpp 20, Managers.cpp 15, ResourceTracker.h:723) by owner: draw-path (S1 1609, S3 2588/3303/4585, S4 4236/4329/5328/5689, S2 1734/4926/4993, S5 Managers.cpp:2938 `HandleOfBuffer`) - retired by their designs. **Not covered by S1-S5, and each is either a run-ahead op or a waited op:** `DrawArrays`/`MultiDrawArrays` client-side attribute arms (6729/6775, run-ahead ops - refused under split already? S1 confirms; if refused the scope is dead code); `GetBackendProgramId` (6166) and `ShaderStorageBlockBinding` (10029) - `set_storage_block_binding` is a run-ahead `kCtxVerb` that resolves the program via `GetProgramObject(GlName)` (PipeApplier.cpp:805-808): must resolve through `MGPStorageBlockBinding::ShaderCso` (carried, unread) -> S4's twin; `ScopedCompleteFramebufferBinding` (8837, texture `Find` inside blit/readback helpers) and the mipmap generators (9161/9216 `HandleOf(texture)`) - `GenerateMipmap` and `CopyFramebufferToTexture` are run-ahead ops whose handle already rides the record (`VerbMipRes`, `VerbCopyTexDst`); the probe must go by-handle; `SyncRenderbufferObjectToBackend` (9695) - renderbuffers have a create/respecify handle (P4a) -> `FindByHandle`; `GetTexImage` (11884) - a reply row (`get_texture_image`), waited, but still an apply-thread probe: by-handle via the record's `Res`; Managers.cpp 256 (`OnFrontendStateObjectDestroyed`, the mailbox arm - dies with the mailbox), 4544/5882/7087/8481/8717/9256/9310/9709/10382/10403/12949/13273/13570 (sampler view, texture id, texture view, FBO `InvalidateSyncedState`, draw-buffers, shader compile buffer-texture, sampler ctor, renderbuffer bind) - S7's re-key list; `ResourceTracker.h:723` (`MGPipeAnnounceBufferGpuWritten`, Magma) - lockstep only, stays behind `!RunAheadArmed`. Readback paths (`resource_readback`, `read_pixels`, `get_texture_image`) are WAITED ops but the wait no longer makes a frontend read legal (the client runs on after publishing everything before it): they resolve by handle too.
|
||||
|
||||
**(7) Measurement plan (Redmi, MC 26.3 VD12).** Arms: monolith; inproc lockstep (`MOBILEGL_IPC_RUN_AHEAD=0`); inproc run-ahead credit 1; credit 2. Per arm: 30 s in-world window, fps, per-thread CPU ms/frame (client GL thread, `mgl-srv-apply`), `cliwait/clipark` and `srv/srvpark` from the wire ledger and the stats line (ClientSession.cpp:1161-1189; ServerLoop.cpp:410-414), `simpleperf` on both threads (target: `WaitForApplied` self on the client falls from 27.9% toward the present-credit wait only; `DrainRing` real work unchanged), `rsp` = 0 in every arm's summary, SSIM of the four A/B traces against monolith. The bench scripts named in the brief (`~/w7/notes/tools/p5d_bench_{fcl4,all4}.sh`) are not on this machine; the report's §"数字" method (P5D-INPROC-PERFORMANCE.md:58-71) is the template.
|
||||
|
||||
## 5. Monolith / G1
|
||||
|
||||
Every change above is `#if MOBILEGL_BUILD_DISAGGREGATED` and behind `RunAheadArmed()`, which is false with no session: `Transport=monolith` never constructs a `ClientSession`, so the emit tables are the monolith adapters and none of `EmitAndWaitTails`, `EmitPresent`, the stamp or the guards runs; `MGPipeValidateForVerb`'s skip is a runtime predicate inside the existing `MOBILEGL_BUILD_DISAGGREGATED` block (:2964-2972 shape) - the pull build's bytes do not move. The one server-side file with a monolith arm, `PipeInputs.cpp`, is compiled only under `MOBILEGL_PIPE_PUSH` and its new `runAhead` argument defaults false. `PipeCalls.def` does not change (no new opcode: the wait class is a generated table, the caps bit is a value).
|
||||
|
||||
## 6. Red-once
|
||||
|
||||
1. Revert the present-credit wait (encode present without `WaitForPresentAck`) -> `SessionTest` twin of `:522-549` in `RemoteClientTest`: a client with credit 1 and a stalled apply thread must park; without the wait the third present publishes and the case reads `Waits()` unchanged -> red by count.
|
||||
2. Revert §3(6) (leave one `CopyField` in the run-ahead fill) -> the layer-2 guard fires `Fatal{RoleViolation,"gPipeInputs"}` by name (`RemoteGuards.ClientPipeInputsFillWhileTheApplierOwnsItIsFatalByName`'s shape, RemoteClientTest.cpp:1989 with `RunAhead=1`).
|
||||
3. Revert §3(7) (count instead of Fatal under a run-ahead verb) -> the `integration-split-strict` lane (test.yml:1140-1206) turns from expected-red into the hard green gate: rewrite its step so GREEN is required for the migrated verbs and any `[BARRIER-PULLED, ...]` marker is red; a revert of any S1-S5 handle arm then goes red HERE, not in a picture.
|
||||
4. Revert §3(8) (keep `Fatal{EventRingOverflow}`) -> a unit case that publishes 300 KiB of `kEventGpuWritten` behind an unwaited run-ahead sequence aborts by name; with flow control it completes.
|
||||
5. Revert §3(2) (publish the caps bit for Magma) -> `MagmaPipeIdentityTest`/`ServerLoopTest`: a Magma-typed server's `CallMask` must not carry bit 10.
|
||||
6. `MOBILEGL_IPC_RUN_AHEAD=0` is the A/B control and must render identically (SSIM); `MOBILEGL_IPC_VERB_BARRIER=0` stays the lockstep arm's negative control.
|
||||
|
||||
## 7. Risks and unsettled
|
||||
|
||||
- **`resource_subdata`'s texture-half acceptance (D-D5)**: `DrainTextureSubData` clears a level's dirty flag on an accepted reply. Making the row `kWaitNone` requires "accept by construction / decline is Fatal" on the server, or the pmap push keeps a wait per block. Needs S2 + integrator ruling; without it run-ahead only covers draws and the pmap path stays ~6 round trips/frame.
|
||||
- **`GenerateMipmap`** waits until S2 retires the `GetActiveTextureUnit` read; **`set_storage_block_binding`** and **`resource_copy_region`** (`GetTextureObject(GlName)` sticky, PipeApplier.cpp:742-743) are `kCtxVerb` rows that still read client state - either wait (`kWaitApplied`) or S2/S4 migrate them; list for S8.
|
||||
- **GPU-write marks are client-side and conservative** (GpuWritePending.cpp:141-147); `OnGpuWritten` events from the server (`MarkBufferGpuWritten`) now arrive late - the client's own marks already cover the draw-time set, so late narrowing is harmless; confirm no server-only producer exists for XFB (`EndStreamOutput` is client-marked, :164-167).
|
||||
- **EGL RPC vs run-ahead** (§4(3)): the wait-before-forwarder rule adds one full drain per make-current/surface event; acceptable (startup-time), but `ServerSwapEGLBuffers` is NOT on that list (present is the swap).
|
||||
- **Event-ring capacity** (256 KiB): a writeback slice is a quarter ring (GpuWritePending.cpp:187-200) and the readback row waits, so flow control is the only new requirement; consider `MOBILEGL_IPC_EVENT_KB` if the per-draw `kEventGpuWritten` traffic under SSBO workloads (Iris) trips the full latch every frame.
|
||||
- **The `VerbBarrier==0` control's meaning** after P5e; and whether `Flush` (kCtxVerb, emitted?) should become the doorbell point of ARCHITECTURE §11.6 - not settled here.
|
||||
- **Thread placement** (P5D report §"什么没完成" 2) is out of scope by the user's instruction; the measurement plan reports per-thread ms/frame so the comparison survives it.
|
||||
@@ -0,0 +1,226 @@
|
||||
# S7 - identity: the five twin registries and the allocator (head `2fde7034`)
|
||||
|
||||
Paths under `MobileGL/`. `DG` = `MG_Backend/DirectGLES/DirectGLES.cpp`, `MG` = `MG_Backend/DirectGLES/Managers.cpp`,
|
||||
`MH` = `Managers.h`, `ST` = `MG_Backend/DirectGLES/SlotTables.h`, `SA` = `MG_Impl/Pipe/SlotAllocator.{h,cpp}`,
|
||||
`PF` = `MG_Impl/Pipe/PipeFill.cpp`. Kinds: **id** = `GetLifetimeId()` + `MGPipeSlots().FindByLifetimeId`
|
||||
(`ST:436-449`, through `MGPipeRefuseAllocatorFromApplyThread` `SA.cpp:257-273`); **mint** = `GetOrCreate(const StatePtr&)`
|
||||
-> `MGPipeSlots().Acquire` (`ST:215-268`), a WRITE into the client allocator; **live** = a dereference of the frontend
|
||||
object beyond its lifetime id; **rec** = a handle-keyed arm that already exists beside the site.
|
||||
|
||||
## 1. The exact live reads of the family (per kind: today's key, every apply-thread site, hit/miss)
|
||||
|
||||
**The mechanism common to all five** (`MH:309-620` `StateBackendObjectRegistry` wrapping `BackendSlotTable`):
|
||||
`Find(StateObject*)` `ST:411-414` = `HandleOf` (id) + `FindByHandle`; `GetOrCreate(StatePtr)` `ST:215-268` = `Acquire`
|
||||
(mint) + `RememberHandle` + `entry.stateRef = stateObj` (a frontend `SharedPtr` OWNED BY THE SERVER TABLE, `ST:162,260`);
|
||||
the per-table memo `m_memoLifetimeId/m_memoHandle` (`ST:649-650`, `mutable`, written from the apply thread on every id);
|
||||
`OnFrontendObjectDestroyed` `ST:465-485` = id + `MGPipeSlots().Free` (monolith / NoSession fixture only). Every id and
|
||||
mint on the apply thread is legal today only through `MGPipeFrontendKeyedRegistryScope` / `MGPipeReverseAnnouncementScope`
|
||||
(`SA.cpp:263-264`); the two depth counters `SA.cpp:303,324`.
|
||||
|
||||
| kind / table (key today) | apply-thread sites at `2fde7034` | kind; when |
|
||||
|---|---|---|
|
||||
| **Buffer** `g_backendBufferResources` `MG:2757`, `BackendSlotTable<..., Buffer>` `MH:886-888` - ALREADY handle-keyed; the only frontend probe is `HandleOfBuffer` `MG:2925-2941` (scope `:2938`) | callers: `EnsureBufferResource(obj)` `MG:3444-3455`; `IsBufferDrawClean(frontend,res)` `MG:3159-3162` -> `IsBufferDrawCleanByHandle(HandleOfBuffer(frontend),...)`; `MarkBufferGpuWritten` `MG:2945-2951`. Reached per draw from S1 (VAO ensure walk, IBO arm), S5 (UBO/SSBO/atomic/XFB points), image buffer textures | id; memo HIT and miss (IsBufferDrawClean runs on the hit path) |
|
||||
| **VAO** `g_backendVertexArrayObjects` `MH:1423-1424`, `TwinRegistry<VertexArrayObject, BackendVertexArrayObject, VertexElementsCso>`; key = VAO lifetime id -> VertexElementsCso slot | `ResolveVaoTwin` `DG:1602-1633` (scope `:1609`, `Find` `:1617`, `GetOrCreate` `:1618`) from `PrepareForDraw` `:4772` EVERY draw; `DrawArrays` `:6729-6731`, `MultiDrawArrays` `:6775-6777` (`Find`) | id every draw; mint on first draw of a VAO |
|
||||
| **Texture** `g_backendTextureObjects` `MH:1818-1819`, key = texture lifetime id -> Texture slot | `SyncTextureObjectToBackend` `DG:1723-1802` (scope `:1734`, `Find` `:1736`, `GetOrCreate` `:1738`, re-resolve `:1781/:1790`) called from the three sync-list rebuilds `:2308,:2381,:2457` (memo MISS), `SyncImageTextureBinding` `:2660` (every image unit), `CopyImageSubData` `:8294-8295`, `GenerateMipmap` `:9575-9578`, CopyTex endpoint `:9735`; `ResolveShaderImageRecord` `:2588/:2634` `HandleOf`; `ResolveAndBindUnitTextures` `:4926-4928` `Find` (memo miss); `ScopedDetachedTextureFramebufferAttachments` `:8837-8839` `Find`; `GetTexImage` `:11884-11886`; mip shape `:9161-9162, :9216-9217` `HandleOf` (transport arm!); CopyTex monolith else-arm `:8512-8515`. `MG`: `:5882-5884` `HandleOf` (image-bindable re-arm), **`:7087-7089` `HandleOf` inside `SyncMipmapsToBackend` - on EVERY texture sync on the handle arm**, `:8481-8483` `ResolvePushedBuiltinSampler`, `:8717-8719` `ResolvePushedTextureParams`, legacy attach `:9256-9261` `Find/GetOrCreate`, `:9630` (monolith-gated), verify arm `:10382-10384` | id on every texture sync (hit or miss of the unit memo); mint on first sync |
|
||||
| **Renderbuffer** `g_backendRenderbufferObjects` `MH:2819-2820`, key = rb lifetime id | `SyncRenderbufferObjectToBackend` `DG:9688-9710` (scope `:9695`, `Find/GetOrCreate` `:9698-9701`) from CopyTex endpoint `:9714` and attach; `MG:9310-9318` legacy attach; **`MG:9709-9720` `HandleOf` cross-check - NOT monolith-gated, unlike the texture twin at `:9628-9632`**; `MG:13570-13574` `HandleOf` inside `BackendRenderbufferObject::SyncToBackend` (every rb sync); verify arm `:10403-10406` | id per sync; mint on first attach |
|
||||
| **Framebuffer** `g_backendFramebufferObjects` `MH:1943-1944`, key = FBO lifetime id; default FBO = `kMGPipeDefaultFramebuffer{0,1}` (`MGPipeHandles.h:73`), never a twin | record arm `SyncCurrentFBOByRecord` `DG:3197` `GetOrCreateByHandle` (rec) **but `:3228` `NoteStateForHandle(record.Fbo, currentFBO)` writes a frontend `SharedPtr` into the table**; decline arm `:3303/:3358/:3367-3369` `Find/GetOrCreate`; `:3032` `HandleOf` (monolith-gated `:3031`); `BindCurrentFBO` decline `:4585/:4592/:4602`; `SyncAndBindFramebufferObject` `:4646-4647`; `SyncAndBindFramebufferByHandle` `:4687` (rec) + `:4700` `StateForHandle` (live: the note); named blit `:8361` `StateForHandle`; `ForEachLive` `:8904` (locks every `stateRef`); `MG:9862,:10101` `HandleOf` monolith else-arms (`m_pushedSyncHandle` `MH:1857` under transport) | rec on the steady draw; the note is a live frontend read on every named blit / by-handle bind |
|
||||
| **Program / ShaderCso** `g_backendProgramObjects` `MH:2540-2541`, key = program lifetime id -> ShaderCso slot (composites: the band, `ProgramEmit.h:411-422`) | `SyncCurrentProgram` `DG:4320-4432` (scope `:4329`, `Find/GetOrCreate` `:4415-4416`) EVERY draw; `ResolveGlobalConstantsRecord` `:4236/:4242` `HandleOf` every draw with UBO bytes; `BindCurrentProgramWithResources` `:5328/:5337` `Find` when the raw-pointer stash `g_currentDrawFrontendProgram` (`:4097,:4509,:5333`) misses; `GetCurrentBackendProgram` `:5689-5691` `Find` (per sub-draw via `:5716-5827`); `GetProgramBackendId` `:6166-6170` `Find/GetOrCreate`; `SetStorageBlockBinding` `:10029-10031`; `MG:12949-12954` `HandleOf` inside `BackendProgramObjectImpl::SyncToBackend` | id every draw; mint on first use |
|
||||
| **Sampler** `g_backendSamplerObjects` `MH:2678-2679`, `TwinRegistry<SamplerObject, BackendSamplerObject, SamplerCso>` - TWO disjoint families in one table (`MH:2681-2700`): identity twins minted off the SamplerObject's lifetime id, and CSO twins at content-addressed handles (`SamplerEmit.h:427` `Allocate` with no lifetime id) | identity family: `ResolveUnitSamplerBackend` `DG:4989-5013` (scope `:4993`, `HandleOf` `:4999`, `g_unitSamplerLookupMemos`), the sampler-pass decline arm `:5623-5630` **`GetOrCreate(samplerObject)` = a MINT from the apply thread on every unit the record arm does not cover**, `MG:13264-13280` `HandleOf` inside `BackendSamplerObject::SyncToBackend(object)`. CSO family: `ResolveSamplerCsoTwin` `MG:13460-13486` `GetOrCreateByHandle(cso)` from `BindCurrentUnitSamplers` `:5146` and the program pass `:5616` | rec (CSO); id + mint (identity) |
|
||||
| **SamplerView** `g_backendSamplerViews` `MH:2761-2764` handle-only `BackendSlotTable`; key = texture lifetime id -> SamplerViewCso slot | no backend caller of `HandleOfSamplerViewForTexture` (`MG:4535-4546`, scope `:4544`); its only caller is the harness `MG_IntegrationTest/Harness/PipeApplyPeek.cpp:165` | none on the draw path |
|
||||
|
||||
Outside DirectGLES: `MG_Impl/Pipe/ResourceTracker.h:723` (`MGPipeAnnounceBufferGpuWritten`, Magma), `VulkanRenderer.cpp:4554,
|
||||
:4634, :8986` (Magma hidden resources' destructors + `MGPipeSlots().IsLive` in the blit endpoint resolve). Scope-site census:
|
||||
20 in `DG` (`:1609 :1734 :2588 :3303 :4236 :4329 :4585 :4926 :4993 :5328 :5689 :6166 :6729 :6775 :8837 :9161 :9216 :9695
|
||||
:10029 :11884`), 15 in `MG` (`:256 :2938 :4544 :5882 :7087 :8481 :8717 :9256 :9310 :9709 :10382 :10403 :12949 :13273 :13570`),
|
||||
1 in `ResourceTracker.h`, 3 in Magma, 3 in `MG_Test/Wire/RemoteClientTest.cpp:1883-1903`.
|
||||
|
||||
**Corrections to the E note.** (i) The VAO twin key is NOT content-addressed: `VertexInputEmit.h:170-172` mints the
|
||||
VertexElementsCso slot with `Acquire(VertexElementsCso, vao->GetLifetimeId())`, one CSO per VAO, re-created on the SAME
|
||||
handle when `ConfigVersion` moves (`:178-179`), so the twin key already equals `MGPipeApplier().BoundVertexElements`.
|
||||
(ii) The same holds for every kind: Texture `TextureEmit.h:422` / `PF:1495`, Renderbuffer `PF:1499`, Framebuffer
|
||||
`FramebufferEmit.h:257` / `PF:1503`, ShaderCso `ProgramEmit.h:411-422` / `PF:1507`, SamplerView `SamplerEmit.h:886-887`
|
||||
all mint off the object's own lifetime id, so `HandleOf(obj)` on the server always answers the handle the records carry.
|
||||
The rekey is therefore a REPLACEMENT OF THE LOOKUP ARGUMENT, not a re-keying of the table.
|
||||
|
||||
## 2. What the records and applier state already carry
|
||||
|
||||
- Handle-indexed record tables, Gen-checked on every read (`MG_Pipe/PipeApply.h:486-524`; readers `MG:4325-4360`
|
||||
`PipeTextureRecordForHandle` / `PipeRenderbufferRecordForHandle` / `PipeSamplerCsoRecordForHandle` /
|
||||
`PipeSamplerViewRecordForHandle` / `PipeShaderCsoRecordForHandle` (band-aware), `PushedFramebufferRecord` `MH:1963`,
|
||||
`FindShaderCsoRecord` `DG:4243`; `PipeApply.cpp:444,481,488,505` `!Live || Gen != handle.Gen -> nullptr`).
|
||||
- The bound handles: `BoundVertexElements` `:594`, `BoundFramebuffer[2]` `:646`, `BoundSamplerViews[u].Texture` `:673`,
|
||||
`BoundSamplerStates[u]`, `BoundShaderImages[u].Res`, `DrawProgram/DispatchProgram/BoundShaderCso` `:691-693`,
|
||||
`VertexBuffers[].Res`, `IndexBuffer.Res`; the verb workspace `VerbBlitReadFbo/DrawFbo`, `VerbCopyTexDst`, `VerbMipRes`,
|
||||
`VerbIndirect*` `:733-755`; `MGPSurface.Res` in `FramebufferRecords`.
|
||||
- Twin creation by handle already exists per kind: `GetOrCreate(handle)` `ST:294-342` (forward Gen = recycle & reset `:338`,
|
||||
backward Gen = refused `:331`), `GetOrCreateByHandle` `MH:407-414`, `AdoptTwinByHandle` `MG:4148-4152`,
|
||||
`GetOrCreateBufferResourceForHandle` `MG:2887-2908`, `GetOrCreateSamplerViewForHandle` `MG:4505-4528`,
|
||||
`ResolveSamplerCsoTwin` `MG:13474`, `SyncAndBindFramebufferByHandle` `DG:4677-4712`, CopyTex split arm `DG:8487`.
|
||||
- Twin death by handle already exists for all seven kinds: `object_death` (opcode 78, `MGPHandleOnly` `MGPipeTypes.h:93-98`,
|
||||
`PipeCalls.def:265`, `kCtxObject`) emitted by `EmitObjectDeathRecord` `MG_Remote/Client/WireTables.cpp:569-608` (GL thread,
|
||||
the client's own allocator) -> `ServerVerbSink::OnObjectDeath` `PipeApplier.cpp:988-1013` -> `ReleaseTwinsForWireObjectDeath`
|
||||
`MG:328-372` -> `ReleaseTwinByHandle` `ST:498-507`; Buffer via `resource_destroy` -> `Ops_H_Destroy` `MG:2424-2444`
|
||||
`ReleaseByHandle`. Order on the client is fixed (`PF:1623-1626` `NotifyAndFree`: notice -> record out -> `Free`), so the
|
||||
death record precedes the slot's next handout on the ring. Under `BatchWaits=1` (default, `Config.h:493`) `object_death`,
|
||||
every `create_*/delete_*` (kCtxCso) and every `set_*` (kCtxState) already publish WITHOUT waiting
|
||||
(`ClientSession.cpp:915-920`); `EmitAndWait` at `WireTables.cpp:604` is a name only.
|
||||
- Client-side lifetime-id -> handle maps that STAY client: `MGPipeSlotAllocator::ByLifetimeId` `SA.h:146`,
|
||||
`MGPipeResourceTracker::m_bySlot` `ResourceTracker.h:535` (slot -> `BufferObject*` inverse for writebacks), the emitters'
|
||||
latches (`VertexInputEmit.h:174`, `SamplerEmit.h:889`, `TextureEmit.h:455-470` `ResolveTexture`), `EmitTables.cpp:1076-1082`
|
||||
`PublishedTextureHandle`. All GL-thread; none is touched by this design.
|
||||
|
||||
## 3. The gap (what does not exist yet)
|
||||
|
||||
No new wire record and no new field is needed for identity. The gaps are server-side shapes:
|
||||
1. **Per-kind by-handle resolvers on the draw path** are missing for VAO, Program and Texture-at-draw: `ResolveVaoTwin(handle)`,
|
||||
`ResolveProgramTwin(handle)`, `ResolveTextureTwin(handle)` (the shape of `ResolveSamplerCsoTwin`). `AdoptTwinByHandle`
|
||||
is the body; the release-build voice of the refusal is per kind (`MG:2893-2898`'s shape).
|
||||
2. **The twin sync bodies take the frontend object** (`MG:4881` VAO, `:7049` mips, `:8802` params, `:10044` FBO, `:11922`
|
||||
program, `:13184/:13188` sampler, `:13550` rb) and resolve their own record through `HandleOf(obj)` (`MG:7089, :12954,
|
||||
:13574`). Identity's requirement on S1-S5: every body becomes `SyncToBackend(MGPipeHandle, const <Record>&)` and stores
|
||||
`m_handle` (the `m_pushedSyncHandle` pattern, `MH:1857`) - the object parameter is deleted, not defaulted to null.
|
||||
3. **The state note** (`NoteStateForHandle` writer `DG:3228`; readers `:4700`, `:8361`) and **`ForEachLive`'s `stateRef`
|
||||
walk** (`DG:8904`, the one direct iteration) are frontend `SharedPtr`s in server memory. S3 owns the replacement: the
|
||||
by-handle FBO sync reads `FramebufferRecords[h].State` only; `ScopedDetachedTextureFramebufferAttachments` walks
|
||||
`FramebufferRecords` for surfaces naming texture handle T (an O(records) walk, or a reverse index texture -> FBO slots
|
||||
maintained at `set_framebuffer_state`).
|
||||
4. **Raw-pointer memos**: `g_currentDrawFrontendProgram` (`DG:4097`) -> a handle stash; `g_unitSamplerLookupMemos`
|
||||
(`DG:4985`) and the sampler identity family (`:4989-5013`, `:5623-5630`, `MG:13264-13280`) are DELETED - a unit whose
|
||||
`BoundSamplerStates[u]` is null while the frontend holds a sampler is a missing `bind_sampler_states`, which under
|
||||
run-ahead is `Fatal{UnmigratedPipeInput,"SamplerObject@draw"}` (strict), never a mint (S2 to ratify).
|
||||
5. **`BackendSlotTable` has no composite band.** `EntryAt(handle.Slot)` `ST:581-584` resizes to the slot; a program-pipeline
|
||||
composite (slot >= 983040, `SA.cpp:457`, `kMaxHandleSlot = 1<<20` `ST:154`) grows `g_backendProgramObjects` to ~983k
|
||||
entries (~40 B each). Today reachable through `GetOrCreate(StatePtr)` for a composite program; after the rekey it is the
|
||||
ordinary path. The table gets a `m_band` vector indexed by `slot - base`, as the allocator (`SA.h:144`) and the applier
|
||||
(`PipeApply.h:511`) already do.
|
||||
6. **`MG:9709-9720`** (renderbuffer attach cross-check) lacks the `Transport == Monolith` gate its texture sibling has
|
||||
(`MG:9628-9632`): a live id probe under transport today. Fixed by the rekey (the check is deleted; `AdoptTwinByHandle`
|
||||
is the whole identity test) - noted so its disappearance is not mistaken for a lost check.
|
||||
7. The client-side rule that lets the server never miss: the record naming a handle is ON THE RING BEFORE the verb that
|
||||
reads it. Already true - `create_*` from the validate point / birth hooks (`PipeMutation.h:996-1184`), `set_*` from the
|
||||
tracker walk, `object_death` from the destructor - and the applier's Gen check turns any violation into the loud
|
||||
refusal (`PipeApply.cpp:1740-1750`), not a wrong twin.
|
||||
|
||||
## 4. The retirement design (server shape after P5e)
|
||||
|
||||
**ST (BackendSlotTable), handle-only under `MOBILEGL_PIPE_PUSH`:** delete `GetOrCreate(const StatePtr&)`, `HandleOf`,
|
||||
`Find(StateObject*)`, `OnFrontendObjectDestroyed`, `NoteStateForHandle/StateForHandle`, `Entry::stateRef`, the memo pair
|
||||
and `RememberHandle/ForgetHandle`; keep `GetOrCreate(handle)`, `FindByHandle`, `ReleaseByHandle`, `ReleaseTwinByHandle`,
|
||||
`LiveGenAt`, the holder list, `ForEachLive` re-typed as `fn(MGPipeHandle, const BackendPtr&)`; add the composite band.
|
||||
`Entry` becomes `{backend, Gen, Live}`. The `StateObject` template parameter survives only as a name. The pull build
|
||||
never compiles this header (`ST:14-16, :86`), so G1 holds by construction.
|
||||
|
||||
**MH (StateBackendObjectRegistry):** the slot arm forwards only the handle members; the legacy `UnorderedMap<StateObject*>`
|
||||
arm stays exactly as it is under `MOBILEGL_PIPE_LEGACY_MEMOS` (the A/B of ARCHITECTURE 9.6; `CMakeLists.txt:43` default ON).
|
||||
`DestroyByLifetimeId` becomes legacy-arm-only; the notice consumer `OnFrontendStateObjectDestroyed` `MG:206-320` keeps the
|
||||
split arm (`EmitObjectDeathRecord`), keeps the monolith switch for the LEGACY arm, and the slot arm's monolith death is the
|
||||
same `object_death` route applied synchronously (`MGPipeRouteObjectDeath` under `Transport=monolith` = direct apply) - one
|
||||
death path per arm, the scope at `MG:256` deleted. The NoSession fixture hop (`MG:224-246`) is deleted: a server-role
|
||||
fixture with no client session gets no deaths (its twins die with the backend at Stop, which is what happens today past
|
||||
`Running()==false` anyway).
|
||||
|
||||
**Twin key = the record's handle, resolved from applier state, never from an object:**
|
||||
- VAO: `ResolveVaoTwin(st.BoundVertexElements)` in `PrepareForDraw`; `DrawArrays/MultiDrawArrays` client-side attribute paths
|
||||
are refused under split already (S1 confirms) - their `Find` becomes the monolith legacy arm only.
|
||||
- Program: `SyncCurrentProgram(st.DrawProgram)`, `PrepareForCompute(st.DispatchProgram)`, `ResolveGlobalConstantsRecord(handle)`;
|
||||
`g_currentDrawBackendProgram` keyed by `{slot,gen}`; `GetProgramBackendId(name)` / `SetStorageBlockBinding(name)` are
|
||||
monolith sticky entries (`DG:6152`, `:10022`) - under split they are unreachable (P5b class-C refused or carried as
|
||||
`MGPSetStorageBlockBinding.ShaderCso`, `EmitTables.cpp:1267`).
|
||||
- Texture: `SyncTextureTwin(handle)` called with `BoundSamplerViews[u].Texture`, `BoundShaderImages[u].Res`,
|
||||
`FramebufferRecords[h].State.Color[i].Res`, `VerbCopyTexDst`, `VerbMipRes`, `MGPCopyImage` src/dst; `SyncMipmapsToBackend`
|
||||
reads the staged store by handle (tx already does, `CONTRACT-P5C.md §2.2`).
|
||||
- Renderbuffer: `AdoptTwinByHandle(surface.Res)` (already, `MG:9719`) + by-handle `SyncToBackend(handle, record)`.
|
||||
- Framebuffer: `GetOrCreateByHandle(BoundFramebuffer[t])` / `record.Fbo` (already); the decline arms (`DG:3303-3370`,
|
||||
`:4568-4602`) become monolith-legacy-only; `g_fboRecordsTrusted=false` under a transport is `Fatal{ProtocolCorruption}`.
|
||||
- Sampler: the CSO family only (`ResolveSamplerCsoTwin(st.BoundSamplerStates[u])`); the table is renamed to what it is.
|
||||
- Buffer: `EnsureBufferResourceForHandle(nullptr, h)` / `IsBufferDrawCleanByHandle(h, res, nullptr)` from every consumer
|
||||
that holds `h` (S1/S5 name them); `HandleOfBuffer` and `MarkBufferGpuWritten(obj)` become monolith-only, and the split
|
||||
GPU-written announcement takes the handle (`MarkBufferGpuWrittenByHandle`).
|
||||
|
||||
**"Is it clean / does it need re-sync" from server-owned serials:** each twin stores `m_handle` and the record serial(s)
|
||||
it last consumed (`m_syncedResourceSerial`, `m_syncedParamsSerial`, `m_syncedShaderCsoSerial`, `m_syncedRecordHashes`
|
||||
already exist: `MH:1400-1410, :1800-1812, :2750, :2820`). `FindByHandle` answering null or a different `Gen` = a different
|
||||
object = full sync; equal handle + equal serials = clean. No frontend version is read anywhere. (S1-S5 own the per-kind
|
||||
serial sets; the identity invariant is only: the compare is `{handle, serial}`, never `{pointer, version}`.)
|
||||
|
||||
**Twin creation moment:** the first apply that resolves the handle through `GetOrCreate(handle)` - a verb, a bind, an
|
||||
attach - AFTER the record naming it was applied (the applier refuses a bind/verb naming an unknown or stale handle,
|
||||
`PipeApply.cpp:2266, :2549, :2625, :2683, :2896`). Creation is lazy, exactly as today; no twin is minted at `create_*`.
|
||||
**Twin death moment:** the apply of `object_death` / `delete_*` / `resource_destroy` (in ring order, after every verb that
|
||||
named the generation), or the server backend's own destruction at Stop (`MG:188-212` `InProcessTeardown`). `applier_reset`
|
||||
does not touch twins or object records (`PipeApply.h:800-832`); `MGPipeApplierReleaseObjectRecords` `:841` is wired to
|
||||
nothing outside tests and stays so.
|
||||
|
||||
**The ABA answer ("recycled slot, new gen"):** `Gen` moves only on reuse (`SA.cpp:410-419`); the client frees a slot only
|
||||
after its death record went out (`PF:1623-1626`); the ring is in order; so at the server every record naming `{s,g}`
|
||||
is applied before `object_death{s,g}`, which is applied before `create{s,g+1}`. Even with the death skipped (an object
|
||||
that never crossed emits none, `WireTables.cpp:595-596`), `GetOrCreate({s,g+1})` finds `Live && Gen != g+1` and resets
|
||||
(`ST:338`); `FindByHandle({s,g})` after the recycle answers null (`:424`); a backward `{s,g-1}` is refused (`:331`).
|
||||
No wait is involved and none is added: run-ahead changes nothing here. What the client must NOT do is hold a server-side
|
||||
`SharedPtr` to a frontend object - after P5e the server holds none (no `stateRef`, no state note, no object rows in
|
||||
`gPipeInputs` under run-ahead), so the P5d deferred-destroy queue (`PipeMutation.h:957-975`, `PF:999-1046`) loses its
|
||||
producer; it stays as a guard that logs once if it ever enqueues under run-ahead.
|
||||
|
||||
**The two scopes:** `MGPipeFrontendKeyedRegistryScope` is deleted (class, 35 Espryt sites, the `SA.cpp:264` exemption, the
|
||||
`ResourceTracker.h:723` site with it once S5 carries the handle). `MGPipeRefuseAllocatorFromApplyThread` becomes
|
||||
`Transport != Monolith && OnApplyThread -> Fatal`, unconditional for DirectGLES. `MGPipeReverseAnnouncementScope` is the
|
||||
Magma question (part 7).
|
||||
|
||||
## 5. Monolith / G1
|
||||
|
||||
- Pull build: untouched - every symbol above is under `MOBILEGL_PIPE_PUSH` or `MOBILEGL_BUILD_DISAGGREGATED`; the
|
||||
`TwinRegistry` alias keeps the two-argument mangled name (`MH:626-634`); G2/G14 unchanged.
|
||||
- Push build under `Transport=monolith`: the applier is in-process and populated synchronously by the same records
|
||||
(`MGPipeRoute* == MGPipeApply*` under monolith), so the handle bodies run under monolith too and read
|
||||
`MGPipeApplier()` state that is current at the verb. Behaviour identical; bytes differ. The selection is the FAMILY BIT
|
||||
(`XSubsystemEnabled()`, the `0x1fff` mask), not a transport check: bit clear -> the legacy `UnorderedMap` arm (its
|
||||
`HandleOf` on the GL thread is legal), bit set -> handle arm. Under a transport the bits are caps-required, so only the
|
||||
handle arm is reachable and a legacy-arm entry from the apply thread is the Fatal. The monolith entry points that reach
|
||||
the backend WITHOUT a record - `GetProgramBackendId(name)`, `GetTexImage`, `CopyImageSubData`, the sticky forwards -
|
||||
keep their object-taking monolith bodies and resolve the handle on the GL thread through the emitter-side maps
|
||||
(`PublishedTextureHandle`'s shape), i.e. the resolution moves to the SAME side the mint lives on.
|
||||
- If the integrator rules "monolith bytes identical" instead, the alternative is `#if MOBILEGL_BUILD_DISAGGREGATED` +
|
||||
`Transport != Monolith` around each handle body with the frontend body kept beside it; it keeps 35 sites alive and the
|
||||
scope classes with them, and is not recommended.
|
||||
|
||||
## 6. Red-once
|
||||
|
||||
1. Revert `ResolveVaoTwin`'s handle arm (put `Find(vao.get())` back) with the scope gone: the first draw under
|
||||
`integration-split` aborts `Fatal{RoleViolation, "MGPipeSlots"}` naming `HandleOf` (`SA.cpp:265-272`); the same for
|
||||
`SyncCurrentProgram` and `SyncTextureTwin`.
|
||||
2. `RemoteGuards.AnAllocatorProbeInsideAnExemptionScopeOnTheApplyThreadIsAllowed` (`RemoteClientTest.cpp:1881-1895`)
|
||||
is deleted with the scope; a new `...FromTheApplyThreadIsFatalEvenAtTheOldDebtSites` posts `HandleOf` through
|
||||
`RunOnApplyThread` and expects the abort. `:1866-1879` and `:1901-1913` stay as the control.
|
||||
3. ABA under run-ahead: `CtWireScenario.TextureDeathCrossesAndTheRecycledSlotAnswersTheNewObject` /
|
||||
`FramebufferDeath...` (`CtWireScenario.cpp:120-215`) and `HandleRecycleScenario`'s `aba` arm (`:140-149`) run with the
|
||||
draw wait removed; skipping the `ReleaseTwinByHandle` in `OnObjectDeath` must render the dead twin's colour (red).
|
||||
4. Unit: `DirectGLESSlotTable.AGenerationBehindTheLiveTwinIsRefusedRatherThanAdopted` (`SanityTest.cpp:4898`) kept; a new
|
||||
`ACompositeHandleDoesNotGrowTheOrdinaryTable` pins the band; the cases that drive `GetOrCreate(StatePtr)` / the death
|
||||
notice (`:3499-3960, :4061, :4241, :4378`) are moved onto the legacy arm or rewritten by handle; `ScopedDirectGLESTextureBindings`
|
||||
(`:230-262`) keeps its by-value registry copy (holder list unchanged).
|
||||
5. Strict lane: `integration-split-strict` green for the migrated verbs is the gate that a frontend-keyed resolution cannot
|
||||
hide behind a memo hit (P5e-3).
|
||||
|
||||
## 7. Risks and what S7 could not settle
|
||||
|
||||
- **Magma.** `VulkanRenderer.cpp:4554, :4634, :8986` and `ResourceTracker.h:723` are apply-thread allocator touches P7
|
||||
retires; with the guard unconditional they abort on the first Magma frame under `inproc`. Ruling needed: keep ONE scope,
|
||||
renamed and compiled for DirectVulkan only (`MagmaP7AllocatorDebtScope`), with the guard's exemption keyed on the
|
||||
backend kind; Espryt has no exemption. (P5e-4 keeps Magma lockstep either way.)
|
||||
- **Sampler identity family deletion** changes what a draw does for a unit the record arm does not cover (`DG:5601-5630`):
|
||||
today it mints a twin off the object; after P5e it is a Fatal under strict. S2 must confirm `bind_sampler_states`
|
||||
covers `[0, maxTouchedUnit]` (E's caveat A8) before the arm is removed.
|
||||
- **`ForEachLive` / the detach walk** (`DG:8893-8935`) needs S3's reverse index; without it the by-handle FBO table cannot
|
||||
answer "which twins attach T" and the walk silently does nothing (the handle-keyed entries are already invisible to
|
||||
`ForEachLive`, `ST:282-285`).
|
||||
- **NoSession server-only fixtures** (`MG:224-246`, `CONTRACT-P5C.md §5.2` amendment) lose their death delivery; the
|
||||
affected fixtures are `ServerLoop` unit cases with no client - to be enumerated by the integrator (grep `RunOnApplyThread`
|
||||
users in `MG_Test/Wire`).
|
||||
- **Composite band in the twin table** (part 3.5) is a pre-existing ~40 MB growth on any program pipeline; it becomes
|
||||
the ordinary path after the rekey, so it is a P5e prerequisite, not a follow-up.
|
||||
- **Ordering of packages.** Every other family's design calls a by-handle resolver; the ST/MH rekey + the per-kind
|
||||
resolvers + the band land FIRST (one worktree, no behaviour change under lockstep), then S1-S5 swap their arguments, then
|
||||
S6 removes the wait. The guard flip (delete the scope) is the LAST commit of the identity package, because it is the
|
||||
red-once for every site that was missed.
|
||||
- Not verified: whether any `MGPipeApplier()` bound handle can be null at a verb that today resolved a non-null frontend
|
||||
object (a family bit clear under transport). The caps-required-bits rule (P5e-4) is what makes that unreachable; S6 to pin.
|
||||
Reference in New Issue
Block a user