Skip to content

[Warp] Part 4a/9: Add the recording utilities and keep lazy data correct under recording - #8998

Draft
hujc7 wants to merge 30 commits into
isaac-sim:mainfrom
hujc7:jichuanh/warp-recording-utils
Draft

hujc7 wants to merge 30 commits into
isaac-sim:mainfrom
hujc7:jichuanh/warp-recording-utils

Conversation

@hujc7

@hujc7 hujc7 commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Lazily computed data (asset data properties, sensor buffers) is correct when read inside a recorded CUDA graph, and isaaclab.utils.warp.capture adds the recording utilities the Warp frontend builds on: GraphedCallable and eager_method.

Description

Update (2026-11-17, 741e29de8c6): a solver whose reset reads the host (the coupled solver with one world and an MPM entry) is reset before the step graph on every step, as on main, also after state writes were recorded in a graph; the graph no longer records that reset. This fixes IsaacContrib-G1-Terrain with the granular preset on Newton, whose recorded step failed with CUDA error 906 on world_mask.numpy().

Update (2026-11-17, 3c65f77950c): the Newton asset data are back to main's lazy finite differences, keeping only the fix of their first value after the ordering setup (item 3); "record" now names only a GraphedCallable's own CUDA graph, and the launch cache speaks of cached launches.

Update (2026-11-17, 02fb34cf577): GraphedCallable.__call__ runs the callable plainly in one branch for its three cases (inside a graph capture something else started, on a CPU device, after an abandoned recording), and each recording step is commented. No behaviour change.

Update (2026-11-17): Newton resolves flagged state writes inside the step's CUDA graph only once a state write was recorded in a graph; otherwise the solver reset and forward kinematics run before the step as on main. This fixes the coupled and MPM tasks (Franka-Pour, UR10-Particle-Push, the coupler and MPM demos), whose solver reset reads the world mask on the host and failed under capture with CUDA error 906.

Update (2026-11-16): rebased onto main (no longer stacked on 3a). Since the previous head, eager, record_at_end and is_recording are removed and eager_method is the only marker: a recording that reaches one is abandoned and the call runs without a graph from then on. A GraphedCallable records again when its owner calls reset, not on its own when the physics backend rebinds. Recordings now check that no torch operation or host synchronization runs while the graph records. The cached Warp launches keep one recorded launch per call site. Newton no longer changes add_model_change.

  1. Recording utilities (isaaclab.utils.warp.capture):
    • GraphedCallable records a call as a CUDA graph on its first run with a given argument layout and replays it after; it records again for another layout, or after its owner calls reset (for example, after a physics rebind).
    • eager_method marks a method that cannot be recorded. A GraphedCallable that calls one while it records abandons the recording without launching it, runs without a CUDA graph from then on and logs a warning that names both calls.
    • While a graph records, a torch operation on its device that is not a view, or a host synchronization, raises a RuntimeError naming the recorded call and the operation, with and without Kit.
  2. Lazy values under recording: inside any CUDA graph capture, a TimestampedBuffer reads as stale and an update does not mark it fresh, so a cached value read in a capture is recomputed on every replay. update_in_graph=False keeps the plain timestamp rule. On Newton, 15 data properties that raised while a graph recorded now record their update. On PhysX and OvPhysX, data that a graph cannot refresh is read as it is: the finite-difference accelerations, and on PhysX also the CPU-only body views and the joint positions and velocities, so the PhysX host actuator runtime still captures its graphs.
  3. Finite-difference accelerations: Newton's joint and body accelerations keep main's lazy finite difference (the property computes when stale over the elapsed time, and update(dt) reads it each physics step), with update_in_graph=False, so a read inside a recording sees the real timestamp and records nothing. Fixed: after the joint or body ordering is set up, main reset their timestamps to -1, so the first difference ran over dt + 1 s; the data is now zeroed instead.
  4. Cached Warp launches: asset data, sensors and managers keep one cached launch per call site, and an argument or launch dimension that changes is set on that launch in place. The sensor clock update of each physics step reuses a cached launch.
  5. Sensors: SensorBase records its buffer refresh in every CUDA graph capture that reads the data, so each replay refreshes the environments whose data is outdated. Camera renders on the host, so a recorded call that reads it runs without a CUDA graph.
  6. Newton backend: once a state write was recorded in a graph (transforms_may_change_on_graph_replay), the solver reset and forward kinematics for the worlds flagged by state writes run at the start of each physics step inside the step's CUDA graph, instead of eagerly before every step. Until then they run before the step as on main, which keeps a solver reset that reads the world mask on the host, such as the coupler's, out of the graph. Without flagged worlds the masked kernels do no work.

Evidence

MEASURED on 8gpu (isaac-lab:latest-main, Newton MJWarp, Kit PhysX and OvPhysX) at 7c0784c04d1, one file per process: 79 test files, 1595 tests passed and none failed. The files are the capture, capture-guard, launch-cache and TimestampedBuffer tests; every test under isaaclab/test/actuators, isaaclab/test/sensors and isaaclab/test/utils/warp; the PhysX and OvPhysX asset and sensor tests; the Newton physics and asset tests; and the articulation contract tests.

At 741e29de8c6 (4-GPU L40 host, isaac-lab:latest-main): test_newton_manager.py 65, test_coupler.py 66, test_newton_solver_reset.py 4 and test_articulation_contract.py 506 (16 skipped) passed; IsaacContrib-G1-Terrain (env=granular physics=newton_mjwarp) steps 60 times on the Warp frontend of the full series (failed at step 1 before) and on the torch frontend.

At 3c65f77950c (4-GPU L40 host, isaac-lab:latest-main, one file per process): test_articulation_contract.py 506 (16 skipped), test_rigid_object_contract.py 231 (4 xfailed), Newton test_articulation.py 44 and test_rigid_object.py 23, test_capture.py 19, test_capture_kit.py 1, test_timestamped_buffer.py 7, test_launch_cache.py 3, test_sensor_update_schedule.py 14 and test_newton_solver_reset.py 4 passed.

At 02fb34cf577 (4-GPU L40 host, isaac-lab:latest-main, one file per process): test_capture.py 19, test_capture_kit.py 1, test_timestamped_buffer.py 7, test_newton_solver_reset.py 4, test_sensor_update_schedule.py 14 and test_articulation_contract.py 506 (16 skipped) passed.

At 90bbae9c71f: the coupled tasks that failed CI at 7c0784c04d1 pass (test_franka_pour_spill.py, test_contrib_environments_kitless.py -k Pour and -k Particle), and test_newton_manager.py passes (64). Warp-frontend step time (Newton MJWarp, 4096 envs, 5 interleaved runs, recorded) is unchanged by the fix: Cartpole 0.775 ms, Ant 1.396 ms; resolving before the step on every step instead would cost Cartpole 1.341 ms.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Release backport

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

Screenshots

Not applicable.

Checklist

Docker and GPU tests run on demand. Push the commits you want tested, then
comment run-ci on the pull request.

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with uv run isaaclab --format
  • I have made corresponding changes to the documentation: isaaclab.utils.warp.capture is in the API reference
  • My changes generate no new warnings
  • I have validated the changed behavior with focused coverage and applied the test-audit criteria to any test changes
  • I have added a changelog fragment under source/<pkg>/changelog.d/ for every touched package (do not edit CHANGELOG.rst or bump package versions — CI handles that)
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@hujc7

hujc7 commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator 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 Nov 10, 2026
@greptile-apps

greptile-apps Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect recorded Warp work across assets, sensors, and Newton physics steps.

Fix the coupled MPM reset path before merging.

Findings

  1. P1 Coupled resets still break capture ▶

Summary

Adds CUDA graph recording helpers and makes lazy asset and sensor reads refresh during replay.

  • Warp callers can record a GPU call once and replay it for the same inputs.
  • Lazy asset values stay current when recorded GPU work replays.
  • Sensor data refreshes stay up to date when a recorded call replays.
  • Warp call sites reuse a cached launch when their inputs change.
  • Newton resolves replayed state writes inside the physics-step graph.

The three previous findings are addressed. One new issue remains: single-world coupled MPM runs can still capture a reset that reads GPU data on the host.

Reviews (2) · Last reviewed commit: "Restore the lazy finite differences of t..." · Reviewed by Greptile

Comment on lines +364 to +367
if isinstance(value, wp.array):
return value.ptr
if isinstance(value, torch.Tensor):
return value.data_ptr()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Different views reuse old graphs

_value_key treats every view starting at the same address as the same argument. Calling a GraphedCallable with values[:2] and then values[:4] replays the two-element graph instead of recording the new size. Changing strides or dtype at the same address also reuses the old reads and writes.

Include array type, shape, strides, dtype, and device alongside the pointer in the key.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0953e28: an array's key now holds its shape, strides, dtype and device besides the pointer; a test records values[:2] and values[:4] as two graphs.

Comment on lines +162 to +168
wp.launch(
articulation_kernels.get_joint_acc_from_joint_vel,
dim=(self._num_instances, self._num_joints),
inputs=[
self.joint_vel.warp,
self._previous_joint_vel,
dt,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Initial accelerations become non-finite

Newton's update now divides by dt even when it is zero. Articulation._initialize_impl calls self.update(0.0), and rigid objects and collections do the same. The kernels divide by that zero, and the new plain acceleration getters return the resulting NaN or infinity until a positive-time update.

Skip the finite difference when no time has passed, while keeping the acceleration buffers finite. Apply the same guard to all three data classes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0953e28: the Newton articulation, rigid object and collection data skip the finite differences on update(0.0), so the accelerations keep their values (zero at initialization). Tests cover them.

Comment on lines 190 to 193
if env_ids is None and env_mask is not None:
# parameters are sampled per reset env, so the mask becomes indices
env_ids = wp.to_torch(env_mask).nonzero(as_tuple=False).squeeze(-1)
self.reset_idx(env_ids)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 One reset restarts every motor

A mask-only Multirotor.reset still resets every thruster. The parent Articulation.reset changes env_ids=None to slice(None) before forwarding both selections through _ThrusterCollection. This condition then ignores env_mask because env_ids is no longer None.

Thruster history and sampled parameters reset everywhere, while thrust targets reset only in the masked environments. Treat slice(None) as an absent selection when a mask is supplied, or normalize it in _ThrusterCollection.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in edc7ec3 (#6646): _ThrusterCollection.reset turns the slice(None) the articulation forwards into None, so a mask-only reset resamples only the masked thrusters. The multirotor unit test covers it.

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isaac Lab Review Bot

Needs attention: Scope and over-engineering (1), Compatibility and deprecation (7), Implementation (4), Style consistency (5), Test quality (4). Other reviewed categories look good.

  • PR description: Clarify cumulative versus recording-only scope, correct non-breaking labels, and replace the duplicated review diagram with a link; supplement reported correctness tests with baseline/candidate revisions, command/workload, hardware, backend, environment count, warmup, latency, and memory.
  • Design and architecture: Architecture looks good.
  • Scope and over-engineering: Minimal implementation: Keep capture.py for graph and stream lifecycle; extend TimestampedBuffer, SensorBase, NewtonManager, and existing selector owners, without allocating Warp selections for Torch-only terms or adding parallel layers. Suggested PR breakdown: 1) selective resets and selector reuse, validated at asset boundaries; 2) origins and SceneEntityCfg migration, validated through public compatibility paths; 3) capture utilities, lazy refresh, and Newton notifications/FK, validated through replay and solver-state tests.
  • API: API changes look good.
  • Compatibility and deprecation: Breaking changes: origins, reset overrides, camera selectors, experimental exports, and documented mask precedence lose established contracts; retain functional bridges with targeted warnings, migration documentation, removal guidance, and transition coverage.
  • Implementation: Pointer-only graph keys reuse incompatible array views, producing incorrect replay; include device, dtype, shape, strides, and array type in the key.
  • Style consistency: The TimestampedBuffer docstring references nonexistent warp.utils.recordings, breaking documentation resolution; point it to warp.capture.recordings.
  • Test quality: The mocked eager-reset case supplies its own decorator and replaces eager, proving neither production Torch-state reset nor graph replay; delete it and its fixture.

Needs rework. Posted 21 inline findings.

The full PR diff was reviewed; some supplemental surrounding file context was omitted.

Automated review; human maintainers own approval decisions.

if isinstance(actuator, ActuatorBase):
actuator.reset(group_env_ids)
self._control.reset_native_actuators(slice(None) if group_env_ids is None else group_env_ids)
actuator.reset(env_ids=group_env_ids, env_mask=env_mask)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Critical · Implementation — Use one reset selection

With conflicting selectors, network actuators use IDs while delayed and native actuators use the mask; wrench composers also use the mask. Resolve one selection before dispatch.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changed: callers pass either ids or a mask, or both selecting the same environments; each reset's docstring states which one it uses when both are given.

@property
def env_origins(self) -> torch.Tensor:
"""Per-env world origins, shape ``(num_envs, 3)``."""
def env_origins(self) -> ProxyArray:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Critical · Compatibility — Preserve tensor-valued origins

Scene and terrain env_origins now return ProxyArray instead of Torch tensors, changing runtime type and metadata. Keep the tensor property functional through deprecation; expose Warp storage separately.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intended: env_origins is a ProxyArray on every path. Indexing, arithmetic and torch.cat still work and return tensors, with a DeprecationWarning on implicit torch use; isinstance(x, torch.Tensor) and .shape change, as listed under Breaking changes, and nothing in the repo relies on either.

# -- assets
for articulation in self._articulations.values():
articulation.reset(env_ids)
articulation.reset(env_ids=env_ids, env_mask=env_mask)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Critical · Compatibility — Preserve custom entity reset hooks

Even an index-only scene reset now passes env_mask=None to custom assets and sensors implementing reset(env_ids), raising TypeError. Retain that invocation through a warned, documented, validated transition.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intended and listed under Breaking changes: custom assets and sensors accept env_mask, as AssetBase.reset and SensorBase.reset do.

wp.launch(
ray_caster_kernels.init_rng_state_kernel,
dim=self._view_count,
inputs=[int(torch.randint(0, 2**31 - 1, (1,)))],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Critical · Implementation — Avoid unused global RNG draws

Every ray caster now consumes a Torch global-generator draw at initialization, even when drift is disabled. This shifts subsequent seeded randomization. Initialize drift RNG only when needed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in edc7ec3 (#6646): the masked-reset random states are seeded by the first reset that samples drift, so a ray caster without drift draws nothing from torch's generator.

def _argument_key(args: tuple, kwargs: dict[str, Any]) -> tuple:
"""Key a call by the pointers of its arrays and the values of its scalars."""
return tuple(_value_key(value) for value in args) + tuple(
(name, _value_key(value)) for name, value in kwargs.items()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Critical · Implementation — Key graphs by array layout

Array keys contain only pointers. Views sharing storage but differing in shape, strides, or dtype can replay a graph captured for the wrong layout. Include array type, device, dtype, shape, and strides.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0953e28: an array's key now holds its shape, strides, dtype and device besides the pointer; a test records values[:2] and values[:4] as two graphs.

graphed(old)
graphed(new)
graphed(new)
graphed(new, 5)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Test Quality — Make scalar changes observable

_Affine ignores the scalar passed in this row. Recording counts cannot prove changed scalar values reach recorded work. Use the scalar in a launch and assert the result.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0953e28: _Affine applies the shift it is called with, and the test asserts that the replays add the new shift.

import warp as wp

from isaaclab.scene import InteractiveScene

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Compatibility — Retain the Warp scene export

Deleting InteractiveSceneWarp breaks its documented import and scene configurations. Retain a functional compatibility class and export with targeted deprecation guidance and old/new validation.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No shim: isaaclab_experimental is folded into the stable package without deprecation shims, as on #8824; the changelog names InteractiveScene as the replacement.

from isaaclab.managers.scene_entity_cfg import SceneEntityCfg as _SceneEntityCfg

if TYPE_CHECKING:
from isaaclab.scene import InteractiveScene

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Compatibility — Bridge experimental entity configuration

Deleting this exported class removes direct imports, joint_mask, and from_stable; the stable replacement lacks those members. Retain a functional warned bridge and validate both paths.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No shim, as for the rest of isaaclab_experimental: the name now resolves to isaaclab.managers.SceneEntityCfg, and the changelog lists joint_mask and from_stable as removed.

np.testing.assert_allclose(sampled_heading.numpy(), yaw, atol=1e-5)


@pytest.mark.parametrize("device", test_devices(DeviceScope.CUDA))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Test Quality — Consolidate tendon capture scenes

This rebuilds the sibling test’s tendon scene and checks staged getters, which still pass if the simulation writer is removed. Put distinct masked-cell assertions in the solver-replay scene.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kept separate: the two tests check different copies, the Newton model and the MJWarp solver's tendon_stiffness; merging them would save one scene build.

from isaaclab_experimental.managers import ManagerTermBase
from isaaclab_experimental.utils.warp.utils import wrap_to_pi

from isaaclab.managers import SceneEntityCfg

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Style Consistency — Restore package import order

The new isaaclab import follows isaaclab_experimental imports. Put Isaac Lab imports first here and in the changed locomotion MDP files.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the order the repo's ruff isort configuration produces; pre-commit passes.

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isaac Lab Review Bot

Needs attention: Design and architecture (1), Scope and over-engineering (2), API (1), Compatibility and deprecation (6), Implementation (2), Style consistency (9), Test quality (6).

  • PR description: Correct non-breaking labels and neural-reset claims; shorten the duplicated series map while preserving template sections; supplement reported validation with step/reset baseline/candidate benchmarks specifying revisions, command/workload, hardware, backend, environment count, warmup, and latency.
  • Design and architecture: Resolve one selection in ActuatorCollection.reset; neural actuators currently use IDs while delayed and native states use masks, clearing different environments in the same call.
  • Scope and over-engineering: Minimal implementation: extend warp.memory, SceneEntityCfg, TimestampedBuffer, SensorBase, and NewtonManager; keep capture.py for graph lifecycle, collapse unconditional selector uploads and unused RNG setup into consumer-driven initialization, then record and replay owner updates. Suggested PR breakdown: (1) memory selectors and masked resets, validated at asset boundaries; (2) origins and selections, validated through frontend consumers; (3) capture and lazy refresh, validated by replay; (4) Newton FK and finite differences, validated against solver state.
  • API: Include shape, strides, dtype, and device in GraphedCallable array keys; pointer-only keys reuse the first recording for different layouts and execute incorrect launches.
  • Compatibility and deprecation: Breaking changes: tensor origins, experimental scene/configuration exports, custom entity/native reset hooks, and camera selector coercion change without complete deprecation bridges; retain functional legacy contracts with targeted warnings, migration/removal guidance, and transition coverage.
  • Implementation: Mask-only multirotor resets reach Thruster.reset with slice(None), causing every motor to resample; treat the full slice as unspecified when a mask is present.
  • Style consistency: Changed imports leave adjacent documentation recommending removed configuration classes and denying newly supported capture behavior; update those references and rationale to the current contracts.
  • Test quality: The collection eager-reset test supplies its asserted behavior through a mock and never records a graph; delete it and its fake actuator or exercise a real recorded reset.

Needs rework. Posted 27 inline findings.

The full PR diff was reviewed; some supplemental surrounding file context was omitted.

Automated review; human maintainers own approval decisions.

if isinstance(actuator, ActuatorBase):
actuator.reset(group_env_ids)
self._control.reset_native_actuators(slice(None) if group_env_ids is None else group_env_ids)
actuator.reset(env_ids=group_env_ids, env_mask=env_mask)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Critical · Design Architecture — Resolve one actuator reset selection

With both selectors, neural actuators use IDs while delayed and native states use the mask. One reset clears different environments. Choose one selection at the collection boundary and forward it consistently.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changed: callers pass either ids or a mask, or both selecting the same environments; each reset's docstring states which one it uses when both are given.

actuator.reset(group_env_ids)
self._control.reset_native_actuators(slice(None) if group_env_ids is None else group_env_ids)
actuator.reset(env_ids=group_env_ids, env_mask=env_mask)
self._control.reset_native_actuators(slice(None) if group_env_ids is None else group_env_ids, env_mask)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Critical · Compatibility — Preserve native actuator reset hooks

Existing ActuatorControl.reset_native_actuators(env_ids) overrides now receive a second positional argument on every reset. Preserve the old call through a warned, documented transition covering old and new hooks.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reset_native_actuators is an internal ActuatorControl method; the PhysX, Newton and OvPhysX implementations all take env_mask.

@property
def env_origins(self) -> torch.Tensor:
"""Per-env world origins, shape ``(num_envs, 3)``."""
def env_origins(self) -> ProxyArray:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Critical · Compatibility — Preserve tensor origins

Scene and terrain env_origins now return ProxyArray, changing runtime type and shape, dtype, and device metadata. Keep the Torch property functional and add Warp access through a documented, warned transition.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intended: env_origins is a ProxyArray on every path. Indexing, arithmetic and torch.cat still work and return tensors, with a DeprecationWarning on implicit torch use; isinstance(x, torch.Tensor) and .shape change, as listed under Breaking changes, and nothing in the repo relies on either.

# -- assets
for articulation in self._articulations.values():
articulation.reset(env_ids)
articulation.reset(env_ids=env_ids, env_mask=env_mask)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Critical · Compatibility — Preserve custom entity reset hooks

Even scene.reset() now passes env_mask=None. Existing custom assets and sensors implementing reset(env_ids) raise TypeError. Retain legacy invocation during a targeted, documented deprecation transition and test both signatures.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intended and listed under Breaking changes: custom assets and sensors accept env_mask, as AssetBase.reset and SensorBase.reset do.


def _argument_key(args: tuple, kwargs: dict[str, Any]) -> tuple:
"""Key a call by the pointers of its arrays and the values of its scalars."""
return tuple(_value_key(value) for value in args) + tuple(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Critical · Api — Key graphs by array layout

Arrays with one pointer but different shapes, strides, or dtypes share a recording. Replay then executes the first layout's launches. Include layout and device alongside the pointer in the key.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0953e28: an array's key now holds its shape, strides, dtype and device besides the pointer; a test records values[:2] and values[:4] as two graphs.


from isaaclab.envs.mdp.events import randomize_rigid_body_mass as _StableRandomizeRigidBodyMass
from isaaclab.envs.mdp.events import randomize_rigid_body_material as _StableRandomizeRigidBodyMaterial
from isaaclab.managers import SceneEntityCfg

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Style Consistency — Update selection configuration guidance

The module docstring still recommends the removed experimental SceneEntityCfg, while this import uses the stable class. Name the current class in the guidance.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0a297ba (#8856): the module docstring names isaaclab.managers.SceneEntityCfg, and the two error messages no longer name the removed class.

np.testing.assert_allclose(sampled_heading.numpy(), yaw, atol=1e-5)


@pytest.mark.parametrize("device", test_devices(DeviceScope.CUDA))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Test Quality — Combine tendon replay scenes

Both new tendon replay tests build the same tendon island. Check selected cells and successive solver refreshes in one scene instead of paying for a second simulation.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kept separate: the two tests check different copies, the Newton model and the MJWarp solver's tendon_stiffness; merging them would save one scene build.

def __init__(self, shape):
self.data = wp.zeros(shape, dtype=wp.float32, device="cpu")
self.timestamp = -1.0
def Buffer(shape):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Style Consistency — Name the factory as a function

Buffer is now a function rather than the class it replaced. Rename it and its calls to snake_case.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left as is: a test-local name.

from isaaclab_experimental.managers.manager_base import ManagerTermBase

import isaaclab.utils.string as string_utils
from isaaclab.managers import SceneEntityCfg

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Style Consistency — Remove obsolete capture warning

The adjacent comment says lazy asset data cannot be graph-captured, but this diff makes its recorded updates capturable. Remove or correct that rationale.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0953e28, and the three other copies of the comment in a37579a.


# Per-env origins (Warp view for kernels; Torch env uses `self.scene.env_origins` directly).
self.env_origins = wp.from_torch(self.scene.env_origins, dtype=wp.vec3f)
self.env_origins = self.scene.env_origins.warp

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Style Consistency — Correct the origins comment

The adjacent comment says Torch uses scene.env_origins directly, but the property now returns ProxyArray. Describe explicit .torch access instead.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0a297ba (#8856): the comment says the torch env reads scene.env_origins.torch.

@hujc7
hujc7 marked this pull request as draft November 10, 2026 21:18
@hujc7

hujc7 commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator Author

run-ci

The PhysX, OVPhysX and visuo-tactile sensors no longer mark their refresh
with eager_method: a step is recorded only with Newton physics, so these
sensors never refresh inside a recording.
The eager timestamp test and the single-read sensor capture test fail
only when the articulation contract tests and the repeated-read sensor
test fail too. The in-recording invalidation test passes without the
recording rule. The CPU capture check joins the foreign-capture test as
its CPU case, and the PhysX ray caster test matches the sensor's own
error again.
GraphedCallable no longer follows the physics backend through a
class-level subscription (watch, unwatch, generation, invalidate), and
cached Warp launches no longer have a global clear_all. Nothing in this
part records a step, so the owner that does resets its own callables and
clears its own caches, as main's physics backend and asset data do.
@hujc7
hujc7 force-pushed the jichuanh/warp-recording-utils branch from f099c6c to 7c0784c Compare November 17, 2026 06:20
@hujc7

hujc7 commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator 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 Nov 17, 2026
@hujc7 hujc7 changed the title [Warp] Part 4a/8: Add the recording utilities and keep lazy data correct under recording [Warp] Part 4a/9: Add the recording utilities and keep lazy data correct under recording Nov 17, 2026
@hujc7

hujc7 commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator 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 Nov 17, 2026
@hujc7

hujc7 commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator 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 Nov 17, 2026
@hujc7

hujc7 commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator 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 Nov 17, 2026
@hujc7
hujc7 marked this pull request as ready for review November 17, 2026 19:52
Comment on lines +634 to +635
if self.transforms_may_change_on_graph_replay:
self._resolve_flagged()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Coupled resets still break capture. In a single-world Newton run with a capture-capable MPM entry and use_cuda_graph=True, recording a state write sets transforms_may_change_on_graph_replay. The next step now records _resolve_flagged(), which calls CouplerSolver.reset(). That method reads world_mask.numpy() on the host when an MPM entry is present. This read cannot run during CUDA capture, so stepping fails.

The new condition only avoids this for runs without recorded writes. Keep host-reading resets outside the captured step, or make those resets work entirely on the device.

Knowledge Base Used: Newton backend

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 741e29d. A solver now reports whether its reset can be recorded (reset_is_capturable); the coupled solver says no for one world with an MPM entry, and then the step resets it eagerly before the step graph on every step, as on main, also after state writes were recorded, so the graph never records the host read. Reproduced first with IsaacContrib-G1-Terrain (granular preset, Newton) on the Warp frontend, which failed at step 1 with CUDA error 906; it now steps 60 times. Test: test_a_reset_that_reads_the_host_resolves_before_the_captured_step in test_newton_manager.py.

@hujc7

hujc7 commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator 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 Nov 17, 2026
@hujc7
hujc7 marked this pull request as draft November 23, 2026 08:10

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant