Call for contributions: unified memory on PCs with separate RAM and VRAM
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- cpp, linux
- Área
- backend, performance
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- C++
- Estrellas
- 214
- Forks
- 7
- Merge medio
- 7 h 53 min
- PR fusionados (30 d)
- 280
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de simnJS/AnyPS5
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
simnJS/AnyPS5#735 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
simnJS/AnyPS5#721 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
simnJS/AnyPS5#716 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Call for contributions: Windows, AMD and Intel validation (run the tests on your hardware)Posiblemente ocupada @adam25136 la tomó hoy. Abiertoarea: tools-ci area: windows good first issue help wanted needs: AMD needs: Windows
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
simnJS/AnyPS5#705 · 8 comentarios ·
Los mantenedores suelen responder en 1 día
-
kyty: kyty_shim_rt_context_pick fails pipeline creation with ErrorUnknown on AMD Windows (RX 6800)Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
simnJS/AnyPS5#741 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de simnJS/AnyPS5
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día
-
needs-format
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Niko1221/Strata#7719 · 1 comentario ·
Los mantenedores suelen responder en 4 días
-
area:tests kind:test
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
BabylonJS/BabylonNative#2138 ·
Los mantenedores suelen responder en 1 día