HLE: keep DirectStorage file references alive for queued reads #1181

Closed
matheusfrta wants to merge 1 commit from upstream-pr/1181 into main
matheusfrta commented 2026-11-24 16:21:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by matheusfrta on 2026-11-24T16:21:42Z.


Holds a reference on the IDStorageFile object while a file-backed read is queued or running, matching StatusArray's lifetime handling and DirectStorage's contract that callers may release a file immediately after enqueuing requests. Releases the reference when the read completes or the queue is closed, with a regression test covering early file release.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6586386918 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1181). Originally posted by [matheusfrta](https://github.com/matheusfrta) on 2026-11-24T16:21:42Z. --- Holds a reference on the IDStorageFile object while a file-backed read is queued or running, matching StatusArray's lifetime handling and DirectStorage's contract that callers may release a file immediately after enqueuing requests. Releases the reference when the read completes or the queue is closed, with a regression test covering early file release.
Aniseto commented 2026-11-24 18:05:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Aniseto on 2026-11-24T17:38:03Z.


Ran the new test and the whole dstorage module at 715293e:

Environment: Windows 11 Pro build 26200 x64, Intel Core i5-12400F, 64 GB RAM, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only) driver 32.0.16.2124, Rust 1.98.1 (pinned by rust-toolchain.toml), MSVC 14.44.35207, DXC 1.9.2609.5, debug build.

cargo test -p victory-hle releasing_file_after_enqueue
1 passed; 0 failed; 0 ignored      (exit 0)

cargo test -p victory-hle dstorage
14 passed; 0 failed; 0 ignored     (exit 0)

modules::dstorage::tests::releasing_file_after_enqueue_keeps_it_alive passes and the rest of the module is unaffected. This is a lifetime test with a real file read queued, so it exercises the ownership path the PR changes, not just a mock. Unit-level overall, so the adapter is not the variable; the datapoint is the pinned 1.98.1 toolchain. No test report on this PR yet.

Not tested: a title streaming archives through this path (no game data here), RDNA2/RDNA4 and Intel GPUs.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash 1017 - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; no game data was used.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7139481779 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1181#issuecomment-7139481779). Originally posted by [Aniseto](https://github.com/Aniseto) on 2026-11-24T17:38:03Z. --- Ran the new test and the whole `dstorage` module at `715293e`: Environment: Windows 11 Pro build 26200 x64, Intel Core i5-12400F, 64 GB RAM, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only) driver 32.0.16.2124, Rust 1.98.1 (pinned by `rust-toolchain.toml`), MSVC 14.44.35207, DXC 1.9.2609.5, debug build. ``` cargo test -p victory-hle releasing_file_after_enqueue 1 passed; 0 failed; 0 ignored (exit 0) cargo test -p victory-hle dstorage 14 passed; 0 failed; 0 ignored (exit 0) ``` `modules::dstorage::tests::releasing_file_after_enqueue_keeps_it_alive` passes and the rest of the module is unaffected. This is a lifetime test with a real file read queued, so it exercises the ownership path the PR changes, not just a mock. Unit-level overall, so the adapter is not the variable; the datapoint is the pinned 1.98.1 toolchain. No test report on this PR yet. Not tested: a title streaming archives through this path (no game data here), RDNA2/RDNA4 and Intel GPUs. AI-assisted (OpenCode), model: **DeepSeek V4.1 Flash 1017** - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; no game data was used.
Zipettte commented 2026-11-24 18:06:11 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T18:00:39Z.


Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 715293e: cargo test -p victory-hle passes, 96 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7140025917 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1181#issuecomment-7140025917). Originally posted by [Zipettte](https://github.com/Zipettte) on 2026-11-24T18:00:39Z. --- Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 715293e: `cargo test -p victory-hle` passes, 96 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
upstream-sync closed this pull request 2026-11-25 01:05:50 +00:00
Marvisak commented 2026-11-25 01:08:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:33:58Z.


Automated triage for the maintainers. Closing because another open pull request covers the same change.

See #577. The same fix as #577 (queued reads keep a file reference), less complete and with formatting damage; it also fails to compile on main for the same reason.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148643880 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1181#issuecomment-7148643880). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:33:58Z. --- Automated triage for the maintainers. Closing because another open pull request covers the same change. See #577. The same fix as #577 (queued reads keep a file reference), less complete and with formatting damage; it also fails to compile on main for the same reason. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!1181
No description provided.