mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-16 22:43:24 +09:00
[Perf] (MG_Pipe, MG_Remote/Client): a texture respecify for a CONFIRMED object stops waiting - the row pays its round trip once, at first use - and the frame drops from 130.9 s to 31.3 s
- The predicate is one function again: MGPipeResourceRespecifyWantsItsReply (PipeRoute.h) is read by the wire emitter, so the two halves of this row cannot disagree about whether an answer is owed. The buffer half never owes one (both call sites discard the Bool, PipeFill.cpp:1105/:1142); the texture half owes one exactly until MGPipeHandleIsPublished, and that latch is set only by an ACCEPTED create - which EmitResourceRespecify already sends, blocking, when it is clear (TextureEmit.h:869-879). So the object pays once, at first use, and every record after it is fire-and-forget. - MEASURED on the device, same frame, same 101,421,396 B staged, stock power policy: waits 25,154 -> 4,543 and wall 130.9 s -> 31.3 s. The op split is the proof of what changed and what did not: waits by_op 3=20611 -> absent (only 2=4536, 5=6, 9=1 remain), while the RECORDS sent are unchanged - frame-sent still shows 3=20633 and 103,094 records total. The round trips went away; the work did not. - It also lands on an independent prediction: an audit run beside this work (mgl-device/scratch/ scheme-review.md) computed 4,543 remaining waits and a 24-37 s credible range (midpoint ~30 s) from the archived logs, a host-inproc round trip of 35.4 us and a measured 43.1 MiB/s link. Measured: 31.3 s, at the midpoint. - Cumulative on that frame since this work started: 43,232 waits / 221.5 s -> 4,543 / 31.3 s (7.1x). What is left is the create row (4,536 waits, ~23 s) - the confirmation itself, not waste - plus hard floors of ~13.4 s client CPU and ~2.2 s of transfer. Going below that means batching the create row, which keeps real answers. - TWO DEBTS, STATED: (1) the invalidation guard for the one silent-loss case is NOT wired; the audit confirmed independently that no production path can drop a texture record today, and if one appears the notice it needs is protocol-surface (a tenth reverse callback). (2) No SSIM or visual check has been taken since these rows stopped asking - frame-sent agreement is strong evidence but it is not a picture. - Two stale controls in older cases were fixed rather than left: the item-B gate now names the CREATE row (its old total-based control only moved because a respecify was still waiting), and the by-op measurement asserts records-sent for the rows that deliberately stopped waiting. RemoteClientTest 169/169; red-once for the predicate is forcing it back to "always wait".
This commit is contained in:
@@ -219,6 +219,29 @@ create 被拒 → 闩不置位 → 下一条参数记录照样阻塞取真答案
|
||||
**下一个 20,633**:`ResourceRespecify` 仍逐条等(在 frame 25 里占 20,633/25,176 = 82%)。它与 params 同形(答案只用于 `NoteRespecified` 与自愈),
|
||||
"对象已确认"这个前提同样成立——按同一条规则处理,估算落在 **~4.5k waits ≈ 24 s** 量级(create 那 4,536 是确认本身,应当保留)。
|
||||
### 2.12 `ResourceRespecify` 的两半根本不同:buffer 是白送的,texture 才是那 20,611按"已确认对象不再等"处理这一行时,代码里两半的差别是决定性的:- **buffer 半**:`PipeFill.cpp:1105` 与 `:1142` **两处都把返回值丢掉**(`MGPipeRouteResourceRespecify(desc, nullptr);`), 所以那条等待买到的值当场被扔——改 fire-and-forget 是**纯收益、语义零变化**。- **texture 半**:返回值既是自愈触发器,又是**验收镜像 `LastDesc` 的闸**, `TextureEmit.h:885-888` 明写不许在未确认的答案上前进(ID-18 M3:否则下一次相同调用会被去重掉,而服务端从没存过)。于是本轮只落 buffer 半(提交见下),并用它把两半的占比量了出来——**同一帧的 `by_op`**:| | waits | `by_op` ||---|---|---|| 只做了 params(frame 25) | 25,176 | `2=4536, `**`3=20633`**`, 5=6, 9=1` || 再放开 buffer 半(frame 10) | **25,154** | `2=4536, `**`3=20611`**`, 5=6, 9=1` |**buffer 半只值 22 次等待(0.1%)——20,633 里几乎全是 texture respecify**,也就是带 ID-18 M3 约束的那一半。墙钟 134.4 s → 130.9 s(同一帧、同样 101,421,396 B staged)。**texture 半的正解(下一步,尚未实现)**:让镜像**只在真答案上前进**——fire-and-forget 之后 `NoteRespecified` 收 `accepted && !provisional`,于是最坏情况退化成"多补发一条相同 respecify"(安全方向),而绝不会变成"该重发的被去重掉"。这需要在 MG_Pipe 的回复信箱上把"临时接受"和"真接受"分开(信箱本来就有"最后一次调用"的纪律,`MGPipeTakeReplyBool` 就是这么读的),改动落在 route/mailbox + `EmitResourceRespecify` 一处判断。按同一模型估算:**25,154 → ~4.5k waits ≈ 24 s 量级**(create 那 4,536 是确认本身)。
|
||||
### 2.13 R3 落地:texture respecify 也只在首次使用时付一次——那一帧 130.9 s → 31.3 s
|
||||
|
||||
实现:把"这一行要不要等"做成**唯一一处**判据 `MGPipeResourceRespecifyWantsItsReply`(`MG_Pipe/PipeRoute.h`),wire 端读它决定要不要开回复槽:
|
||||
buffer 半永远不等(两处返回值都被丢弃);texture 半只在**对象未确认**时等(`MGPipeHandleIsPublished` 为假),确认本身由 `EmitResourceRespecify` 在首次使用时补的那次**阻塞 create** 付掉。
|
||||
|
||||
同一台设备、同一份工作量(staged **101,421,396 B**,与改动前逐字节相同)、出厂省电、服务端 spin 默认:
|
||||
|
||||
| | 那一帧 waits | `by_op`(等待) | `by_op`(发出的记录) | 墙钟 |
|
||||
|---|---|---|---|---|
|
||||
| R1+R2 之后 | 25,154 | `2=4536, 3=20611, 5=6, 9=1` | `2=4536, 3=20633, …` 共 103,088 | 130.9 s |
|
||||
| **R3 之后** | **4,543** | `2=4536, 5=6, 9=1` | `2=4536, `**`3=20633`**`, …` 共 **103,094** | **31.3 s** |
|
||||
|
||||
**respecify 那 20,633 条记录一条没少(照发),少的是它们各自的那次往返**——这正是这条路线与"少干活"的区别。
|
||||
独立审查给的预测是"4,543 waits、24–37 s(中点 ~30 s)",实测 **31.3 s**,落在中点。
|
||||
|
||||
**累计(同一帧)**:43,232 waits / 221.5 s → **4,543 waits / 31.3 s**(7.1×)。剩下的是 create 那 4,536 次等待 ≈ 23 s,
|
||||
那是确认本身,不是浪费;硬地板还有客户端 CPU ~13.4 s 与传输 ~2.2 s(审查实测 43.1 MiB/s)。**想再往下只剩"批处理 create 行"**(4,536 → ~1.1k,且仍拿真答案)。
|
||||
|
||||
**两笔明账**:
|
||||
1. **① 的守卫尚未接**:审查独立复核"今天不可达"(能清纹理记录的只有 `MGPipeApplierReleaseObjectRecords`,调用者只有测试;`MGPipeApplierReset` 不清它)。
|
||||
接管时**优先查能否挂在 caps 代次/会话边界这类已有信号上**(一行);否则要新增反向通道第 10 个回调 = 协议面 = 两端重出 APK。
|
||||
2. **画面未验**:这条路线改的是"客户端还问不问",`frame-sent` 一致是强证据但不是画面证据;R3 之后应补一次 SSIM/目视。
|
||||
|
||||
## 3. 剩余(下一轮的直接入口)
|
||||
|
||||
1. **把记录数压下来(新的头号项)**。§2.5 的真机数字说:那一帧剩下的 43,232 次等待全在「必须等」的三条 row 上,
|
||||
|
||||
Reference in New Issue
Block a user