Repository navigation
Conversation
…thout sizing regions EnqueueRequest checked the destination page array and the file object with gpu::shader::readable, which calls VirtualQuery for each region the range touches. VirtualQuery sizes a region by walking it, and a retail title keeps those arrays inside very large reservations with scattered committed pages, so the check costs far more than the read. While the title streams its world it enqueues thousands of requests a second, on one of its threads. The two reads are now ReadProcessMemory on the current process: it copies the bytes or fails on memory that is not readable, which is what the check was for, without sizing the region around them.
|
Static code audit of Looks clean and is a strict safety + performance improvement over
AI use: static code review of |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
IDStorageQueueX::EnqueueRequestchecked two small inputs withgpu::shader::readable: the destination page array of a request withDEST_PHYS_PAGES, and the file object's vtable pointer.readablecallsVirtualQueryfor each region the range touches.VirtualQuerysizes the region around the address by walking it, and a retail title keeps its page arrays inside very large reservations with scattered committed pages. While the title streams its world it enqueues thousands of requests a second from one thread, so the check costs far more than the read.What is in it
dstorage.rs:snapshot_page_arraycopies the array withReadProcessMemoryon the current process. That copies the bytes or fails on memory that isn't readable, which is what the check was for, without sizing the region. Unreadable memory still refuses the request withE_ACCESS_VIOLATION.readableitself is unchanged; other callers keep it.Tested
cargo build --workspacethen release and debug tests.cargo test --workspace --no-fail-fast -- --test-threads=4: 656 passed, 0 failed, 40 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.readableand 0.4 µs throughReadProcessMemory.7a033c8+ GTA VI reaches its title screen and menus: GPU title memory in large pages, to_zero pruned once #203, Memory windows from the descriptor heap (no per-access switch); NVIDIA OOM fallback; physical-page fixes #187, DirectStorage: BCPack entropy stage for all modes, not yet called #208a7ffb2f, Lazy physical pages: a thread that loses the race to commit a page retries #244, KernelX: GPU-visible title memory outside the windows is write-watched (retail menu text complete) #252, KernelX / title textures: a GPU view of the title's CPU memory reads the CPU view (retail intro video, no green screen) #283, D3D12.X: title textures on shared 64 KiB pages of video memory – video memory stays at what the title covers (#248) #269, D3D12.X: retire overwritten title textures, evict MADE, and clean up (#248) #292, DirectStorage: a destination page array entry that is 0 at enqueue is read at the request's turn #289.EnqueueRequestcall on that stack before the change took 5–13 ms, small requests too. This change removes one part of that cost; I did not identify the rest.Regression run
main:
PR:
(
gpu:names a virtual monitor's adapter; the title ran on the RTX 4070. #282 changes what smoke.ps1 prints there.)Not tested
AI use