[MG_Backend, MG_Pipe, MG_Impl, Docs] (Disaggregated): P5e ra2 ID-136 - retire the indirect-binding pull instead of escalating for it, and withdraw escalation (iii)

- TOUCHING mv's FILE UNDER ID-136, deliberately and by ruling: MG_Backend/DirectGLES/
  MultiDraw.cpp is mv's per ID-113, and the integrator overrode that boundary for this one
  change because the two halves must not exist apart on any head. The boundary has not drifted.
- BoundDrawIndirectBufferId (MultiDraw.cpp) gets the handle arm its neighbour
  ResolveBoundIndexBuffer already had, in mv's own idiom rather than a second one beside it:
  the arm is `MG_Config::Transport != Monolith`, STATED (ID-81) and never inferred from a null
  handle (ID-110); a null handle is "this verb bound no indirect buffer", the same 0 the
  monolith arm returns for an empty slot; a missing backend resource is the named refusal
  Fatal{RoleViolation, "multidraw-indirect-buffer-arm"}, a sibling of mv's
  RefuseMissingIndexBufferRecord, never a quiet fall-back to the frontend. The monolith body
  below it is unchanged token for token. The function moved down beside BoundIndexBufferId,
  which is the same question about the other target.
- WHY A HANDLE ARM AND NOT A MIGRATION: the tier never reads a byte of the client's indirect
  buffer. It binds its OWN scratch command buffer and wants to put back the name that was
  there - a save/restore. 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
  MGPipeApplier().VerbIndirectBuffer and nothing else, so "what was bound" IS "what the verb's
  record named".
- Escalation (iii) withdrawn in the same commit - MGPipeBarriered's clause, the client's
  verb-keyed half in ClientVerbIsBarriered, and the contract row. It was never wrong, it was
  the wrong instrument: there is one draw opcode and the tier is chosen server-side per batch,
  so the narrowest key both roles could compute charged EVERY plain glMultiDraw* on the
  auto -> ext default - a per-batch rendezvous on the arm the phone ships, added to make a lane
  green. THE CHECK ON AN ESCALATION IS "WHICH ARM PAYS FOR IT", NOT "WHICH LANE GOES GREEN";
  the rule is recorded in PipeApply.h beside the three that remain and in CONTRACT-P5E §2.1.
- Red-once D: `if (false && ...)` on the new arm and the entry dies 3/3, deterministically, on
  `Fatal{UnmigratedPipeInput, "GetBufferBindingSlot@DrawArrays"} [BARRIER-PULLED, UNBARRIERED,
  the client did not fill it, retires in P8 (indirect), P9 (readback), P13 (transfer)]`.
  Its counterpart is this head itself: the escalation is GONE and the lane is green, so nothing
  needed it - and the strict census's admitted set drops from nine rows back to ID-128's eight,
  because the pull no longer happens at all rather than being legalised.
- Gate on the flipped head: unit 2256/2256, isplit 179/179, gens rc=0, lane counts unchanged
  (179 / 1357 / 2 / 2).
This commit is contained in:
2026-09-18 14:10:04 -04:00
parent f286548010
commit efe58eac14
5 changed files with 132 additions and 88 deletions
+19 -25
View File
@@ -3015,33 +3015,27 @@ namespace MobileGL::MG_Pipe {
if (op == MGPWireOp::DrawVbo && payload != nullptr) {
const auto& draw = *static_cast<const MGPDrawInfo*>(payload);
if ((draw.Flags & static_cast<Uint8>(kDrawClientArrays)) != 0) return true;
// 4. Escalation (iii), ID-133: a PLAIN multi-draw - NumDraws > 1 and not indirect.
// Espryt's multi-draw tiers are chosen on the SERVER and per batch
// (MultiDraw.cpp's ResolveTierForBatch), and the two indirect tiers reach
// MultiDrawImpl::RunIndirect, whose apply still reads the client's
// GL_DRAW_INDIRECT_BUFFER binding slot (BoundDrawIndirectBufferId, :87). That
// is a BARRIER_PULLED field whose retiring phase is P8, so under run-ahead an
// unbarriered record reading it is `Fatal{UnmigratedPipeInput,
// "GetBufferBindingSlot@DrawArrays"}` - 18 lane entries on the two tier lanes.
// ---- ESCALATION (iii) WAS HERE AND IS WITHDRAWN (P5e ra2, ID-133 then ID-136) ---
//
// WHY THE KEY IS THE RECORD AND NOT THE TIER, which is the thing a reader will
// want to check: there is exactly ONE draw opcode. Every one of the twenty draw
// entry points collapses onto draw_vbo (MGPDrawInfo's header says so), and the
// tier is resolved on the server, per batch, from driver caps the client does
// not hold - so "escalate the indirect multi-draw op" has no op to name and no
// predicate both roles could compute. NumDraws > 1 is the narrowest wire fact
// that CONTAINS the reaching set: RunIndirect is reachable only from
// DrawElementsBatch, which only a multi-draw record enters.
// ID-133 escalated a PLAIN multi-draw (`NumDraws > 1 && !kDrawIsIndirect`) so that
// MultiDrawImpl::RunIndirect's read of the client's GL_DRAW_INDIRECT_BUFFER binding
// became a legal barriered pull instead of an unbarriered Fatal. It worked, and it
// cost a rendezvous on EVERY plain glMultiDraw* on the DEFAULT tier: there is one
// draw opcode - all twenty entry points collapse onto draw_vbo - and the tier is
// chosen on the server per batch (MultiDraw.cpp's ResolveTierForBatch), so no
// predicate both roles can compute names the arm that actually needed it.
//
// AND kDrawIsIndirect IS EXCLUDED, which is what keeps Sodium's draw call out of
// it: a genuinely indirect record carries its buffer as a handle in the second
// tail and its apply resolves from that (ResolveIndirectCommandBytes' split
// arm), so it pulls nothing and needs no wait. NumDraws is 0 there, so the test
// is written `> 1` and the flag test is belt to that brace - both are stated
// because the reason each holds is different.
if (draw.NumDraws > 1 && (draw.Flags & static_cast<Uint8>(kDrawIsIndirect)) == 0) {
return true;
}
// THE CHECK ON AN ESCALATION IS "WHICH ARM PAYS FOR IT", NOT "WHICH LANE GOES
// GREEN", and that is the rule this pair of rulings exists to record. The read was
// a save/restore of a GL binding NAME around the tier's own scratch buffer, not a
// data dependency, so the answer was to ask the side that did the binding:
// BoundDrawIndirectBufferId now takes the handle arm its neighbour
// ResolveBoundIndexBuffer already had, and the pull is GONE rather than legalised.
//
// Both halves landed in ONE commit on purpose: the pull retired without this clause
// withdrawn is a cost with no reason, and this clause withdrawn without the pull
// retired puts 18 lane entries back on the unbarriered arm. Neither is a state to
// gate or to measure, so neither was ever a head.
}
return false;
}
+10 -5
View File
@@ -916,13 +916,18 @@ namespace MobileGL::MG_Pipe {
// 1. MGPipeWaitClassFor(op) != kWaitNone the static column (§2.2)
// 2. kCtxVerb with an open transform-feedback span escalation (i): XFB stays lockstep
// 3. draw_vbo carrying kDrawClientArrays escalation (ii): client vertex arrays
// 4. draw_vbo with NumDraws > 1 and NOT indirect escalation (iii): plain multi-draw
//
// NO OTHER RUNTIME ESCALATION EXISTS. Adding one is an integrator ruling and a row in the
// contract, not a condition somebody adds at a call site - because a fifth clause that only
// one side computes is the same silent failure one level down. (iii) is ID-133's, and
// ID-118's precedent is the one it follows: move the record into a barriered class rather
// than special-case the field its apply still pulls.
// contract, not a condition somebody adds at a call site - because a fourth clause that only
// one side computes is the same silent failure one level down.
//
// THERE WAS AN ESCALATION (iii) AND IT WAS WITHDRAWN, which is worth a line here rather than
// only in the history: ID-133 barriered a plain multi-draw to legalise a pull in Espryt's
// indirect multi-draw tier, ID-136 retired the pull instead (MultiDraw.cpp's
// BoundDrawIndirectBufferId) and took the clause back out. The rule it leaves behind is the
// one to apply to the next candidate: ask WHICH ARM PAYS for an escalation, not which lane
// it turns green - (iii) was keyed on the only wire fact available and therefore charged the
// default tier for a read only two opt-in tiers made.
//
// Escalation (ii) is a REFUSAL under run-ahead (§5.1), so on a run-ahead server it never
// reaches the sink at all; it is here so the predicate is TOTAL and so the lockstep arm,