GPU BVH: preserve small invertible instance transforms (#1488) #1678
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1688"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by Adika713 on 2026-11-24T19:18:01Z.
Part of #1488.
The absolute determinant cutoff in PR #1633 rejects some finite, invertible instance transforms: its own 1e-11 × 1e-10 × 1e-10 test has determinant 1e-31 but a finite f32 inverse. This change rejects only zero/non-finite determinants, then checks the serialized f32 inverse for non-finite values before returning it.
What is in it
crates/xcl/src/gpu/bvh.rs: replace the scale-dependent determinant threshold with zero/non-finite detection plus a finite-output check.world_to_object_keeps_small_invertible_transforms, covering the 1e-31 determinant case and a finite-precision overflow fallback.Tested
cargo build --workspace --locked: passed; two existingAtomic::fetch_updatedeprecation warnings.cargo test -p xcl --lib gpu::bvh::tests::world_to_object_keeps_small_invertible_transforms -- --exact --test-threads=1: 1 passed, 0 failed, 0 ignored.cargo test -p xcl --lib gpu::bvh::tests:: -- --test-threads=4: 8 passed, 0 failed, 0 ignored.git diff --check: clean.Not tested
AI use
Imported from ivall/xcl. Originally posted by upipibi on 2026-11-24T22:50:40Z.
NVIDIA run: RTX 3070 8 GB, driver 616.56, Windows 11, debug,
0f45226merged ontomain689f2db(clean). Tests matchingbvh, includingworld_to_object_keeps_small_invertible_transformsand the GPU BVH tests: 12 passed, 0 failed.AI-assisted (Claude Code). Synthetic tests only.
Imported from ivall/xcl. Originally posted by throny on 2026-11-25T00:15:36Z.
Two contributors checked independently and found that #1521 #1633 solves the same problem (for #1488) in a different way: #1607, group D52. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
Imported from ivall/xcl. Originally posted by Adika713 on 2026-11-25T00:28:40Z.
@throny
Thanks for the D52 hint and for the independent RTX 3070 run.
I checked the current diffs of the other D52 PRs. #1521 (head
172041475f0518b778603ed1d1b980514881eb96) now guardsworld_to_objectwithif !det.is_finite() || det == 0.0plus a finite-output check, and its testinverse_preserves_small_scales_and_rejects_unrepresentable_resultscovers the same small-scale and overflow cases as this PR. That is functionally the same runtime fix as #1688, so #1688 no longer adds a separate runtime change relative to #1521.The remaining distinction is #1633: its
world_to_objectandbuild_topstill usedet.abs() <= 1e-30 || !det.is_finite(). That absolute cutoff rejects finite, invertible transforms; #1633's owntinymatrix1e-11 x 1e-10 x 1e-10has determinant1e-31, below the cutoff, even though the serialized f32 inverse is representable. This PR's rationale is to validate the inverse instead of applying a scale-dependent cutoff.Suggestion for the maintainers: consolidate on one implementation rather than three overlapping ones. #1521 already covers the runtime path; #1633 additionally sanitizes singular instances in
build_top. If #1521 is chosen, #1688 can be closed as superseded, and the cutoff counterexample above can be used to update #1521/#1633's tests. I am not changing any PR state myself.Note: #1688's PR-description check is still failing because the required paired retail-title smoke blocks were not run on its head. If this PR is kept rather than consolidated, I will add a real pair before asking for review.
AI use: OpenCode with Big Pickle (opencode/big-pickle) prepared this draft from
gh pr diffreads of #1521 and #1633 and the full #1688 thread; no comment was posted.Imported from ivall/xcl. Originally posted by throny on 2026-11-25T00:29:55Z.
@Adika713 thanks for the comparison. One correction: the RTX 3070 run isn't mine; the D52 hint came from the #1607 script. Your reading of the three diffs counts as a check of D52 if you post it in #1607 as an
xcl-checkblock with the heads you read, for example"verdict": "suggest 1521; same change as 1688"if that's your finding. #1633 can stay out of that verdict, since a verdict may name only part of a group. That's how it reaches the maintainers' table.AI use: Claude Code (Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by Toons29 on 2026-11-25T03:35:33Z.
Regression run of
0f452264on the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon4178e888, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 101 % of
main's frames, 100 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; I checked the blocks before posting.Imported from ivall/xcl. Originally posted by CalvyPZ on 2026-11-25T22:41:33Z.
This PR has been marked as a duplicate and closed after multiple agreeing checks in #1607. If you believe this is incorrect please re-open with why.
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T20:44:38Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:29:35Z.
Triage (#1607) – head
0f45226Overlaps #1633 (same issue #1488, same function
bvh.rs::world_to_object) as a different approach: #1633 also zeroes transforms with |det| <= 1e-30 and guardsbuild_top,transform_aabband emptybounds; this PR only refuses a zero or non-finite determinant or a non-finite f32 inverse, keeping small invertible transforms (its test covers the 1e-31 case #1633 zeroes). The closed #1521 and #1767 made this same change.No problems found in the diff. Main's
world_to_objectstill has no guard. The PR is a draft and conflicts with main.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.