Measured: GPU access to physical pages in place (SEC_COMMIT sections ≤ 4095 MB, aliases, physical page table) – no game data #1147
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#1147
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?
@quzopl on GitHub · 2026-11-24 16:13 UTC · original
Measurements only, no game data and no title run. A synthetic probe on this machine, to answer one question: can the GPU read and write title memory in place (no copies, no write watch) under VIctory's physical-page model, aliases included?
Short answer: yes, if the GPU addresses physical slices through a page table. Two constraints apply. Sections must be
SEC_COMMIT, notSEC_RESERVE, and each must be at most 4095 MB. Bandwidth is that of system memory.Machine
Method
This mirrors
xmem.rs: 64 KiB slices of a pagefile-backed section, mapped in runs into placeholders withMapViewOfFile3(MEM_REPLACE_PLACEHOLDER).ID3D12Device3::OpenExistingHeapFromFileMapping.ResourceDescriptorHeap[NonUniformResourceIndex(..)].jis visited through an odd-multiplier bijection, so neighbouring lanes hit different slices.Load*3 + add + j. The+ jtags the logical address, so a wrong page→slice link shows up on the CPU.Results
The RTX 5080, RTX 4070 Ti and UHD 770 gave identical results. The device was not removed in any run.
SEC_RESERVEsection, every page committed through a view →OpenExistingHeapFromFileMappingSEC_COMMITsection →OpenExistingHeapFromFileMappingSEC_COMMIT→OpenExistingHeapFromAddresson a plain view, and on a view that replaced a placeholderSEC_COMMITsize limit for a heapCosts:
SEC_COMMITcharges the whole section at creation.Bandwidth
This is the part that limits the idea. These figures come from a companion run: private placeholder chunks, each imported with
OpenExistingHeapFromAddress, same scattered shader.A scattered 2 GB pass took 3.1 s on the 4070 Ti, and the device was removed (
0x887A0006, past TDR). The same pass over 128 MB was correct. The cause is dispatch length, not the import.Other facts from that run:
MEM_WRITE_WATCHchunks import.What it suggests for VIctory
watch.rshandles today with write watch and guarded blocks.XMemAllocatePhysicalPages:SEC_COMMITsections, with full commit at allocation.xmem.rsavoids this on purpose because of error 1450 on busy hosts.ResourceDescriptorHeap[]indexing in large real shaders is a known NVIDIA risk: XCL #680 reports the driver's compiler ending the process. The probe's shader is small.Not tested
The probe is ~800 lines of Rust and two small shaders, written for this test, and I can share it if it's useful.
AI-assisted: the probe and this write-up were done with Claude Code. The numbers are from runs on the hardware above.
@pickles976 on GitHub · 2026-11-24 16:15 UTC · original
Second-machine confirmation, three years of prior art, and one design question.
gpu/uma.rs— the title's console addresses are kept in regions D3D12 opens as heaps viaOpenExistingHeapFromAddress, GPU works on them directly, no copies). Our measured constraint table from 2026-11-20 on Windows 11 + RX 9070 matches yours on both axes: fully committed sections only (a reservation with partial commit is rejected — the SEC_RESERVE vs SEC_COMMIT finding, reproduced) and 4095 MiB opens, exactly 4 GiB is rejected — hard enough that our constant is literally(4096 << 20) - 64 KiB(MAX_SIZE), with the side note that the rejected 4 GiB open still costs ~0.5 s to fail, so probing upward is expensive to get wrong. Two vendors (AMD/RDNA3 + your NVIDIA), two machines: treat the 4095 MiB ceiling and the commit requirement as platform facts, not driver quirks — no runtime should build a model that assumes they might not apply.base + k·4 GiB, window index =(address >> 32) & 3, allocations never straddle (4 windows, so 16 GiB of console GPU addresses per run; the recompiler emits per-windowmem/mem1… buffers). Your page-table result says the same problem solved one level down: with a real GPU-side page table the ceiling moves from heap-per-region to section-per-slice, and straddling becomes free. Worth being explicit in your issue which API your probe used for GPU visibility (OpenExistingHeapFromAddress-class vs an actual page-table path) — the ceiling you measured may be a property of the visibility API, not of the page table: our 4095 MiB is exactly the former's limit, so if your ≤4095 MB finding came through a section-open path, the page-table conclusion ("straddle freely") is supported by your alias rows more than by your size rows.OpenExistingHeapFromAddressneeds the whole window committed up front — lazy commit is a rejected-state risk, not a perf option. If your physical-page model starts from SEC_RESERVE for sparse title memory, that transition (reserve → commit before GPU visibility) is where runs will die in debug builds and mysteriously pass in ones that pre-commit everything.@Marvisak on GitHub · 2026-11-25 10:08 UTC · original
Automated triage for the maintainers.
Thanks for the synthetic measurements (no title run, no game data). They fit the project's scope as design input for how the GPU sees title memory.
One check against
main:XMemAllocatePhysicalPagesincrates/victory-hle/src/modules/xmem.rscreates its section withSEC_RESERVEon Windows andSEC_COMMITonly under Wine, because committing 6.1 GiB at once often fails with error 1450 on busy hosts. So the two preconditions you found (SEC_COMMITand at most 4095 MB per section) would both need changes there. Todaymainstill works with copies: sincecd94d35, shaders mark the 64 KiB pages they write through views and copy-backs compare only those pages (crate::shadow::copy_back_marks). Open PR #2088 also changes how loose title memory is copied.Your bandwidth numbers (about 0.3-0.4 GB/s for scattered access to imported system memory) are the main open question for in-place access. This stays open for the maintainers as tracked design input.
Generated by Claude Code