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

Merged
LouisRiverstone merged 1 commit from upstream-pr/1440 into main 2026-11-29 00:24:47 +00:00
LouisRiverstone commented 2026-11-28 20:04:40 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by LouisRiverstone on 2026-11-28T20:04:40Z.


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).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5544091025 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1440). Originally posted by [LouisRiverstone](https://github.com/LouisRiverstone) on 2026-11-28T20:04:40Z. --- ## 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`).
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
trustno1-coder/VIctory-NVIDIA!1440
No description provided.