GPU: programs that walk the BVH wait until the builder has run whole (NVIDIA device hang at world entry) #2309

Open
Bullet18x wants to merge 2 commits from upstream-pr/2311 into main
Bullet18x commented 2026-11-25 10:20:39 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Bullet18x on 2026-11-25T10:20:39Z.


Stacked on #2118 ("the BVH builder runs whole or not at all"); only the last commit, 481a9ae, is new here. If #2118 changes, I'll rebase.

Problem

On a host of 32-lane waves the BVH builder never runs: some of XboxBvhBuilder.dll's 64-lane programs are refused (with #1960, the ones that share LDS within one wave64 group: 28918b7150a7aad5, caa78b8ca62bc3d6 and 3 more), so #2118 holds the builder back for good. The structures are never built.

The world's ray-traced pass (f607780aa8e502d0, #1968/#2098) still runs. It walks the structures with image_bvh64_intersect_ray, in a loop the title bounds at 65,535 steps per wave, over whatever lies in that memory. That outlasts the GPU timeout: DXGI_ERROR_DEVICE_HUNG at world entry, every run.

RTX 5090, driver 621.40, DRED, main + #2177 #2178 #1868 #2180 #1780 #2098 #2118 #1960 + #2286:

BVH builder held back: not all its pipelines are made pipelines=53 made=48 refused=5
host GPU device removed ... a list stopped at command 84 of 113 (op 5), commands 83..85
command 84 (op 5): indirect kind 2 max 1 [compute f607780aa8e502d0]
... (0x887A0006 DXGI_ERROR_DEVICE_HUNG)   frame 1185

Without #2118 or #1960 it hangs at the same point, inside the half-run builder instead (caa78b8ca62bc3d6 / 28918b7150a7aad5).

Fix

A pipeline with an image_bvh*_intersect_ray program (found from its containers' native code at creation, pipeline::walks_bvh) is held back like the builder's own dispatches, until the builder has run whole once (builder::built, set when runs() opens with builder pipelines). Titles without XboxBvhBuilder.dll are not held.

held_back now returns why, and the dispatch and indirect paths log it once and pass it to the diagnostics' drop reasons.

On a host where the builder runs (64-lane waves), walks start at most one frame later than before. On a host where it cannot, ray-traced passes do not run (their output stays as on main without the builder: no ray-traced lighting) and the device survives.

Tested

  • Same stack + this commit: ran 5+ minutes into the world, frame 6,436, 0 errors, until I stopped it. The log shows an indirect call held back why="a BVH walk held back: the builder has not built its structures". Before: device hung at frame ~1,185, every run.
  • New tests: programs_that_intersect_rays_walk_the_structures (narrow and NSA image_bvh* encodings vs. plain code), walks_wait_for_the_builder_to_run_whole.
  • cargo test -p victory-gpu: 146 passed, 2 failed. The 2 are NVIDIA's 1,000,000 view-heap cap, same as on main (#2177 / #2185).
  • cargo clippy --workspace --all-targets --locked -- -D warnings: clean.

Not covered

The builder itself on 32-lane hosts: its LDS-sharing wave64 programs need both halves of a console wave in one control flow (#1929's console flow, or #1960 extended). This only keeps the title alive until then.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6602253121 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2311). Originally posted by [Bullet18x](https://github.com/Bullet18x) on 2026-11-25T10:20:39Z. --- **Stacked on #2118** ("the BVH builder runs whole or not at all"); only the last commit, 481a9ae, is new here. If #2118 changes, I'll rebase. ## Problem On a host of 32-lane waves the BVH builder never runs: some of `XboxBvhBuilder.dll`'s 64-lane programs are refused (with #1960, the ones that share LDS within one wave64 group: `28918b7150a7aad5`, `caa78b8ca62bc3d6` and 3 more), so #2118 holds the builder back for good. The structures are never built. The world's ray-traced pass (`f607780aa8e502d0`, #1968/#2098) still runs. It walks the structures with `image_bvh64_intersect_ray`, in a loop the title bounds at 65,535 steps per wave, over whatever lies in that memory. That outlasts the GPU timeout: `DXGI_ERROR_DEVICE_HUNG` at world entry, every run. RTX 5090, driver 621.40, DRED, main + #2177 #2178 #1868 #2180 #1780 #2098 #2118 #1960 + #2286: ``` BVH builder held back: not all its pipelines are made pipelines=53 made=48 refused=5 host GPU device removed ... a list stopped at command 84 of 113 (op 5), commands 83..85 command 84 (op 5): indirect kind 2 max 1 [compute f607780aa8e502d0] ... (0x887A0006 DXGI_ERROR_DEVICE_HUNG) frame 1185 ``` Without #2118 or #1960 it hangs at the same point, inside the half-run builder instead (`caa78b8ca62bc3d6` / `28918b7150a7aad5`). ## Fix A pipeline with an `image_bvh*_intersect_ray` program (found from its containers' native code at creation, `pipeline::walks_bvh`) is held back like the builder's own dispatches, until the builder has run whole once (`builder::built`, set when `runs()` opens with builder pipelines). Titles without `XboxBvhBuilder.dll` are not held. `held_back` now returns why, and the dispatch and indirect paths log it once and pass it to the diagnostics' drop reasons. On a host where the builder runs (64-lane waves), walks start at most one frame later than before. On a host where it cannot, ray-traced passes do not run (their output stays as on main without the builder: no ray-traced lighting) and the device survives. ## Tested - Same stack + this commit: ran 5+ minutes into the world, frame 6,436, 0 errors, until I stopped it. The log shows `an indirect call held back why="a BVH walk held back: the builder has not built its structures"`. Before: device hung at frame ~1,185, every run. - New tests: `programs_that_intersect_rays_walk_the_structures` (narrow and NSA `image_bvh*` encodings vs. plain code), `walks_wait_for_the_builder_to_run_whole`. - `cargo test -p victory-gpu`: 146 passed, 2 failed. The 2 are NVIDIA's 1,000,000 view-heap cap, same as on main (#2177 / #2185). - `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean. ## Not covered The builder itself on 32-lane hosts: its LDS-sharing wave64 programs need both halves of a console wave in one control flow (#1929's console flow, or #1960 extended). This only keeps the title alive until then. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
catminou4 commented 2026-11-25 11:04:47 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T10:54:03Z.

Review: COMMENTED


Programs walking the BVH wait until the builder finishes (note_title_dll wiring + draw.rs gate). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.

<!-- greyfinch-sync:Marvisak/VIctory:review:6056243063 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2311#pullrequestreview-6056243063). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T10:54:03Z. **Review:** COMMENTED --- Programs walking the BVH wait until the builder finishes (note_title_dll wiring + draw.rs gate). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.
DesertGamer commented 2026-11-25 11:05:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DesertGamer on 2026-11-25T10:26:07Z.


Not a request to change how this issue works, just a note for people who want a running build to try pull requests together, and for authors whose PRs may already be in it.

VIctory V2 is an integration fork: it merges community pull requests, keeps each author in the history, and runs cargo test --workspace plus one run of the title before each push. On our machine it reaches the first cutscene. It is not playable yet and it is not the official project or endorsed by its author. Three tests are red, listed in the issues there.

What would help us:

  • a test report from your GPU: one comment per machine in hardware reports (there is a form);
  • three small tasks labelled help wanted (one, two, three), two of them look like stale tests.

If you want your PR exercised together with others in a running build, tell us its number.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7159690328 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2311#issuecomment-7159690328). Originally posted by [DesertGamer](https://github.com/DesertGamer) on 2026-11-25T10:26:07Z. --- Not a request to change how this issue works, just a note for people who want a running build to try pull requests together, and for authors whose PRs may already be in it. [VIctory V2](https://github.com/DesertGamer/VIctory-V2) is an integration fork: it merges community pull requests, keeps each author in the history, and runs `cargo test --workspace` plus one run of the title before each push. On our machine it reaches the first cutscene. It is not playable yet and it is not the official project or endorsed by its author. Three tests are red, listed in the issues there. What would help us: - a test report from your GPU: one comment per machine in [hardware reports](https://github.com/DesertGamer/VIctory-V2/issues/4) (there is a form); - three small tasks labelled `help wanted` ([one](https://github.com/DesertGamer/VIctory-V2/issues/16), [two](https://github.com/DesertGamer/VIctory-V2/issues/17), [three](https://github.com/DesertGamer/VIctory-V2/issues/18)), two of them look like stale tests. If you want your PR exercised together with others in a running build, tell us its number.
Xvania7 commented 2026-11-25 12:03:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Xvania7 on 2026-11-25T11:52:31Z.

Review: APPROVED


Verified 481a9ae on Windows 10 + NVIDIA GeForce RTX 5060:

  • pipeline::builder::tests::builder_pipelines_are_known_by_their_origin (passed)
  • pipeline::builder::tests::the_builder_runs_only_with_every_pipeline_made (passed)
  • pipeline::tests::builder_dispatches_wait_for_every_builder_pipeline (passed)
  • pipeline::tests::programs_that_intersect_rays_walk_the_structures (passed)
  • pipeline::tests::walks_wait_for_the_builder_to_run_whole (passed)
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: 0 warnings
  • cargo xtask policy: 183 files ok

Approving.

<!-- greyfinch-sync:Marvisak/VIctory:review:6057097010 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2311#pullrequestreview-6057097010). Originally posted by [Xvania7](https://github.com/Xvania7) on 2026-11-25T11:52:31Z. **Review:** APPROVED --- Verified `481a9ae` on Windows 10 + NVIDIA GeForce RTX 5060: - `pipeline::builder::tests::builder_pipelines_are_known_by_their_origin` (passed) - `pipeline::builder::tests::the_builder_runs_only_with_every_pipeline_made` (passed) - `pipeline::tests::builder_dispatches_wait_for_every_builder_pipeline` (passed) - `pipeline::tests::programs_that_intersect_rays_walk_the_structures` (passed) - `pipeline::tests::walks_wait_for_the_builder_to_run_whole` (passed) - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: 0 warnings - `cargo xtask policy`: 183 files ok Approving.
Venom2054 commented 2026-11-25 13:02:49 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Venom2054 on 2026-11-25T12:29:36Z.


With 481a9ae (including #2118) and the #439 translator at 3fab5a19, my RTX 5070 Ti stayed up for 150 s after world rendering began, until I stopped the run. Both controls reached DEVICE_HUNG within 11 s of that point. I used the first frame with at least 500 host draws as the marker.

The two controls used the same binary without this PR. The second skipped just one shader.

Run Time to DEVICE_HUNG DRED location
No filter 114 s Command 467/1217, Dispatch(1,1,1), compute caa78b8ca62bc3d6.
VICTORY_SKIP_PIPELINES=caa78b8ca62bc3d6 121 s Command 298/843, op 0. The surrounding dispatches at 297 and 300 used compute 28918b7150a7aad5, with groups (13,1,1) and (74,1,1). The trace confirmed that dispatches of the first shader were dropped.

With this PR and no skip filter, the gate reported 53 builder pipelines, 48 made, 5 refused. The trace confirmed an indirect BVH walk was held back. Total run time was 200 s. The intro still ran at about 1 fps with credits over a dark background. Playable rendering remains unverified.

Driver 621.01, Windows 11 build 26200, D3D12 debug layer and DRED enabled. All three runs used a fresh cache and a scripted Enter at 15 s. The fixed run reused the first control's saved setup. The common base was 940d32f with local descriptor-heap, GPU-memory, view/format, buffer-state and indirect-argument fixes, plus #2041. In a separate offline scan of the builder DLL with #439, 47/52 programs passed DXIL validation and pipeline creation. The five refusals were for wave64 groups with more than 64 threads on a 32-lane host.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7162446981 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2311#issuecomment-7162446981). Originally posted by [Venom2054](https://github.com/Venom2054) on 2026-11-25T12:29:36Z. --- With `481a9ae` (including #2118) and the #439 translator at `3fab5a19`, my RTX 5070 Ti stayed up for 150 s after world rendering began, until I stopped the run. Both controls reached DEVICE_HUNG within 11 s of that point. I used the first frame with at least 500 host draws as the marker. The two controls used the same binary without this PR. The second skipped just one shader. | Run | Time to DEVICE_HUNG | DRED location | | --- | --- | --- | | No filter | 114 s | Command 467/1217, `Dispatch(1,1,1)`, compute `caa78b8ca62bc3d6`. | | `VICTORY_SKIP_PIPELINES=caa78b8ca62bc3d6` | 121 s | Command 298/843, op 0. The surrounding dispatches at 297 and 300 used compute `28918b7150a7aad5`, with groups `(13,1,1)` and `(74,1,1)`. The trace confirmed that dispatches of the first shader were dropped. | With this PR and no skip filter, the gate reported **53 builder pipelines, 48 made, 5 refused**. The trace confirmed an indirect BVH walk was held back. Total run time was 200 s. The intro still ran at about 1 fps with credits over a dark background. Playable rendering remains unverified. Driver 621.01, Windows 11 build 26200, D3D12 debug layer and DRED enabled. All three runs used a fresh cache and a scripted Enter at 15 s. The fixed run reused the first control's saved setup. The common base was `940d32f` with local descriptor-heap, GPU-memory, view/format, buffer-state and indirect-argument fixes, plus #2041. In a separate offline scan of the builder DLL with #439, 47/52 programs passed DXIL validation and pipeline creation. The five refusals were for wave64 groups with more than 64 threads on a 32-lane host.
FunWithFlagsDev commented 2026-11-25 13:03:06 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by FunWithFlagsDev on 2026-11-25T13:01:10Z.


<html>

@Bullet18x Thanks for this important stability fix. The reported hardware results are encouraging.

I reviewed 481a9ae and found a potential correctness gap in the builder completion gate that may become relevant once the remaining wave64 pipelines are supported.

Pipeline readiness is not builder completion

In pipeline/builder.rs, runs() sets BUILT as soon as all currently registered builder pipelines are available:

if open && !states.is_empty() && !BUILT.swap(true, Ordering::Relaxed) {
    tracing::info!(frame, "BVH builder ran whole: programs that walk its structures run from here on");
}

However, this happens during command recording, before resource binding and actual dispatch recording.

In draw.rs, the sequence is:

  1. held_back() calls builder::runs(), potentially setting BUILT.

  2. The host pipeline is obtained.

  3. Resource binding is attempted.

  4. The dispatch is recorded only if the preceding checks succeed.

Consequently, BUILT can become true even when:

  • Resource binding fails and no dispatch is recorded.

  • The recorded command list is reset without being submitted.

  • The dispatch contains no effective work.

  • Only part of the required builder sequence has completed.

A subsequent traversal can then pass the gate without a successfully constructed BVH.

Synthetic verification

I attached an executable Python state model of a hypothetical two-stage builder, including eight regression tests and 128 deliberately constructed combinations.

Completion policy | False-ready states -- | -- Current readiness-based gate | 127 First successful submission fence | 29 Verified complete, ordered construction | 0

All eight tests pass.

These are abstract model results, not measured gameplay failure rates. The complete-construction model assumes knowledge of the required stages; identifying those stages in the actual runtime remains an open question.

Suggested follow-up

I would recommend separating pipeline readiness from verified construction completion.

Moving BUILT after successful command recording would eliminate the immediate binding-failure case, but would still leave discarded lists and incomplete submissions uncovered.

Similarly, setting it after the first successful fence would not prove that every required builder stage has completed.

A stronger implementation could track:

  • Builder generation and pipeline readiness.

  • Successfully recorded builder work.

  • Command-list submission and reset.

  • Successful GPU completion.

  • A reliable end-of-build boundary.

Until such a boundary is established, the existing gate should be understood as a stability heuristic rather than proof of successful BVH construction.

This is not a request to discard the current protection, which has already demonstrated useful hardware results. It is a follow-up correctness concern worth addressing before enabling the full builder on additional adapters.

Attachment: bvh_gate_review_v2.zip

No native Rust, DXIL or GPU execution was performed in this review. I have not established that these counterexamples occur in the title.

AI-assisted source review and independent synthetic verification. No game files or proprietary assets were used.

</html>@Bullet18x Thanks for this important stability fix. The reported hardware results are encouraging.

I reviewed 481a9ae and found a potential correctness gap in the builder completion gate that may become relevant once the remaining wave64 pipelines are supported.

Pipeline readiness is not builder completion

In [pipeline/builder.rs](https://github.com/Bullet18x/VIctory/blob/481a9ae/crates/victory-gpu/src/pipeline/builder.rs), runs() sets BUILT as soon as all currently registered builder pipelines are available:

if open && !states.is_empty() && !BUILT.swap(true, Ordering::Relaxed) {
    tracing::info!(frame, "BVH builder ran whole: programs that walk its structures run from here on");
}

However, this happens during command recording, before resource binding and actual dispatch recording.

In [draw.rs](https://github.com/Bullet18x/VIctory/blob/481a9ae/crates/victory-gpu/src/draw.rs#L922-L964), the sequence is:

  1. held_back() calls builder::runs(), potentially setting BUILT.
  2. The host pipeline is obtained.
  3. Resource binding is attempted.
  4. The dispatch is recorded only if the preceding checks succeed.

Consequently, BUILT can become true even when:

  • Resource binding fails and no dispatch is recorded.
  • The recorded command list is reset without being submitted.
  • The dispatch contains no effective work.
  • Only part of the required builder sequence has completed.

A subsequent traversal can then pass the gate without a successfully constructed BVH.

Synthetic verification

I attached an executable Python state model of a hypothetical two-stage builder, including eight regression tests and 128 deliberately constructed combinations.

Completion policy False-ready states
Current readiness-based gate 127
First successful submission fence 29
Verified complete, ordered construction 0

All eight tests pass.

These are abstract model results, not measured gameplay failure rates. The complete-construction model assumes knowledge of the required stages; identifying those stages in the actual runtime remains an open question.

Suggested follow-up

I would recommend separating pipeline readiness from verified construction completion.

Moving BUILT after successful command recording would eliminate the immediate binding-failure case, but would still leave discarded lists and incomplete submissions uncovered.

Similarly, setting it after the first successful fence would not prove that every required builder stage has completed.

A stronger implementation could track:

  • Builder generation and pipeline readiness.
  • Successfully recorded builder work.
  • Command-list submission and reset.
  • Successful GPU completion.
  • A reliable end-of-build boundary.

Until such a boundary is established, the existing gate should be understood as a stability heuristic rather than proof of successful BVH construction.

This is not a request to discard the current protection, which has already demonstrated useful hardware results. It is a follow-up correctness concern worth addressing before enabling the full builder on additional adapters.

Attachment: bvh_gate_review_v2.zip

No native Rust, DXIL or GPU execution was performed in this review. I have not established that these counterexamples occur in the title.
bvh_gate_review_v2.zip

<!-- greyfinch-sync:Marvisak/VIctory:comment:7163176087 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2311#issuecomment-7163176087). Originally posted by [FunWithFlagsDev](https://github.com/FunWithFlagsDev) on 2026-11-25T13:01:10Z. --- <html> <body> <!--StartFragment--><p><span>@Bullet18x Thanks for this important stability fix. The reported hardware results are encouraging.</span></p><p><span>I reviewed </span><code><span>481a9ae</span></code><span> and found a potential correctness gap in the builder completion gate that may become relevant once the remaining wave64 pipelines are supported.</span></p><h3><span>Pipeline readiness is not builder completion</span></h3><p><span>In </span><a href="https://github.com/Bullet18x/VIctory/blob/481a9ae/crates/victory-gpu/src/pipeline/builder.rs"><code><span>pipeline/builder.rs</span></code></a><span>, </span><code><span>runs()</span></code><span> sets </span><code><span>BUILT</span></code><span> as soon as all currently registered builder pipelines are available:</span></p><pre><code><span>if open &amp;&amp; !states.is_empty() &amp;&amp; !BUILT.swap(true, Ordering::Relaxed) { tracing::info!(frame, "BVH builder ran whole: programs that walk its structures run from here on"); }</span></code></pre><p><span>However, this happens during command recording, before resource binding and actual dispatch recording.</span></p><p><span>In </span><a href="https://github.com/Bullet18x/VIctory/blob/481a9ae/crates/victory-gpu/src/draw.rs#L922-L964"><code><span>draw.rs</span></code></a><span>, the sequence is:</span></p><ol start="1"><li><p><code><span>held_back()</span></code><span> calls </span><code><span>builder::runs()</span></code><span>, potentially setting </span><code><span>BUILT</span></code><span>.</span></p></li><li><p><span>The host pipeline is obtained.</span></p></li><li><p><span>Resource binding is attempted.</span></p></li><li><p><span>The dispatch is recorded only if the preceding checks succeed.</span></p></li></ol><p><span>Consequently, </span><code><span>BUILT</span></code><span> can become true even when:</span></p><ul><li><p><span>Resource binding fails and no dispatch is recorded.</span></p></li><li><p><span>The recorded command list is reset without being submitted.</span></p></li><li><p><span>The dispatch contains no effective work.</span></p></li><li><p><span>Only part of the required builder sequence has completed.</span></p></li></ul><p><span>A subsequent traversal can then pass the gate without a successfully constructed BVH.</span></p><h3><span>Synthetic verification</span></h3><p><span>I attached an executable Python state model of a hypothetical two-stage builder, including eight regression tests and 128 deliberately constructed combinations.</span></p> Completion policy | False-ready states -- | -- Current readiness-based gate | 127 First successful submission fence | 29 Verified complete, ordered construction | 0 <p><span>All eight tests pass.</span></p><p><span>These are abstract model results, not measured gameplay failure rates. The complete-construction model assumes knowledge of the required stages; identifying those stages in the actual runtime remains an open question.</span></p><h3><span>Suggested follow-up</span></h3><p><span>I would recommend separating pipeline readiness from verified construction completion.</span></p><p><span>Moving </span><code><span>BUILT</span></code><span> after successful command recording would eliminate the immediate binding-failure case, but would still leave discarded lists and incomplete submissions uncovered.</span></p><p><span>Similarly, setting it after the first successful fence would not prove that every required builder stage has completed.</span></p><p><span>A stronger implementation could track:</span></p><ul><li><p><span>Builder generation and pipeline readiness.</span></p></li><li><p><span>Successfully recorded builder work.</span></p></li><li><p><span>Command-list submission and reset.</span></p></li><li><p><span>Successful GPU completion.</span></p></li><li><p><span>A reliable end-of-build boundary.</span></p></li></ul><p><span>Until such a boundary is established, the existing gate should be understood as a stability heuristic rather than proof of successful BVH construction.</span></p><p><span>This is not a request to discard the current protection, which has already demonstrated useful hardware results. It is a follow-up correctness concern worth addressing before enabling the full builder on additional adapters.</span></p><p><span>Attachment: </span><code><span>bvh_gate_review_v2.zip</span></code></p><p><span>No native Rust, DXIL or GPU execution was performed in this review. I have not established that these counterexamples occur in the title.</span></p><p><span>AI-assisted source review and independent synthetic verification. No game files or proprietary assets were used.</span></p><!--EndFragment--> </body> </html>@Bullet18x Thanks for this important stability fix. The reported hardware results are encouraging. I reviewed `481a9ae` and found a potential correctness gap in the builder completion gate that may become relevant once the remaining wave64 pipelines are supported. ### Pipeline readiness is not builder completion In [`[pipeline/builder.rs](https://github.com/Bullet18x/VIctory/blob/481a9ae/crates/victory-gpu/src/pipeline/builder.rs)`](https://github.com/Bullet18x/VIctory/blob/481a9ae/crates/victory-gpu/src/pipeline/builder.rs), `runs()` sets `BUILT` as soon as all currently registered builder pipelines are available: ```rust if open && !states.is_empty() && !BUILT.swap(true, Ordering::Relaxed) { tracing::info!(frame, "BVH builder ran whole: programs that walk its structures run from here on"); } ``` However, this happens during command recording, before resource binding and actual dispatch recording. In [`[draw.rs](https://github.com/Bullet18x/VIctory/blob/481a9ae/crates/victory-gpu/src/draw.rs#L922-L964)`](https://github.com/Bullet18x/VIctory/blob/481a9ae/crates/victory-gpu/src/draw.rs#L922-L964), the sequence is: 1. `held_back()` calls `builder::runs()`, potentially setting `BUILT`. 2. The host pipeline is obtained. 3. Resource binding is attempted. 4. The dispatch is recorded only if the preceding checks succeed. Consequently, `BUILT` can become true even when: - Resource binding fails and no dispatch is recorded. - The recorded command list is reset without being submitted. - The dispatch contains no effective work. - Only part of the required builder sequence has completed. A subsequent traversal can then pass the gate without a successfully constructed BVH. ### Synthetic verification I attached an executable Python state model of a hypothetical two-stage builder, including eight regression tests and 128 deliberately constructed combinations. | Completion policy | False-ready states | |---|---:| | Current readiness-based gate | 127 | | First successful submission fence | 29 | | Verified complete, ordered construction | 0 | All eight tests pass. These are abstract model results, not measured gameplay failure rates. The complete-construction model assumes knowledge of the required stages; identifying those stages in the actual runtime remains an open question. ### Suggested follow-up I would recommend separating pipeline readiness from verified construction completion. Moving `BUILT` after successful command recording would eliminate the immediate binding-failure case, but would still leave discarded lists and incomplete submissions uncovered. Similarly, setting it after the first successful fence would not prove that every required builder stage has completed. A stronger implementation could track: - Builder generation and pipeline readiness. - Successfully recorded builder work. - Command-list submission and reset. - Successful GPU completion. - A reliable end-of-build boundary. Until such a boundary is established, the existing gate should be understood as a stability heuristic rather than proof of successful BVH construction. This is not a request to discard the current protection, which has already demonstrated useful hardware results. It is a follow-up correctness concern worth addressing before enabling the full builder on additional adapters. Attachment: `bvh_gate_review_v2.zip` No native Rust, DXIL or GPU execution was performed in this review. I have not established that these counterexamples occur in the title. [bvh_gate_review_v2.zip](https://github.com/user-attachments/files/35412524/bvh_gate_review_v2.zip)
Xvania7 commented 2026-11-25 14:07:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Xvania7 on 2026-11-25T13:05:44Z.


Concur with @FunWithFlagsDev's analysis on separating pipeline readiness from verified construction completion.

Looking at the dispatch recording flow in crates/victory-gpu/src/draw.rs:

  1. held_back(self.pipeline) is evaluated at line 931. Because p.builder is true, it calls builder::runs(), which executes BUILT.swap(true) immediately on the first builder dispatch of the frame.
  2. At that point, host_pipeline(self.pipeline) has not been confirmed, descriptor binding (SRVs/UAVs/CBVs) has not occurred, and the dispatch has not been recorded into list.
  3. Even within a single frame, the builder issues dozens of sequential compute passes. Setting BUILT on dispatch 1 allows any traversal pipeline (p.walks_bvh) recorded in the same list or sub-sequence to pass the gate prematurely while the remaining builder dispatches have not even been recorded, let alone executed on the GPU.

Tracking builder work per command list (e.g. marking the host list as containing active builder dispatches) and advancing the BUILT barrier in crates/victory-gpu/src/queue.rs upon host.execute(&host_lists) / fence completion provides a concrete path to eliminate the false-ready window without discarding the immediate crash-prevention benefit of this PR on 32-lane hosts.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7163283305 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2311#issuecomment-7163283305). Originally posted by [Xvania7](https://github.com/Xvania7) on 2026-11-25T13:05:44Z. --- Concur with @FunWithFlagsDev's analysis on separating pipeline readiness from verified construction completion. Looking at the dispatch recording flow in `crates/victory-gpu/src/draw.rs`: 1. `held_back(self.pipeline)` is evaluated at line 931. Because `p.builder` is true, it calls `builder::runs()`, which executes `BUILT.swap(true)` immediately on the first builder dispatch of the frame. 2. At that point, `host_pipeline(self.pipeline)` has not been confirmed, descriptor binding (SRVs/UAVs/CBVs) has not occurred, and the dispatch has not been recorded into `list`. 3. Even within a single frame, the builder issues dozens of sequential compute passes. Setting `BUILT` on dispatch 1 allows any traversal pipeline (`p.walks_bvh`) recorded in the same list or sub-sequence to pass the gate prematurely while the remaining builder dispatches have not even been recorded, let alone executed on the GPU. Tracking builder work per command list (e.g. marking the host list as containing active builder dispatches) and advancing the `BUILT` barrier in `crates/victory-gpu/src/queue.rs` upon `host.execute(&host_lists)` / fence completion provides a concrete path to eliminate the false-ready window without discarding the immediate crash-prevention benefit of this PR on 32-lane hosts.
Marvisak commented 2026-11-25 16:09:10 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T15:22:27Z.


Automated triage for the maintainers.

Needs rebase. This PR no longer merges cleanly into main (conflict in crates/victory-gpu/src/pipeline.rs). It will be reviewed again once it is rebased (it is stacked on #2118).

From the earlier needs-work note, still open: set BUILT only after the builder work is recorded or fenced, cover draws in held_back (or say why not), note the effect on 32-lane hosts in the builder module doc, and move the fork reference out of the source comment.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7166741599 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2311#issuecomment-7166741599). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T15:22:27Z. --- <!-- victory-triage v1 head=481a9aec8eaf9938fe8ce8ae9451b78cfd6b0920 verdict=needs-rebase at=2026-11-25T22:28:30Z --> Automated triage for the maintainers. **Needs rebase.** This PR no longer merges cleanly into `main` (conflict in `crates/victory-gpu/src/pipeline.rs`). It will be reviewed again once it is rebased (it is stacked on #2118). From the earlier needs-work note, still open: set `BUILT` only after the builder work is recorded or fenced, cover draws in `held_back` (or say why not), note the effect on 32-lane hosts in the `builder` module doc, and move the fork reference out of the source comment. --- _Generated by [Claude Code](https://claude.ai/code)_
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/2311:upstream-pr/2311'
git switch 'upstream-pr/2311'

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/2311'
git switch 'upstream-pr/2311'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2311'
git switch 'upstream-pr/2311'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2311'
git switch 'main'
git merge --squash 'upstream-pr/2311'
git switch 'main'
git merge --ff-only 'upstream-pr/2311'
git switch 'main'
git merge 'upstream-pr/2311'
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
Marvisak/VIctory!2309
No description provided.