Ray-tracing builder translates on 32-lane GPUs; textures spill to shared memory; findings on a 6 GB laptop #601

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

@⁠DiogoPCastelos on GitHub · 2026-11-25 02:54 UTC · original
DiogoPCastelos:fork/6gb-laptop-rt-builder → main · +775 −26 · 11 files · 3 commits · open

Bring-up on a machine well below the fork's test machine (RTX 3060 Laptop 6 GB, i7-11800H, 16 GB RAM), rebased on main at 9376fd6. Where upstream has since done the same thing, upstream's version is kept and this branch's was dropped: v_cvt_f32_f64, v_permlane16/x16, first-half interpolation pairs, descriptors read only for their sizes (unused_descriptor_kind), the texture catch-up budget, the R9G9B9E5 stand-in, translate --warm. Every program those fixed still translates and validates.

What changes

Ray-tracing builder (off by default, VICTORY_BVH_BUILDER=1)

  • All 52 programs of the builder DLL now translate, validate and make pipelines on a 32-lane GPU (49 before). The last three are block-wide scans that broadcast a sum with v_readfirstlane inside a loop each console wave leaves together. lane_uniform now proves a shared-memory read at a uniform address uniform where the memory has settled (lds_settled: no write after it, every write before it behind an s_barrier), so both halves of a console wave take their own first lane. This is the case VICTORY_FIRSTLANE_OWN=1 was added for, now proven per program.
  • lane_uniform no longer counts a destination's old value as one of an operand's registers (an instruction whose destination was not one of its sources was never uniform).
  • In a run the builder now runs ("all of its programs have host pipelines pipelines=53") but is not usable yet: a stage stores outside the structures' buffers. The title faults within seconds, and with VICTORY_BVH_QUARANTINE=1 the layer runs out of memory copying what those stores name. The three scans are not the cause: a GPU test runs their form and checks every thread. Details and next steps in docs/fork-findings-6gb-laptop.md.

Shaders

  • Programs whose only cross-lane code is v_permlane16/x16 keep the console's lane order (upstream lowers the instructions but did not ask for that order).

Runtime

  • Textures picked by index may spill into the memory the system shares with the card once the card's share is reached, up to half of that budget (VICTORY_TEXTURE_SPILL=0 turns it off). On 6 GB, skin, walls and clothes sampled black without it. Upstream's kept room (buffer copies, first-frame targets) counts as used in both rules.
  • A dispatch whose pipeline is still being made waits for it instead of being dropped (VICTORY_COMPUTE_WAIT=0 drops it as before).
  • Pipeline workers wait while less than 2 GB of the system's commit is left (VICTORY_PIPELINE_COMMIT_MB).
  • Device slots 0x1c8/0x218 are Deserialize{Graphics,Compute}PipelineStateX. The title falls back to its description, so they now fail with one info line instead of a warning per call.
  • Series S: present planes are read at their real 72-byte size and their layout is logged from the title's descriptions. The UI plane is not composed yet.

The XCL items (the slot names, compute waiting, the commit guard) are ideas from its notes, written anew; no code was taken (XCL is GPL-2.0-only).

Testing

  • cargo test --workspace --release on the rebased branch: all pass (shader crate 218, GPU crate 144, HLE 98).
  • New GPU test a_scan_over_console_waves_sums_each_waves_predecessors passes on the RTX 3060. New unit tests for lds_settled (positive, no-barrier and write-after cases).
  • As for this GPU (VICTORY_HOST_WAVE=32 … --validate --pipelines): all 52 builder programs. The programs fixed while this was written (deferred materials, puddles, a shallow-water reduction, water transmittance) validate and make pipelines with upstream's fixes. Two water volumetrics programs validate but the driver refuses their pipelines (upstream's state; listed in the doc).
  • cargo xtask policy: ok. Formatting: no rustfmt differences added beyond each file's existing ones.
  • The documented warm-up (--warm all with this GPU's two settings) followed by a launch: 2,119 shaders from the cache, 2 translated.

Not done

  • GPU feedback for textures picked by index, so the slots the frame samples come first.
  • The builder stage that stores out of bounds.
  • The five compute programs that still need 64-lane waves (shared memory inside per-lane branches).
  • Composing the Series S UI plane.

🤖 Generated with Claude Code

**@⁠DiogoPCastelos** on GitHub · 2026-11-25 02:54 UTC · [original](https://github.com/fxceless/victory-fork/pull/601) `DiogoPCastelos:fork/6gb-laptop-rt-builder` → `main` · +775 −26 · 11 files · 3 commits · open Bring-up on a machine well below the fork's test machine (RTX 3060 Laptop 6 GB, i7-11800H, 16 GB RAM), rebased on `main` at 9376fd6. Where upstream has since done the same thing, upstream's version is kept and this branch's was dropped: `v_cvt_f32_f64`, `v_permlane16/x16`, first-half interpolation pairs, descriptors read only for their sizes (`unused_descriptor_kind`), the texture catch-up budget, the R9G9B9E5 stand-in, `translate --warm`. Every program those fixed still translates and validates. ## What changes **Ray-tracing builder (off by default, `VICTORY_BVH_BUILDER=1`)** - All 52 programs of the builder DLL now translate, validate and make pipelines on a 32-lane GPU (49 before). The last three are block-wide scans that broadcast a sum with `v_readfirstlane` inside a loop each console wave leaves together. `lane_uniform` now proves a shared-memory read at a uniform address uniform where the memory has settled (`lds_settled`: no write after it, every write before it behind an `s_barrier`), so both halves of a console wave take their own first lane. This is the case `VICTORY_FIRSTLANE_OWN=1` was added for, now proven per program. - `lane_uniform` no longer counts a destination's old value as one of an operand's registers (an instruction whose destination was not one of its sources was never uniform). - In a run the builder now runs ("all of its programs have host pipelines pipelines=53") but **is not usable yet**: a stage stores outside the structures' buffers. The title faults within seconds, and with `VICTORY_BVH_QUARANTINE=1` the layer runs out of memory copying what those stores name. The three scans are not the cause: a GPU test runs their form and checks every thread. Details and next steps in `docs/fork-findings-6gb-laptop.md`. **Shaders** - Programs whose only cross-lane code is `v_permlane16/x16` keep the console's lane order (upstream lowers the instructions but did not ask for that order). **Runtime** - Textures picked by index may spill into the memory the system shares with the card once the card's share is reached, up to half of that budget (`VICTORY_TEXTURE_SPILL=0` turns it off). On 6 GB, skin, walls and clothes sampled black without it. Upstream's kept room (buffer copies, first-frame targets) counts as used in both rules. - A dispatch whose pipeline is still being made waits for it instead of being dropped (`VICTORY_COMPUTE_WAIT=0` drops it as before). - Pipeline workers wait while less than 2 GB of the system's commit is left (`VICTORY_PIPELINE_COMMIT_MB`). - Device slots 0x1c8/0x218 are `Deserialize{Graphics,Compute}PipelineStateX`. The title falls back to its description, so they now fail with one info line instead of a warning per call. - Series S: present planes are read at their real 72-byte size and their layout is logged from the title's descriptions. The UI plane is not composed yet. The XCL items (the slot names, compute waiting, the commit guard) are ideas from its notes, written anew; no code was taken (XCL is GPL-2.0-only). ## Testing - `cargo test --workspace --release` on the rebased branch: all pass (shader crate 218, GPU crate 144, HLE 98). - New GPU test `a_scan_over_console_waves_sums_each_waves_predecessors` passes on the RTX 3060. New unit tests for `lds_settled` (positive, no-barrier and write-after cases). - As for this GPU (`VICTORY_HOST_WAVE=32 … --validate --pipelines`): all 52 builder programs. The programs fixed while this was written (deferred materials, puddles, a shallow-water reduction, water transmittance) validate and make pipelines with upstream's fixes. Two water volumetrics programs validate but the driver refuses their pipelines (upstream's state; listed in the doc). - `cargo xtask policy`: ok. Formatting: no rustfmt differences added beyond each file's existing ones. - The documented warm-up (`--warm all` with this GPU's two settings) followed by a launch: 2,119 shaders from the cache, 2 translated. ## Not done - GPU feedback for textures picked by index, so the slots the frame samples come first. - The builder stage that stores out of bounds. - The five compute programs that still need 64-lane waves (shared memory inside per-lane branches). - Composing the Series S UI plane. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
- lane_uniform proves a shared-memory read at a uniform address uniform
  where the memory has settled (lds_settled: no write after it on any path,
  every write before it reaches it only through s_barrier). The builder's
  block-wide scans broadcast such a sum with v_readfirstlane inside a loop
  each console wave leaves together; both halves of a console wave now take
  their own first lane, without VICTORY_FIRSTLANE_OWN. All 52 programs of
  the title's builder DLL translate, validate and make pipelines on an
  RTX 3060 (49 before), so the builder can run at all. A GPU test runs a
  scan over the eight console waves of a 512-thread group as 32-lane halves
  and checks every thread; unit tests cover the barrier and write rules.
- lane_uniform no longer takes a destination's old value (read by the IR)
  for one of an operand's registers: an instruction whose destination was
  not one of its sources was never uniform.
- Programs whose only cross-lane code is v_permlane16/x16 keep the
  console's lane order.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Textures picked by index may go on into the PC memory the system shares
  with the card once the card's share is reached, up to half of that budget
  (VICTORY_TEXTURE_SPILL=0: off). On a 6 GB card the card's share was
  reached in the world's first frames and skin, walls and clothes sampled
  black; with the spill the same shots have their colours. The room upstream
  keeps for card copies of title buffers and first-frame render targets
  counts as used in both rules.
- A dispatch whose pipeline is still being made after the frame's wait
  waits for it instead of being dropped (VICTORY_COMPUTE_WAIT=0: dropped):
  a dropped dispatch leaves its results unwritten for later passes. The
  rule XCL follows.
- Pipeline workers wait while less than 2 GB of the system's commit is left
  (VICTORY_PIPELINE_COMMIT_MB); a pipeline a title thread waits for does
  not. A driver failing an allocation in its compiler crashes inside itself.
- Device slots 0x1c8 and 0x218 are Deserialize{Graphics,Compute}PipelineStateX
  (the console driver's pipeline cache): the title makes the pipeline from
  its description when they fail, so they fail quietly now (one line, not
  a warning per call).
- Series S: present planes are read at their real size (72 bytes; the
  second plane's count read as garbage at 24) and their layout is logged
  when it changes, from the title's descriptions (no host copy made). The
  UI plane is not composed yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
What was run, measured and changed on an RTX 3060 Laptop with 16 GB of RAM,
what XCL's notes on the same title gave, and what is open. The builder now
runs but a stage stores outside the structures' buffers (the title faults;
quarantined, the layer runs out of memory copying what those stores name).

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

@⁠Headache3318 on GitHub · 2026-11-25 08:32 UTC · original

Independent verification: PR #543 does not exist on this repo; verified PR #601 (Ray-tracing builder translates on 32-lane GPUs) instead. Build: success (7.93s). Tests: fail due to pre-existing Linux build errors in victory-loader (missing windows_sys) and victory-gpu (host_resource not in scope) — confirmed identical on main without this PR. PR #601 introduces no regressions. Conflicts: none. Machine: Arch Linux, kernel 7.3.5-arch1-1, 3x RTX 4090 driver 620.73.04, Proton, AI-assisted.

**@⁠Headache3318** on GitHub · 2026-11-25 08:32 UTC · [original](https://github.com/fxceless/victory-fork/pull/601#issuecomment-7157161813) Independent verification: PR #543 does not exist on this repo; verified PR #601 (Ray-tracing builder translates on 32-lane GPUs) instead. Build: success (7.93s). Tests: fail due to pre-existing Linux build errors in victory-loader (missing windows_sys) and victory-gpu (host_resource not in scope) — confirmed identical on main without this PR. PR #601 introduces no regressions. Conflicts: none. Machine: Arch Linux, kernel 7.3.5-arch1-1, 3x RTX 4090 driver 620.73.04, Proton, AI-assisted.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/device.rs
  • crates/victory-gpu/src/pipeline.rs
  • crates/victory-gpu/src/queue.rs
  • crates/victory-shader/src/emit/wave64_tests.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/601/head:github-bot/gh-601'
git switch 'github-bot/gh-601'

Merge

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