Skip to content

Fix Torch actuator targets during CPU graph capture - #9013

Merged
r-schmitt merged 2 commits into
isaac-sim:mainfrom
maxkra15:maximiliank/fix-cpu-capture-torch-targets
Nov 12, 2026
Merged

r-schmitt merged 2 commits into
isaac-sim:mainfrom
maxkra15:maximiliank/fix-cpu-capture-torch-targets

Conversation

@maxkra15

Copy link
Copy Markdown
Contributor

Description

After #8959 enabled Newton CPU graph capture, actuator target writes could fail with AttributeError: 'Tensor' object has no attribute 'ptr'. Warp's CPU capture expects array metadata when recording the Torch values and selectors passed to these kernels.

Convert Torch arguments to zero-copy wp.from_torch views at the indexed and masked target-setter launch boundaries. This preserves storage, dtype, strides, and selector order, so graph replay observes in-place command updates. Existing dispatch and backend staging remain unchanged.

Extends the two existing setter tests with CPU capture/replay checks for updated values, selections, and untouched entries.

Validation

  • All six extended setter cases reproduce the original error before the fix; all 23 actuator tests pass afterward.
  • Real Cartpole CPU capture/replay: 20 steps with changing actions, correct targets, and finite outputs.
  • Full formatting/lint, changelog, and diff checks passed.

@maxkra15
maxkra15 requested a review from a team November 11, 2026 15:51
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Nov 11, 2026
@maxkra15

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 Nov 11, 2026

@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: Test quality (1). Other reviewed categories look good.

  • PR description: The title and body match the launch-boundary fix, replay assertions, and changelog; validation reports functional results, and the zero-copy metadata conversion introduces no material copying change requiring benchmarks.
  • 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: Style consistency looks good.
  • Test quality: Capture replay repeats the same shared implementation for each command name; keep one indexed and one masked replay while retaining per-command eager assertions.

Minor fixes needed. Posted 1 inline finding.

Automated review; human maintainers own approval decisions.

torch.testing.assert_close(command_buffer.torch.cpu(), expected)

joint_ids = wp.to_torch(joint_ids)
with wp.ScopedCapture(device="cpu") as capture:

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 — Capture each setter path once

Position, velocity, and effort use the same indexed and masked capture paths. Four replays add test cost without a distinct regression; keep one replay per path and retain the existing per-command eager assertions.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

i agree with the bot

@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: Test quality (1). Other reviewed categories look good.

  • PR description: The title and body match the three-file setter, test, and changelog diff; reported regression and Cartpole validation address correctness, and no measurable performance claim requires benchmarking.
  • 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: Style consistency looks good.
  • Test quality: Capture blocks repeat identical shared helpers across command names already covered by eager routing assertions; retain one indexed and one masked replay check while preserving parametrized eager coverage.

Minor fixes needed. Posted 1 inline finding.

Automated review; human maintainers own approval decisions.

torch.testing.assert_close(command_buffer.torch.cpu(), expected)

joint_ids = wp.to_torch(joint_ids)
with wp.ScopedCapture(device="cpu") as capture:

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 — Capture each setter path once

Both capture blocks repeat the same shared helper for position, velocity, and effort; eager assertions already check command routing. Capture once per selector mode and retain parametrized eager coverage.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

+1

@greptile-apps

greptile-apps Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Converts Torch values and index selectors to Warp views before actuator target writes. Backend staging and index dispatch stay unchanged.

  • Actuator target writes use current Torch inputs during CPU graph replay.

No actionable issues were found. Tests were inspected but not run.

Reviews (1) · Last reviewed commit: "Fix Torch actuator targets during CPU gr..." · Reviewed by Greptile

@r-schmitt r-schmitt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thanks @maxkra15 looks good, just need to address the bot comment

@r-schmitt
r-schmitt merged commit 616f517 into isaac-sim:main Nov 12, 2026
58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants