[Perf] (MG_Remote/Client): the buffer half of resource_respecify stops waiting - its answer is discarded at both call sites - and the measurement says the texture half is where the other 20,611 waits live

- The two halves of this row are not the same row. PipeFill.cpp:1105 and :1142 both call
  MGPipeRouteResourceRespecify(desc, nullptr) and drop the Bool, so for a buffer the wait bought a
  value that was thrown away. It goes fire-and-forget with the provisional-accept shape
  resource_subdata has had since item B.
- The texture half keeps its answer ON PURPOSE: there the Bool is the self-heal trigger AND the
  gate on the acceptance mirror, and TextureEmit.h:885-888 (ID-18 M3) says advancing that mirror on
  an unconfirmed answer is how the next identical call gets suppressed "against a record that was
  never stored". That half needs the provisional/really-accepted distinction plumbed through the
  reply mailbox before it can stop waiting; it is not a flag flip.
- MEASURED, same frame, same 101,421,396 B staged: waits 25,176 -> 25,154 and by_op 3=20633 ->
  3=20611. So the buffer half is worth 22 waits (0.1%) and the remaining 20,611 are texture
  respecifies - which is what says the next step is the mirror design, not another flag. Wall
  134.4 s -> 130.9 s.
- The ERROR-is-not-a-decline case moves to the texture half: a row that reads no answer cannot fold
  ERROR into a decision, so the rule it exists for belongs to the half that still waits (the
  transport fault is caught at the next row that does). New case
  ABufferRespecifyTakesNoReplyWhileATextureOneStillDoes pins both directions; red-once with the
  branch removed is exit 155. RemoteClientTest 169/169.
This commit is contained in:
BZLZHH
2026-09-25 22:53:38 +08:00
parent 5ad8370b37
commit f2b55b9d2d
3 changed files with 86 additions and 6 deletions
+28 -5
View File
@@ -470,11 +470,34 @@ namespace MobileGL::MG_Remote::Client {
} else {
MG_Pipe::MGPipeClearRespecifiedLevel(record);
}
Int32 status = 0;
const Uint64 seq =
session.EmitAndWait(MGPWireOp::ResourceRespecify, &record, sizeof(record), nullptr,
0, nullptr, 0, &status);
(void)seq;
// P12: THE BUFFER HALF'S ANSWER IS READ BY NOBODY. Both call sites discard this
// record's Bool outright (PipeFill.cpp:1105 and :1142: `MGPipeRouteResourceRespecify(
// desc, nullptr);`), so for a buffer the wait buys a value that is thrown away - pure
// cost, and on the device run this row was the second largest source of round trips in
// the frame. It goes fire-and-forget, with the same provisional-accept shape
// resource_subdata has had since item B.
//
// THE TEXTURE HALF KEEPS ITS ANSWER, and that is deliberate rather than left over:
// there the Bool is the self-heal trigger AND the gate on the acceptance mirror, and
// advancing that mirror on an answer nobody waited for is exactly ID-18 M3
// (TextureEmit.h:885-888: "a refused respecify must leave LastDesc naming the
// descriptor that actually landed, or the next identical call is suppressed against a
// record that was never stored"). A texture respecify still waits until that mirror
// can be advanced on something better than a provisional accept.
const Bool bufferHalf =
static_cast<MG_Pipe::MGPipeResourceTarget>(record.Target) ==
MG_Pipe::MGPipeResourceTarget::Buffer;
Int32 status = Wire::ReplySink::kStatusError;
if (bufferHalf) {
const Uint64 seq = session.EmitAndWaitTails(
MGPWireOp::ResourceRespecify, &record, sizeof(record), nullptr, 0, nullptr, 0,
&status, nullptr, /*wantReply=*/false);
status = seq == Wire::kInvalidSeq ? Wire::ReplySink::kStatusDeclined
: Wire::ReplySink::kStatusOk;
} else {
(void)session.EmitAndWait(MGPWireOp::ResourceRespecify, &record, sizeof(record),
nullptr, 0, nullptr, 0, &status);
}
++g_emitted;
// ERROR IS NOT A DECLINE (M4 / codex 5 / R-5). status is 0 OK / 1 DECLINED / 2 ERROR;
// an escape may not fold 2 into `false`, which is what a bare `return status == 0`