Structure builder: the last three programs translate on 32-lane hosts; steadier intro #294

Open
github-bot wants to merge 3 commits from github-bot/gh-294 into main AGit
Owner

@⁠ALFREDOHDEZ on GitHub · 2026-11-24 23:20 UTC · original
ALFREDOHDEZ:fix/builder-prefix-sums-and-intro → main · +91 −5 · 5 files · 3 commits · open

Three independent changes, one commit each. Tested on an RTX 4070 (621.24), Ryzen 7 5800X3D, 32 GB, Windows 11.

1. First-lane reads of values alike in every running lane

On a 32-lane host the structure builder stayed off because 3 of 53 programs (39321a95223001ed, 77360df21e12ea43, 9fc111d3be79364f) stopped with "a first-lane read where not every lane runs". They are prefix sums: the value read is a scalar plus ds_read_b32 at a uniform address, so every running lane holds the same. The new rule follows only unguarded v_mov_b32, v_add_nc_u32 and ds_read_b32.

All three now translate, validate and get a pipeline on the RTX 4070, and the builder reports that all 53 pipelines run.

2. Only the structure builder names memory by constants and writes by address

  • Programs that walk the structures declared every numbered copy written, so VICTORY_BVH_QUARANTINE=1 leaked into title memory. In one run before this change the title crashed about 13 s after the builder started; after it, one run lasted 400 s.
  • In the programs I saved from a run, 70 use raw addresses; only 11 store through them, all unnamed ones (the builder's, as far as I can tell).

3. Two pipeline workers until the title draws a world

With over 1,000 pipelines queued, eight workers made the intro vary between 14 and 32 fps. With two workers it stayed at 30 (29 to 30.2). I also stopped writing captures during the intro, so part of the gain may come from that. The world's first frames may wait longer for pipelines on a cold cache.

Not fixed

  • Nothing is lit by ray tracing yet, and everything stays off by default.
  • With the builder on (quarantine too) meshes are deformed and the picture is darker: its stores reach host copies that meshes also read.
  • The 1,023-copy limit is still reached about 7 s after the builder starts.

Measurements that may help (same save and spot, no input, 2 min into the world)

Switch ms/frame GPU column
default 435 212
VICTORY_LATE_WAIT=3 347 88
VICTORY_INDIRECT_WINDOW=1 472 211

The input was not fully controlled in the last two runs, so take those as approximate. Putting sampled textures in shared 64 MB heaps gave no gain and is not included.

Tests

victory-shader: 210 passed on this branch. Clippy (-D warnings, victory-shader and victory-gpu) is clean. victory-gpu: 110 passed on an earlier base with these changes; not re-run on this one. The game runs above were also on that earlier base. No unit test is added for the new rule.

🤖 Generated with Claude Code

**@⁠ALFREDOHDEZ** on GitHub · 2026-11-24 23:20 UTC · [original](https://github.com/fxceless/victory-fork/pull/294) `ALFREDOHDEZ:fix/builder-prefix-sums-and-intro` → `main` · +91 −5 · 5 files · 3 commits · open Three independent changes, one commit each. Tested on an RTX 4070 (621.24), Ryzen 7 5800X3D, 32 GB, Windows 11. ### 1. First-lane reads of values alike in every running lane On a 32-lane host the structure builder stayed off because 3 of 53 programs (39321a95223001ed, 77360df21e12ea43, 9fc111d3be79364f) stopped with "a first-lane read where not every lane runs". They are prefix sums: the value read is a scalar plus `ds_read_b32` at a uniform address, so every running lane holds the same. The new rule follows only unguarded `v_mov_b32`, `v_add_nc_u32` and `ds_read_b32`. All three now translate, validate and get a pipeline on the RTX 4070, and the builder reports that all 53 pipelines run. ### 2. Only the structure builder names memory by constants and writes by address - Programs that walk the structures declared every numbered copy written, so `VICTORY_BVH_QUARANTINE=1` leaked into title memory. In one run before this change the title crashed about 13 s after the builder started; after it, one run lasted 400 s. - In the programs I saved from a run, 70 use raw addresses; only 11 store through them, all unnamed ones (the builder's, as far as I can tell). ### 3. Two pipeline workers until the title draws a world With over 1,000 pipelines queued, eight workers made the intro vary between 14 and 32 fps. With two workers it stayed at 30 (29 to 30.2). I also stopped writing captures during the intro, so part of the gain may come from that. The world's first frames may wait longer for pipelines on a cold cache. ### Not fixed - Nothing is lit by ray tracing yet, and everything stays off by default. - With the builder on (quarantine too) meshes are deformed and the picture is darker: its stores reach host copies that meshes also read. - The 1,023-copy limit is still reached about 7 s after the builder starts. ### Measurements that may help (same save and spot, no input, 2 min into the world) | Switch | ms/frame | GPU column | |---|---|---| | default | 435 | 212 | | `VICTORY_LATE_WAIT=3` | 347 | 88 | | `VICTORY_INDIRECT_WINDOW=1` | 472 | 211 | The input was not fully controlled in the last two runs, so take those as approximate. Putting sampled textures in shared 64 MB heaps gave no gain and is not included. ### Tests `victory-shader`: 210 passed on this branch. Clippy (`-D warnings`, `victory-shader` and `victory-gpu`) is clean. `victory-gpu`: 110 passed on an earlier base with these changes; not re-run on this one. The game runs above were also on that earlier base. No unit test is added for the new rule. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The structure builder's prefix sums read a sum of scalars and shared memory at a uniform address with v_readfirstlane; on a 32-lane host that was refused and kept the whole builder off (3 of 53 programs).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Programs that walk the structures declared every copy written, which let the builder's quarantine leak into title memory.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:40:08 +00:00
Author
Owner

@⁠Krashgamer on GitHub · 2026-11-25 03:05 UTC · original

Tested on an RTX 3080 10 GB (32-lane), i7-10700K, 32 GB, Windows 11 26200, driver 610.88. Tree: fork main c96b4f2 + this PR (947d8b6), diag build, Series X profile, scripted Enter only (no pad input), 300 s runs. Switches: VICTORY_BVH_BUILDER=1 VICTORY_BVH_QUARANTINE=1, plus #176's set (VICTORY_DISPLAY_MODE=1920x1080 VICTORY_LATE_WAIT=3 VICTORY_SHADER_LOOP_LIMIT=4096, rest now default).

  • c96b4f2 alone: the ray-tracing structure builder stays off ... missing=3 of=53.
  • With this PR: the ray-tracing structure builder runs ... pipelines=53. 3 of 3 runs reached 300 s with no access violation and no device loss. Dispatches dropped without a host pipeline fell from ~340/frame (builder stages) to 4-23/frame (the refused 02384a60fda6f2d0, 2cc4c197ee29e291, 2da4beb386509b77, 369cbe906ea72764 and f133e35efed2a48a). Median frame after 2 min: 1585 / 362 / 796 ms (builder off: about 280-420 ms; prologue, view not fixed). Deformed meshes, as you note.
  • Without quarantine (1 run): the title crashed at 96 s, 0xc0000005 reading 0x17 in title code.
  • Same machine and switches, the other two builder PRs instead of this one: #497 crashed 2 of 2 runs at about 2 min, #156 1 of 1 at 113 s, both with quarantine on (reads of -1 / an uncommitted page in title code). Neither has this PR's change 2 (numbered copies declared written only for the builder), which fits your note that quarantine leaked without it.
  • Adding #346 on top (1 run): also 300 s, median 1115 ms; no clear change.

Not tested: longer runs, lighting (nothing reads the structures yet).

AI-assisted: Claude Code (Claude Opus 5.5) built, ran and measured this and wrote the comment; numbers are from our run logs.

**@⁠Krashgamer** on GitHub · 2026-11-25 03:05 UTC · [original](https://github.com/fxceless/victory-fork/pull/294#issuecomment-7151585260) Tested on an RTX 3080 10 GB (32-lane), i7-10700K, 32 GB, Windows 11 26200, driver 610.88. Tree: fork main `c96b4f2` + this PR (`947d8b6`), diag build, Series X profile, scripted Enter only (no pad input), 300 s runs. Switches: `VICTORY_BVH_BUILDER=1 VICTORY_BVH_QUARANTINE=1`, plus #176's set (`VICTORY_DISPLAY_MODE=1920x1080 VICTORY_LATE_WAIT=3 VICTORY_SHADER_LOOP_LIMIT=4096`, rest now default). - `c96b4f2` alone: `the ray-tracing structure builder stays off ... missing=3 of=53`. - With this PR: `the ray-tracing structure builder runs ... pipelines=53`. **3 of 3 runs reached 300 s** with no access violation and no device loss. Dispatches dropped without a host pipeline fell from ~340/frame (builder stages) to 4-23/frame (the refused `02384a60fda6f2d0`, `2cc4c197ee29e291`, `2da4beb386509b77`, `369cbe906ea72764` and `f133e35efed2a48a`). Median frame after 2 min: 1585 / 362 / 796 ms (builder off: about 280-420 ms; prologue, view not fixed). Deformed meshes, as you note. - Without quarantine (1 run): the title crashed at 96 s, `0xc0000005` reading `0x17` in title code. - Same machine and switches, the other two builder PRs instead of this one: #497 crashed 2 of 2 runs at about 2 min, #156 1 of 1 at 113 s, both with quarantine on (reads of `-1` / an uncommitted page in title code). Neither has this PR's change 2 (numbered copies declared written only for the builder), which fits your note that quarantine leaked without it. - Adding #346 on top (1 run): also 300 s, median 1115 ms; no clear change. Not tested: longer runs, lighting (nothing reads the structures yet). AI-assisted: Claude Code (Claude Opus 5.5) built, ran and measured this and wrote the comment; numbers are from our run logs.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/pipeline.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/294/head:github-bot/gh-294'
git switch 'github-bot/gh-294'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-294'
git switch 'github-bot/gh-294'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-294'
git switch 'github-bot/gh-294'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-294'
git switch 'main'
git merge --squash 'github-bot/gh-294'
git switch 'main'
git merge --ff-only 'github-bot/gh-294'
git switch 'main'
git merge 'github-bot/gh-294'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.