Skip to content

Fix device for gravity data allocation in Kamino#2823

Merged
chschuma-disney merged 2 commits into
newton-physics:mainfrom
chschuma-disney:chschuma/gravity-device-allocation-fix
May 9, 2026
Merged

Fix device for gravity data allocation in Kamino#2823
chschuma-disney merged 2 commits into
newton-physics:mainfrom
chschuma-disney:chschuma/gravity-device-allocation-fix

Conversation

@chschuma-disney

@chschuma-disney chschuma-disney commented May 8, 2026

Copy link
Copy Markdown
Member

Description

When converting gravity from a Newton model to Kamino's gravity data structure, a specific code path failed to allocate new warp arrays on the same device the model data lives, instead allocating it on the default device. This specific case generally happens when an existing gravity data structure is updated, e.g., as a reaction to the solver being notified about an update to the gravity values.

At the same time, an issue with the size check of the existing array was addressed. The issue lead to a new array being allocated with every change, even if the size was compatible with the new gravity data.

To simplify the testing and in anticipation of the test migration, I added Kamino to the existing Newton gravity tests, instead of creating a new test in Kamino.

Checklist

  • New or existing tests cover these changes
  • The documentation is up to date with these changes
  • CHANGELOG.md has been updated (if user-facing change)

Test plan

uv run --extra dev -m newton.tests -k test_runtime_gravity

Bug fix

Steps to reproduce:

  1. Add Kamino to test_runtime_gravity.py
  2. Run uv run --extra dev -m newton.tests -k test_runtime_gravity
  3. The CPU-based test for Kamino will fail

Summary by CodeRabbit

  • Tests

    • Gravity runtime tests now include the Kamino solver, increasing solver coverage.
  • Bug Fixes

    • Fixed device-aware allocation for gravity model data to ensure correct behavior across compute devices.

@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: cd00de81-6a01-4ce9-b6eb-ca214d14c6a9

📥 Commits

Reviewing files that changed from the base of the PR and between 4abbb78 and c6160e3.

📒 Files selected for processing (2)
  • newton/_src/solvers/kamino/_src/core/gravity.py
  • newton/tests/test_runtime_gravity.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • newton/tests/test_runtime_gravity.py
  • newton/_src/solvers/kamino/_src/core/gravity.py

📝 Walkthrough

Walkthrough

The PR updates the gravity model output validation in the Kamino solver to correctly handle g_dir_acc and vector arrays as (world_count,) shaped collections of vec4f elements, and ensures these arrays are allocated on the input model's device. The test matrix is extended to include the Kamino solver in gravity runtime testing.

Changes

Gravity Model Array Shape and Device Allocation

Layer / File(s) Summary
Gravity Model Allocation and Shape Validation
newton/_src/solvers/kamino/_src/core/gravity.py
Output validation for GravityModel.g_dir_acc and GravityModel.vector now interprets arrays as (world_count,) shaped vec4f instead of (world_count, 4), and allocates on model_in.device when reallocation is needed.
Test Matrix Integration
newton/tests/test_runtime_gravity.py
SolverKamino is imported and added to the solvers_bodies test dictionary, extending rigid-body gravity test coverage to the kamino solver.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix device for gravity data allocation in Kamino' directly and clearly describes the main change in the PR - fixing device allocation for gravity data in the Kamino solver.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI 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.

Pull request overview

Fixes Kamino gravity model updates so that reallocated Warp arrays are created on the same device as the source Newton model, and corrects the shape check that previously forced unnecessary reallocations during runtime gravity updates. Adds SolverKamino to the existing Newton runtime gravity test matrix to cover this regression.

Changes:

  • Fix convert_model_gravity() to (1) validate Warp array shape correctly for vec4f arrays and (2) allocate replacement arrays on model_in.device.
  • Extend test_runtime_gravity.py solver matrix to include SolverKamino for body-based runtime gravity tests.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
newton/_src/solvers/kamino/_src/core/gravity.py Corrects shape checks for vec4f Warp arrays and ensures reallocations happen on model_in.device during in-place updates.
newton/tests/test_runtime_gravity.py Adds SolverKamino to the existing runtime gravity body-solver test combinations to exercise the runtime update path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov

codecov Bot commented May 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
newton/_src/solvers/kamino/_src/core/gravity.py 50.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@vastsoun vastsoun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks @chschuma-disney

@chschuma-disney chschuma-disney force-pushed the chschuma/gravity-device-allocation-fix branch from 4abbb78 to c6160e3 Compare May 8, 2026 20:31
@chschuma-disney chschuma-disney self-assigned this May 8, 2026
@chschuma-disney chschuma-disney added the kamino Issues that come up while integrating/implementing the Kamino solver label May 8, 2026
@chschuma-disney chschuma-disney added this pull request to the merge queue May 9, 2026
Merged via the queue into newton-physics:main with commit 6648d39 May 9, 2026
25 checks passed
@adenzler-nvidia adenzler-nvidia added this to the 1.2 Release milestone May 11, 2026
hujc7 added a commit to hujc7/IsaacLab that referenced this pull request May 14, 2026
Bumps the Newton pin from v1.2.0rc2 (current develop) directly to the
v1.2.0 stable release across all five pin sites (isaaclab_newton,
isaaclab_physx, isaaclab_visualizers x3,
tools/wheel_builder/res/python_packages.toml), keeping the canonical
`newton[sim] @ git+...` form everywhere.

The full upstream release notes are at
https://github.com/newton-physics/newton/releases/tag/v1.2.0
(published 2026-05-12). IsaacLab-relevant changes vs the rc2 pin:

- MPR/GJK convex-hull centering fix
  (newton-physics/newton#2651)
- Kamino FK solver performance
  (newton-physics/newton#2703)
- HDR color output for tiled camera sensors
  (newton-physics/newton#2721)
- Collada texture URDF import fix
  (newton-physics/newton#2743)
- Kamino multi-GPU gravity-data device fix
  (newton-physics/newton#2823)
- CollisionPipeline small fixes
  (newton-physics/newton#2632)
- DelassusOperator attribute refactor
  (newton-physics/newton#2734) -- not used in
  IsaacLab source, no adapt needed.
- SolverMuJoCo fixes: planar meshes, contact-anchor computation,
  distance conversion.

mjwarp moves 3.8.0.1 -> 3.8.0.3 transitively via newton[sim]; no
IsaacLab-side mujoco / mujoco-warp pin change since
isaac-sim#5566 dropped explicit pins.
hujc7 added a commit to hujc7/IsaacLab that referenced this pull request May 14, 2026
Bumps the Newton pin from v1.2.0rc2 (current develop) directly to the
v1.2.0 stable release across all five pin sites (isaaclab_newton,
isaaclab_physx, isaaclab_visualizers x3,
tools/wheel_builder/res/python_packages.toml), keeping the canonical
`newton[sim] @ git+...` form everywhere.

The full upstream release notes are at
https://github.com/newton-physics/newton/releases/tag/v1.2.0
(published 2026-05-12). IsaacLab-relevant changes vs the rc2 pin:

- MPR/GJK convex-hull centering fix
  (newton-physics/newton#2651)
- Kamino FK solver performance
  (newton-physics/newton#2703)
- HDR color output for tiled camera sensors
  (newton-physics/newton#2721)
- Collada texture URDF import fix
  (newton-physics/newton#2743)
- Kamino multi-GPU gravity-data device fix
  (newton-physics/newton#2823)
- CollisionPipeline small fixes
  (newton-physics/newton#2632)
- DelassusOperator attribute refactor
  (newton-physics/newton#2734) -- not used in
  IsaacLab source, no adapt needed.
- SolverMuJoCo fixes: planar meshes, contact-anchor computation,
  distance conversion.

mjwarp moves 3.8.0.1 -> 3.8.0.3 transitively via newton[sim]; no
IsaacLab-side mujoco / mujoco-warp pin change since
isaac-sim#5566 dropped explicit pins.
kellyguo11 pushed a commit to isaac-sim/IsaacLab that referenced this pull request May 15, 2026
## Summary

Bumps the Newton pin from `v1.2.0rc2` (current develop) directly to the
[`v1.2.0` stable
release](https://github.com/newton-physics/newton/releases/tag/v1.2.0)
across all five pin sites, keeping the canonical `newton[sim] @ git+...`
form everywhere.

Per Kelly Guo's suggestion: skip the rc bump and go straight to stable.
Upstream published `v1.2.0` on 2026-05-12.

**Alternative**:
[#5614](#5614)
(rc3 bump) — pick whichever target based on CI signal. This one is the
most forward target.

> Branch is still named `jichuanh/newton-1.2.0rc4-bump` from when this
PR was originally proposing rc4 — the branch name doesn't match the
current target but the diff is correct. Force-pushing the rename would
close/reopen the PR, which adds noise without changing the artifact.

## What's new in Newton v1.2.0 vs v1.2.0rc2

Full release notes: [newton-physics/newton release
v1.2.0](https://github.com/newton-physics/newton/releases/tag/v1.2.0).
Notable IsaacLab-relevant fixes:

-
[newton-physics/newton#2651](newton-physics/newton#2651)
— MPR/GJK no longer assumes convex hulls are centered around the origin.
-
[newton-physics/newton#2703](newton-physics/newton#2703)
— Kamino FK solver performance.
-
[newton-physics/newton#2721](newton-physics/newton#2721)
— HDR color output for tiled camera sensors.
-
[newton-physics/newton#2743](newton-physics/newton#2743)
— Collada textures in URDF import.
-
[newton-physics/newton#2823](newton-physics/newton#2823)
— Gravity-data device allocation in Kamino (multi-GPU).
-
[newton-physics/newton#2632](newton-physics/newton#2632)
— CollisionPipeline small fixes.
-
[newton-physics/newton#2734](newton-physics/newton#2734)
— `DelassusOperator` attribute refactor. Not used in IsaacLab source
today (verified by grep), no adapt needed.
- SolverMuJoCo fixes: planar meshes, contact-anchor computation,
distance conversion.

## Required dep bumps

None on the IsaacLab side. The `mjwarp 3.8.0.1 → 3.8.0.3` bump flows in
transitively through `newton[sim]`, since
[#5566](#5566)
dropped IsaacLab's explicit `mujoco` / `mujoco-warp` pins.

`warp-lang` stays at `1.13.0` (set by
[#5523](#5523)).

## Pins updated

| File | Change |
|---|---|
| `source/isaaclab_newton/setup.py` | `v1.2.0rc2` → `v1.2.0` |
| `source/isaaclab_physx/setup.py` | `v1.2.0rc2` → `v1.2.0` |
| `source/isaaclab_visualizers/setup.py` | 3× `v1.2.0rc2` → `v1.2.0` |
| `tools/wheel_builder/res/python_packages.toml` | `v1.2.0rc2` →
`v1.2.0` |

## Test plan

- [x] Pre-commit clean.
- [ ] CI smoke verifies clean install picks up `newton 1.2.0` and
downstream `mjwarp 3.8.0.3`.
matthewtrepte pushed a commit to matthewtrepte/IsaacLab that referenced this pull request May 18, 2026
## Summary

Bumps the Newton pin from `v1.2.0rc2` (current develop) directly to the
[`v1.2.0` stable
release](https://github.com/newton-physics/newton/releases/tag/v1.2.0)
across all five pin sites, keeping the canonical `newton[sim] @ git+...`
form everywhere.

Per Kelly Guo's suggestion: skip the rc bump and go straight to stable.
Upstream published `v1.2.0` on 2026-05-12.

**Alternative**:
[isaac-sim#5614](isaac-sim#5614)
(rc3 bump) — pick whichever target based on CI signal. This one is the
most forward target.

> Branch is still named `jichuanh/newton-1.2.0rc4-bump` from when this
PR was originally proposing rc4 — the branch name doesn't match the
current target but the diff is correct. Force-pushing the rename would
close/reopen the PR, which adds noise without changing the artifact.

## What's new in Newton v1.2.0 vs v1.2.0rc2

Full release notes: [newton-physics/newton release
v1.2.0](https://github.com/newton-physics/newton/releases/tag/v1.2.0).
Notable IsaacLab-relevant fixes:

-
[newton-physics/newton#2651](newton-physics/newton#2651)
— MPR/GJK no longer assumes convex hulls are centered around the origin.
-
[newton-physics/newton#2703](newton-physics/newton#2703)
— Kamino FK solver performance.
-
[newton-physics/newton#2721](newton-physics/newton#2721)
— HDR color output for tiled camera sensors.
-
[newton-physics/newton#2743](newton-physics/newton#2743)
— Collada textures in URDF import.
-
[newton-physics/newton#2823](newton-physics/newton#2823)
— Gravity-data device allocation in Kamino (multi-GPU).
-
[newton-physics/newton#2632](newton-physics/newton#2632)
— CollisionPipeline small fixes.
-
[newton-physics/newton#2734](newton-physics/newton#2734)
— `DelassusOperator` attribute refactor. Not used in IsaacLab source
today (verified by grep), no adapt needed.
- SolverMuJoCo fixes: planar meshes, contact-anchor computation,
distance conversion.

## Required dep bumps

None on the IsaacLab side. The `mjwarp 3.8.0.1 → 3.8.0.3` bump flows in
transitively through `newton[sim]`, since
[isaac-sim#5566](isaac-sim#5566)
dropped IsaacLab's explicit `mujoco` / `mujoco-warp` pins.

`warp-lang` stays at `1.13.0` (set by
[isaac-sim#5523](isaac-sim#5523)).

## Pins updated

| File | Change |
|---|---|
| `source/isaaclab_newton/setup.py` | `v1.2.0rc2` → `v1.2.0` |
| `source/isaaclab_physx/setup.py` | `v1.2.0rc2` → `v1.2.0` |
| `source/isaaclab_visualizers/setup.py` | 3× `v1.2.0rc2` → `v1.2.0` |
| `tools/wheel_builder/res/python_packages.toml` | `v1.2.0rc2` →
`v1.2.0` |

## Test plan

- [x] Pre-commit clean.
- [ ] CI smoke verifies clean install picks up `newton 1.2.0` and
downstream `mjwarp 3.8.0.3`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kamino Issues that come up while integrating/implementing the Kamino solver

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants