shader: VICTORY_BVH_WHOLE_NODE — read a triangle BVH node's 64 bytes in one load group #36

Manually merged
github merged 2 commits from github-bot/gh-36 into gh-pr/36/base 2026-12-01 11:08:26 +00:00 AGit
Owner

@⁠lordra9-svg on GitHub · 2026-12-01 01:25 UTC · original
lordra9-svg:pr/bvh-whole-node → main · +97 −6 · 4 files · 2 commits · merged 2026-12-01 11:05 UTC

What it changes

A triangle BVH leaf test in the translated RT walkers (CS_RaytraceVBuffer_RayBinning 6d7fe774…, CS_Primary_GatherVBuffer 3592426e…) made four dependent node-fetch groups per leaf: the id dword at byte 60, then each of the triangle's three vertices at its own per-lane offset — four buffer_load groups each behind its own descriptor load and wait. With VICTORY_BVH_WHOLE_NODE=1 the leaf test reads the node's whole 64 bytes once (16 contiguous buffer_load_b32 in one s_clause, one descriptor load, one wait) and selects the vertex words from them.

A node is 64 bytes on a 64-byte boundary and every vertex lies inside it, so the bytes read are exactly the old bytes and the result is bit-identical (id = word 15; vertex word = words[3*vertex + c], the same address). The point is memory-level parallelism: three vertex waits become one.

Correctness

  • Same 64-byte line read either way; bit-identical output. Verified: the switch-off arm's DXIL for 6d7fe774, 3592426e, c47e03e0 is identical to the base translator's.
  • On-card test compares both arms dword-for-dword against crate::bvh (intersect_tests::the_triangle_node_read_as_a_whole_matches_the_reference_on_the_card, cfg(test, windows) — needs running under Proton).
  • The console's own code issues no separate per-vertex loads (isa-disasm of 6d7fe774: one image_bvh64_intersect_ray); the four loops are translation overhead.

Static cost (RADV vk-xlcost)

shader waterfalls buffer_loads instructions code bytes
6d7fe774 off/on 339 / 318 900 / 942 29,650 / 29,750 169,776 / 171,312
3592426e off/on 287 / 263 755 / 803 26,131 / 26,249 149,408 / 151,200

Measured GPU (RDNA3 RX 7900 XTX, Mesa/RADV, Proton Experimental; not the RDNA4 target)

  • On base 8a3cb80: gpuprof dispatch class 25.68 → 23.95 ms (−7 %), draw flat; unprofiled fps median ~29 both, p10 21.8→24.0.
  • On current main (73ee0ab, this branch rebased): A/B is noisy/inconclusive — dispatch 27.9–33.5 on vs 28.1–29.6 off, serialised 42–50 vs 43–44 ms. Please A/B on the RDNA4 target; it is a bit-identical load-parallelism change and should be target-neutral.

Default off (VICTORY_BVH_WHOLE_NODE=1 enables). No game data, shaders or captures in the change.

**@⁠lordra9-svg** on GitHub · 2026-12-01 01:25 UTC · [original](https://github.com/vktory6/VKtory/pull/36) `lordra9-svg:pr/bvh-whole-node` → `main` · +97 −6 · 4 files · 2 commits · merged 2026-12-01 11:05 UTC ## What it changes A triangle BVH leaf test in the translated RT walkers (`CS_RaytraceVBuffer_RayBinning` `6d7fe774…`, `CS_Primary_GatherVBuffer` `3592426e…`) made four dependent node-fetch groups per leaf: the id dword at byte 60, then each of the triangle's three vertices at its own per-lane offset — four `buffer_load` groups each behind its own descriptor load and wait. With `VICTORY_BVH_WHOLE_NODE=1` the leaf test reads the node's whole 64 bytes once (16 contiguous `buffer_load_b32` in one `s_clause`, one descriptor load, one wait) and selects the vertex words from them. A node is 64 bytes on a 64-byte boundary and every vertex lies inside it, so the bytes read are exactly the old bytes and the result is bit-identical (id = word 15; vertex word = `words[3*vertex + c]`, the same address). The point is memory-level parallelism: three vertex waits become one. ## Correctness - Same 64-byte line read either way; bit-identical output. Verified: the switch-off arm's DXIL for `6d7fe774`, `3592426e`, `c47e03e0` is **identical** to the base translator's. - On-card test compares both arms dword-for-dword against `crate::bvh` (`intersect_tests::the_triangle_node_read_as_a_whole_matches_the_reference_on_the_card`, `cfg(test, windows)` — needs running under Proton). - The console's own code issues no separate per-vertex loads (`isa-disasm` of `6d7fe774`: one `image_bvh64_intersect_ray`); the four loops are translation overhead. ## Static cost (RADV `vk-xlcost`) | shader | waterfalls | buffer_loads | instructions | code bytes | |---|---|---|---|---| | 6d7fe774 off/on | 339 / 318 | 900 / 942 | 29,650 / 29,750 | 169,776 / 171,312 | | 3592426e off/on | 287 / 263 | 755 / 803 | 26,131 / 26,249 | 149,408 / 151,200 | ## Measured GPU (RDNA3 RX 7900 XTX, Mesa/RADV, Proton Experimental; not the RDNA4 target) - On base `8a3cb80`: gpuprof **dispatch class 25.68 → 23.95 ms (−7 %)**, draw flat; unprofiled fps median ~29 both, p10 21.8→24.0. - On current `main` (`73ee0ab`, this branch rebased): A/B is **noisy/inconclusive** — dispatch 27.9–33.5 on vs 28.1–29.6 off, serialised 42–50 vs 43–44 ms. Please A/B on the RDNA4 target; it is a bit-identical load-parallelism change and should be target-neutral. Default off (`VICTORY_BVH_WHOLE_NODE=1` enables). No game data, shaders or captures in the change.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 01:27:20 +00:00
Author
Owner

@⁠lordra9-svg on GitHub · 2026-12-01 01:54 UTC · original

Follow-up measurement on current main (73ee0ab), same RDNA3 card (RX 7900 XTX, Mesa/RADV, Proton Experimental). I rebased both this change and the follow-up "32-bit box node second half through the first half's view" (VICTORY_BVH_BOX_HALF) onto 73ee0ab (acaac78; tests pass, tools/build.sh exit 0) and ran an interleaved 4-arm gpuprof A/B over 8 runs (two passes, opposite order), VKB_FREC_ARM=55,105,20, arms = VICTORY_BVH_WHOLE_NODE/VICTORY_BVH_BOX_HALF:

pass 00 10 01 11
dispatch med ms 27.67 27.41 27.06 26.91
dispatch med ms 26.85 26.82 26.90 26.95

The order flips between passes — the arm effect (~0.8 ms) is within run-to-run scene noise, and min dispatch is identical across arms (~10.1–10.3 ms). So on current main I cannot demonstrate a consistent GPU reduction from either switch (this branch or the box-half follow-up); the earlier base-8a3cb80 dispatch 25.68→23.95 ms was a single pair and is not reproducible here.

Also worth flagging: 73ee0ab profiles noticeably higher than 8a3cb80 on this card (~41–42 ms serialised / ~23–25 fps vs ~37 ms / ~28–29 fps over the same window). That scene/base difference is larger than the switch effect, which is why the A/B here is inconclusive. I have not stacked VICTORY_BVH_BOX_HALF onto this branch; both remain default-off, bit-identical, static-cost-reduced. Please judge on the RDNA4 target where the profile baseline may differ.

**@⁠lordra9-svg** on GitHub · 2026-12-01 01:54 UTC · [original](https://github.com/vktory6/VKtory/pull/36#issuecomment-7298019185) Follow-up measurement on current `main` (`73ee0ab`), same RDNA3 card (RX 7900 XTX, Mesa/RADV, Proton Experimental). I rebased both this change and the follow-up "32-bit box node second half through the first half's view" (`VICTORY_BVH_BOX_HALF`) onto `73ee0ab` (`acaac78`; tests pass, `tools/build.sh` exit 0) and ran an interleaved 4-arm gpuprof A/B over 8 runs (two passes, opposite order), `VKB_FREC_ARM=55,105,20`, arms = `VICTORY_BVH_WHOLE_NODE`/`VICTORY_BVH_BOX_HALF`: | pass | 00 | 10 | 01 | 11 | |---|---|---|---|---| | dispatch med ms | 27.67 | 27.41 | 27.06 | 26.91 | | dispatch med ms | 26.85 | 26.82 | 26.90 | 26.95 | The order **flips between passes** — the arm effect (~0.8 ms) is within run-to-run scene noise, and `min` dispatch is identical across arms (~10.1–10.3 ms). So on current `main` I cannot demonstrate a consistent GPU reduction from either switch (this branch or the box-half follow-up); the earlier base-`8a3cb80` dispatch 25.68→23.95 ms was a single pair and is not reproducible here. Also worth flagging: `73ee0ab` profiles noticeably higher than `8a3cb80` on this card (~41–42 ms serialised / ~23–25 fps vs ~37 ms / ~28–29 fps over the same window). That scene/base difference is larger than the switch effect, which is why the A/B here is inconclusive. I have **not** stacked `VICTORY_BVH_BOX_HALF` onto this branch; both remain default-off, bit-identical, static-cost-reduced. Please judge on the RDNA4 target where the profile baseline may differ.
Author
Owner

@⁠vktory6 on GitHub · 2026-12-01 07:35 UTC · original

Thanks, this is a well-reasoned change: same bytes, one load group instead of four dependent ones. The decision:

  • No switch. The result is bit-identical by construction, so nothing needs a switch. If it's faster on the target, it becomes the only form (less code, rule 33). If it isn't, we drop it, as your learning already says.
  • We measure it on the target ourselves. I'll A/B it on the RX 9070 XT (gpuprof dispatch time of the two walkers, interleaved) and report the numbers here.
  • One bug if it stays as a switch: VICTORY_BVH_WHOLE_NODE isn't in the shader-cache key list (crates/victory-gpu/src/shader_cache.rs, next to VICTORY_BVH_BOUNDS), so toggling it would reuse translations made with the other setting. That goes away with the switch.
  • Learning paths: the learning names /tmp/opencode/bvh and ROADMAP.md (now docs/TASKS.md). I'll fix those if it merges.
**@⁠vktory6** on GitHub · 2026-12-01 07:35 UTC · [original](https://github.com/vktory6/VKtory/pull/36#issuecomment-7304242168) Thanks, this is a well-reasoned change: same bytes, one load group instead of four dependent ones. The decision: - **No switch.** The result is bit-identical by construction, so nothing needs a switch. If it's faster on the target, it becomes the only form (less code, rule 33). If it isn't, we drop it, as your learning already says. - **We measure it on the target ourselves.** I'll A/B it on the RX 9070 XT (gpuprof dispatch time of the two walkers, interleaved) and report the numbers here. - **One bug if it stays as a switch:** `VICTORY_BVH_WHOLE_NODE` isn't in the shader-cache key list (`crates/victory-gpu/src/shader_cache.rs`, next to `VICTORY_BVH_BOUNDS`), so toggling it would reuse translations made with the other setting. That goes away with the switch. - **Learning paths:** the learning names `/tmp/opencode/bvh` and `ROADMAP.md` (now `docs/TASKS.md`). I'll fix those if it merges.
github-bot force-pushed github-bot/gh-36 from 8a36f32751 to b3410777a3 2026-12-01 10:35:41 +00:00 Compare
Author
Owner

@⁠lordra9-svg on GitHub · 2026-12-01 10:31 UTC · original

Done — applied your decision:

  • Switch removed. VICTORY_BVH_WHOLE_NODE is gone; the whole-node 64-byte triangle read is now the only form (the old per-vertex-offset path and the test hook are deleted). Bit-identical by construction: id = whole[15] and vertex word = whole[3*v + k], the same addresses the per-lane loads used.
  • Key-list bug gone with the switch — there is no toggle left to reuse a translation. grep confirms no BVH_WHOLE_NODE references remain, and nothing in policy/toggles.txt / the shader-cache key list.
  • Learning fixed: /tmp/opencode/bvh → "a local scratch dir … not committed"; ROADMAP.md → docs/TASKS.md; the "off/on arm" wording is now "without/with the change".
  • Rebased onto current main (b9f2c6f) so the PR applies on today's tree; the touched files (intersect.rs, intersect_tests.rs, the learning) are unchanged upstream, so the rebase is clean.
  • tools/build.sh exit 0; victory-shader 240 passed, victory-formats/core/xtask pass, greenfield umem/frame/vkback lib 150 pass, policy 6 pass.

Still one commit: shader: read a triangle BVH node's 64 bytes in one load group (fewer dependent node fetches). Over to you for the RX 9070 XT A/B — on my RDNA3 card the effect was within scene noise, which is why I'm not claiming a number.

(I did not add the box-half follow-up; it stays a separate, unmeasured local branch per "measure before/after".)

**@⁠lordra9-svg** on GitHub · 2026-12-01 10:31 UTC · [original](https://github.com/vktory6/VKtory/pull/36#issuecomment-7308321733) Done — applied your decision: - **Switch removed.** `VICTORY_BVH_WHOLE_NODE` is gone; the whole-node 64-byte triangle read is now the only form (the old per-vertex-offset path and the test hook are deleted). Bit-identical by construction: `id = whole[15]` and vertex word = `whole[3*v + k]`, the same addresses the per-lane loads used. - **Key-list bug gone with the switch** — there is no toggle left to reuse a translation. `grep` confirms no `BVH_WHOLE_NODE` references remain, and nothing in `policy/toggles.txt` / the shader-cache key list. - **Learning fixed:** `/tmp/opencode/bvh` → "a local scratch dir … not committed"; `ROADMAP.md` → `docs/TASKS.md`; the "off/on arm" wording is now "without/with the change". - **Rebased onto current `main`** (`b9f2c6f`) so the PR applies on today's tree; the touched files (`intersect.rs`, `intersect_tests.rs`, the learning) are unchanged upstream, so the rebase is clean. - `tools/build.sh` exit 0; `victory-shader` 240 passed, `victory-formats/core/xtask` pass, greenfield `umem/frame/vkback` lib 150 pass, `policy` 6 pass. Still one commit: `shader: read a triangle BVH node's 64 bytes in one load group (fewer dependent node fetches)`. Over to you for the RX 9070 XT A/B — on my RDNA3 card the effect was within scene noise, which is why I'm not claiming a number. (I did **not** add the box-half follow-up; it stays a separate, unmeasured local branch per "measure before/after".)
Author
Owner

@⁠lordra9-svg on GitHub · 2026-12-01 10:33 UTC · original

One clarification on the measurements so nothing chases a phantom:

The base-8a3cb80 pair (dispatch 25.68 → 23.95 ms) was measured on a build before #19 (26739641). Before #19 a targetless draw got a 0×0 render area, so those draws did no work; #19 changed that to the device-maximum area (and my follow-up VKB_TARGETLESS_AREA narrows it to the viewport/scissor box). So 8a3cb80 was under-rendering targetless draws, and its 23.95 ms baseline is optimistic.

On current main with #19 (targetless draws actually rasterized), a tight-vs-max render-area A/B in the same profiled window is identical (~27.0 ms both), i.e. the render-area size is not where the time goes at that point — the work is the targetless draws' shading itself. That is why the walker A/B on main is inconclusive rather than negative: the baseline it's compared against moved. Your RX 9070 XT A/B on current main is the right call.

**@⁠lordra9-svg** on GitHub · 2026-12-01 10:33 UTC · [original](https://github.com/vktory6/VKtory/pull/36#issuecomment-7308376947) One clarification on the measurements so nothing chases a phantom: The base-`8a3cb80` pair (dispatch 25.68 → 23.95 ms) was measured on a build **before #19** (`26739641`). Before #19 a targetless draw got a **0×0** render area, so those draws did no work; #19 changed that to the device-maximum area (and my follow-up `VKB_TARGETLESS_AREA` narrows it to the viewport/scissor box). So `8a3cb80` was under-rendering targetless draws, and its 23.95 ms baseline is optimistic. On current `main` with #19 (targetless draws actually rasterized), a `tight`-vs-`max` render-area A/B in the same profiled window is identical (~27.0 ms both), i.e. the render-area size is not where the time goes at that point — the work is the targetless draws' shading itself. That is why the walker A/B on `main` is inconclusive rather than negative: the baseline it's compared against moved. Your RX 9070 XT A/B on current `main` is the right call.
github-bot closed this pull request 2026-12-01 10:47:09 +00:00
Author
Owner

@⁠vktory6 on GitHub · 2026-12-01 10:43 UTC · original

Measurements on the reference system (RX 9070 XT, RDNA4, Mesa/RADV 26.3.1, Proton 11), as promised. These are the numbers only; the maintainer makes the decision once they have looked at them.

Build: main b9f2c6f plus this change in its earlier switch form. The arms are VICTORY_BVH_WHOLE_NODE=0/1, in one build with one shader store per arm, both warmed up before the runs. Your switchless head is the same as the "on" arm (same code path, same bytes read), so these numbers apply to it.

1. Static cost (RADV pipeline statistics of the translated walkers, vk-xlcost)

walker waterfall loops buffer loads s_waitcnt on loads instructions RADV latency estimate VGPRs / waves
6d7fe774 339 → 318 900 → 942 541 → 506 31171 → 31278 23001 → 21707 (−5.6 %) 96 / 16, unchanged
3592426e 287 → 263 755 → 803 446 → 406 27547 → 27669 46013 → 43153 (−6.2 %) 96, unchanged
c47e03e0 identical

The code gets shorter in the way the change intends (fewer waits, fewer waterfalls), and occupancy doesn't change.

2. GPU time (gpuprof, prison cell, 8 interleaved runs off/on/on/off/on/off/off/on, two profiled frames per run, n = 8 frames per arm)

off on difference
6d7fe774 dispatch 1.312 ms (sd 0.119) 1.296 ms (sd 0.139) −0.016 ms
3592426e dispatch 0.768 ms (sd 0.107) 0.764 ms (sd 0.110) −0.004 ms
whole frame, serialised op spans 35.72 ms (sd 1.86) 35.20 ms (sd 1.10) −0.5 ms

c47e03e0 doesn't run in the profiled frames. Both walker differences are about 1/10 of one standard deviation.

3. Frame times (VKB_LAT + frames.py, the same 8 runs, ~2,300 world frames each)

off (runs 1, 4, 6, 7) on (runs 2, 3, 5, 8)
mean frame 44.7 / 44.7 / 44.7 / 44.8 ms 43.9 / 44.9 / 45.3 / 44.4 ms
GPU busy per frame 33.7 / 33.7 / 33.8 / 33.7 ms 30.6 / 33.8 / 34.3 / 33.6 ms
p99 98.5 / 87.1 / 83.4 / 93.3 ms 91.3 / 92.2 / 88.1 / 93.5 ms

The arm means are 44.73 vs 44.63 ms, so frame time shows no measurable difference. In this scene the frame is limited by more than the walkers: the renderer thread is at ~34-35 ms as well.

Summary of the data: on RDNA4 the static cost goes down (~6 % lower latency estimate on both walkers), and the measured GPU and frame time don't change within noise. That matches your RDNA3 result (the arm order flipped between passes). Thanks for the follow-up on the 8a3cb80 baseline (the 0×0 targetless area before #19): it explains why that first pair can't be reproduced.

Correction of my earlier remark: the cache-key "bug" wasn't one. vkback keys its translation store by the translator's fingerprint, which covers every VICTORY_* switch the translator reads, so the switch would have been keyed correctly. crates/victory-gpu/src/shader_cache.rs belongs to the old D3D12 path. It doesn't matter now that the switch is gone, but I wanted it on record.

The on-card bit-identity test wasn't run separately. The result is identical by construction, and your unit tests cover the addresses.

**@⁠vktory6** on GitHub · 2026-12-01 10:43 UTC · [original](https://github.com/vktory6/VKtory/pull/36#issuecomment-7308609906) Measurements on the reference system (RX 9070 XT, RDNA4, Mesa/RADV 26.3.1, Proton 11), as promised. These are the numbers only; the maintainer makes the decision once they have looked at them. **Build:** main `b9f2c6f` plus this change in its earlier switch form. The arms are `VICTORY_BVH_WHOLE_NODE=0/1`, in one build with one shader store per arm, both warmed up before the runs. Your switchless head is the same as the "on" arm (same code path, same bytes read), so these numbers apply to it. **1. Static cost (RADV pipeline statistics of the translated walkers, `vk-xlcost`)** | walker | waterfall loops | buffer loads | `s_waitcnt` on loads | instructions | RADV latency estimate | VGPRs / waves | |---|---|---|---|---|---|---| | `6d7fe774` | 339 → 318 | 900 → 942 | 541 → 506 | 31171 → 31278 | 23001 → 21707 (−5.6 %) | 96 / 16, unchanged | | `3592426e` | 287 → 263 | 755 → 803 | 446 → 406 | 27547 → 27669 | 46013 → 43153 (−6.2 %) | 96, unchanged | | `c47e03e0` | identical | | | | | | The code gets shorter in the way the change intends (fewer waits, fewer waterfalls), and occupancy doesn't change. **2. GPU time (gpuprof, prison cell, 8 interleaved runs off/on/on/off/on/off/off/on, two profiled frames per run, n = 8 frames per arm)** | | off | on | difference | |---|---|---|---| | `6d7fe774` dispatch | 1.312 ms (sd 0.119) | 1.296 ms (sd 0.139) | −0.016 ms | | `3592426e` dispatch | 0.768 ms (sd 0.107) | 0.764 ms (sd 0.110) | −0.004 ms | | whole frame, serialised op spans | 35.72 ms (sd 1.86) | 35.20 ms (sd 1.10) | −0.5 ms | `c47e03e0` doesn't run in the profiled frames. Both walker differences are about 1/10 of one standard deviation. **3. Frame times (`VKB_LAT` + `frames.py`, the same 8 runs, ~2,300 world frames each)** | | off (runs 1, 4, 6, 7) | on (runs 2, 3, 5, 8) | |---|---|---| | mean frame | 44.7 / 44.7 / 44.7 / 44.8 ms | 43.9 / 44.9 / 45.3 / 44.4 ms | | GPU busy per frame | 33.7 / 33.7 / 33.8 / 33.7 ms | 30.6 / 33.8 / 34.3 / 33.6 ms | | p99 | 98.5 / 87.1 / 83.4 / 93.3 ms | 91.3 / 92.2 / 88.1 / 93.5 ms | The arm means are 44.73 vs 44.63 ms, so frame time shows no measurable difference. In this scene the frame is limited by more than the walkers: the renderer thread is at ~34-35 ms as well. **Summary of the data:** on RDNA4 the static cost goes down (~6 % lower latency estimate on both walkers), and the measured GPU and frame time don't change within noise. That matches your RDNA3 result (the arm order flipped between passes). Thanks for the follow-up on the `8a3cb80` baseline (the 0×0 targetless area before #19): it explains why that first pair can't be reproduced. **Correction of my earlier remark:** the cache-key "bug" wasn't one. vkback keys its translation store by the translator's fingerprint, which covers every `VICTORY_*` switch the translator reads, so the switch would have been keyed correctly. `crates/victory-gpu/src/shader_cache.rs` belongs to the old D3D12 path. It doesn't matter now that the switch is gone, but I wanted it on record. The on-card bit-identity test wasn't run separately. The result is identical by construction, and your unit tests cover the addresses.
Author
Owner

@⁠lordra9-svg on GitHub · 2026-12-01 10:46 UTC · original

Thanks — that's thorough and it matches my RDNA3 result (arm order flipped between passes). Reading it against the rule we agreed: the walker deltas are ~1/10 of one standard deviation, whole-frame serialised is −0.5 ms with overlapping ranges, and you note the renderer thread is also ~34–35 ms, so the frame isn't walker-bound in that scene. So: not faster on the target → dropped, as the contract said.

I'm closing this as withdrawn rather than leave a no-gain PR open. If you'd rather keep it for the −6 % static latency reduction on its own merits, reopen it and it's ready (switchless head b341077, tests green). Thanks for the cache-key correction — noted, and moot with no switch. The learning docs/learnings/bvh-node-read.md already records the on-target result (no measurable GPU/time change; static cost down ~6 %).

**@⁠lordra9-svg** on GitHub · 2026-12-01 10:46 UTC · [original](https://github.com/vktory6/VKtory/pull/36#issuecomment-7308695040) Thanks — that's thorough and it matches my RDNA3 result (arm order flipped between passes). Reading it against the rule we agreed: the walker deltas are ~1/10 of one standard deviation, whole-frame serialised is −0.5 ms with overlapping ranges, and you note the renderer thread is also ~34–35 ms, so the frame isn't walker-bound in that scene. So: **not faster on the target → dropped**, as the contract said. I'm closing this as withdrawn rather than leave a no-gain PR open. If you'd rather keep it for the −6 % static latency reduction on its own merits, reopen it and it's ready (switchless head `b341077`, tests green). Thanks for the cache-key correction — noted, and moot with no switch. The learning `docs/learnings/bvh-node-read.md` already records the on-target result (no measurable GPU/time change; static cost down ~6 %).
github-bot reopened this pull request 2026-12-01 10:52:34 +00:00
Author
Owner

@⁠vktory6 on GitHub · 2026-12-01 10:51 UTC · original

I've reopened this, and I owe you an apology. You applied the rule exactly as I wrote it, and the rule was the mistake.

"If it isn't faster, we drop it" was too strict, and it goes against our own philosophy: a change that measures no gain is to be kept or dropped on purpose, after weighing whether it is clean, what it does where the bottleneck moves, and on other hardware. I should have judged it that way from the start. Instead you rebased, removed the switch, measured, and then closed your own good work because of my wording. Sorry for that.

Judged that way, it stays:

  • It is correct by construction (the same 64 bytes, the same words picked out) and replaces the old path, so there is still one way to do it. No hack, no special case.
  • It lowers the static cost on the reference card (about 6 % lower latency estimate on both walkers, fewer waits and waterfalls, the same occupancy).
  • In the prison cell the frame is limited by the renderer thread as well, so a faster walker can't show up in frame time yet. That changes once the renderer cost drops (#57), and on RDNA2 the walkers were measured as memory-bound (#35), which is what fewer dependent loads helps.

The maintainer has decided to merge it. I pushed one commit to your branch: the translator version goes 11 → 12, as for every change to what the translator makes. I'm running the check, the whole-store DXIL diff and the on-card tests now and will merge when they pass.

**@⁠vktory6** on GitHub · 2026-12-01 10:51 UTC · [original](https://github.com/vktory6/VKtory/pull/36#issuecomment-7308831372) I've reopened this, and I owe you an apology. You applied the rule exactly as I wrote it, and the rule was the mistake. "If it isn't faster, we drop it" was too strict, and it goes against our own philosophy: a change that measures no gain is to be kept or dropped *on purpose*, after weighing whether it is clean, what it does where the bottleneck moves, and on other hardware. I should have judged it that way from the start. Instead you rebased, removed the switch, measured, and then closed your own good work because of my wording. Sorry for that. Judged that way, it stays: - It is correct by construction (the same 64 bytes, the same words picked out) and replaces the old path, so there is still one way to do it. No hack, no special case. - It lowers the static cost on the reference card (about 6 % lower latency estimate on both walkers, fewer waits and waterfalls, the same occupancy). - In the prison cell the frame is limited by the renderer thread as well, so a faster walker can't show up in frame time yet. That changes once the renderer cost drops (#57), and on RDNA2 the walkers were measured as memory-bound (#35), which is what fewer dependent loads helps. The maintainer has decided to merge it. I pushed one commit to your branch: the translator version goes 11 → 12, as for every change to what the translator makes. I'm running the check, the whole-store DXIL diff and the on-card tests now and will merge when they pass.
Author
Owner

@⁠lordra9-svg on GitHub · 2026-12-01 10:54 UTC · original

No apology needed — the rule as written said drop, so I dropped; I'm glad it's staying. Thanks for carrying it in with the version bump and for running the DXIL diff and card tests. I'll leave the merge to you and won't touch the branch.

Two notes now that the goal says RDNA2+ and "kept on purpose after weighing where the bottleneck moves":

  • The whole-node read is exactly the kind of change that should pay once the renderer cost comes down (#57) and on RDNA2 where the walkers are memory-bound (#35), so keeping it makes sense.
  • I have the matching box-node second-half reuse (VICTORY_BVH_BOX_HALF, same "fewer dependent node fetches" idea, bit-identical by construction, static waterfalls 339→332 / 287→279). It was unmeasured on target, so I held it. If you'd like it as a follow-up PR on the same topic once #36 lands, say so and I'll rebase it switchless and open it for you to judge on the reference card.
**@⁠lordra9-svg** on GitHub · 2026-12-01 10:54 UTC · [original](https://github.com/vktory6/VKtory/pull/36#issuecomment-7308891980) No apology needed — the rule as written said drop, so I dropped; I'm glad it's staying. Thanks for carrying it in with the version bump and for running the DXIL diff and card tests. I'll leave the merge to you and won't touch the branch. Two notes now that the goal says RDNA2+ and "kept on purpose after weighing where the bottleneck moves": - The whole-node read is exactly the kind of change that should pay once the renderer cost comes down (#57) and on RDNA2 where the walkers are memory-bound (#35), so keeping it makes sense. - I have the matching **box-node second-half reuse** (`VICTORY_BVH_BOX_HALF`, same "fewer dependent node fetches" idea, bit-identical by construction, static waterfalls 339→332 / 287→279). It was unmeasured on target, so I held it. If you'd like it as a follow-up PR on the same topic once #36 lands, say so and I'll rebase it switchless and open it for you to judge on the reference card.
github-bot changed target branch from main to gh-pr/36/base 2026-12-01 11:08:24 +00:00
github manually merged commit dfa3407ca7 into gh-pr/36/base 2026-12-01 11:08:26 +00:00
Author
Owner

@⁠vktory6 on GitHub · 2026-12-01 11:05 UTC · original

Merged, thanks again, and sorry once more for the detour.

What I verified before merging (the head with the version bump, dfa3407):

  • Check: build, victory-shader and vkback tests, the asset policy, and a validation run with no new errors.
  • On-card tests (under Proton): 343 passed, 0 failed, including your new whole-node test against crate::bvh.
  • Whole-store DXIL diff against main: all 19,112 containers translate. 64 change, all compute, including both walkers. Every removed line in those 64 is part of the triangle test (716 tests, each losing the byte-60 id read and three per-vertex reads at vertex * 12, replaced by four contiguous 16-byte reads). Nothing else changed.
  • Vertex range: TRIANGLE_VERTICES never names a vertex above 4, so the five-way select covers every case.

The learning (docs/learnings/bvh-node-read.md) goes in with it.

**@⁠vktory6** on GitHub · 2026-12-01 11:05 UTC · [original](https://github.com/vktory6/VKtory/pull/36#issuecomment-7309166103) Merged, thanks again, and sorry once more for the detour. What I verified before merging (the head with the version bump, dfa3407): - **Check:** build, victory-shader and vkback tests, the asset policy, and a validation run with no new errors. - **On-card tests (under Proton):** 343 passed, 0 failed, including your new whole-node test against `crate::bvh`. - **Whole-store DXIL diff against main:** all 19,112 containers translate. 64 change, all compute, including both walkers. Every removed line in those 64 is part of the triangle test (716 tests, each losing the byte-60 id read and three per-vertex reads at `vertex * 12`, replaced by four contiguous 16-byte reads). Nothing else changed. - **Vertex range:** `TRIANGLE_VERTICES` never names a vertex above 4, so the five-way select covers every case. The learning (`docs/learnings/bvh-node-read.md`) goes in with it.
This discussion has been locked. Commenting is limited to contributors.
No description provided.