Diagnostics: trace a DirectStorage request from submission to decoder outcome #1178

Open
Razdva122 wants to merge 2 commits from upstream-pr/1178 into main
Razdva122 commented 2026-11-24 16:21:10 +00:00 (Migrated from github.com)

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


For #1063, this adds an opt-in DirectStorage request trace. Each enqueue receives an ID that follows the request through admission, file reads and worker completion. The trace records input and destination sizes, decoder outcome, and bytes written or the failure code. The five-second throughput counters also use actual output bytes. Tests cover identical concurrent submissions, short successful output, and insufficient capacity.

On an earlier revision, the reporter traced 9,819 enqueues on a GTX 1660 SUPER. None carried 46,586 as a size, and 5,651 requests completed with 65,536 bytes written. The per-size stack capture answered its original question, so this revision removes the filter and the loader API added solely for it. The general trace remains available for other streaming reports. Reporter’s results

The README now has one row for the trace target. The diagnostic build command, PowerShell invocation and fields to compare are in the issue. Reproduction instructions

AI-assisted with Codex.

Windows CI passed both workspace Clippy configurations, the full workspace suite and the diagnostics-mode DirectStorage tests at 40dac06. Windows job · Download the Windows x64 diagnostic build

<!-- greyfinch-sync:Marvisak/VIctory:issue:5476056705 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1178). Originally posted by [Razdva122](https://github.com/Razdva122) on 2026-11-24T16:21:10Z. --- For #1063, this adds an opt-in DirectStorage request trace. Each enqueue receives an ID that follows the request through admission, file reads and worker completion. The trace records input and destination sizes, decoder outcome, and bytes written or the failure code. The five-second throughput counters also use actual output bytes. Tests cover identical concurrent submissions, short successful output, and insufficient capacity. On an earlier revision, the reporter traced 9,819 enqueues on a GTX 1660 SUPER. None carried 46,586 as a size, and 5,651 requests completed with 65,536 bytes written. The per-size stack capture answered its original question, so this revision removes the filter and the loader API added solely for it. The general trace remains available for other streaming reports. [Reporter’s results](https://github.com/Marvisak/VIctory/pull/1178#issuecomment-7139806415) The README now has one row for the trace target. The diagnostic build command, PowerShell invocation and fields to compare are in the issue. [Reproduction instructions](https://github.com/Marvisak/VIctory/issues/1063#issuecomment-7155166775) AI-assisted with Codex. Windows CI passed both workspace Clippy configurations, the full workspace suite and the diagnostics-mode DirectStorage tests at `40dac06`. [Windows job](https://github.com/Razdva122/VIctory/actions/runs/45818274261/job/139905737227) · [Download the Windows x64 diagnostic build](https://github.com/Razdva122/VIctory/actions/runs/45818274261/artifacts/15116284867)
roon9e commented 2026-11-24 18:05:59 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by roon9e on 2026-11-24T17:51:32Z.


Ran the #1178 diagnostics on a reporting-class machine — the 46,586 value does not reach VIctory's DirectStorage boundary. No request matches the filter.

Setup: Windows 11, GTX 1660 SUPER 6 GB, own 1.0.2.1 copy (SHA-256 e95020b2…), Xbox Series build, win-x64, --profile diag --features diagnostics at 9b8949f, run without the local int3 workaround (the stop is the raw 0x80000003 at title+0x1330a44). VICTORY_LOG=info,victory_dstorage=trace, VICTORY_DSTORAGE_CALLER_SIZE=46586.

Result:

enqueue requests:            9819
  options=0x1 (zlib):        6532
  options=0x0 (raw):         3287
  bcpack ≠ 0:                0        (bcpack=0 in all 29,457 read lines)
completed written=65536:     5651
completed written=16:        1402
(size fields equal to 46586: 0)
  • No request carries 46,586 as source_size, destination_size, intermediate_size or written. The literal 46586 occurs in the log only as a substring of an offset (…4658672), never a size. The size filter therefore appended no caller stack to any request (the only caller= lines are the unrelated device slot 0x218/0x1c8 warnings).
  • The streaming decode is entirely zlib (options=0x1, e.g. source_size≈44k → destination_size=65536, read=source_size hr=0, completed written=65536) or raw (0x0). VIctory's side of the pair — 65,536 — is exactly what it decodes and completes.
  • No BCPack crosses the boundary at all (bcpack=0 in every read), so the texture/BС decode is not a DirectStorage request here.

So the 64 KiB/46,586 pair you were tracking does not reach VIctory's DirectStorage API as a request shape. At the same stop, reading the faulting thread's stream state directly shows where the pair actually lives:

[walk rsi] inst=[stream+0x10020]
[inst]  +0x8=0x10000 (65536)   +0x58=0x70817 (codec id)
[inst+0x40] -> descriptor, +8=46586, +0x20=4096 ; [inst+8]=65536
[prov]  vtable = <title>+0x62fd480
        +0x3f0 = <title>+0x28ce0a0   (the codec-capability query)

vt[0x3f0] (0x28ce0a0) is an adjustor thunk to <title>+0x28ce1b0, which searches the provider's own registry for the 64-bit interface key and then title+0x144db65b0 reads a per-codec entry (title+0x144db6600; a 0xffff/0xff entry = "absent") → returns 0 → test al,al / je → int3 at 0x1330a44. The provider and its registry are title code over title data (vtable in the title's .rdata), and the codec id there is 0x70817.

The trace is still the right instrument — it cleanly confirms VIctory's boundary is healthy and that the size pair is title-internal. What would pin it next, if useful: the same trace keyed on the codec id (0x70817) rather than a size, or on requests whose output the title later re-reads and rejects; and a snapshot of the provider registry ([prov+0x28] → +0x20 key table, +0x28/+0x38 codec tables) taken while the thread is suspended. If that registry is expected to be filled from a device call, note that device slots 0x218/0x1c8 are currently E_NOTIMPL (caller="+0x24800db" / "+0x247757e", the +0x2478440 bring-up group) — possible registration steps, though they also fire in every menu run.

AI-assisted; run on my machine, no game data quoted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7139806415 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1178#issuecomment-7139806415). Originally posted by [roon9e](https://github.com/roon9e) on 2026-11-24T17:51:32Z. --- **Ran the #1178 diagnostics on a reporting-class machine — the 46,586 value does *not* reach VIctory's DirectStorage boundary. No request matches the filter.** Setup: Windows 11, **GTX 1660 SUPER 6 GB**, own 1.0.2.1 copy (SHA-256 `e95020b2…`), Xbox Series build, `win-x64`, `--profile diag --features diagnostics` at `9b8949f`, run **without** the local `int3` workaround (the stop is the raw `0x80000003` at `title+0x1330a44`). `VICTORY_LOG=info,victory_dstorage=trace`, `VICTORY_DSTORAGE_CALLER_SIZE=46586`. Result: ```text enqueue requests: 9819 options=0x1 (zlib): 6532 options=0x0 (raw): 3287 bcpack ≠ 0: 0 (bcpack=0 in all 29,457 read lines) completed written=65536: 5651 completed written=16: 1402 (size fields equal to 46586: 0) ``` - **No request carries 46,586** as `source_size`, `destination_size`, `intermediate_size` or `written`. The literal `46586` occurs in the log only as a *substring of an offset* (`…4658672`), never a size. The size filter therefore appended **no caller stack** to any request (the only `caller=` lines are the unrelated `device slot 0x218/0x1c8` warnings). - The streaming decode is entirely **zlib** (`options=0x1`, e.g. `source_size≈44k → destination_size=65536`, `read=source_size hr=0`, `completed written=65536`) or raw (`0x0`). VIctory's side of the pair — 65,536 — is exactly what it decodes and completes. - **No BCPack** crosses the boundary at all (`bcpack=0` in every read), so the texture/BС decode is not a DirectStorage request here. So the 64 KiB/46,586 pair you were tracking does not reach VIctory's DirectStorage API as a request shape. At the same stop, reading the faulting thread's stream state directly shows where the pair actually lives: ```text [walk rsi] inst=[stream+0x10020] [inst] +0x8=0x10000 (65536) +0x58=0x70817 (codec id) [inst+0x40] -> descriptor, +8=46586, +0x20=4096 ; [inst+8]=65536 [prov] vtable = <title>+0x62fd480 +0x3f0 = <title>+0x28ce0a0 (the codec-capability query) ``` `vt[0x3f0]` (`0x28ce0a0`) is an adjustor thunk to `<title>+0x28ce1b0`, which searches the provider's own registry for the 64-bit interface key and then `title+0x144db65b0` reads a per-codec entry (`title+0x144db6600`; a `0xffff`/`0xff` entry = "absent") → returns 0 → `test al,al / je → int3` at `0x1330a44`. **The provider and its registry are title code over title data** (vtable in the title's `.rdata`), and the codec id there is `0x70817`. The trace is still the right instrument — it cleanly confirms VIctory's boundary is healthy and that the size pair is title-internal. What would pin it next, if useful: the same trace keyed on the **codec id** (`0x70817`) rather than a size, or on requests whose output the title later re-reads and rejects; and a snapshot of the provider registry (`[prov+0x28]` → `+0x20` key table, `+0x28`/`+0x38` codec tables) taken while the thread is suspended. If that registry is expected to be filled from a device call, note that `device` slots `0x218`/`0x1c8` are currently `E_NOTIMPL` (`caller="+0x24800db"` / `"+0x247757e"`, the `+0x2478440` bring-up group) — possible registration steps, though they also fire in every menu run. AI-assisted; run on my machine, no game data quoted.
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:42Z.


Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 9b8949f: cargo test -p victory-hle -p victory-loader passes, 121 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:7140027018 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1178#issuecomment-7140027018). Originally posted by [Zipettte](https://github.com/Zipettte) on 2026-11-24T18:00:42Z. --- Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 9b8949f: `cargo test -p victory-hle -p victory-loader` passes, 121 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
Marvisak commented 2026-11-25 02:05:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:18:00Z.


Automated triage for the maintainers.

This pull request no longer merges cleanly into main (conflicts in crates/victory-hle/src/modules/dstorage.rs). It will be reviewed once it is rebased onto the current main. The earlier verdict (merge-candidate) was for an older state of main.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149406179 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1178#issuecomment-7149406179). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T01:18:00Z. --- <!-- victory-triage v1 head=f475df13ac2f5f2e11babe34ae4e67b19f9a3b78 verdict=needs-rebase at=2026-11-25T16:00:10Z --> Automated triage for the maintainers. This pull request no longer merges cleanly into `main` (conflicts in `crates/victory-hle/src/modules/dstorage.rs`). It will be reviewed once it is rebased onto the current `main`. The earlier verdict (merge-candidate) was for an older state of `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
Razdva122 commented 2026-11-25 07:03:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Razdva122 on 2026-11-25T06:55:44Z.


@Marvisak, could you re-review f475df1 and update the triage: needs work label if the revised scope addresses your feedback?

The reporter found no request carrying 46,586 as a size across 9,819 enqueues. I removed the size filter, the caller-stack capture and its loader API. The general request ID and actual bytes written remain available. The README now has one row for the trace target, and the reproduction procedure is in #1063.

Both Clippy configurations, the workspace suite and the diagnostics-mode DirectStorage tests passed on Windows. Changes since triage · Windows CI

<!-- greyfinch-sync:Marvisak/VIctory:comment:7155305097 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1178#issuecomment-7155305097). Originally posted by [Razdva122](https://github.com/Razdva122) on 2026-11-25T06:55:44Z. --- @Marvisak, could you re-review `f475df1` and update the `triage: needs work` label if the revised scope addresses your feedback? The reporter found no request carrying 46,586 as a size across 9,819 enqueues. I removed the size filter, the caller-stack capture and its loader API. The general request ID and actual bytes written remain available. The README now has one row for the trace target, and the reproduction procedure is in [#1063](https://github.com/Marvisak/VIctory/issues/1063#issuecomment-7155166775). Both Clippy configurations, the workspace suite and the diagnostics-mode DirectStorage tests passed on Windows. [Changes since triage](https://github.com/Marvisak/VIctory/compare/9d357e862365ebf9fa099388e90d6fb7b06a052e...f475df13ac2f5f2e11babe34ae4e67b19f9a3b78) · [Windows CI](https://github.com/Razdva122/VIctory/actions/runs/45563455856/job/139032459796)
Razdva122 commented 2026-11-26 13:04:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Razdva122 on 2026-11-26T12:28:36Z.


Could you re-review the DirectStorage trace at 40dac06 and refresh the rebase label? The branch now merges cleanly with main at 63bcca4 and keeps the upstream request-admission changes. Both Clippy configurations, the full workspace suite and the diagnostics-mode DirectStorage tests passed on Windows. The diagnostic build in the PR description has also been rebuilt at this commit. Windows verification

<!-- greyfinch-sync:Marvisak/VIctory:comment:7192050002 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1178#issuecomment-7192050002). Originally posted by [Razdva122](https://github.com/Razdva122) on 2026-11-26T12:28:36Z. --- Could you re-review the DirectStorage trace at `40dac06` and refresh the rebase label? The branch now merges cleanly with `main` at `63bcca4` and keeps the upstream request-admission changes. Both Clippy configurations, the full workspace suite and the diagnostics-mode DirectStorage tests passed on Windows. The diagnostic build in the PR description has also been rebuilt at this commit. [Windows verification](https://github.com/Razdva122/VIctory/actions/runs/45818274261/job/139905737227)
cloph-dsp commented 2026-11-27 06:55:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-27T06:55:29Z.


Independent CPU-only verification of PR #1178 (DirectStorage trace: record completed bytes and distinguish short zlib from overflow).

  • Windows, rustc/cargo 1.100.0/MSVC, worktree-local CARGO_TARGET_DIR (D:\Victory-Contrib\target-1178-watch), CARGO_BUILD_JOBS=2.
  • Head 40dac069cbf5a9be222ee18b66152188d6747200, merge base 63bcca43c6a00a758510398fa43096ce7e4f7df0.
  • Command: cargo test --locked -p victory-hle --lib -- modules::dstorage::tests::records_completed_bytes_and_distinguishes_short_zlib_from_overflow --exact --test-threads=1 --quiet -> 1 passed; 0 failed; 152 filtered.
  • Negative control: git grep -F for the new test name on 63bcca4 returned no hits (test absent on base).
  • git diff --check 63bcca4 HEAD exit 0 (clean).
  • Only the named synthetic test was replayed; the rest of the suite, real DirectStorage I/O and zlib streams were not exercised.
  • AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only trace/decompression logic). No game data, assets, shaders, DRM or decrypt used.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7211973885 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1178#issuecomment-7211973885). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-27T06:55:29Z. --- Independent CPU-only verification of PR #1178 (`DirectStorage trace: record completed bytes and distinguish short zlib from overflow`). - Windows, rustc/cargo 1.100.0/MSVC, worktree-local `CARGO_TARGET_DIR` (`D:\Victory-Contrib\target-1178-watch`), `CARGO_BUILD_JOBS=2`. - Head `40dac069cbf5a9be222ee18b66152188d6747200`, merge base `63bcca43c6a00a758510398fa43096ce7e4f7df0`. - Command: `cargo test --locked -p victory-hle --lib -- modules::dstorage::tests::records_completed_bytes_and_distinguishes_short_zlib_from_overflow --exact --test-threads=1 --quiet` -> `1 passed; 0 failed; 152 filtered`. - Negative control: `git grep -F` for the new test name on `63bcca4` returned no hits (test absent on base). - `git diff --check 63bcca4 HEAD` exit 0 (clean). - Only the named synthetic test was replayed; the rest of the suite, real DirectStorage I/O and zlib streams were not exercised. - AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only trace/decompression logic). No game data, assets, shaders, DRM or decrypt used.
Razdva122 commented 2026-11-28 06:37:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Razdva122 on 2026-11-28T06:37:30Z.


@Marvisak, could you remove triage: needs rebase from this PR? GitHub still reports that 40dac06 merges cleanly into main at 63bcca4. Since the previous review request, an independent tester has also reproduced the completed-byte and short-zlib regression test on Windows at this exact commit. Tester's report · Workspace CI

<!-- greyfinch-sync:Marvisak/VIctory:comment:7235415355 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1178#issuecomment-7235415355). Originally posted by [Razdva122](https://github.com/Razdva122) on 2026-11-28T06:37:30Z. --- @Marvisak, could you remove `triage: needs rebase` from this PR? GitHub still reports that `40dac06` merges cleanly into `main` at `63bcca4`. Since the previous review request, an independent tester has also reproduced the completed-byte and short-zlib regression test on Windows at this exact commit. [Tester's report](https://github.com/Marvisak/VIctory/pull/1178#issuecomment-7211973885) · [Workspace CI](https://github.com/Marvisak/VIctory/actions/runs/45818220967/job/139903362015)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1178:upstream-pr/1178'
git switch 'upstream-pr/1178'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1178'
git switch 'upstream-pr/1178'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1178'
git switch 'upstream-pr/1178'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1178'
git switch 'main'
git merge --squash 'upstream-pr/1178'
git switch 'main'
git merge --ff-only 'upstream-pr/1178'
git switch 'main'
git merge 'upstream-pr/1178'
git push origin 'main'
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!1178
No description provided.