shader: a node test that misses every node asks nothing of title memory #1440

Manually merged
github merged 1 commit from github-bot/gh-1440 into gh-pr/1440/base 2026-11-29 00:28:03 +00:00 AGit
Owner

@⁠LouisRiverstone on GitHub · 2026-11-28 20:04 UTC · original
LouisRiverstone:perf/bvh-miss-no-memory-lookup → main · +47 −17 · 2 files · 1 commits · merged 2026-11-29 00:24 UTC

Why

With VICTORY_BVH_MISS=1 (the launcher's default) every ray-tracing node test already answers a miss, but the lowering still looked the node up in the directory of title memory before branching:

  • one SLOT_MEMORY directory load per node test, whose result no branch read;
  • for a page without a copy, a note in SLOT_FAULTS. memory.rs take_faults reads those notes every frame and, for each page, maps 64 KiB of card memory and sends it up (map + bring), for nodes that are never read.

So on the default settings the trace programs cost VRAM, uploads and host work for nothing. That hurts most on 8 GB cards.

What changed

crates/victory-shader/src/emit/intersect.rs: bvh_miss() now takes the same early path as no_hit(). A box returns NONE, anything else the triangle miss, and nothing is read. Those are the values the old bvh_miss() branches returned, so the picture should not change. The two branches made dead by this are removed.

The shader cache key includes the translator's sources (VICTORY_TRANSLATOR), so cached translations are replaced on the first run of this build.

Tests

  • New: a_node_test_that_misses_every_node_asks_nothing_of_title_memory checks that, with every node missed, the program binds neither SLOT_MEMORY nor SLOT_FAULTS, in both the 32- and 64-bit forms and both descriptor forms.
  • cargo test -p victory-shader: 337 passed, 6 ignored. This includes the on-card node tests against the reference.
  • cargo clippy -p victory-shader --all-targets: one warning, in emit/mod.rs:2837, which this PR does not touch.

Not verified

The change has not been run in game. To check it on a card, compare the log's ten-second line "title memory by address" (faults and pages made should drop to about zero with the builder off), and VRAM and GPU time in F3, against a build without it. Expect a stutter on the first run while the affected shaders are translated again (or run victory warm).

**@⁠LouisRiverstone** on GitHub · 2026-11-28 20:04 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1440) `LouisRiverstone:perf/bvh-miss-no-memory-lookup` → `main` · +47 −17 · 2 files · 1 commits · merged 2026-11-29 00:24 UTC ## Why With `VICTORY_BVH_MISS=1` (the launcher's default) every ray-tracing node test already answers a miss, but the lowering still looked the node up in the directory of title memory before branching: - one `SLOT_MEMORY` directory load per node test, whose result no branch read; - for a page without a copy, a note in `SLOT_FAULTS`. `memory.rs` `take_faults` reads those notes every frame and, for each page, maps 64 KiB of card memory and sends it up (`map` + `bring`), for nodes that are never read. So on the default settings the trace programs cost VRAM, uploads and host work for nothing. That hurts most on 8 GB cards. ## What changed `crates/victory-shader/src/emit/intersect.rs`: `bvh_miss()` now takes the same early path as `no_hit()`. A box returns `NONE`, anything else the triangle miss, and nothing is read. Those are the values the old `bvh_miss()` branches returned, so the picture should not change. The two branches made dead by this are removed. The shader cache key includes the translator's sources (`VICTORY_TRANSLATOR`), so cached translations are replaced on the first run of this build. ## Tests - New: `a_node_test_that_misses_every_node_asks_nothing_of_title_memory` checks that, with every node missed, the program binds neither `SLOT_MEMORY` nor `SLOT_FAULTS`, in both the 32- and 64-bit forms and both descriptor forms. - `cargo test -p victory-shader`: 337 passed, 6 ignored. This includes the on-card node tests against the reference. - `cargo clippy -p victory-shader --all-targets`: one warning, in `emit/mod.rs:2837`, which this PR does not touch. ## Not verified The change has not been run in game. To check it on a card, compare the log's ten-second line "title memory by address" (faults and pages made should drop to about zero with the builder off), and VRAM and GPU time in F3, against a build without it. Expect a stutter on the first run while the affected shaders are translated again (or run `victory warm`).
With VICTORY_BVH_MISS=1 (the launcher's default) every node test already
answered a miss, but it still looked the node up in the directory of title
memory first: a directory load per test, and, for a page without a copy, a
note in the faults buffer. The host read those notes every frame
(memory.rs take_faults) and made and sent up 64 KiB of card memory for
pages no branch ever read.

BVH_MISS now lowers as BVH_NO_HIT does: a box returns no child, anything
else the triangle miss, nothing is read. The results are the same as
before; the shader cache key follows the translator's sources.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 20:06:04 +00:00
github-bot force-pushed github-bot/gh-1440 from 35fa829bcd to 23cd9aa4c4 2026-11-28 20:11:38 +00:00 Compare
github-bot referenced this pull request from a commit 2026-11-29 00:27:22 +00:00
github-bot changed target branch from main to gh-pr/1440/base 2026-11-29 00:27:45 +00:00
github manually merged commit 23cd9aa4c4 into gh-pr/1440/base 2026-11-29 00:27:46 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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/trustno1-coder--VIctory-NVIDIA!1440
No description provided.