Skip to content

Bug Fixes for Mimic-Cosmos Workflows - #7500

Merged
kellyguo11 merged 10 commits into
isaac-sim:developfrom
shauryadNv:shauryad/bug_fixes
Sep 8, 2026
Merged

kellyguo11 merged 10 commits into
isaac-sim:developfrom
shauryadNv:shauryad/bug_fixes

Conversation

@shauryadNv

@shauryadNv shauryadNv commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Backport this pull request to the active release branch after it merges into develop

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • 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)
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@greptile-apps

greptile-apps Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Too many files changed for review (802 files, 100 file limit).

@github-actions github-actions Bot added bug Something isn't working documentation Improvements or additions to documentation asset New asset feature or request isaac-sim Related to Isaac Sim team isaac-mimic Related to Isaac Mimic team infrastructure labels Sep 2, 2026
@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Sep 4, 2026
@kellyguo11

Copy link
Copy Markdown
Contributor

/isaaclab-review

@kellyguo11

Copy link
Copy Markdown
Contributor

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Sep 4, 2026
@shauryadNv

Copy link
Copy Markdown
Contributor Author

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Sep 4, 2026
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

Copy link
Copy Markdown
Contributor Author

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Sep 8, 2026
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.
@shauryadNv

Copy link
Copy Markdown
Contributor Author

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Sep 8, 2026
@kellyguo11
kellyguo11 merged commit 6fdc484 into isaac-sim:develop Sep 8, 2026
53 checks passed
@isaaclab-bot

isaaclab-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Backported to release/3.0.0 as 3dc2900.

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

asset New asset feature or request bug Something isn't working documentation Improvements or additions to documentation infrastructure isaac-mimic Related to Isaac Mimic team isaac-sim Related to Isaac Sim team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants