Repository navigation
[Fix] Cut ~4 s from the first articulation spawn by deferring the TorchScript converter import - #8762
Conversation
Importing torch._export.converter at module scope loads torch._dynamo on every articulation spawn, adding ~4 s to the first load in a process and pushing test_robot_load_performance[Cartpole-cpu] past its 15 s limit.
|
run-ci |
|
run-ci |
There was a problem hiding this comment.
Isaac Lab Review Bot
Needs attention: Style consistency (1). Other reviewed categories look good.
- PR description: The body matches the diff and reports five runs per arm, but reproducibility requires exact revisions, command, hardware, environment count, and confirmation that each first-spawn sample used a fresh process.
- Design and architecture: Architecture looks good.
- Scope and over-engineering: No over-engineering issues.
- API: API changes look good.
- Compatibility and deprecation: No breaking changes identified.
- Implementation: Implementation looks good.
- Style consistency: The comment incorrectly describes a cached, once-per-process import cost as affecting every articulation spawn; state that it delays the first spawn instead.
- Test quality: Test quality looks good.
Minor fixes needed. Posted 1 inline finding.
Automated review; human maintainers own approval decisions.
| Returns: | ||
| Path to the temporary ``.pt2`` checkpoint. | ||
| """ | ||
| # Deferred: importing the converter loads torch._dynamo, which adds seconds to every articulation spawn. |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Comment misstates import cost frequency
Module imports are cached, so the converter cost is paid once per process on the first articulation spawn, not on "every articulation spawn". Reword to match the changelog fragment and PR body.
[Medium impact] The change affects articulation startup and actuator checkpoint conversion. The PR appears safe to merge, with a non-blocking correction to the import-cost comment. Findings
SummaryMoves the
Reviews (1) · Last reviewed commit: "Merge remote-tracking branch 'upstream/m..." · Reviewed by Greptile |
| Returns: | ||
| Path to the temporary ``.pt2`` checkpoint. | ||
| """ | ||
| # Deferred: importing the converter loads torch._dynamo, which adds seconds to every articulation spawn. |
There was a problem hiding this comment.
Comment overstates repeated import costs
The comment says this import adds seconds to every articulation spawn, but Python caches the imported module. Only the first import in a process pays that cost. Change “every articulation spawn” to “the first articulation spawn” so future maintainers do not mistake a one-time startup cost for a repeated cost.
| # Deferred: importing the converter loads torch._dynamo, which adds seconds to every articulation spawn. | |
| # Deferred: importing the converter loads torch._dynamo, which adds seconds to the first articulation spawn. |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
test_robot_load_performance[test_config0-cpu](Cartpole, CPU, 15 s limit) drops from 11.5–11.9 s to 7.7–8.0 s.torch._export.converteris now imported insideresave_checkpoint_with_metadata, its only user, instead of at module scope.Description
#8381 added a module-level
from torch._export.converter import TS2EPConvertertoisaaclab/sim/schemas/schemas_actuators.py. PhysXactuator_controlimports that module on every articulation spawn, and the converter import pulls intorch._dynamo,torch.exportand sympy (~4.3 s). The cost lands on the firstArticulation(cfg)in a process, which is the first-parametrized case oftest_robot_load_performance. Since then, that case has failed intermittently on CI hosts, where it runs close to its 15 s limit (NVBug 6937746).Only
resave_checkpoint_with_metadatauses the converter, so the import moves there. Behaviour is unchanged.Not addressed here: other one-time costs remain in the first spawn (
isaaclab.actuators.newtonimport ~2.6 s, Warp CPU kernel compile on a cold cache).Fixes NVBug 6937746
Type of change
Test plan
Kit PhysX,
isaac-lab:latest-mainimage, desk (5 runs per arm):test_robot_load_performance[test_config0-cpu]source/isaaclab/test/actuators/test_newton_adapter.py(exercises the converter path): 17/17 passChecklist
Docker and GPU tests run on demand. Push the commits you want tested, then
comment
run-cion the pull request.pre-commitchecks withuv run isaaclab --formatsource/<pkg>/changelog.d/for every touched package (do not editCHANGELOG.rstor bump package versions — CI handles that)CONTRIBUTORS.mdor my name already exists there