Call for contributions: unified memory on PCs with separate RAM and VRAM
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- cpp, linux
- Lĩnh vực
- backend, performance
Hướng nghiên cứu
Start with docs/dev/ARCHITECTURE.md and the named memory paths: guestMirror.cpp, bufferCache.cpp, guestHostView.cpp, memoryTracker.cpp, pageManager.cpp, hotWriteWatch.cpp, and vma.cpp. Pick one direction, then build a fixed-seed Vulkan benchmark in tools/ and record five before-and-after runs with GPU, driver, OS, and ReBAR details. A design proposal should explain ordering, constraints, and fallbacks; a prototype should report measured results and pass the applicable existing tests.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Why
A PS5 has one unified memory pool shared by CPU and GPU. A PC with a discrete GPU splits system RAM and VRAM across PCIe.
Today AnyKyty bridges the two with a single sparse Vulkan buffer (GuestMirror, 32 MiB DEVICE_LOCAL chunks with host-memory spill, capped at 768 GiB on NVIDIA because its ~896 GiB GPU VA space is shared across all allocations; RADV has 128 TiB). PageManager and MemoryTracker watch guest 4 KiB pages (mprotect+SIGSEGV on Linux, VirtualProtect+VEH on Windows, plus Linux HotWriteWatch using UFFD_FEATURE_WP_ASYNC + PAGEMAP_SCAN). CPU writes reach VRAM through staging/stream buffers and vkCmdCopyBuffer; unknown-reach dispatches can read host RAM via GuestHostView (VK_EXT_external_memory_host / /dev/udmabuf); GPU writes protect guest pages and come back to RAM through readbacks (BufferCache::DownloadMemory).
On a heavy native PS5 title, this bridge is now a primary bottleneck: GPU copies take the largest share of GPU time, and synchronous readback waits stall CPU worker threads while leaving the GPU idle. We want to gather community ideas, designs, and prototypes to rethink how AnyKyty keeps CPU and GPU memory coherent on discrete and unified-memory PCs.
What to pick (directions and tradeoffs)
- Tighter GPU write-range tracking and copy reduction: when a shader binds a large pool as writable, marking the entire pool GPU-dirty triggers false CPU write faults, unnecessary readbacks, and re-uploads. Narrowing tracked write ranges, batching copies, and skipping unchanged re-uploads helps every GPU and OS (
core/kyty/graphics/host_gpu/renderer/cache/bufferCache.cpp,core/kyty/graphics/host_gpu/memoryTracker.cpp). - Direct CPU writes into ReBAR-backed mirror chunks: on Resizable BAR GPUs (
DEVICE_LOCAL | HOST_VISIBLE, e.g. 16 GiB BAR1), mapping mirror chunks and doing a write-combinedmemcpyfrom the CPU could replace staging +vkCmdCopyBuffer(core/kyty/graphics/host_gpu/renderer/cache/guestMirror.cpp).- Tradeoff: CPU reads from write-combined VRAM over PCIe are orders of magnitude slower than RAM, so readbacks must stay on cached download buffers.
- Hard problem: ordering. A direct CPU write is only safe when no in-flight GPU tick can still read the old bytes of that range (queued GPU copies give that ordering for free).
- Selective hybrid host-mapped memory (
VK_EXT_external_memory_host/dma-buf): serving all guest memory from system RAM is a trap—our measurements over PCIe 4.0 x16 show ~26× slower sequential and ~34× slower random GPU reads than VRAM, and assuming snapshot semantics breaks with CPU/GPU races. Keeping read-heavy buffers in VRAM while serving only small, hot CPU↔GPU ping-pong ranges (command rings, sync/label pages, write-once uploads) directly from host memory with strict GPU-ordered sync is much more promising (core/kyty/graphics/host_gpu/renderer/cache/guestHostView.cpp). - Direct texture uploads and indirect copies:
VK_EXT_host_image_copy(core in Vulkan 1.4) can upload static/streamed textures straight intoOPTIMALimages without staging buffers or GPU queue copies (at the cost of CPU swizzle work);VK_KHR_copy_memory_indirectcan avoid CPU round-trips for GPU-computed copy ranges. - True UMA zero-copy path (APUs / integrated GPUs): on unified-memory PCs (Steam Deck, AMD Strix Halo / Ryzen AI Max, integrated GPUs exposing
DEVICE_LOCAL | HOST_VISIBLE | HOST_CACHED, potentially paired withVK_EXT_map_memory_placed), mirror copies and readbacks should be avoidable altogether once CPU/GPU hazard ordering is preserved. - OS dirty-page tracking and VRAM residency: exploring Windows
GetWriteWatch(MEM_WRITE_WATCH) for hot anonymous write regions, tuning Linuxuserfaultfd/PAGEMAP_SCAN, andVK_EXT_pageable_device_local_memory+VK_EXT_memory_priorityon Windows WDDM (core/kyty/graphics/host_gpu/pageManager.cpp,hotWriteWatch.cpp,vma.cpp).
Open questions we would love input on
- Ordering for direct ReBAR writes: what lightweight tracking (per-range last-reader tick, ring-buffered shadow slots, or copy-on-write fallback) best proves a dirty range has no in-flight GPU reader without adding per-draw CPU overhead?
- Narrowing GPU write ranges: how can we detect which subranges of a bound storage buffer a dispatch actually writes, without heavy readbacks or shader instrumentation stalls?
- Hybrid classification: what simple online heuristic cleanly separates "keep in VRAM" from "serve directly from host RAM over PCIe" across titles?
- Cross-vendor reality: what driver quirks have you hit with
VK_EXT_map_memory_placed,VK_EXT_host_image_copy, ReBAR WC writes (vkd3d-proton'sno_upload_hvvlessons), or NVIDIA's 896 GiB GPU VA limit across NVIDIA, AMD (RADV/Windows), and Intel?
Expected result
Either:
- A concrete design proposal in this issue (citing data, driver/spec constraints, and how it handles CPU/GPU ordering and cross-vendor fallbacks), or
- A focused prototype or pull request with measured before/after numbers on a synthetic benchmark and all existing tests passing.
How to test without our games
Write a small synthetic Vulkan benchmark or test in tools/ (1 to 30 s, fixed seed, printing throughput or latency): e.g., dirty-page write + staging-vs-ReBAR upload throughput, PCIe host-import vs VRAM shader bandwidth, readback round-trip latency under concurrent draws, or vkCopyMemoryToImage vs vkCmdCopyBufferToImage. Give before and after numbers on the same machine in the same session (five runs each), state GPU/driver/OS/ReBAR status, and verify existing tests (ctest -R '^kyty_shim_' when a GPU is available, or the CPU-only library/tracker tests). Do not claim a frame-rate gain you cannot measure without a title; claim the micro-benchmark and what bottleneck it models.
Difficulty
Medium to hard. Design discussions and small benchmark prototypes are welcome before any large refactor.
Who to ask
Comment in this issue; the maintainers read every comment, can share constraints from docs/dev/ARCHITECTURE.md and core/kyty/graphics/host_gpu/, and will benchmark promising designs on real titles.
Rules that apply to every call
- Comment on the issue before you start coding, so two people do not duplicate work. One topic per pull request, against
AnyKyty. - Conventional Commits (
fix(kyty): ...,feat(kyty): ...,perf(kyty): ...,test(...),docs: ...). No comments in code. Nothing specific to one title: no game names, no title IDs, no data taken from a game, no per-title branches. - Say where a behaviour comes from: public specs, driver documentation, published write-ups, or your own measurements. Do not post or attach firmware files, system modules, or game files.
- Each CI test finishes in 30 s.
python3 tools/check_conventions.py --base origin/AnyKytymust pass before you push. - Build and test:
docs/dev/START_HERE.mdanddocs/dev/BUILD.md.
Links
- Codebase:
docs/dev/ARCHITECTURE.md,core/kyty/graphics/host_gpu/renderer/cache/guestMirror.cpp,bufferCache.cpp,guestHostView.cpp,core/kyty/graphics/host_gpu/pageManager.cpp,hotWriteWatch.cpp,memoryTracker.cpp,vma.cpp. - Specs and references: Vulkan Device Memory (GPUOpen), Write Combining Pitfalls,
VK_EXT_external_memory_host,VK_EXT_map_memory_placed,VK_EXT_host_image_copy,VK_KHR_copy_memory_indirect, D3D12 GPU Upload Heaps,vkd3d-protonmemory.c.
- Ngôn ngữ chính
- C++
- Star
- 214
- Fork
- 7
- Merge trung bình
- 7 giờ 53 phút
- Pull request đã merge (30 ngày)
- 280
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của simnJS/AnyPS5
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
simnJS/AnyPS5#735 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
simnJS/AnyPS5#721 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
simnJS/AnyPS5#716 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Call for contributions: Windows, AMD and Intel validation (run the tests on your hardware)Có thể đã có người làm @adam25136 đã nhận hôm nay. Đang mởarea: tools-ci area: windows good first issue help wanted needs: AMD needs: Windows
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
simnJS/AnyPS5#705 · 8 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
kyty: kyty_shim_rt_context_pick fails pipeline creation with ErrorUnknown on AMD Windows (RX 6800)Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
simnJS/AnyPS5#741 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của simnJS/AnyPS5
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-format
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Niko1221/Strata#7719 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
area:tests kind:test
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
BabylonJS/BabylonNative#2138 ·
Maintainer thường phản hồi trong vòng 1 ngày