Reject most shadow candidates in double before the exact test - #6593
Closed
meshinspector-agent[bot] wants to merge 1 commit into
Closed
Reject most shadow candidates in double before the exact test#6593meshinspector-agent[bot] wants to merge 1 commit into
meshinspector-agent[bot] wants to merge 1 commit into
Conversation
The shadow filter evaluated every candidate in exact arithmetic, because the port to FastInt lost the double conversion the pre-filter needed. toDouble brings it back, and the sign of one of bp, bq now rejects 79-91% of the candidates before any bignum work, with the exact path kept for the few falling within the error bound.
This was referenced Aug 14, 2026
Contributor
Author
|
Superseded by #6596: same step, rebased onto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The shadow filter evaluated every candidate in exact arithmetic: the port to
FastIntlost the bignum-to-double conversion the pre-filter needed. #6592 brings it back, so the pre-filter returns.up/uqare computed once per pair indoubleviatoDouble;bp = dot( d, up )andbq = dot( d, uq ), and a negative sign of either rejects the candidate before any bignum work.pp/pqare below 2^64 and the components ofup/uqbelow 2^96.toDoubleis correctly rounded, so each rounding costs 2^-53 of the running magnitude and the total error stays below 2^78 — adoublebelow -2^78 is thus negative exactly as well. The tolerance is 2^84, 64x that margin; candidates in between fall through to the exact path unchanged.agent/mlib-fastint-to-double(Add toDouble for the FastInt family #6592), notalpha-shape-triangle-shadow:toDoubleis a hard compile dependency. Retarget once Add toDouble for the FastInt family #6592 lands on the branch.The exact path itself is untouched — this only decides which candidates reach it.
Verification
Built in the ubuntu22 image mirroring
build-test-ubuntu-x64.yml:clone_submodules_linux.sh --skip-prebuilt-thirdparty, prebuilt thirdparty linked aslib/include/share, Ninja Release,g++-12,-DMR_CXX_STANDARD=20.MRTesttarget and its dependency graph built clean, no new warnings.MRTest --no-python-tests --gtest_also_run_disabled_tests --gtest_filter=*AlphaShape*:*FastInt*:*PrecisePredicates*:*InSphere*→ 25/25 pass.A/B on the same tree —
DISABLED_AlphaShapeBenchrun with the pre-filter, then the file stashed and rebuilt incrementally so only this diff differs (same clouds, same binary otherwise):shadowTestsexactShadowTestsbefore → after17403291826481596167unchanged635805191690857954unchanged11472133144093973002unchangedconsideredTris,touchableTris,inBallTestsandshadowedNeisare identical on all three clouds in both runs, and so are the triangle hashes — the pre-filter is output-preserving, as its bound claims.inBallTests(1461420 / 3055058 / 23736199) also matches the filter-on column of #6590's table.No timings here on purpose — this box is not a GitHub-hosted runner, so its milliseconds are not comparable to the reported set. The counters above are exact and platform-independent; the payoff in wall clock comes from the branch run.
Not exercised: the other 17
MRTestconfigs (MSVC, arm64, wasm, macOS) — this PR gets no checks of its own, the numbers come from the branch run after it lands. No UI surface (library-internal predicate, no MCP-exposed tool and no viewer widget), so nothing to drive and no screenshots; the three structurally different clouds x filter-on/off are the state coverage instead.CI labels: none.