Merge branch 'p5e/ra' into feat/disaggregated (P5e ra)

This commit is contained in:
2026-09-18 08:41:10 -04:00
23 changed files with 1671 additions and 107 deletions
+13 -3
View File
@@ -953,9 +953,19 @@ namespace MobileGL::MG_Pipe {
// EmitAndWaitTails the client still blocks after every record, so the answer the server
// must stamp is `true` whatever the wire says - the two named exemption scopes (§4.4) are
// legal exactly while the client is parked, and it is parked behind all of them today.
// Package ra flips this to true in the same commit that lands the wait rule; the sink's
// stamp then follows the predicate. Computing the predicate anyway (PipeApplier::ApplyOne)
// is deliberate: it keeps the function exercised on every record for the whole phase.
// IT FLIPS WITH kMGPipeP5eRunAheadReady, IN THE INTEGRATION COMMIT, AND NOT WHEN ra LANDS
// (ra's amendment to ID-103's wording, which said "the same commit that lands the wait
// rule"). The argument ID-103 makes is about whether the CLIENT is parked, not about
// whether ra's code exists: RunAheadArmed() is a conjunction whose third term is the
// server's caps bit, so between ra landing and the caps bit being published the client
// still blocks after every record - and stamping `false` there would withdraw §4.4's
// exemptions from probes that client's own wait still makes safe, which is exactly the
// "refusal with no defect behind it" ID-103 refused. The two constants are therefore ONE
// switch with two spellings, and the integration commit throws both.
//
// Computing the predicate anyway (PipeApplier::ApplyOne) is deliberate: it keeps the
// function exercised on every record for the whole phase rather than first run on the day
// it starts deciding.
inline constexpr Bool kMGPipeP5eClientWaitRuleLanded = false;
// P5c (rv): the two serials the PipeInputs texture-shutter accessors answer with under a
+30
View File
@@ -231,8 +231,38 @@ namespace MobileGL::MG_Pipe {
// BeforeReadOnlyVerb) through MGPipeDrainDeferredDestroys. A delayed free is safe:
// slots are plentiful, reuse is delayed rather than corrupted, and the replay runs the
// helper itself, so every helper's own three-step order is untouched.
// P5e (ra), CONTRACT-P5E §2.7 / ruling 13 (ID-91): THE QUEUE STAYS LIVE, AND AN
// UNBARRIERED ENQUEUE IS A FINDING. After the family packages land, an unbarriered apply
// holds no frontend SharedPtr at all - every object is resolved from a handle - so the
// only apply thread that can still be a last owner is one inside a BARRIERED record (a
// fill's O-class rows, XFB's pinned targets). An enqueue from an unbarriered record
// therefore means some site still pins a frontend object across a record, which is a
// migration this phase believes it finished: it logs once with the kind, and is Fatal
// under MOBILEGL_IPC_STRICT_ERRORS so the strict lane owns the red. The queue itself is
// NOT removed - it is the belt that keeps the barriered case from corrupting the
// allocator while the finding is being read.
Bool MGPipeDeferDestroyAndFreeIfOnApplyThread(MGPipeKind kind, Uint64 lifetimeId);
void MGPipeDrainDeferredDestroys();
// P5e (ra), CONTRACT-P5E §2.3: drop the four O-class SharedPtr rows the residual fill left
// in gPipeInputs (the bound VAO and the three programs, PipeInputs.h's O block). Called by
// ClientSession on the GL thread once a BARRIERED apply has returned - the one instant
// under run-ahead at which the applier is provably idle and this block has no other
// reader. Under lockstep nothing calls it: the next verb's fill overwrites those rows
// within a verb, and dropping them early would only cost a re-pin.
//
// It is HERE rather than in ClientSession because the rows are PipeInputs' private storage
// and MGPipeFillAccess - the client-side door to it - lives in MG_Impl (PipeFill.cpp).
// MG_Remote says when; MG_Impl says what.
void MGPipeReleaseResidualFillPins();
// P5e (ra), CONTRACT-P5E §2.5: glFinish's whole body under a transport. Declared here
// rather than on ClientSession so that MG_Impl's GL entry points - which are BELOW
// MG_Remote - can reach it without learning that a session exists; the implementation in
// PipeFill.cpp is one forward to ClientSession::Finish. A no-op with no live session, on a
// monolith transport, and on a lockstep one (there the client waited out every command it
// issued before it could reach the call).
void MGPipeClientFinish();
#endif
void MGPipeEmitResourceCreate(MG_State::GLState::BufferObject& buffer);
+30 -1
View File
@@ -287,12 +287,41 @@ namespace MobileGL::MG_Pipe {
}
// ---- resources ---------------------------------------------------------------------
// P5e (ra), CONTRACT-P5E §2.5 / ruling 15 (ID-93): DOES THIS SUB-DATA RECORD WANT ITS
// ANSWER? One predicate, two callers - this route and the wire emit table - because the
// route cannot pass a flag through the thunk (the call table's signature is the
// catalogue's) and two hand-written copies of "is this the buffer half" is exactly the
// drift that would make the client wait for an answer the emitter told the server not to
// bother with, or read a slot that was never posted.
//
// THE BUFFER HALF DOES NOT: its Bool is discarded at the only call site there is
// (MGPipeEmitResourceSubData), and because the row carries kReplySlot the client used to
// wait for it anyway - one full round trip per 64 KB persistent-map block, whose answer
// nobody looked at. THE TEXTURE HALF DOES: DrainTextureSubData clears the level's dirty
// flag on an ACCEPTED reply, so its answer is load-bearing (D-D5; making that half
// fire-and-forget is a trailing item, not this package's).
//
// The test is MGPSubData::Target == kMGPipeResourceTargetBuffer, whole field, which is the
// invariant MGPipeTypes.h asserts beside the packer and which the applier's own
// SubDataNamesABuffer already reads.
inline Bool MGPipeSubDataWantsItsReply(const MGPSubData& record) {
return record.Target != kMGPipeResourceTargetBuffer;
}
inline Bool MGPipeRouteResourceSubData(const MGPSubData& record, const void* bytes,
Uint64 byteCount,
const MGPSubRegion* regions = nullptr) {
// THE SLOT IS STILL MINTED AND STILL TAKEN, even for the buffer half. The row keeps
// kReplySlot on the wire, the server still posts, and the mailbox's "every minted slot
// is taken" rule is what the next row's ReplyOverrun Fatal is looking for - so the
// half that does not WAIT still has to collect. What changes is that under run-ahead
// the emit table publishes and returns, and the answer it collects is the emitter's
// accept-by-construction rather than the server's.
MGPReplySlot reply = MGPipeMintReplySlot();
MGP_ResourceSubData(&record, bytes, byteCount, regions, record.RegionCount, &reply);
return MGPipeTakeReplyBool(reply, "resource_subdata");
const Bool accepted = MGPipeTakeReplyBool(reply, "resource_subdata");
return MGPipeSubDataWantsItsReply(record) ? accepted : true;
}
inline void MGPipeRouteBufferSubDataResident(const MGPSubData& record, const void* bytes,
Uint64 byteCount) {