Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate link, frame, and joint indices in our jit-compiled APIs #182

Merged
merged 5 commits into from
Jun 19, 2024

Conversation

diegoferigo
Copy link
Member

@diegoferigo diegoferigo commented Jun 18, 2024

Implements the jit-compatible exceptions of #181 to stop the execution of jit-compiled methods when the integer indices of links, frames, and joints are not valid.


馃摎 Documentation preview 馃摎: https://jaxsim--182.org.readthedocs.build//182/

@diegoferigo diegoferigo self-assigned this Jun 18, 2024
@diegoferigo diegoferigo force-pushed the validate_indices_in_jit_functions branch 2 times, most recently from 2a47d62 to 5bf62e6 Compare June 18, 2024 15:00
@diegoferigo diegoferigo marked this pull request as ready for review June 18, 2024 15:01
Copy link
Collaborator

@flferretti flferretti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's great, thanks! Does it have any concrete effect on the performances?

src/jaxsim/api/frame.py Outdated Show resolved Hide resolved
src/jaxsim/api/link.py Outdated Show resolved Hide resolved
@diegoferigo diegoferigo force-pushed the validate_indices_in_jit_functions branch from 5bf62e6 to 8cf72f2 Compare June 18, 2024 18:54
Co-authored-by: Filippo Luca Ferretti <[email protected]>
@diegoferigo
Copy link
Member Author

That's great, thanks! Does it have any concrete effect on the performances?

Not really, the modified methods are not called a lot. I don't expect any runtime overhead since the extra branch injected for raising the exception is never called, and the only overhead is a boolean comparison that has almost no cost.

Inspecting the time taken by CI, there's no significant change. It takes 15-20 seconds more on average but this is also because this PR introduces a new test.

@diegoferigo diegoferigo merged commit 5e4adaa into main Jun 19, 2024
29 checks passed
@diegoferigo diegoferigo deleted the validate_indices_in_jit_functions branch June 19, 2024 09:20
@diegoferigo
Copy link
Member Author

In any case, if we face any overhead in the future that we want to get rid of, we can introduce a new environment variable that disables raising exceptions within jit-compiled function. It should be straightforward.

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.

None yet

2 participants