[PREF] Rigid: single-write acc update in func_update_acc#44
Open
suphilip wants to merge 1 commit intoamd-integrationfrom
Open
[PREF] Rigid: single-write acc update in func_update_acc#44suphilip wants to merge 1 commit intoamd-integrationfrom
suphilip wants to merge 1 commit intoamd-integrationfrom
Conversation
Collaborator
|
Pre-submit is 726705.4 |
718db34 to
9adc4d1
Compare
Author
|
/run-ci |
9adc4d1 to
0188d7b
Compare
Author
|
/run-ci |
0188d7b to
a7be949
Compare
Author
|
/run-ci |
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.
Summary
Refactor func_update_acc in genesis/engine/solvers/rigid/abd/forward_dynamics.py so that links_state.cdd_vel, cdd_ang, cacc_lin, and cacc_ang are no longer updated on every DOF iteration. The same values are built in local variables (ls_*) over the per-link DOF loop, then the corresponding global fields are assigned once per link index.
Motivation / performance
This cuts repeated global traffic and, for the backward path, removes the need for the previous pattern that relied on func_add_safe_backward (accumulation/atomics required by the autodiff global access rules) when updating these fields in the inner loop.
Autodiff (Taichi-style)
The change aligns with the global data access rules for differentiable programs: in particular, avoiding multiple writes to the same global field element in ways that are not the allowed += / accumulation pattern. With a single assignment to each links_state.*[i_l, i_b] per forward pass over that site, the refactor stays consistent with those constraints while simplifying the implementation.
Description
Related Issue
Resolves Genesis-Embodied-AI/Genesis#
Motivation and Context
How Has This Been / Can This Be Tested?
Screenshots (if appropriate):
Checklist:
Submitting Code Changessection of CONTRIBUTING document.