VIctory: GPU-side performance fixes for title-memory shaders (GTA VI) #2695

Open
opened 2026-11-26 05:12:14 +00:00 by github-bot · 3 comments
Owner

@⁠Olliee96 on GitHub · 2026-11-25 18:23 UTC · original

O jogo melhorou: GPU de 850–1450 ms para 200–345 ms por quadro, e fps de 0,4–0,7 para 1,4–1,5. Agora vou levantar todas as mudanças para o documento do PR.

Gerei o pacote do PR em inglês em E:\Temp\pr-victory\. Não fiz commit nem publiquei nada.

Arquivos:

  • PR-DESCRIPTION.md: descrição completa em inglês, com o problema, a correção, as medições, os testes e as ressalvas de cada patch.
  • 1-wave-dedupe-memory-marks.patch (tradutor, lower.rs): é o ganho desta rodada.
  • 2-root-uav-view-marks.patch (draw.rs, host.rs, memory.rs, shadow.rs): a correção dos snapshots.
  • 3-dstorage-late-page-lists.patch (dstorage.rs, xmem.rs): espera de até ~1 s pelas listas de páginas atrasadas, mais logs.
  • 4-diag-no-view-marks.patch: só a chave de diagnóstico, opcional.

O que o teste isolado do e63d22 mostrou:

  • Medição no jogo: confere. Cada chamada tem intervalo próprio, sem sobreposição.
  • Causa: cada lane fazia um atomicOr na mesma palavra do bitmap, que fica na RAM do sistema. Isso serializa o dispatch inteiro.
  • Mesmo DXIL rodado isolado: 71 grupos levam 20 ms. Com o bitmap na VRAM, caem para 0,24 ms.
  • Correção no tradutor: um atômico por wave, e só quando o bit ainda não está marcado. 71 grupos caem de 20 ms para 2,0 ms, e as marcas no bitmap são as mesmas.
  • No jogo: o tempo de GPU caiu de 855–1456 para 203–344 ms por quadro, e o fps subiu de 0,4–0,7 para 1,4–1,5. Nenhum aviso de escrita perdida.

Ressalvas, também escritas no PR:

  • O número de draws por quadro foi diferente entre as duas rodadas do jogo, então o ganho in-game é indicativo. A medição controlada é a do teste isolado.
  • No teste isolado, os dados sintéticos fazem os grupos escreverem nas mesmas posições. Por isso a saída de dados muda de uma execução para outra. O que confere entre as variantes é o bitmap de marcas, e é ele que a correção altera.
  • A tela continua branca. A causa é outra: os shaders wave64 sem tradução.
  • Dois testes do victory-shader falham, mas já falhavam com a correção desligada. Os outros 246 passam.

Próximo passo natural, se quiser: levar o bitmap para a VRAM e copiá-lo de volta uma vez por envio, ou partir para os shaders wave64 que deixam a tela branca.VIctory: GPU-side performance fixes for title-memory shaders (GTA VI)

**@⁠Olliee96** on GitHub · 2026-11-25 18:23 UTC · [original](https://github.com/Marvisak/VIctory/issues/2695) O jogo melhorou: GPU de 850–1450 ms para 200–345 ms por quadro, e fps de 0,4–0,7 para 1,4–1,5. Agora vou levantar todas as mudanças para o documento do PR. Gerei o pacote do PR em inglês em `E:\Temp\pr-victory\`. Não fiz commit nem publiquei nada. **Arquivos:** - `PR-DESCRIPTION.md`: descrição completa em inglês, com o problema, a correção, as medições, os testes e as ressalvas de cada patch. - `1-wave-dedupe-memory-marks.patch` (tradutor, `lower.rs`): é o ganho desta rodada. - `2-root-uav-view-marks.patch` (`draw.rs`, `host.rs`, `memory.rs`, `shadow.rs`): a correção dos snapshots. - `3-dstorage-late-page-lists.patch` (`dstorage.rs`, `xmem.rs`): espera de até ~1 s pelas listas de páginas atrasadas, mais logs. - `4-diag-no-view-marks.patch`: só a chave de diagnóstico, opcional. **O que o teste isolado do `e63d22` mostrou:** - **Medição no jogo:** confere. Cada chamada tem intervalo próprio, sem sobreposição. - **Causa:** cada lane fazia um `atomicOr` na mesma palavra do bitmap, que fica na RAM do sistema. Isso serializa o dispatch inteiro. - **Mesmo DXIL rodado isolado:** 71 grupos levam 20 ms. Com o bitmap na VRAM, caem para 0,24 ms. - **Correção no tradutor:** um atômico por wave, e só quando o bit ainda não está marcado. 71 grupos caem de 20 ms para 2,0 ms, e as marcas no bitmap são as mesmas. - **No jogo:** o tempo de GPU caiu de 855–1456 para 203–344 ms por quadro, e o fps subiu de 0,4–0,7 para 1,4–1,5. Nenhum aviso de escrita perdida. **Ressalvas, também escritas no PR:** - O número de draws por quadro foi diferente entre as duas rodadas do jogo, então o ganho in-game é indicativo. A medição controlada é a do teste isolado. - No teste isolado, os dados sintéticos fazem os grupos escreverem nas mesmas posições. Por isso a saída de dados muda de uma execução para outra. O que confere entre as variantes é o bitmap de marcas, e é ele que a correção altera. - A tela continua branca. A causa é outra: os shaders wave64 sem tradução. - Dois testes do `victory-shader` falham, mas já falhavam com a correção desligada. Os outros 246 passam. Próximo passo natural, se quiser: levar o bitmap para a VRAM e copiá-lo de volta uma vez por envio, ou partir para os shaders wave64 que deixam a tela branca.VIctory: GPU-side performance fixes for title-memory shaders (GTA VI)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:12:14 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 18:48 UTC · original

Automated triage for the maintainers.

This describes four local patches (wave-level dedupe of memory write marks, root UAV view marks, waiting for late DirectStorage page lists, a diagnostics switch) with measurements, but the patches themselves are only on your machine. Pull requests are open to everyone: please open one PR per patch against main so they can be reviewed and tested (also say which VIctory commit the measurements were taken on).

For the first patch: in main (13f91ca) the write-mark code in crates/victory-shader/src/emit/lower.rs already loads the bitmap word first and issues the atomicOr only for lanes that find the bit clear; there is no per-wave dedupe, so a PR should be measured against that.

(Resumo: os patches só existem localmente; abra um PR por patch contra a main para revisão.)


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 18:48 UTC · [original](https://github.com/Marvisak/VIctory/issues/2695#issuecomment-7171432859) <!-- victory-issue-triage v1 verdict=tracked seen=2026-11-25T18:23:34Z at=2026-11-25T18:51:15Z --> Automated triage for the maintainers. This describes four local patches (wave-level dedupe of memory write marks, root UAV view marks, waiting for late DirectStorage page lists, a diagnostics switch) with measurements, but the patches themselves are only on your machine. Pull requests are open to everyone: please open one PR per patch against main so they can be reviewed and tested (also say which VIctory commit the measurements were taken on). For the first patch: in main (13f91ca) the write-mark code in `crates/victory-shader/src/emit/lower.rs` already loads the bitmap word first and issues the `atomicOr` only for lanes that find the bit clear; there is no per-wave dedupe, so a PR should be measured against that. (Resumo: os patches só existem localmente; abra um PR por patch contra a main para revisão.) --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-25 18:49 UTC · original

Independent reconstruction on main 13f91ca (private tree, no branch published), with the #486 test-binaries runtime so the marks test runs on hardware. One safety point first, because it changes the shape of the fix:

"One atomic per wave" is only equivalent when the lanes mark the same page/word. Lanes of a 64-lane store can mark different pages (a strided write), and for a 16-byte store some lanes cross a page while others do not. Deduping all of them to one lane loses marks. Also, the first lane outright can be one with nothing left to set (its second page equals its first, already marked), so gating on WaveIsFirstLane alone can drop the shared atomic.

The shape I tested:

  1. WaveAnyTrue(clear) — if no lane has a bit to set, no wave ops beyond this;
  2. inside that uniform branch, WaveActiveAllEqual(page);
  3. pages equal → the lowest lane with a bit to set (WaveActiveMin(lane, -1) over the lanes where clear) does the one atomic; pages differ → every lane with clear does its own, as today.

That keeps the per-lane path for the mixed case and still collapses the common contiguous write to one atomic per marked page.

Tests on Windows 10 19045 + RX 7800 XT (driver 32.0.32029.2010), view_marks: true:

  • new 64-lane synthetic, each lane stores 4 bytes at lane * 4: exactly bit 100 set (the shared-atomic path);
  • same shader with lane * 0x10000: bits 100..163 set (the mixed path, no mark lost);
  • the existing dword/16-byte/atomic marks test unchanged;
  • cargo test -p victory-shader --lib --locked: 271 passed, 0 failed, 3 ignored, every DXIL module validated.

I did not measure the in-game or isolated-dispatch speedup, so I make no claim on the 10x number; this is correctness-only. The patch is ~35 lines in Lower::mark_view_write plus the two-lane test. Happy to paste the diff or send it to you if useful — I did not open a PR because the patch package is yours.

**@⁠Calvix2k** on GitHub · 2026-11-25 18:49 UTC · [original](https://github.com/Marvisak/VIctory/issues/2695#issuecomment-7171443682) Independent reconstruction on `main` `13f91ca` (private tree, no branch published), with the #486 test-binaries runtime so the marks test runs on hardware. One safety point first, because it changes the shape of the fix: **"One atomic per wave" is only equivalent when the lanes mark the same page/word.** Lanes of a 64-lane store can mark different pages (a strided write), and for a 16-byte store some lanes cross a page while others do not. Deduping all of them to one lane loses marks. Also, the first lane outright can be one with nothing left to set (its second page equals its first, already marked), so gating on `WaveIsFirstLane` alone can drop the shared atomic. The shape I tested: 1. `WaveAnyTrue(clear)` — if no lane has a bit to set, no wave ops beyond this; 2. inside that uniform branch, `WaveActiveAllEqual(page)`; 3. pages equal → the **lowest lane with a bit to set** (`WaveActiveMin(lane, -1)` over the lanes where `clear`) does the one atomic; pages differ → every lane with `clear` does its own, as today. That keeps the per-lane path for the mixed case and still collapses the common contiguous write to one atomic per marked page. Tests on Windows 10 19045 + RX 7800 XT (driver 32.0.32029.2010), `view_marks: true`: - new 64-lane synthetic, each lane stores 4 bytes at `lane * 4`: exactly bit 100 set (the shared-atomic path); - same shader with `lane * 0x10000`: bits 100..163 set (the mixed path, no mark lost); - the existing dword/16-byte/atomic marks test unchanged; - `cargo test -p victory-shader --lib --locked`: **271 passed, 0 failed, 3 ignored**, every DXIL module validated. I did not measure the in-game or isolated-dispatch speedup, so I make no claim on the 10x number; this is correctness-only. The patch is ~35 lines in `Lower::mark_view_write` plus the two-lane test. Happy to paste the diff or send it to you if useful — I did not open a PR because the patch package is yours.
Author
Owner

@⁠Cuebert on GitHub · 2026-11-26 20:35 UTC · original

I can add one implementation-specific data point. In a warmed 4K RT startup on my Cool Fox-based path, compute selector e63d22c4def9ba6a translated, joined a host pipeline, and first-bound. The lowerer I inspected handles missing-page writes with a branch-guarded raw fault-list store; I don't see the dirty-bitmap atomicOr path described here. A selector match alone therefore doesn't make the reported speedup transferable to this implementation. Per-dispatch GPU timestamps on the exact lowering path would be needed before attributing a gain.

**@⁠Cuebert** on GitHub · 2026-11-26 20:35 UTC · [original](https://github.com/Marvisak/VIctory/issues/2695#issuecomment-7202869030) I can add one implementation-specific data point. In a warmed 4K RT startup on my Cool Fox-based path, compute selector `e63d22c4def9ba6a` translated, joined a host pipeline, and first-bound. The lowerer I inspected handles missing-page writes with a branch-guarded raw fault-list store; I don't see the dirty-bitmap `atomicOr` path described here. A selector match alone therefore doesn't make the reported speedup transferable to this implementation. Per-dispatch GPU timestamps on the exact lowering path would be needed before attributing a gain.
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory#2695
No description provided.