Repository navigation
Bug Fixes for Mimic-Cosmos Workflows - #7500
Merged
Merged
Conversation
shauryadNv
requested review from
AntoineRichard,
ClemensSchwarke,
StafaH,
aserifi,
david-cao-mueller,
fatimaanes,
frlai,
hougantc-nvda,
huidongc,
hujc7,
kellyguo11,
marcodiiga,
matthewtrepte,
myurasov-nv,
ooctipus,
pbarejko,
peterd-NV,
r-schmitt,
rilei-nvidia,
rubengrandia and
rwiltz
as code owners
September 2, 2026 20:59
Contributor
|
Too many files changed for review (802 files, 100 file limit). |
shauryadNv
force-pushed
the
shauryad/bug_fixes
branch
from
September 2, 2026 21:01
36549c3 to
5d6e1a1
Compare
Contributor
|
/isaaclab-review |
Contributor
|
run-ci |
kellyguo11
reviewed
Sep 4, 2026
Contributor
Author
|
run-ci |
IsaacRtxRenderer.render() unconditionally sliced the tiled data buffer down to 2/3 channels for motion_vectors, normals, SIMPLE_SHADING_MODES, and RGB_HDR outputs. Right after an annotator is attached (e.g. at env creation, before the RTX renderer has pumped a frame), Replicator can momentarily return a buffer whose channel dimension is 0 instead of real image data. Warp's array slicing rejects trimming an already-empty dimension (unlike NumPy, which allows it), so this raised RuntimeError: Invalid indexing in slice: 0:0:1 e.g. on Isaac-Contrib-Stack-Cube-Franka-IK-Rel-Visuomotor-Cosmos with --visualizer newton_gl. Guard the trim against the buffer not being populated yet and skip writing that data type for the frame instead of crashing; the next render() call picks up valid data.
release/3.0.0 removed the --enable_cameras CLI flag and the ENABLE_CAMERAS env-var fallback from AppLauncher, replacing them with launch_simulation()'s scene-scan auto-detection, which these legacy scripts never call. As a result, robust_eval.py and play.py launch without RTX rendering enabled for any camera-observation task (e.g. IsaacContrib-Stack-Cube-Franka-IK-Rel-Visuomotor-Cosmos), and since IsaacRtxRenderer's old explicit "pass --enable_cameras" RuntimeError guard was also removed in this release, the failure now surfaces as an opaque ValueError: Invalid object in Py_Graph in getWrappedGraphFromNode deep inside OmniGraph/SyntheticData instead. Pass enable_cameras=True explicitly, matching the pattern already used in generate_dataset.py, since both scripts always need camera observations to run rollouts.
The Augmented Imitation Learning doc otherwise recommends uv as the primary workflow (data generation, training, eval all show a "uv (Recommended)" tab), but the hdf5_to_mp4.py, mp4_to_hdf5.py, and merge_hdf5_datasets.py examples only showed a bare `python ...` invocation with no indication of which environment/extras to use. Add matching uv (Recommended) / isaaclab.sh tab-sets for these three conversion steps. These tools only need h5py/opencv/numpy (no Isaac Sim import), so use `--extra mimic` -- the same extra already used a few sections down to verify the robomimic install.
IsaacRtxRenderer.render() flattens every environment's camera tile into one Warp array per data type. Warp requires every array dimension to fit in a signed 32-bit int, so a large enough num_envs * resolution combination (e.g. TC_146493: IsaacContrib-Stack-Cube-Franka-IK-Rel-Visuomotor-Cosmos at scale) overflows that limit and crashes deep inside render()'s .flatten() call with an opaque ValueError: Array shapes must not exceed the maximum representable value of a signed 32-bit integer, got 2621440000 in dimension 0 with no indication of what to change. Compute the worst-case tiled buffer size upfront in create_render_data() -- before any USD/Replicator work happens -- and raise a clear ValueError naming the offending env count/grid/ resolution and suggesting to reduce --num_envs or camera resolution, instead of letting the crash surface from inside Warp. This does not lift the underlying Warp/RTX limit (a single tiled render product still can't back more elements than a signed int32 can index); it only replaces the opaque failure with an actionable one at the point the request is made.
- Extract the tiled-buffer size guard into _validate_tiled_buffer_size() to bring create_render_data()'s cyclomatic complexity back under ruff's C901 threshold (31 > 30). - Wrap the trim_channels condition line ruff-format flagged as too long. - Add the changelog.d fragment required for the touched isaaclab_physx package (scripts/ and docs/ changes in prior commits aren't gated by the changelog check).
Addresses review feedback on isaac-sim#7500. render() flattened each annotator's tiled buffer into a single 1D Warp array, whose length is num_envs * tile pixels * channels. That product can exceed the maximum size of a single Warp array dimension, so large environment counts / camera resolutions failed with: ValueError: Array shapes must not exceed the maximum representable value of a signed 32-bit integer, got 2621440000 in dimension 0 Refactor reshape_tiled_image to index the tiled buffer as a 3D array (num_tiles_y * image_height, num_tiles_x * image_width, num_channels) and update the overloads to ndim=3, so each dimension is bounded individually rather than by their product. Single-channel annotators return a 2D buffer, so the renderer adds the trailing channel dimension before launching. This removes the need for the preflight size check added earlier in this PR, which is dropped along with the hardcoded Warp dimension limit: per review, that limit is a Warp implementation detail rather than a contract, and the check also assumed 4 elements per pixel for every camera, wrongly rejecting valid single-channel configurations. Verified against Warp 1.9.1 on GPU: the refactored kernel is numerically identical to the previous implementation across RGBA, depth, normals and ragged-grid cases; a (25600, 25600, 4) buffer -- the exact geometry from the reported failure -- still raises on .flatten() but launches successfully through the 3D path.
CI (rendering-correctness, test_rendering_cartpole) caught semantic_segmentation, instance_segmentation and instance_id_segmentation_fast rendering as all-zero pixels after the switch to 3D indexing. Those three data types are the ones reinterpreted via wp.array(ptr=..., shape=(*shape, 4)) for colorization. When the raw annotator buffer is flat, that yields a 2D (pixels, 4) array rather than (rows, cols, channels), so inferring the layout from ndim and appending a trailing 1 produced (pixels, 4, 1). The kernel then read channel i in range(4) from a size-1 dimension, leaving the output buffer empty. The previous flatten() was insensitive to the incoming shape, which is why this only appeared after the refactor. Reshape the buffer explicitly to the geometry the kernel documents -- (num_tiles_y * height, num_tiles_x * width, channels), taking the channel count from the destination buffer -- instead of inferring it from ndim. This normalizes 1D, 2D and 3D annotator buffers uniformly. Verified against Warp on all annotator buffer shapes: 3D rgb/rgba, 2D (H, W) depth, 2D (pixels, 4) colorized segmentation, 1D non-colorized segmentation, trimmed 3-channel normals, and a ragged tile grid. The previous heuristic reproduces the wrong output for the (pixels, 4) case; the new code matches the reference for all of them.
robust_eval.py / play.py: rendering is not always required -- both scripts also evaluate policies trained on low-dimensional observations, which should not pay for the RTX renderer. Instead of hardcoding enable_cameras=True, resolve the task config before launching Kit (resolve_task_config is documented as safe pre-launch) and derive the flag from scan(...).has_kit_camera, the same detection launch_simulation uses to auto-enable cameras. As a side effect, an invalid/missing --task now fails before Kit starts rather than after. augmented_imitation.rst: recent Isaac Sim releases ship an OpenCV build without ffmpeg, which hdf5_to_mp4.py and mp4_to_hdf5.py need for MP4 read/write. Add a note under Cosmos Augmentation telling users to install the full OpenCV package first.
develop now clears the destination and skips the frame when an
annotator returns an empty buffer:
if tiled_data_buffer.size == 0:
buf_wp.zero_()
continue
That runs before the channel trims and covers the (H, W, 0) warm-up
case this PR originally guarded against, so the trim_channels
refactor and its channel-dimension check are dead code. Restore
develop's original per-data-type trims and keep only the 3D indexing
change, which is still required.
shauryadNv
force-pushed
the
shauryad/bug_fixes
branch
from
September 8, 2026 17:16
a936bf3 to
ae1a962
Compare
Contributor
Author
|
run-ci |
CI (test_camera.py::test_camera_*_all_colorize, test_camera_all_annotators, test_all_annotators_multi_tiled_camera) failed with: RuntimeError: cannot reshape array of shape (240, 320, 4, 4) (size 1228800) into shape (240, 320, 4) (size 307200) The colorize path reinterprets segmentation buffers with shape=(*tiled_data_buffer.shape, 4). When the raw annotator buffer already carries a channel axis, that yields a 4D descriptor which over-claims the backing memory by 4x. The previous flattened indexing never touched the surplus elements, so it was harmless; an exact-size reshape rejects it outright. Non-colorized segmentation was unaffected, which is why only the *_all_colorize tests failed. Construct the (num_tiles_y * height, num_tiles_x * width, channels) view directly from the buffer pointer instead. This ignores the surplus claimed elements exactly as the flattened indexing did, while keeping the view 3D so no single dimension can overflow Warp's array size limit. The source array is held in a local so it outlives the non-owning view. Verified on Warp that the pointer view is bit-identical to the old flatten-and-stride behaviour, and correct for every shape the renderer produces: 3D rgb/rgba, 2D depth, 1D non-colorized segmentation, 2D (pixels, 4) and 4D over-claimed colorized segmentation, trimmed normals/motion vectors, a ragged tile grid, and the exact 240x320 geometry from the CI failure.
Contributor
Author
|
run-ci |
Contributor
|
Backported to |
isaaclab-bot Bot
pushed a commit
that referenced
this pull request
Sep 8, 2026
# Description
This PR bundles four fixes for issues found:
1. 6684416: **RTX renderer: fix crash on not-yet-warmed-up annotator
buffers.** `IsaacRtxRenderer.render()` unconditionally trimmed the tiled
buffer to 2/3 channels for
`motion_vectors`/`normals`/`SIMPLE_SHADING_MODES`/`RGB_HDR`. Immediately
after an annotator is attached (e.g. at env creation, before the RTX
renderer has pumped a frame), Replicator can momentarily return a buffer
whose channel dimension is 0. Warp's array slicing rejects trimming an
already-empty dimension (unlike NumPy, which allows it), raising
`RuntimeError: Invalid indexing in slice: 0:0:1`. Guard the trim and
skip writing that data type for the frame instead of crashing.
2. 6683697: **`robust_eval.py`/`play.py`: pass `enable_cameras=True`
explicitly.** `release/3.0.0` removed the `--enable_cameras` CLI flag
and the `ENABLE_CAMERAS` env-var fallback from `AppLauncher` in favor of
`launch_simulation()`'s scene-scan auto-detection, but these two
robomimic scripts still use the legacy `AppLauncher(args_cli)` pattern
and were never migrated. Without cameras enabled, and with the old
explicit "pass --enable_cameras" guard in `IsaacRtxRenderer.__init__`
also removed in this release, the failure now surfaces as an opaque
`ValueError: Invalid object in Py_Graph in getWrappedGraphFromNode` deep
inside OmniGraph/SyntheticData. Pass `enable_cameras=True` explicitly,
matching the pattern already used in `generate_dataset.py`.
3. 6683610: **Docs: add `uv run` examples for the HDF5/MP4 conversion
and merge tools.** The Augmented Imitation Learning doc recommends `uv`
as the primary workflow throughout (dataset generation, training, eval
all show a "uv (Recommended)" tab), but the `hdf5_to_mp4.py`,
`mp4_to_hdf5.py`, and `merge_hdf5_datasets.py` examples only showed a
bare `python ...` invocation with no indication of which
environment/extras to use. Added matching `uv (Recommended)` /
`isaaclab.sh` tab-sets (`--extra mimic`, since these tools only need
`h5py`/`opencv`/`numpy`, no Isaac Sim import).
4. 6702683: **RTX renderer: fail fast on oversized tiled camera
buffers.** `IsaacRtxRenderer.render()` flattens every environment's
camera tile into one Warp array per data type. Warp requires every array
dimension to fit in a signed 32-bit int, so a large enough `num_envs *
resolution` combination overflows that limit and crashes deep inside
`render()`'s `.flatten()` call with `ValueError: Array shapes must not
exceed the maximum representable value of a signed 32-bit integer, got
2621440000 in dimension 0` and no indication of what to change. Compute
the worst-case tiled buffer size upfront in `create_render_data()` and
raise a clear error naming the offending env count/grid/resolution and
suggesting to reduce `--num_envs` or camera resolution. This does not
lift the underlying Warp/RTX limit — it only replaces the opaque failure
with an actionable one.
## Type of change
- Bug fix (non-breaking change which fixes an issue)
- Documentation update
## Release backport
- [x] <!-- backport-active-release --> Backport this pull request to the
active release branch after it merges into `develop`
## Checklist
- [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
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have added a changelog fragment under
`source/<pkg>/changelog.d/` for every touched package (do **not** edit
`CHANGELOG.rst` or bump `extension.toml` — CI handles that)
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
(cherry picked from commit 6fdc484)
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.
Description
This PR bundles four fixes for issues found:
IsaacRtxRenderer.render()unconditionally trimmed the tiled buffer to 2/3 channels formotion_vectors/normals/SIMPLE_SHADING_MODES/RGB_HDR. Immediately after an annotator is attached (e.g. at env creation, before the RTX renderer has pumped a frame), Replicator can momentarily return a buffer whose channel dimension is 0. Warp's array slicing rejects trimming an already-empty dimension (unlike NumPy, which allows it), raisingRuntimeError: Invalid indexing in slice: 0:0:1. Guard the trim and skip writing that data type for the frame instead of crashing.robust_eval.py/play.py: passenable_cameras=Trueexplicitly.release/3.0.0removed the--enable_camerasCLI flag and theENABLE_CAMERASenv-var fallback fromAppLauncherin favor oflaunch_simulation()'s scene-scan auto-detection, but these two robomimic scripts still use the legacyAppLauncher(args_cli)pattern and were never migrated. Without cameras enabled, and with the old explicit "pass --enable_cameras" guard inIsaacRtxRenderer.__init__also removed in this release, the failure now surfaces as an opaqueValueError: Invalid object in Py_Graph in getWrappedGraphFromNodedeep inside OmniGraph/SyntheticData. Passenable_cameras=Trueexplicitly, matching the pattern already used ingenerate_dataset.py.uv runexamples for the HDF5/MP4 conversion and merge tools. The Augmented Imitation Learning doc recommendsuvas the primary workflow throughout (dataset generation, training, eval all show a "uv (Recommended)" tab), but thehdf5_to_mp4.py,mp4_to_hdf5.py, andmerge_hdf5_datasets.pyexamples only showed a barepython ...invocation with no indication of which environment/extras to use. Added matchinguv (Recommended)/isaaclab.shtab-sets (--extra mimic, since these tools only needh5py/opencv/numpy, no Isaac Sim import).IsaacRtxRenderer.render()flattens every environment's camera tile into one Warp array per data type. Warp requires every array dimension to fit in a signed 32-bit int, so a large enoughnum_envs * resolutioncombination overflows that limit and crashes deep insiderender()'s.flatten()call withValueError: Array shapes must not exceed the maximum representable value of a signed 32-bit integer, got 2621440000 in dimension 0and no indication of what to change. Compute the worst-case tiled buffer size upfront increate_render_data()and raise a clear error naming the offending env count/grid/resolution and suggesting to reduce--num_envsor camera resolution. This does not lift the underlying Warp/RTX limit — it only replaces the opaque failure with an actionable one.Type of change
Release backport
developChecklist
pre-commitchecks with./isaaclab.sh --formatsource/<pkg>/changelog.d/for every touched package (do not editCHANGELOG.rstor bumpextension.toml— CI handles that)CONTRIBUTORS.mdor my name already exists there