GPU: shared title-memory directory can expose copies not prepared by closed command lists #937

Open
opened 2026-11-26 03:54:13 +00:00 by github-bot · 1 comment
Owner

@⁠FunWithFlagsDev on GitHub · 2026-11-25 13:14 UTC · original

<html>

Problem

While reviewing #916 and the existing title-memory synchronization improvements in #205 and #370, I identified a potential coverage gap that remains after command-list recording.

Reviewed against main at 0b0074e0.

The title-memory directory is shared globally, whereas descriptor installation is tracked separately for each host heap and refresh/write declarations are registered per command list.

A newly published directory entry can therefore become visible to a previously closed command list whose corresponding descriptor or memory coverage has not been prepared.

Minimal counterexample

  1. Command list A records a raw-address dispatch using heap H1 and closes.

  2. Command list B records using heap H2 and publishes a new numbered copy in the shared directory.

  3. B installs the corresponding descriptor in H2 but does not need to execute.

  4. A is submitted and its shader resolves an address through the newly published directory entry.

  5. H1's corresponding descriptor has not necessarily been installed, and A lacks the relevant refresh/write declarations.

With a shared heap, the descriptor may exist while refresh and write-back coverage remains absent.

This scenario does not require concurrent GPU execution.

Relevant source

Relationship to existing work

  • #205 and #370 improve coverage across successive recording-time calls.

  • #589 addresses heap identity reuse.

  • #916 reduces unnecessary write declarations.

The proposed investigation is complementary: a closed list may have no further recording-time calls before execution.

Possible direction

Instead of immediately publishing newly discovered mappings into the GPU-visible directory:

  • Maintain a CPU-side authoritative directory and incremental journal.

  • Reconcile descriptor, refresh and write coverage during submission preparation.

  • Publish directory deltas in GPU queue order, before the commands that consume them.

  • Preserve resource and staging lifetimes until GPU completion.

The existing directory occupies 16 MiB. Incremental publication could avoid duplicating it for every command list.

Submission-time reconciliation alone would not protect against subsequent unsynchronized publication.

Synthetic verification

The attached Python model evaluates 16 deliberately constructed scenarios per policy.

Policy | Descriptor or coverage inconsistencies -- | -- Recording-time preparation | 12 Submission-time reconciliation only | 8 Queue-ordered delta publication | 0

All eight regression tests pass.

The last policy still permits controlled missing-page accesses when discovery occurs after preparation. It does not establish complete memory correctness or recovery of dropped writes.

The archive also describes a proposed native regression using synthetic shaders, valid sentinel descriptors, separate heaps and controlled queue ordering.

Limitations

This is a source-level correctness investigation and an abstract protocol model. No native Rust compilation, WARP execution, hardware validation or title-performance measurements were performed.

I have not established that this mechanism causes any particular gameplay failure.

Attachment: fx_memory_epoch_v3.zip

AI-assisted source review and synthetic verification. No game files or proprietary assets were used.

</html>## Problem

While reviewing #916 and the existing title-memory synchronization improvements in #205 and #370, I identified a potential coverage gap that remains after command-list recording.

Reviewed against main at 0b0074e0.

The title-memory directory is shared globally, whereas descriptor installation is tracked separately for each host heap and refresh/write declarations are registered per command list.

A newly published directory entry can therefore become visible to a previously closed command list whose corresponding descriptor or memory coverage has not been prepared.

Minimal counterexample

  1. Command list A records a raw-address dispatch using heap H1 and closes.
  2. Command list B records using heap H2 and publishes a new numbered copy in the shared directory.
  3. B installs the corresponding descriptor in H2 but does not need to execute.
  4. A is submitted and its shader resolves an address through the newly published directory entry.
  5. H1's corresponding descriptor has not necessarily been installed, and A lacks the relevant refresh/write declarations.

With a shared heap, the descriptor may exist while refresh and write-back coverage remains absent.

This scenario does not require concurrent GPU execution.

Relevant source

Relationship to existing work

  • #205 and #370 improve coverage across successive recording-time calls.
  • #589 addresses heap identity reuse.
  • #916 reduces unnecessary write declarations.

The proposed investigation is complementary: a closed list may have no further recording-time calls before execution.

Possible direction

Instead of immediately publishing newly discovered mappings into the GPU-visible directory:

  • Maintain a CPU-side authoritative directory and incremental journal.
  • Reconcile descriptor, refresh and write coverage during submission preparation.
  • Publish directory deltas in GPU queue order, before the commands that consume them.
  • Preserve resource and staging lifetimes until GPU completion.

The existing directory occupies 16 MiB. Incremental publication could avoid duplicating it for every command list.

Submission-time reconciliation alone would not protect against subsequent unsynchronized publication.

Synthetic verification

The attached Python model evaluates 16 deliberately constructed scenarios per policy.

Policy Descriptor or coverage inconsistencies
Recording-time preparation 12
Submission-time reconciliation only 8
Queue-ordered delta publication 0

All eight regression tests pass.

The last policy still permits controlled missing-page accesses when discovery occurs after preparation. It does not establish complete memory correctness or recovery of dropped writes.

The archive also describes a proposed native regression using synthetic shaders, valid sentinel descriptors, separate heaps and controlled queue ordering.

Limitations

This is a source-level correctness investigation and an abstract protocol model. No native Rust compilation, WARP execution, hardware validation or title-performance measurements were performed.

I have not established that this mechanism causes any particular gameplay failure.

Attachment: fx_memory_epoch_v3.zip

fx_memory_epoch_v3.zip

**@⁠FunWithFlagsDev** on GitHub · 2026-11-25 13:14 UTC · [original](https://github.com/fxceless/victory-fork/issues/937) <html> <body> <!--StartFragment--><h2><span>Problem</span></h2><p><span>While reviewing #916 and the existing title-memory synchronization improvements in #205 and #370, I identified a potential coverage gap that remains after command-list recording.</span></p><p><span>Reviewed against </span><code><span>main</span></code><span> at </span><code><span>0b0074e0</span></code><span>.</span></p><p><span>The title-memory directory is shared globally, whereas descriptor installation is tracked separately for each host heap and refresh/write declarations are registered per command list.</span></p><p><span>A newly published directory entry can therefore become visible to a previously closed command list whose corresponding descriptor or memory coverage has not been prepared.</span></p><h2><span>Minimal counterexample</span></h2><ol start="1"><li><p><span>Command list A records a raw-address dispatch using heap H1 and closes.</span></p></li><li><p><span>Command list B records using heap H2 and publishes a new numbered copy in the shared directory.</span></p></li><li><p><span>B installs the corresponding descriptor in H2 but does not need to execute.</span></p></li><li><p><span>A is submitted and its shader resolves an address through the newly published directory entry.</span></p></li><li><p><span>H1's corresponding descriptor has not necessarily been installed, and A lacks the relevant refresh/write declarations.</span></p></li></ol><p><span>With a shared heap, the descriptor may exist while refresh and write-back coverage remains absent.</span></p><p><span>This scenario does not require concurrent GPU execution.</span></p><h2><span>Relevant source</span></h2><ul><li><p><a href="https://github.com/fxceless/victory-fork/blob/0b0074e0/crates/victory-gpu/src/memory.rs#L119-L195"><span>Global directory publication</span></a></p></li><li><p><a href="https://github.com/fxceless/victory-fork/blob/0b0074e0/crates/victory-gpu/src/memory.rs#L242-L320"><span>Per-heap descriptor installation and recording-time coverage</span></a></p></li><li><p><a href="https://github.com/fxceless/victory-fork/blob/0b0074e0/crates/victory-shader/src/emit/lower.rs#L2797-L2862"><span>Shader-side directory lookup</span></a></p></li><li><p><a href="https://github.com/fxceless/victory-fork/blob/0b0074e0/crates/victory-gpu/src/host.rs#L5340-L5439"><span>Submission preparation</span></a></p></li></ul><h2><span>Relationship to existing work</span></h2><ul><li><p><span>#205 and #370 improve coverage across successive recording-time calls.</span></p></li><li><p><span>#589 addresses heap identity reuse.</span></p></li><li><p><span>#916 reduces unnecessary write declarations.</span></p></li></ul><p><span>The proposed investigation is complementary: a closed list may have no further recording-time calls before execution.</span></p><h2><span>Possible direction</span></h2><p><span>Instead of immediately publishing newly discovered mappings into the GPU-visible directory:</span></p><ul><li><p><span>Maintain a CPU-side authoritative directory and incremental journal.</span></p></li><li><p><span>Reconcile descriptor, refresh and write coverage during submission preparation.</span></p></li><li><p><span>Publish directory deltas in GPU queue order, before the commands that consume them.</span></p></li><li><p><span>Preserve resource and staging lifetimes until GPU completion.</span></p></li></ul><p><span>The existing directory occupies 16 MiB. Incremental publication could avoid duplicating it for every command list.</span></p><p><span>Submission-time reconciliation alone would not protect against subsequent unsynchronized publication.</span></p><h2><span>Synthetic verification</span></h2><p><span>The attached Python model evaluates 16 deliberately constructed scenarios per policy.</span></p> Policy | Descriptor or coverage inconsistencies -- | -- Recording-time preparation | 12 Submission-time reconciliation only | 8 Queue-ordered delta publication | 0 <p><span>All eight regression tests pass.</span></p><p><span>The last policy still permits controlled missing-page accesses when discovery occurs after preparation. It does not establish complete memory correctness or recovery of dropped writes.</span></p><p><span>The archive also describes a proposed native regression using synthetic shaders, valid sentinel descriptors, separate heaps and controlled queue ordering.</span></p><h2><span>Limitations</span></h2><p><span>This is a source-level correctness investigation and an abstract protocol model. No native Rust compilation, WARP execution, hardware validation or title-performance measurements were performed.</span></p><p><span>I have not established that this mechanism causes any particular gameplay failure.</span></p><p><span>Attachment: </span><code><span>fx_memory_epoch_v3.zip</span></code></p><p><span>AI-assisted source review and synthetic verification. No game files or proprietary assets were used.</span></p><!--EndFragment--> </body> </html>## Problem While reviewing #916 and the existing title-memory synchronization improvements in #205 and #370, I identified a potential coverage gap that remains after command-list recording. Reviewed against `main` at `0b0074e0`. The title-memory directory is shared globally, whereas descriptor installation is tracked separately for each host heap and refresh/write declarations are registered per command list. A newly published directory entry can therefore become visible to a previously closed command list whose corresponding descriptor or memory coverage has not been prepared. ## Minimal counterexample 1. Command list A records a raw-address dispatch using heap H1 and closes. 2. Command list B records using heap H2 and publishes a new numbered copy in the shared directory. 3. B installs the corresponding descriptor in H2 but does not need to execute. 4. A is submitted and its shader resolves an address through the newly published directory entry. 5. H1's corresponding descriptor has not necessarily been installed, and A lacks the relevant refresh/write declarations. With a shared heap, the descriptor may exist while refresh and write-back coverage remains absent. This scenario does not require concurrent GPU execution. ## Relevant source - [[Global directory publication](https://github.com/fxceless/victory-fork/blob/0b0074e0/crates/victory-gpu/src/memory.rs#L119-L195)](https://github.com/fxceless/victory-fork/blob/0b0074e0/crates/victory-gpu/src/memory.rs#L119-L195) - [[Per-heap descriptor installation and recording-time coverage](https://github.com/fxceless/victory-fork/blob/0b0074e0/crates/victory-gpu/src/memory.rs#L242-L320)](https://github.com/fxceless/victory-fork/blob/0b0074e0/crates/victory-gpu/src/memory.rs#L242-L320) - [[Shader-side directory lookup](https://github.com/fxceless/victory-fork/blob/0b0074e0/crates/victory-shader/src/emit/lower.rs#L2797-L2862)](https://github.com/fxceless/victory-fork/blob/0b0074e0/crates/victory-shader/src/emit/lower.rs#L2797-L2862) - [[Submission preparation](https://github.com/fxceless/victory-fork/blob/0b0074e0/crates/victory-gpu/src/host.rs#L5340-L5439)](https://github.com/fxceless/victory-fork/blob/0b0074e0/crates/victory-gpu/src/host.rs#L5340-L5439) ## Relationship to existing work - #205 and #370 improve coverage across successive recording-time calls. - #589 addresses heap identity reuse. - #916 reduces unnecessary write declarations. The proposed investigation is complementary: a closed list may have no further recording-time calls before execution. ## Possible direction Instead of immediately publishing newly discovered mappings into the GPU-visible directory: - Maintain a CPU-side authoritative directory and incremental journal. - Reconcile descriptor, refresh and write coverage during submission preparation. - Publish directory deltas in GPU queue order, before the commands that consume them. - Preserve resource and staging lifetimes until GPU completion. The existing directory occupies 16 MiB. Incremental publication could avoid duplicating it for every command list. Submission-time reconciliation alone would not protect against subsequent unsynchronized publication. ## Synthetic verification The attached Python model evaluates 16 deliberately constructed scenarios per policy. | Policy | Descriptor or coverage inconsistencies | |---|---:| | Recording-time preparation | 12 | | Submission-time reconciliation only | 8 | | Queue-ordered delta publication | 0 | All eight regression tests pass. The last policy still permits controlled missing-page accesses when discovery occurs after preparation. It does not establish complete memory correctness or recovery of dropped writes. The archive also describes a proposed native regression using synthetic shaders, valid sentinel descriptors, separate heaps and controlled queue ordering. ## Limitations This is a source-level correctness investigation and an abstract protocol model. No native Rust compilation, WARP execution, hardware validation or title-performance measurements were performed. I have not established that this mechanism causes any particular gameplay failure. Attachment: `fx_memory_epoch_v3.zip` [fx_memory_epoch_v3.zip](https://github.com/user-attachments/files/35413125/fx_memory_epoch_v3.zip)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:54:13 +00:00
Author
Owner

@⁠avt0m4t48 on GitHub · 2026-11-25 15:11 UTC · original

I checked the ordering on main at 0b0074e with synthetic memory and actual D3D12 submissions on Windows WARP. I called production memory::ready while recording each list, and used an eight-byte GPU copy to read back the directory entry. A control submitted before discovery returned [0, 0].

  • Separate heaps. A closed list using H1 read [1, 0] after a later list recorded against H2. H2 had installed copy 1 and H1's installed count was still zero. The later list never executed.
  • Shared heap. I recorded another list on H1 to install copy 1. The earlier closed list could then see [1, 0] with copy 1 installed in its heap, but it still had no deferred refresh or GPU-write declaration for that address. The newer recording had both declarations and never executed.

The probe reads the directory itself. It avoids indexing an uninitialized GPU descriptor and does not measure the result of a raw-address shader or a title. It confirms the late visibility and the coverage gap independently of concurrent GPU execution.

Probe source · Windows run

**@⁠avt0m4t48** on GitHub · 2026-11-25 15:11 UTC · [original](https://github.com/fxceless/victory-fork/issues/937#issuecomment-7166454580) I checked the ordering on `main` at `0b0074e` with synthetic memory and actual D3D12 submissions on Windows WARP. I called production `memory::ready` while recording each list, and used an eight-byte GPU copy to read back the directory entry. A control submitted before discovery returned `[0, 0]`. - **Separate heaps.** A closed list using H1 read `[1, 0]` after a later list recorded against H2. H2 had installed copy 1 and H1's installed count was still zero. The later list never executed. - **Shared heap.** I recorded another list on H1 to install copy 1. The earlier closed list could then see `[1, 0]` with copy 1 installed in its heap, but it still had no deferred refresh or GPU-write declaration for that address. The newer recording had both declarations and never executed. The probe reads the directory itself. It avoids indexing an uninitialized GPU descriptor and does not measure the result of a raw-address shader or a title. It confirms the late visibility and the coverage gap independently of concurrent GPU execution. [Probe source](https://github.com/avt0m4t48/victory-fork/commit/d3030c1a2b2437b0e67018d6e218657b31938296) · [Windows run](https://github.com/avt0m4t48/victory-fork/actions/runs/45641883414)
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/fxceless--victory-fork#937
No description provided.