Repository navigation
Pairs phase at 1.1-1.2x Box3D, the wide separating axis test, #158 - #159
Merged
Merged
Conversation
…h prefetch The dynamic tree's nodes and the world's fat boxes are single precision, narrowed outward from double (math.aabb_round_out, b3RoundDownFloat and b3RoundUpFloat): 32-byte nodes, the reference's. The insertion costs and the rays stay in double on the widened boxes; storage, refit, overlaps and queries are float. The golden trace is unchanged. The pairs phase's cost was the pair set's cache misses, not the box bytes: candidates are batched 32 at a time with every hash slot prefetched before any probe (b3FlushCandidatePairs), and the walk reads a leaf's shape index from the node instead of the proxy array. scripts/profile.sh passes ae cflags whole (0.795's -idirafter pairs).
Every hull carries f32 rows of its vertices and normals, padded to eight lanes with vertex 0 and zeros, and its edges' cosines, filled where its hash is stamped (HULL_VERSION 0x4A4C9588; hull_bytes_valid checks them). The separating axis test reads them as the reference's wide test does: support searches eight vertices a pass (the lowest index wins a tie; the reference's embedded-index trick waits on aether#2603), edge candidates culled by the inscribed spheres with the stored cosines and again by a probe point (b3FilterEdgeCandidates), edge pairs eight a pass with the axis and separation in lanes. Every winner is measured again in double, and the golden trace is unchanged. hull_bytes_valid bounded half-edges by MAX_HULL_EDGES, half what the builder allows: a compound of big hulls failed its byte round trip (#158). Fixed, with the round trip tested on a 240-half-edge cylinder.
The narrowing of a coordinate to the float at or below (or above) it is the bit step nextafterf takes, inline in the native header and without branches, checked against libm's at zero, the denormals and the largest float. A tree query compares the double box against each node's float box widened, which is exact (a node holds every double box under it), so a query pays no rounding at all. Small hulls (16 vertices or fewer) are searched one vertex at a time in double, where the lanes' reduction cost more than it saved.
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 pairs phase brought to 1.1-1.2x Box3D
e77352c(it was 1.45-1.6x), a wide separating axis test, and a bug from #157. The golden trace is unchanged bit for bit.The broad phase (#151):
math.aabb_round_out, its b3RoundDownFloat and b3RoundUpFloat). That gives 32-byte nodes.The separating axis test (#150, in part):
HULL_VERSIONchanged, andhull_bytes_validchecks the new sections.A bug fixed (#158):
hull_bytes_valid(from #157) bounded half-edges byMAX_HULL_EDGES, half what the builder allows. A compound holding a hull of more than 64 edges failed its byte round trip. It is fixed, and the round trip is now tested on a 240-half-edge cylinder.Whole step, ours before and after, ms per step:
The trees scenes pay for rounding the fat boxes of fast shapes, which leave them every step. Details are in bench/RESULTS.md, "The pairs phase and the wide separating axis test".
Also:
scripts/profile.shpassesae cflagswhole, since 0.795's include directories come as-idirafter <dir>pairs.Local gate on Aether 0.795.0: all 34 suites pass with no warnings, and the golden trace matches bit for bit (1,256 steps). Pins: Aether 0.795.0 and aeb v0.325, the latest releases.
Closes #151. Closes #158. Refs #150, #121.