Repository navigation
Integrate, finalize and store in single precision, as the reference does - #236
Merged
Merged
Conversation
Integrating the positions and finalizing the bodies widened the float velocities and motions to double, worked in double and narrowed back, where Box3D works in float throughout: a body's sleep velocity took five square roots through std.math's out-of-line call, its world inertia two double 3x3 products. Now the positions are integrated, the sleep velocity estimated and the world inertia rotated (at all four places it is made, math.rotate_inertiaf) in single precision with the reference's sums; the pose still moves in double. The sweep's reach is worked out only for a body that sweeps, and the stored friction impulse is a float sum. The suite prints the solve's stages under AEPHYSICS_STAGES=1 and suite_box3d.c the reference's beside them; AEPHYSICS_BENCH_NO_SLEEP=1 keeps every body awake in both, for long profiles. The golden trace and test_human's three figure hashes are regenerated: the falling ragdolls sleep at 256 where they slept at 271 (Box3D's own builds: 273 and 274), the pile's chaos rather than the estimate (the estimate alone in double still sleeps at 256).
4 tasks done
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.
Progress at a glance
math.rotate_inertiaf)AEPHYSICS_BENCH_NO_SLEEP=1Why
A stage-by-stage read of the sleep scene against Box3D showed two simple per-body loops well behind: integrating the positions (0.068 ms against 0.044) and finalizing the bodies (0.134 against 0.098). Both widened float velocities and motions to double and narrowed them back, where the reference stays in float. A body's sleep velocity took five square roots through std.math's out-of-line call (aether#3852), and its world inertia took two double 3x3 products.
Numbers
Pinned to one core, best of five, ms per step:
Results move
The falling ragdolls now sleep at step 256; before this change they slept at 271, and Box3D's own two builds sleep at 273 and 274. That shift comes from the pile's chaos, not from the float estimate. With the estimate alone put back in double, the ragdolls still sleep at 256. With the inertia alone put back in double, they sleep at 264. Every other check passes unchanged: soak, the human drop and throw sweeps, and the worker hashes.
Details are in bench/RESULTS.md, under "Single precision where the reference keeps it".