Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Fixed
^^^^^

* Stabilized RTX MDL shader-warmup flakes in the rendering-correctness tests
by stepping the env 10 frames before reading the camera tensor, instead of
a single step. Affected ``test_shadow_hand_vision_presets.py``'s
``test_camera_renders_not_empty`` and the three helper-driven tests in
``rendering_test_utils.py``
(``rendering_test_shadow_hand``/``_cartpole``/``_dexsuite_kuka``) — all of
which intermittently failed with "Camera output is all zeros or all inf"
for ``simple_shading_*_mdl`` and ``simple_shading_constant_diffuse``
variants on cold-cache CI runners (the GPU returned a still-zero
framebuffer because the MDL material hadn't finished compiling).
21 changes: 21 additions & 0 deletions source/isaaclab_tasks/test/rendering_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,24 @@ def validate_camera_outputs(
pytest.fail(reason)


def _warmup_render(env, num_steps: int = 10) -> None:
"""Step the env ``num_steps`` times to let RTX MDL shaders finish compiling.

RTX MDL materials compile asynchronously on first use. A single ``env.step()``
is not enough — the GPU may return a still-zero framebuffer for shader
variants that have not finished compiling, which trips
:func:`validate_camera_outputs` with "no non-zero pixels" or
"all zeros or all inf". ``10`` is empirically enough across the MDL
presets (``simple_shading_constant_diffuse``, ``simple_shading_diffuse_mdl``,
``simple_shading_full_mdl``) that flake on the CI runners as of 2026-05.
Adds ~1-2 s of wall time per parametrize variant; cheap relative to the
cost of a CI re-run.
"""
actions = torch.zeros(env.num_envs, env.action_space.shape[-1], device=env.device)
for _ in range(num_steps):
env.step(actions)


def rendering_test_shadow_hand(
physics_backend: str,
renderer: str,
Expand All @@ -700,6 +718,7 @@ def rendering_test_shadow_hand(
try:
env = ShadowHandVisionEnv(env_cfg)
maybe_save_stage("shadow_hand", physics_backend, renderer, data_type)
_warmup_render(env)

validate_camera_outputs(
"shadow_hand",
Expand Down Expand Up @@ -739,6 +758,7 @@ def rendering_test_cartpole(
try:
env = CartpoleCameraEnv(env_cfg)
maybe_save_stage("cartpole", physics_backend, renderer, data_type)
_warmup_render(env)
validate_camera_outputs(
"cartpole",
physics_backend,
Expand Down Expand Up @@ -795,6 +815,7 @@ def rendering_test_dexsuite_kuka(
try:
env = ManagerBasedRLEnv(env_cfg)
maybe_save_stage("dexsuite_kuka", physics_backend, renderer, data_type)
_warmup_render(env)
validate_camera_outputs(
"dexsuite_kuka",
physics_backend,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,12 @@ def render_correctness_env(request, shadow_hand_vision_presets):
env = ShadowHandVisionEnv(cfg)
env.reset()
actions = torch.zeros(cfg.scene.num_envs, env.action_space.shape[-1], device=env.device)
env.step(actions)
# Step enough frames for RTX MDL shader variants to finish compiling. A single step
# returns a still-zero framebuffer for ``simple_shading_*_mdl`` presets on cold caches,
# which trips the assertion in ``test_camera_renders_not_empty`` below. 10 steps is
# empirically enough across the MDL variants that flake in CI as of 2026-05.
for _ in range(10):
env.step(actions)
yield renderer_preset, camera_preset, physics, env
env.close()

Expand Down
Loading