startup-runtime: startup stalls ~120 s after #2395 (an unplaced memory SRV wraps a ~2.15 GiB allocation, VirtualQuery over it becomes slow) #2602

Closed
opened 2026-11-25 23:18:24 +00:00 by lukaslw-lab · 0 comments
lukaslw-lab commented 2026-11-25 23:18:24 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-25T23:18:24Z.


Since #2395 (4a8acf51), main-executable startup (#870) sits ~120 s before the first DirectStorage request completes. Bisect on Windows 10 22H2, RTX 3080 Ti, release build, warm shader cache, same input script:

Build DirectStorage requests at 10 s First input poll
2b883ea6 3,254 5.6 s
1cce2a32 (parent of #2395) not recorded 5.6 s
4a8acf51 (#2395) 0 (0 at 30 s, burst of ~3,260 at ~120–130 s) ~122 s
5ca71c5b + OpenExistingHeapFromAddress disabled in unplaced_memory_buffer 3,254 5.4 s
0a40a0fd (fix PR below, on a6967446) 3,254 5.8 s
  • The only other runtime change in the range (#2539) was ruled out separately (same stall with the old value). An empty shader cache stalls too, and so does a run with the lazy-commit switches off.
  • With #2395, two small memory SRVs (6,144 B and 768 B) at the start of the title's low startup allocation are written through the new unplaced path. Before #2395 they were refused (buffer_unavailable). That allocation is ~2.15 GiB, private, write-combined. unplaced_memory_buffer passes memory.base to OpenExistingHeapFromAddress, so a 6 KiB view wraps the whole 2.15 GiB block as a heap.
  • A stack sample at ~50 s shows one thread with 48 s of kernel time in VirtualQuery ← the DirectStorage stand-in's destination check (destination_writable, xcrdapi.cpp, one VirtualQuery per region). Another thread spins in title code waiting for it. placed_buffer_range.h already notes that VirtualQuery on large private regions scans page-table entries.
  • Not proven: why the wrap makes the later queries slow (write-combine protection, Windows 10 only?). JVProg's Windows 11 runs inside the range did not report it.

Fix PR (linked below): wrap an allocation for an unplaced SRV only up to the 256 MiB limit #2395 already applies to the span; larger allocations take the existing upload copy.

This report was prepared with AI assistance (Claude); the runs and the bisect are mine.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6615752957 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2610). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-11-25T23:18:24Z. --- Since #2395 (`4a8acf51`), main-executable startup (#870) sits ~120 s before the first DirectStorage request completes. Bisect on Windows 10 22H2, RTX 3080 Ti, release build, warm shader cache, same input script: | Build | DirectStorage requests at 10 s | First input poll | |---|---|---| | `2b883ea6` | 3,254 | 5.6 s | | `1cce2a32` (parent of #2395) | not recorded | 5.6 s | | `4a8acf51` (#2395) | 0 (0 at 30 s, burst of ~3,260 at ~120–130 s) | ~122 s | | `5ca71c5b` + `OpenExistingHeapFromAddress` disabled in `unplaced_memory_buffer` | 3,254 | 5.4 s | | `0a40a0fd` (fix PR below, on `a6967446`) | 3,254 | 5.8 s | - The only other runtime change in the range (#2539) was ruled out separately (same stall with the old value). An empty shader cache stalls too, and so does a run with the lazy-commit switches off. - With #2395, two small memory SRVs (6,144 B and 768 B) at the start of the title's low startup allocation are written through the new unplaced path. Before #2395 they were refused (`buffer_unavailable`). That allocation is ~2.15 GiB, private, write-combined. `unplaced_memory_buffer` passes `memory.base` to `OpenExistingHeapFromAddress`, so a 6 KiB view wraps the whole 2.15 GiB block as a heap. - A stack sample at ~50 s shows one thread with 48 s of kernel time in `VirtualQuery` ← the DirectStorage stand-in's destination check (`destination_writable`, `xcrdapi.cpp`, one `VirtualQuery` per region). Another thread spins in title code waiting for it. `placed_buffer_range.h` already notes that `VirtualQuery` on large private regions scans page-table entries. - Not proven: why the wrap makes the later queries slow (write-combine protection, Windows 10 only?). JVProg's Windows 11 runs inside the range did not report it. Fix PR (linked below): wrap an allocation for an unplaced SRV only up to the 256 MiB limit #2395 already applies to the span; larger allocations take the existing upload copy. This report was prepared with AI assistance (Claude); the runs and the bisect are mine.
Sign in to join this conversation.
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
R0Y00/Xbox2Windows#2602
No description provided.