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

Open
ALFREDOHDEZ wants to merge 3 commits from upstream-pr/294 into main
ALFREDOHDEZ commented 2026-11-24 23:20:53 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by ALFREDOHDEZ on 2026-11-24T23:20:53Z.


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

<!-- greyfinch-sync:fxceless/victory-fork:issue:6593411440 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/294). Originally posted by [ALFREDOHDEZ](https://github.com/ALFREDOHDEZ) on 2026-11-24T23:20:53Z. --- 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)
Krashgamer commented 2026-11-25 03:06:37 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Krashgamer on 2026-11-25T03:05:48Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7151585260 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/294#issuecomment-7151585260). Originally posted by [Krashgamer](https://github.com/Krashgamer) on 2026-11-25T03:05:48Z. --- 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 cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/294:upstream-pr/294'
git switch 'upstream-pr/294'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/294'
git switch 'upstream-pr/294'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/294'
git switch 'upstream-pr/294'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/294'
git switch 'main'
git merge --squash 'upstream-pr/294'
git switch 'main'
git merge --ff-only 'upstream-pr/294'
git switch 'main'
git merge 'upstream-pr/294'
git push origin 'main'
Sign in to join this conversation.
No reviewers
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
fxceless/victory-fork!294
No description provided.