Skip to content

Fuse the three jacobian dot products into one horizontal reduction. - #2151

Merged
jrouwe merged 2 commits into
jrouwe:masterfrom
asenkew:fuse-jv-dot
Oct 9, 2026
Merged

jrouwe merged 2 commits into
jrouwe:masterfrom
asenkew:fuse-jv-dot

Conversation

@asenkew

@asenkew asenkew commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

SolveVelocityConstraintGetTotalLambda computed three independent Vec3::Dot calls and summed the scalar results. Since Dot(a,b) = sum_xyz(a*b), the sum of the dots equals a single reduction of the component-wise sum of products, so the two redundant horizontal reductions can be removed from the latency-bound critical path. Accumulate component-wise into a Vec3 and call ReduceSum() once.

Performance uplift about 3% for Pyramid test with 300 iterations.

Cross-platform determinism is preserved but results changed (fewer roundings), so the determinism check hashes have been regenerated.

asenkew and others added 2 commits October 8, 2026 20:27
SolveVelocityConstraintGetTotalLambda computed three independent Vec3::Dot
calls and summed the scalar results. Since Dot(a,b) = sum_xyz(a*b), the sum of
the dots equals a single reduction of the component-wise sum of products, so
the two redundant horizontal reductions can be removed from the latency-bound
critical path. Accumulate component-wise into a Vec3 and call ReduceSum() once.

Performance uplift about 3% for Pyramid test with 300 iterations.

Cross-platform determinism is preserved but results changed (fewer roundings),
so the determinism check hashes have been regenerated.
@jrouwe
jrouwe merged commit b6f0675 into jrouwe:master Oct 9, 2026
0 of 71 checks passed
@jrouwe

jrouwe commented Oct 9, 2026

Copy link
Copy Markdown
Owner

Clever, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants