Repository navigation
[Backport] PR #8539 to release/3.0.0 - #8547
Conversation
On Windows, the first CUDA graph capture after the renderer's first frame can stall for many minutes. This PR applies the workaround from @shi-eric's analysis in #8342: record one tiny allocation in a CUDA graph when `SimulationContext` is created, so the CUDA driver reserves graph memory before anything can block its placement. Fixes #8342. Supersedes #8528. - The first allocation recorded in a CUDA graph makes the driver reserve a large virtual-address range for graph memory (96 GiB on our machine). - Cubric allocates managed memory, which creates a 52 GiB managed-memory window. The driver places the graph-memory range directly above that window. - When a rendered frame already occupies those addresses, the driver retries placement 2 MiB higher each time, at about 0.8 s of kernel CPU per attempt. The GPU stays idle; getting past the blocked range takes about 15 minutes. - #8058 moved Newton's first capture to the first physics step, after the first frame. MuJoCo-Warp allocates temporaries on every step, so the capture contains allocations. - `isaaclab.utils.device.reserve_cuda_graph_memory(device)`: records one `wp.empty(1)` inside `wp.ScopedCapture`, once per CUDA device. It skips non-CUDA devices, devices with the Warp memory pool disabled, and devices that are already capturing. A failure is logged as a warning and never blocks startup. - `SimulationContext.__init__` calls it right after selecting the device, before physics backends and renderers are created. Every entry point (environments, benchmarks, tests) goes through this path. - Runs on all platforms; on platforms without the driver issue the extra capture is harmless. Windows 11, RTX 6000 Ada, driver 596.72, `Isaac-Lift-KukaAllegro-Camera`, 1024 envs, `newton_mjwarp`, capture watchdog 8–15 s: | Setup | `develop` | This PR | |---|---|---| | OVRTX (kitless), `presets=newton_mjwarp,ovrtx,single_camera,simple_shading_full_mdl64` | about 70% of runs stalled | 0 / 10 | | Kit with Isaac Sim RTX, `presets=newton_mjwarp,isaacsim_rtx,single_camera` | 7 / 8 stalled | 0 / 8 | The Kit result means this stall is not limited to OVRTX: Kit with Newton physics hits it too. Other checks with the same workaround (applied at `gym.make`, physics-only task, 8192 envs): - A graph-memory trim right before Newton's capture does not release the early reservation (0 / 8 stalls). - Physics step, full environment step and peak GPU memory are within noise of `develop`. - Under Kit, Kit's renderer starts before `SimulationContext`, so the reservation cannot precede it. It still precedes Cubric's managed memory and the next rendered frame, which was enough in the measurements above. - OvPhysX imports `ovstage` in `_prepare_stage_creation`, before this call. OvPhysX with OVRTX was not measured. - Linux, L40, and long training runs were not tested here. - Kit with PhysX physics was not tested. - Bug fix (non-breaking change which fixes an issue) - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `develop` - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `uv run isaaclab --format` (ruff check and format on the changed files) - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have validated the changed behavior with focused coverage and applied the [test-audit criteria](https://github.com/isaac-sim/IsaacLab/blob/develop/skills/developer/test-audit/SKILL.md) to any test changes - [x] I have added a changelog fragment under `source/<pkg>/changelog.d/` for every touched package - [ ] I have added my name to the `CONTRIBUTORS.md` or my name already exists there (cherry picked from commit c647410)
|
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 explains provenance but does not substantiate “deterministic validation” or the measurable stall claim; provide or link revisions, command, workload, hardware, backend, environment count, warmup, metric, and validation result.
- 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 module docstring now omits graph-memory setup, obscuring the module’s responsibility; widen it to cover device selection and device-level initialization.
- Test quality: Test quality looks good.
Minor fixes needed. Posted 1 inline finding.
Automated review; human maintainers own approval decisions.
| wp.set_device(warp_device) | ||
|
|
||
|
|
||
| def reserve_cuda_graph_memory(device: str) -> None: |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Module docstring no longer covers contents
The module docstring says "Internal utilities for selecting compute devices", but reserve_cuda_graph_memory selects nothing; it reserves a driver address range. Widen the module docstring to cover device selection and device-level setup.
Backports #8539 to
release/3.0.0.The original cherry-pick conflicted. An NVIDIA inference model proposed this resolution, and deterministic validation confirmed that it changes no paths outside the original PR. Because conflict resolution cannot be certified as an exact patch replay, this PR is intentionally a draft and requires release-maintainer review.
c647410de088139054199f41bb71b451602a5fe734ba08a104f370fa22d6136bb4e64a1190096c5aae4599d5cd4d2ce592459ffe3cf5b978af18ec1d