Ideas for features / improvements (performance & quality) #1273

Closed
opened 2026-11-26 08:26:19 +00:00 by github-bot · 4 comments
Owner

@⁠JayFoxRox on GitHub · 2026-11-26 08:21 UTC · original

Was keeping notes for myself as I was curious how AI designed this thing.
However, I then noticed some shortcomings.

I was looking into implementing some of this myself, but then noticed a bunch of people were using more powerful AI to do some of this already.
Instead I'm dropping it here and hope someone else (or rather their agent) picks this up, tries to implement these and sends PRs (if deemded useful) or splits this meta-issue into new issues.


Common functionality:

[1] Avoiding guard pages by patching (as in: overwriting with trampoline / emulating) the instruction which tried the write / read.
Instead of the exception, code could itself call a handler (similar to the exception handler).
The page can remain locked, because another view of that same page could be used to finish the actual write (by emulating the behaviour and modifying the destination).

Specific applications:

**@⁠JayFoxRox** on GitHub · 2026-11-26 08:21 UTC · [original](https://github.com/fxceless/victory-fork/issues/1273) Was keeping notes for myself as I was curious how AI designed this thing. However, I then noticed some shortcomings. I was looking into implementing some of this myself, but then noticed a bunch of people were using more powerful AI to do some of this already. Instead I'm dropping it here and hope someone else (or rather their agent) picks this up, tries to implement these and sends PRs (if deemded useful) or splits this meta-issue into new issues. --- ### Common functionality: [1] Avoiding guard pages by patching (as in: overwriting with trampoline / emulating) the instruction which tried the write / read. Instead of the exception, code could itself call a handler (similar to the exception handler). The page can remain locked, because another view of that same page could be used to finish the actual write (by emulating the behaviour and modifying the destination). ### Specific applications: - GPU -> CPU pages on change (GPU marks page dirty) https://git.gtahub.st/github/fxceless--victory-fork/pulls/1014 Clever solution as GPU has free resources apparently. Why not track these writes in the shader as they happen? Which shaders do these writes? Will these resources be moved to system-ram? Could the GPU simply set a flag that a specific page needs to be guarded so the CPU only tries to readback when the page has changed (instead of being downloaded directly). How much of the CPU code is affected by this? It could be using [1] https://git.gtahub.st/github/fxceless--victory-fork/issues/1238 ? - CPU -> GPU pages on changes (CPU marks page dirty) Catch page write: https://github.com/fxceless/victory-fork/blob/988aa41608cace81a54923e7d26ff6b561e3cf30/crates/victory-gpu/src/watch.rs#L1838 Upload page [not sure where exactly; might be wrong file?]: https://github.com/fxceless/victory-fork/blob/main/crates/victory-gpu/src/shadow.rs?utm_source=chatgpt.com#L3411-L3487 Lock page again: https://github.com/fxceless/victory-fork/blob/988aa41608cace81a54923e7d26ff6b561e3cf30/crates/victory-gpu/src/watch.rs#L501 If the page exception handler gets triggered to often, this could be fixed by [1] https://git.gtahub.st/github/fxceless--victory-fork/issues/1169 ? - DXR 1.1 Only 17 shaders which contain `image_bvh_...` instructions, at least some of them can be trivially made to use DXR 1.1 (tested locally using weak model Gemini 3.8-Flash). https://github.com/xcl-dev/xcl/issues/1751 https://git.gtahub.st/github/fxceless--victory-fork/issues/17 - mesa NIR instead direct DXIL target Idea is to port the translator to be RDNA2 -> NIR -> mesa NIR optimized -> NIR -> DXIL. mesa NIR optimizer is probably more powerful than the optimizer in VIctory and it will eventually enable easier ports to SPIR-V / Vulkan. - Resource labels for more powerful debugging Hash the textures/meshes/shaders/.. in resource files to label buffers on GPU upload for debugging. The API is ID3D12Object::SetName().
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:26:19 +00:00
Author
Owner

@⁠liuycsbxbxn on GitHub · 2026-11-26 13:36 UTC · original

Split into six, each with its code pointers and its verification cost, as this issue asked for:

  • #1305 guard-page patching (trampoline / emulate the faulting access) - [GPU][TITLE]
  • #1306 GPU -> CPU: let the GPU mark the pages that need a read-back - [GPU][TITLE]
  • #1307 CPU -> GPU: the write-watch round trip (catch -> upload -> re-lock) - [GPU]
  • #1310 DXR 1.1 for the image_bvh_* node tests - [GPU][TITLE]
  • #1308 Translator: RDNA2 -> NIR -> DXIL, scoped as a spike - [CPU] for translation, [GPU] for output quality
  • #1309 Resource labels: name GPU resources with content hashes - [CPU] plus one capture

[CPU] = needs neither a card nor the title; [GPU] = needs a real card; [TITLE] = needs the game dump.

Of the six, #1309 is the one a contributor can land without hardware; #1308 is deliberately written as a ten-program spike rather than a port, so it can be closed cheaply if the instruction counts do not improve.

**@⁠liuycsbxbxn** on GitHub · 2026-11-26 13:36 UTC · [original](https://github.com/fxceless/victory-fork/issues/1273#issuecomment-7193590606) Split into six, each with its code pointers and its verification cost, as this issue asked for: - #1305 guard-page patching (trampoline / emulate the faulting access) - `[GPU][TITLE]` - #1306 GPU -> CPU: let the GPU mark the pages that need a read-back - `[GPU][TITLE]` - #1307 CPU -> GPU: the write-watch round trip (catch -> upload -> re-lock) - `[GPU]` - #1310 DXR 1.1 for the `image_bvh_*` node tests - `[GPU][TITLE]` - #1308 Translator: RDNA2 -> NIR -> DXIL, scoped as a spike - `[CPU]` for translation, `[GPU]` for output quality - #1309 Resource labels: name GPU resources with content hashes - `[CPU]` plus one capture `[CPU]` = needs neither a card nor the title; `[GPU]` = needs a real card; `[TITLE]` = needs the game dump. Of the six, #1309 is the one a contributor can land without hardware; #1308 is deliberately written as a ten-program spike rather than a port, so it can be closed cheaply if the instruction counts do not improve.
Author
Owner

@⁠JayFoxRox on GitHub · 2026-11-26 16:35 UTC · original

Thanks for slpitting into issues; I'll close - use the new issues to discuss / implement.

**@⁠JayFoxRox** on GitHub · 2026-11-26 16:35 UTC · [original](https://github.com/fxceless/victory-fork/issues/1273#issuecomment-7197835592) Thanks for slpitting into issues; I'll close - use the new issues to discuss / implement.
Author
Owner

@⁠JayFoxRox on GitHub · 2026-11-26 17:56 UTC · original

I also created #1355 for another aspect (potential GPU hasher performance impact) of "GPU -> CPU pages on change (GPU marks page dirty)" which was lost in the existing issues

**@⁠JayFoxRox** on GitHub · 2026-11-26 17:56 UTC · [original](https://github.com/fxceless/victory-fork/issues/1273#issuecomment-7199866143) I also created #1355 for another aspect (potential GPU hasher performance impact) of "GPU -> CPU pages on change (GPU marks page dirty)" which was lost in the existing issues
Author
Owner

@⁠JayFoxRox on GitHub · 2026-11-26 18:24 UTC · original

Added #1363 which is similar to #1305

**@⁠JayFoxRox** on GitHub · 2026-11-26 18:24 UTC · [original](https://github.com/fxceless/victory-fork/issues/1273#issuecomment-7200429973) Added #1363 which is similar to #1305
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/fxceless--victory-fork#1273
No description provided.