Repository navigation
Joint records laid out for the solve; stage clocks reset per report - #107
Merged
Merged
Conversation
JointSim puts what the warm start and the solve read first (kind, fixed rotation, masses, inertias, softness, the joint event thresholds) and the kind's data right after it; the local frames, ids and settings only the prepare and the API read go last. SphericalJoint puts its enable flags, body indices, linear impulse, frames and centre delta first, then the impulses and axes the warm start reads. The arithmetic is unchanged and every height sum and golden is the same. Joint grid, interleaved against main, 6 rounds: solve 4.36-4.98 to 3.90-4.14 ms, relax 4.21-4.88 to 3.88-4.14, step 14.4-17.0 to 13.6-14.7. AEPHYSICS_STAGES never reset its clocks, so a benchmark's later scenes reported averages over every step since the first (the joint grid showed a wide prepare and a store with no contacts). stage_report now starts the clocks over and frees the rows it allocated.
The transform, centre, local centre, inverse mass and world inertia (and the id and flags) come first, three cache lines instead of five; the extents, the integration's loads and the time of impact's start pose follow. Layout only: every height sum and golden is the same. Each scene alone, interleaved, 4 rounds: joint grid prepare 1.43-1.49 to 1.26-1.37 ms; many pyramids wide prepare 3.53-3.60 to 3.38-3.49; the large pyramid about even.
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.
What
JointSimputs the fields the warm start and solve read first: kind, fixed rotation, masses, inertias, softness and the joint event thresholds. The kind's data comes next. The local frames, ids and settings, which only the prepare and the API read, go last.SphericalJointputs its enable flags, body indices, linear impulse, frames and centre delta first, then the impulses and axes the warm start reads.BodySimstarts with what every constraint prepare reads: transform, centres, inverse mass, world inertia, id and flags. That's three cache lines instead of five. Each scene alone, interleaved, 4 rounds: the joint grid's prepare went from 1.43-1.49 to 1.26-1.37 ms and the many pyramids' wide prepare from 3.53-3.60 to 3.38-3.49. The large pyramid was about even.AEPHYSICS_STAGESnever reset between scenes, so a benchmark's second and third scenes printed averages over every step since the start. The joint grid showed a 1.46 ms wide prepare and a 0.68 ms store although it has no contacts.stage_reportnow starts the clocks over and frees the rows it allocated.Why
The joint grid (19,800 spherical joints, no contacts) steps at about 14.5 ms against Box3D main's 10.4. That gap has nothing to do with the eight-wide lanes (#96). The solve and relax were reading about eleven cache lines per joint, because the fields they need were spread through the records.
Measured
Joint grid alone, interleaved against main, 6 rounds, one thread:
e77352cThe prepare may be slightly slower, since it now reads both ends of the record. The solve and relax gains outweigh it several times over.
The arithmetic is unchanged: the height sums are the same in all three scenes, and
scripts/test.shpasses 28/28 on Aether 0.779.0, determinism goldens included. bench/RESULTS.md has the table and the note about stage figures recorded before this fix.Also tried and dropped this round (noted on #95): a velocity-only gather for the wide warm start. GCC already drops the unused loads.