gpu: probe a CPU-visible placed-buffer arena #501
No reviewers
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!501
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/501/head"
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?
@ToxicmaggotRP on GitHub · 2026-11-24 04:14 UTC · original
ToxicmaggotRP:gpu/unified-memory-arena-probe→main· +444 −10 · 1 files · 11 commits · closed without merging[Related to #407. This is the first isolated step toward the CPU/GPU shared-memory path described there, and groundwork for the commit-limit investigation in #471.
What
Noneif heap creation or mapping fails, capacity is exhausted, or size rounding overflows.None.The arena uses one placed resource across the heap because separate placed resources are not guaranteed to have contiguous GPU virtual addresses. The test uses the D3D12 aliasing barrier to activate the resource before its first GPU use, then transitions it for shader access.
Scope and limits
This PR verifies shared CPU/GPU backing and relative offsets on the tested adapter. It does not set the GPU virtual address equal to a title/guest address, route title/XMEM allocations through the arena, or remove the shadow-copy bridge. The world-load commit-limit report in #471 remains outside this PR's scope.
Verification
cargo test --locked -p victory-gpu: 44 passed, 1 ignored (benchmark).cargo test --locked --workspace: passed.cargo clippy --locked -p victory-gpu --all-targets: passed.cargo fmt --all -- --checkreports formatting differences across existing workspace files; no broad formatting change is included here.References:
AI-assisted contribution (ChatGPT).](#501)
@aycow on GitHub · 2026-11-24 04:44 UTC · original
Independent Windows validation of
4ec7939: the stockcargo test -p victory-gpu --features diagnostics host::tests::placed_custom_heap_shares_memory_between_cpu_and_gpu -- --exact --nocapturepassed. I also ran the same arena and compute fixture with a local test-only adapter selector using Agility SDK 1.620.2. AMD Radeon Graphics, NVIDIA RTX 5070 Laptop GPU, and WARP all allocated the 256 MiB arena, reserved the 174 MiB slice, and returned0xb7910c22through the mapped destination after the fence. Full GPU-based validation and the debug layer reported zero errors.All three emitted the same advisory:
CreatePlacedResourceignoredUNORDERED_ACCESSas the buffer’s initial state and usedCOMMON. I would specifyCOMMONin the arena and document first-use buffer promotion (or transition explicitly). This validates the Windows placed-buffer primitive and offset arithmetic. Guest VA identity, allocation routing, concurrency and residency remain separate.I can rerun this matrix on a revised head.
@aycow on GitHub · 2026-11-24 06:34 UTC · original
Thanks for switching the placed buffer to COMMON in
262874b. I'm evaluating a narrow opt-in integration that uses the mapped arena for bounded, allocator-owned, GPU-read-only scratch chunks. The committed upload path remains the per-allocation fallback. This gives us a place to measure translated addresses, ownership and allocation pressure before routing title-owned memory. I'll test the exact output and implementation on AMD, NVIDIA and WARP and share the branch and results here.@aycow on GitHub · 2026-11-24 06:49 UTC · original
The opt-in scratch integration is available at
f68b332on top of262874b. It routes only allocator-owned, GPU-read-only list scratch to the mapped arena. The byte-exact fixture checks a nonzero CPU/GPU offset, reset reuse, and committed-upload fallback after capacity is exhausted. AMD Radeon Graphics, RTX 5070 Laptop, and WARP passed with full GBV.The separate 1 MiB synthetic shadow comparison across three access strides measured 49–89 µs of median submit preparation through the ordinary private-memory shadow and 0–1 µs through the arena. These numbers exclude arena initialization, list and PSO creation, and output checking. The queue-fence interval is recorded separately in the fixture. Branch and reproducible benchmark
@aycow on GitHub · 2026-11-24 07:29 UTC · original
I extended the read-only scratch work with an opt-in allocation for the host's GPU-writable indirect budget word. It uses independent placed resources in a 4 MiB L0 heap, returns slots only after completion and falls back to a committed buffer per allocation. AMD, RTX 5070 Laptop and WARP checked reset reuse, slot replacement, exhaustion fallback and byte-exact atomic output under full GBV.
The guide separates CPU allocation, submission preparation, and actual GPU timestamps. The results describe one 1,024-thread contended atomic workload. Guest memory and Wine remain separate because their ownership and mapping conditions differ. Implementation and benchmark
Pull request closed