GPU: shared title-memory directory can expose copies not prepared by closed command lists #937
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork#937
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@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
mainat0b0074e0.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
Command list A records a raw-address dispatch using heap H1 and closes.
Command list B records using heap H2 and publishes a new numbered copy in the shared directory.
B installs the corresponding descriptor in H2 but does not need to execute.
A is submitted and its shader resolves an address through the newly published directory entry.
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
Per-heap descriptor installation and recording-time coverage
Shader-side directory lookup
Submission preparation
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 | 0All 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.zipAI-assisted source review and synthetic verification. No game files or proprietary assets were used.
</html>## ProblemWhile 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
mainat0b0074e0.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
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
github.com/fxceless/victory-fork@0b0074e0/crates/victory-gpu/src/memory.rs (L119-L195))github.com/fxceless/victory-fork@0b0074e0/crates/victory-gpu/src/memory.rs (L242-L320))github.com/fxceless/victory-fork@0b0074e0/crates/victory-shader/src/emit/lower.rs (L2797-L2862))github.com/fxceless/victory-fork@0b0074e0/crates/victory-gpu/src/host.rs (L5340-L5439))Relationship to existing work
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:
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.
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.zipfx_memory_epoch_v3.zip
@avt0m4t48 on GitHub · 2026-11-25 15:11 UTC · original
I checked the ordering on
mainat0b0074ewith synthetic memory and actual D3D12 submissions on Windows WARP. I called productionmemory::readywhile recording each list, and used an eight-byte GPU copy to read back the directory entry. A control submitted before discovery returned[0, 0].[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.[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