Preserve pipeline cache retries and reject unmapped BVH nodes #2851

Open
Lkxex wants to merge 1 commit from upstream-pr/2853 into main
Lkxex commented 2026-11-25 22:24:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Lkxex on 2026-11-25T22:24:30Z.


Make the renderer report a miss when title-memory BVH pages are missing instead of interpreting zero-filled words as a node. Keep pipeline cache saves exclusive and retain dirty state after a failed write. Stop warm-up scans at the configured time limit and avoid reading inactive lanes in the native permute path.

Tested: Windows diagnostics build and 14 BVH tests, including hardware and WARP comparisons. No game run or frame-rate measurement.

AI use: Codex (GPT-6.2 Sol).

<!-- greyfinch-sync:Marvisak/VIctory:issue:6614992426 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2853). Originally posted by [Lkxex](https://github.com/Lkxex) on 2026-11-25T22:24:30Z. --- Make the renderer report a miss when title-memory BVH pages are missing instead of interpreting zero-filled words as a node. Keep pipeline cache saves exclusive and retain dirty state after a failed write. Stop warm-up scans at the configured time limit and avoid reading inactive lanes in the native permute path. Tested: Windows diagnostics build and 14 BVH tests, including hardware and WARP comparisons. No game run or frame-rate measurement. AI use: Codex (GPT-6.2 Sol).
kotekompotek commented 2026-11-25 23:05:44 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T22:51:28Z.

Review: COMMENTED


Two clean changes: the warm time limit reads like the other VICTORY_ knobs and breaks both scan and workers; and the save restructuring is an improvement, not just a move — USED_CHANGED now survives a failed save (store(true) on the retry path) instead of being lost by the old mid-check swap, and LAST->state is the only lock order so no new cycle. LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:review:6066073305 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2853#pullrequestreview-6066073305). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T22:51:28Z. **Review:** COMMENTED --- Two clean changes: the warm time limit reads like the other VICTORY_ knobs and breaks both scan and workers; and the save restructuring is an improvement, not just a move — USED_CHANGED now survives a failed save (store(true) on the retry path) instead of being lost by the old mid-check swap, and LAST->state is the only lock order so no new cycle. LGTM.
fuzeofficlal commented 2026-11-25 23:06:31 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T23:00:39Z.


Tested 7ee73a3c on Windows 11 (RTX 5090 + WARP + dxil.dll) against main (842b0cb) and found a deterministic test regression plus a serious lock-hold regression:

1. Deterministic unit-test failure (root cause of the CI Tests failure)

  • emit::lower::tests::ds_bpermute_wave64_preserves_32_lane_half fails deterministically at lower.rs:12193 (wave64=false: left: true, right: false).
  • lower.rs:3278-3280 unconditionally emits dx.op.waveGetLaneIndex for all wave widths (including wave64=false), breaking the Wave32 contract tested there.

2. Lock-hold regression in pipeline::library::save (library.rs:315-377)

  • Holding library.state mutex across the entire write_atomically disk write (rather than releasing it after serialization) stalls pipeline stores/saves for the full write duration of LIBRARY_FILE (up to ~1.7 GB on NVIDIA). Releasing the lock before writing and re-acquiring briefly to clear/preserve the dirty flag on error preserves retry safety without holding the mutex across disk I/O.

3. Bundling & test coverage

  • Four unrelated changes (VICTORY_WARM_SECONDS in translate.rs, library.rs, lower.rs permute, and bvh.rs unmapped-node residency checks) are bundled in one PR with zero new unit tests for any of the four. Splitting them into focused PRs with targeted regression tests (especially an unmapped-page BVH residency test and a save-failure retry test) would make each piece much easier to review and land.

(Local suite notes: emit::bvh_tests 14/14, pipeline::library::tests 11/11, cache::tests 8/8, clippy, and policy 190 ok all passed; emit::lower::tests failed on ds_bpermute_wave64_preserves_32_lane_half.)

<!-- greyfinch-sync:Marvisak/VIctory:comment:7177041847 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2853#issuecomment-7177041847). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T23:00:39Z. --- Tested `7ee73a3c` on Windows 11 (RTX 5090 + WARP + `dxil.dll`) against `main` (`842b0cb`) and found a deterministic test regression plus a serious lock-hold regression: ### 1. Deterministic unit-test failure (root cause of the CI `Tests` failure) - `emit::lower::tests::ds_bpermute_wave64_preserves_32_lane_half` fails deterministically at `lower.rs:12193` (`wave64=false: left: true, right: false`). - `lower.rs:3278-3280` unconditionally emits `dx.op.waveGetLaneIndex` for all wave widths (including `wave64=false`), breaking the Wave32 contract tested there. ### 2. Lock-hold regression in `pipeline::library::save` (`library.rs:315-377`) - Holding `library.state` mutex across the entire `write_atomically` disk write (rather than releasing it after serialization) stalls pipeline stores/saves for the full write duration of `LIBRARY_FILE` (up to ~1.7 GB on NVIDIA). Releasing the lock before writing and re-acquiring briefly to clear/preserve the dirty flag on error preserves retry safety without holding the mutex across disk I/O. ### 3. Bundling & test coverage - Four unrelated changes (`VICTORY_WARM_SECONDS` in `translate.rs`, `library.rs`, `lower.rs` permute, and `bvh.rs` unmapped-node residency checks) are bundled in one PR with zero new unit tests for any of the four. Splitting them into focused PRs with targeted regression tests (especially an unmapped-page BVH residency test and a save-failure retry test) would make each piece much easier to review and land. (Local suite notes: `emit::bvh_tests` 14/14, `pipeline::library::tests` 11/11, `cache::tests` 8/8, `clippy`, and `policy` 190 ok all passed; `emit::lower::tests` failed on `ds_bpermute_wave64_preserves_32_lane_half`.)
Marvisak commented 2026-11-26 04:06:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T03:19:46Z.


Automated triage for the maintainers.

Verdict: needs work. This bundles four unrelated changes (a VICTORY_WARM_SECONDS limit in apps/victory/src/translate.rs, retry on a failed save in pipeline/library.rs, the permute lane source in emit/lower.rs, and residency checks in emit/lower/bvh.rs), and none of them has a new test. Please split them into focused PRs.

Specific problems:

  • CI fails. emit::lower::tests::ds_bpermute_wave64_preserves_32_lane_half now sees waveGetLaneIndex emitted on the wave32 path as well.
  • library::save now holds library.state (and LAST) for the whole disk write of the library file, which blocks pipeline stores during the write. Release the lock before writing, and take it again only to clear or keep the dirty flags.
  • bvh_lanes returns a hard-coded triangle miss (0x7f800000, 0x3f800000, 0, 0) for a non-resident node. A change to emulated BVH results needs evidence for those values, such as hardware output or public documentation.
  • translate.rs has misformatted lines (if time_is_up() { break; }).

CI: failing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7181615154 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2853#issuecomment-7181615154). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-26T03:19:46Z. --- <!-- victory-triage v1 head=7ee73a3cdf5554790c0aefbd7a65be5af3075641 verdict=needs-work at=2026-11-26T03:19:45Z --> Automated triage for the maintainers. **Verdict: needs work.** This bundles four unrelated changes (a `VICTORY_WARM_SECONDS` limit in `apps/victory/src/translate.rs`, retry on a failed save in `pipeline/library.rs`, the permute lane source in `emit/lower.rs`, and residency checks in `emit/lower/bvh.rs`), and none of them has a new test. Please split them into focused PRs. Specific problems: - CI fails. `emit::lower::tests::ds_bpermute_wave64_preserves_32_lane_half` now sees `waveGetLaneIndex` emitted on the wave32 path as well. - `library::save` now holds `library.state` (and `LAST`) for the whole disk write of the library file, which blocks pipeline stores during the write. Release the lock before writing, and take it again only to clear or keep the dirty flags. - `bvh_lanes` returns a hard-coded triangle miss (`0x7f800000, 0x3f800000, 0, 0`) for a non-resident node. A change to emulated BVH results needs evidence for those values, such as hardware output or public documentation. - `translate.rs` has misformatted lines (`if time_is_up() { break; }`). CI: failing. --- _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/2853:upstream-pr/2853'
git switch 'upstream-pr/2853'

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