PROJECT L6: a Vulkan-based approach to the same title, sharing findings and looking for contributors #3911

Open
opened 2026-11-30 19:53:21 +00:00 by trxyazilimgit · 2 comments
trxyazilimgit commented 2026-11-30 19:53:21 +00:00 (Migrated from github.com)
Contributor

Imported from Marvisak/VIctory. Originally posted by trxyazilimgit on 2026-11-30T19:53:21Z.


Hi Victory team,

I work on PROJECT L6 (https://github.com/trxyazilimgit/ProjectL6, GPL-3.0). It is an independent
runtime for the same console title: it runs the title's x86-64 code natively, implements the console
graphics API on Vulkan, and translates the console GPU code to SPIR-V with a translator
written in Rust. The title boots, reaches its first cutscene and draws a mostly correct picture.
Speed and memory are the open problems.

I'm opening this to share what we found, to explain why we chose a different graphics path, and
to ask for help on a few problems where pull requests would be very welcome.

Why Vulkan rather than Direct3D 12

The console API descends from Direct3D 12, so a D3D12 host maps onto it more directly. We still
chose Vulkan, for these reasons:

  • Raw GPU addresses. The console reads memory by address. VK_KHR_buffer_device_address gives
    shaders real pointers, so translated code can read the title's memory the way the console does,
    without rewriting every access into a bound buffer.
  • Descriptors as memory. On the console, texture and buffer descriptors are plain data that the
    title writes and patches at run time. Descriptor indexing and descriptor buffers let us follow
    that model closely.
  • Wave size control. The console runs 64-lane waves. VK_EXT_subgroup_size_control lets us pick
    wave64 where the hardware has it (AMD). Where it doesn't (NVIDIA, 32 lanes), our translator
    emulates 64-lane waves exactly, including cross-lane operations, ballots and reductions.
  • An open intermediate form. We generate SPIR-V directly from Rust and check every module with
    spirv-val. There is no dependency on an external compiler or on DXIL signing, and every
    translation step can be inspected.
  • Pipeline control. Graphics pipeline libraries, an explicit pipeline cache we manage ourselves,
    and mesh shaders through VK_EXT_mesh_shader.
  • Portability. The same backend can later run natively on Linux (including the Steam Deck)
    and on AMD, NVIDIA and Intel GPUs, and on macOS through MoltenVK. A D3D12 host would tie the
    project to Windows.
  • Debugging. Validation layers, RenderDoc, and open-source drivers (Mesa) where we need to see
    inside the driver.

The cost is honest: on Windows, D3D12 drivers are the most tuned path, and we carry a translation
layer that a D3D12 host would not need. We think the portability and the closer memory model are
worth it.

Findings that may help you

  • NVIDIA pipeline cache: the driver keeps one compression dictionary per process, and the first
    one registered wins. Entries compressed with any other dictionary silently miss. Registering the
    cache file's dictionary before any other compile took us from about a quarter of the entries
    loading to all of them.
  • Streamed textures: the title maps only the pages of the mip levels it has loaded. Waiting
    until every page of a texture is committed before uploading it left about 2,000 textures
    (2.3 GB) never uploaded. Uploading the mapped part, and uploading again as more pages arrive,
    fixed that.
  • Upload starvation: an upload pass that always restarts from the same position never reaches
    textures that arrived later. Those textures stay black even though their data is ready.
  • 64-lane waves on 32-lane GPUs: described above. The translator and its tests are in
    translator/.

Where we'd welcome pull requests

  1. Memory. The console has one memory for CPU and GPU. Mirroring it costs us about 16 GB of
    host memory, and our target is a machine with 16 GB RAM and an 8 GB GPU. Ideas or code for
    keeping GPU-only data in VRAM and copying only what the CPU really touches.
  2. Texture lifetime. When the title places a new resource in a memory range it has released,
    the views it still binds must stay valid.
  3. Frame time. About 1.3 s per frame for us. Most of it goes to texture staging (~600 ms),
    ~380 queue submissions per frame, and tracking which pages of title memory the CPU wrote.
  4. Translated shader size. Our largest compute modules are far bigger than they need to be.
    That costs GPU time, driver memory and hours of first-time compile.

The README has the measured numbers and the full list of known problems. If any of this matches
work you've already done, a pointer, a short note or a PR in either direction would help a lot.
Both projects are GPL-3.0, so code can move both ways with notices kept.

No game files, logs, shaders or captures are shared in this thread or in the repository.

Thanks!

<!-- greyfinch-sync:Marvisak/VIctory:issue:6704947877 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3911). Originally posted by [trxyazilimgit](https://github.com/trxyazilimgit) on 2026-11-30T19:53:21Z. --- Hi Victory team, I work on **PROJECT L6** (https://github.com/trxyazilimgit/ProjectL6, GPL-3.0). It is an independent runtime for the same console title: it runs the title's x86-64 code natively, implements the console graphics API on **Vulkan**, and translates the console GPU code to **SPIR-V** with a translator written in Rust. The title boots, reaches its first cutscene and draws a mostly correct picture. Speed and memory are the open problems. I'm opening this to share what we found, to explain why we chose a different graphics path, and to ask for help on a few problems where pull requests would be very welcome. ## Why Vulkan rather than Direct3D 12 The console API descends from Direct3D 12, so a D3D12 host maps onto it more directly. We still chose Vulkan, for these reasons: - **Raw GPU addresses.** The console reads memory by address. `VK_KHR_buffer_device_address` gives shaders real pointers, so translated code can read the title's memory the way the console does, without rewriting every access into a bound buffer. - **Descriptors as memory.** On the console, texture and buffer descriptors are plain data that the title writes and patches at run time. Descriptor indexing and descriptor buffers let us follow that model closely. - **Wave size control.** The console runs 64-lane waves. `VK_EXT_subgroup_size_control` lets us pick wave64 where the hardware has it (AMD). Where it doesn't (NVIDIA, 32 lanes), our translator emulates 64-lane waves exactly, including cross-lane operations, ballots and reductions. - **An open intermediate form.** We generate SPIR-V directly from Rust and check every module with `spirv-val`. There is no dependency on an external compiler or on DXIL signing, and every translation step can be inspected. - **Pipeline control.** Graphics pipeline libraries, an explicit pipeline cache we manage ourselves, and mesh shaders through `VK_EXT_mesh_shader`. - **Portability.** The same backend can later run natively on Linux (including the Steam Deck) and on AMD, NVIDIA and Intel GPUs, and on macOS through MoltenVK. A D3D12 host would tie the project to Windows. - **Debugging.** Validation layers, RenderDoc, and open-source drivers (Mesa) where we need to see inside the driver. The cost is honest: on Windows, D3D12 drivers are the most tuned path, and we carry a translation layer that a D3D12 host would not need. We think the portability and the closer memory model are worth it. ## Findings that may help you - **NVIDIA pipeline cache:** the driver keeps one compression dictionary per process, and the first one registered wins. Entries compressed with any other dictionary silently miss. Registering the cache file's dictionary before any other compile took us from about a quarter of the entries loading to all of them. - **Streamed textures:** the title maps only the pages of the mip levels it has loaded. Waiting until every page of a texture is committed before uploading it left about 2,000 textures (2.3 GB) never uploaded. Uploading the mapped part, and uploading again as more pages arrive, fixed that. - **Upload starvation:** an upload pass that always restarts from the same position never reaches textures that arrived later. Those textures stay black even though their data is ready. - **64-lane waves on 32-lane GPUs:** described above. The translator and its tests are in `translator/`. ## Where we'd welcome pull requests 1. **Memory.** The console has one memory for CPU and GPU. Mirroring it costs us about 16 GB of host memory, and our target is a machine with 16 GB RAM and an 8 GB GPU. Ideas or code for keeping GPU-only data in VRAM and copying only what the CPU really touches. 2. **Texture lifetime.** When the title places a new resource in a memory range it has released, the views it still binds must stay valid. 3. **Frame time.** About 1.3 s per frame for us. Most of it goes to texture staging (~600 ms), ~380 queue submissions per frame, and tracking which pages of title memory the CPU wrote. 4. **Translated shader size.** Our largest compute modules are far bigger than they need to be. That costs GPU time, driver memory and hours of first-time compile. The README has the measured numbers and the full list of known problems. If any of this matches work you've already done, a pointer, a short note or a PR in either direction would help a lot. Both projects are GPL-3.0, so code can move both ways with notices kept. No game files, logs, shaders or captures are shared in this thread or in the repository. Thanks!
cheerfulScumbag commented 2026-11-30 22:47:53 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by cheerfulScumbag on 2026-11-30T22:47:53Z.


Another independent layer for the same title here (Direct3D 12 host, shaders translated from the console GPU code, running on Linux under Proton). We are further along on some of your open problems and behind on others, so here is what we can hand over. Everything below is method and numbers, no game files.

Streamed textures. Your mapped-pages finding matches ours. We keep each host copy as a reserved resource and give a level its tiles only in a submission-time step of the list that writes that level, so a texture holds memory for exactly the levels the title has mapped and a level with no memory is never sampled. Before that, our log counted 2.2 to 3.0 GB of host copies sitting in levels whose title memory was not mapped, on about 1,600 textures, and new copies waited for room. Two counters we would recommend to anyone on this path: how many textures are waiting for room, and how many were passed over unmapped. Ours read 2,551 waiting and 115,684 passed over on a recent run, which is how we know the job is not finished.

Upload starvation. Assume it is real and check the order explicitly. Ours still shows thousands waiting, and a pass that restarts from the same position every frame is the cheapest explanation for textures that never arrive even when room exists.

64-lane waves on 32-lane hardware. We hit a concrete instance: two compute programs that compute the water's see-through light tile by tile come out black in some tiles on NVIDIA. A sibling build of ours works around it by leaving both programs out entirely; it reports that this removes every patch and about 15 ms of GPU work a frame in water scenes, at the cost of the water's teal glow. We would rather fix the translation than keep the workaround. The suspect class is exactly yours: lane-range assumptions, cross-lane operations and exec-mask reasoning under a 32-lane host wave. If your translator already emulates this exactly, that part of your work is ahead of ours and we would read it with interest.

Pipeline cache. Your dictionary finding is useful. On our path the D3D12 pipeline library reports 0 MB saved and released, so every run rebuilds the whole set, and a first run compiles tens of thousands of pipelines. Worth checking on your side whether the cache you manage actually survives a run.

Memory. Your mirroring cost is the problem we have been measuring from the other end. On our side the copies are not the expensive part; the bookkeeping around them is. A frame of ours spends about 31 ms of host time, of which 18 ms is copies of roughly 54 MB, and 2.4 ms is GPU work. Fifty-four megabytes in 18 ms is about 3 GB/s, so the time is per-piece overhead rather than bandwidth. Reducing scanning and comparing before reducing copying is what moved our numbers.

Both projects are GPL-3.0, so anything here is yours to use with notices kept. Happy to compare counters or exchange patches in either direction.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7294316985 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3911#issuecomment-7294316985). Originally posted by [cheerfulScumbag](https://github.com/cheerfulScumbag) on 2026-11-30T22:47:53Z. --- Another independent layer for the same title here (Direct3D 12 host, shaders translated from the console GPU code, running on Linux under Proton). We are further along on some of your open problems and behind on others, so here is what we can hand over. Everything below is method and numbers, no game files. **Streamed textures.** Your mapped-pages finding matches ours. We keep each host copy as a reserved resource and give a level its tiles only in a submission-time step of the list that writes that level, so a texture holds memory for exactly the levels the title has mapped and a level with no memory is never sampled. Before that, our log counted 2.2 to 3.0 GB of host copies sitting in levels whose title memory was not mapped, on about 1,600 textures, and new copies waited for room. Two counters we would recommend to anyone on this path: how many textures are waiting for room, and how many were passed over unmapped. Ours read 2,551 waiting and 115,684 passed over on a recent run, which is how we know the job is not finished. **Upload starvation.** Assume it is real and check the order explicitly. Ours still shows thousands waiting, and a pass that restarts from the same position every frame is the cheapest explanation for textures that never arrive even when room exists. **64-lane waves on 32-lane hardware.** We hit a concrete instance: two compute programs that compute the water's see-through light tile by tile come out black in some tiles on NVIDIA. A sibling build of ours works around it by leaving both programs out entirely; it reports that this removes every patch and about 15 ms of GPU work a frame in water scenes, at the cost of the water's teal glow. We would rather fix the translation than keep the workaround. The suspect class is exactly yours: lane-range assumptions, cross-lane operations and exec-mask reasoning under a 32-lane host wave. If your translator already emulates this exactly, that part of your work is ahead of ours and we would read it with interest. **Pipeline cache.** Your dictionary finding is useful. On our path the D3D12 pipeline library reports 0 MB saved and released, so every run rebuilds the whole set, and a first run compiles tens of thousands of pipelines. Worth checking on your side whether the cache you manage actually survives a run. **Memory.** Your mirroring cost is the problem we have been measuring from the other end. On our side the copies are not the expensive part; the bookkeeping around them is. A frame of ours spends about 31 ms of host time, of which 18 ms is copies of roughly 54 MB, and 2.4 ms is GPU work. Fifty-four megabytes in 18 ms is about 3 GB/s, so the time is per-piece overhead rather than bandwidth. Reducing scanning and comparing before reducing copying is what moved our numbers. Both projects are GPL-3.0, so anything here is yours to use with notices kept. Happy to compare counters or exchange patches in either direction.
trxyazilimgit commented 2026-12-01 00:14:05 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by trxyazilimgit on 2026-12-01T00:14:05Z.


Thanks, this is very useful, and several of your numbers line up closely with ours. Here is where we stand on the same points. Everything below is method and measurements; no game files.

Streamed textures. We arrived at the same finding: the title maps pages only for the levels it has loaded. Before our fix we counted 1,965 BC textures (2.3 GB) that had title data but had never been uploaded, because our upload waited for every page to be committed. We now upload the mapped part only. On the next run that count dropped to 0, plus 3 stragglers. Your reserved-resource approach, where a level gets tiles only when the title maps it, is cleaner than ours. We may move to it.

Upload starvation. You are right that it is real. We tried a round-robin pass over the textures that had never been uploaded. Every one of them arrived, but the title froze about 90 s into the scene in 2 runs out of 2. It did not freeze in any of the 9 runs without the pass. We have not found the mechanism yet: the GPU was idle, no fence was pending, and the upload counter had stopped moving. So the pass is off by default for now. Did you see anything similar when you changed the order?

An open problem you may also have: black skin. On our side, faces and arms come out black, while clothing drawn in the same frame is textured. What we have measured so far:

  • the albedo texture is fully uploaded, every level non-zero;
  • the bound view points at the live image (266 of 266 checks);
  • the view honours the descriptor's base and last level;
  • even so, the skin pixel program writes 0 albedo into the G-buffer.

So we suspect the translated program itself, and we are setting up a register value capture around its base-colour sample. Do skin and faces render correctly on your side? If so, did any shader-translation fix make the difference?

64-lane waves. Our translator emulates wave64 on 32-lane hardware for compute, vertex, pixel and geometry programs, including cross-lane operations and 64-bit exec masks. Compute is the most mature part; graphics is newer. Our main known gap is the TFE/LWE residency status dword on image samples: we do not write it yet. If you can name the two water programs by their behaviour (inputs, outputs, dispatch size), we can check whether ours draws those tiles correctly on NVIDIA.

Pipeline cache. Ours survives between runs. Driver memory for pipelines is the cost instead: about 4.1 GiB for 1,395 compute pipelines on an 8 GB card. We keep a rate limit on pipeline creation, because creating a large cached set all at once stalls the driver.

Memory and copies. Your point about per-piece overhead matches what we see. One frame of ours currently takes 1.25–1.4 s of wall time:

┌────────────────┬───────────┐
│ Item │ Per frame │
├────────────────┼───────────┤
│ Staging │ 614 ms │
├────────────────┼───────────┤
│ Staging copies │ 292 │
├────────────────┼───────────┤
│ Write faults │ 917 │
├────────────────┼───────────┤
│ Submits │ 383 │
└────────────────┴───────────┘

Cutting the number of pieces and the scanning, rather than the bytes, is our next target. How do you detect that the title wrote to a texture? Write watches or page protection, or a comparison?

Happy to exchange counters or patches. Both projects are GPL-3.0, so notices kept either way.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7296090988 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3911#issuecomment-7296090988). Originally posted by [trxyazilimgit](https://github.com/trxyazilimgit) on 2026-12-01T00:14:05Z. --- Thanks, this is very useful, and several of your numbers line up closely with ours. Here is where we stand on the same points. Everything below is method and measurements; no game files. Streamed textures. We arrived at the same finding: the title maps pages only for the levels it has loaded. Before our fix we counted 1,965 BC textures (2.3 GB) that had title data but had never been uploaded, because our upload waited for every page to be committed. We now upload the mapped part only. On the next run that count dropped to 0, plus 3 stragglers. Your reserved-resource approach, where a level gets tiles only when the title maps it, is cleaner than ours. We may move to it. Upload starvation. You are right that it is real. We tried a round-robin pass over the textures that had never been uploaded. Every one of them arrived, but the title froze about 90 s into the scene in 2 runs out of 2. It did not freeze in any of the 9 runs without the pass. We have not found the mechanism yet: the GPU was idle, no fence was pending, and the upload counter had stopped moving. So the pass is off by default for now. Did you see anything similar when you changed the order? An open problem you may also have: black skin. On our side, faces and arms come out black, while clothing drawn in the same frame is textured. What we have measured so far: - the albedo texture is fully uploaded, every level non-zero; - the bound view points at the live image (266 of 266 checks); - the view honours the descriptor's base and last level; - even so, the skin pixel program writes 0 albedo into the G-buffer. So we suspect the translated program itself, and we are setting up a register value capture around its base-colour sample. Do skin and faces render correctly on your side? If so, did any shader-translation fix make the difference? 64-lane waves. Our translator emulates wave64 on 32-lane hardware for compute, vertex, pixel and geometry programs, including cross-lane operations and 64-bit exec masks. Compute is the most mature part; graphics is newer. Our main known gap is the TFE/LWE residency status dword on image samples: we do not write it yet. If you can name the two water programs by their behaviour (inputs, outputs, dispatch size), we can check whether ours draws those tiles correctly on NVIDIA. Pipeline cache. Ours survives between runs. Driver memory for pipelines is the cost instead: about 4.1 GiB for 1,395 compute pipelines on an 8 GB card. We keep a rate limit on pipeline creation, because creating a large cached set all at once stalls the driver. Memory and copies. Your point about per-piece overhead matches what we see. One frame of ours currently takes 1.25–1.4 s of wall time: ┌────────────────┬───────────┐ │ Item │ Per frame │ ├────────────────┼───────────┤ │ Staging │ 614 ms │ ├────────────────┼───────────┤ │ Staging copies │ 292 │ ├────────────────┼───────────┤ │ Write faults │ 917 │ ├────────────────┼───────────┤ │ Submits │ 383 │ └────────────────┴───────────┘ Cutting the number of pieces and the scanning, rather than the bytes, is our next target. How do you detect that the title wrote to a texture? Write watches or page protection, or a comparison? Happy to exchange counters or patches. Both projects are GPL-3.0, so notices kept either way.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory#3911
No description provided.