Completion markers assume command lists run in recording order

未关闭
#64 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
15/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
cpp

调研方向

Start from clean/rr_f/runtime/src/rr_runtime.cpp around marker_done (:496), pump (:505) and the slot wait (:2570), then look at the transient and arena release paths at :3448 and :3544. The fix is a design choice between a per-recording marker ring and documenting the submit-order contract. Done means the WARP test that records lists A (serial 1) and B (serial 2), runs only B, and asserts serial 1 is not done passes.

由索引模型根据 Issue 内容生成。

描述

area: ray-reconstruction area: runtime enhancement needs-hardware-test

What happens

Both runtimes use one scalar completion marker and treat "marker observed >= s" as "every recording up to s is done". The marker is written by the recorded list, so this only holds if lists execute in the order they were recorded.

  • RR: clean/rr_f/runtime/src/rr_runtime.cpp:496 (marker_done), pump (:505), slot wait (:2570), frame marker (:3408), transient marker (:3525).
  • Model M: clean/runtime/device_d3d12.cpp:400 (end_external), :421 (external_done), :996 (wait_external).

Model M: the marker belongs to one device, so to one context. If one context's frames ran out of order, its temporal history would already be wrong, so this is not a case that matters in practice.

RR: the marker is runtime-wide (rt.marker, rt.serial) and shared by every instance and by transient copies. If instance B's list runs before instance A's earlier list, B's serial covers A's outstanding work, and defer_release of A's old arena (:3448) or of a transient (:3544) can release early. Out-of-order execution can also move the marker backwards, because the lower serial is written last. That causes slot-wait timeouts (:2572) and failed frames rather than a use-after-free.

When it can happen

Rarely. A use-after-free needs several RR instances (for example two viewports) with lists submitted out of order or on different queues, and an arena regrow, resize or transient release inside that window. Transient copies recorded on a list that is submitted after the evaluate list already break the data dependency.

Found by reading the code. It has not been reproduced.

To do

This is a design discussion. Options:

  • Replace the single maximum with a per-recording marker ring. The readback buffer is 256 bytes, so 64 dwords. Each recording writes its serial into dword s % N, and recording s is done when that dword equals s (low 32 bits) or a later serial that maps to the same dword. Bound the recordings in flight to N; the slot waits already bound this. Wrap handling needs care.
  • Or document the contract: one RR instance at a time, or submit in recording order.

Test

WARP. Record list A (serial 1), then list B (serial 2), using only WriteBufferImmediate. Execute B alone and wait for the queue. Assert that "serial 1 done" is false. This fails today and would pass with the ring.

Related: #63, #62, #65.

主要语言
C++
星标
12
派生
2
平均合并
3 小时 10 分钟
30 天内合并 PR
171

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

phantoslayer21/wronggpu 的其他 Issue

查看 phantoslayer21/wronggpu 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。