Skip to content

Conversation

@christophercrouzet
Copy link
Member

@christophercrouzet christophercrouzet commented Jan 5, 2026

Following the release of Warp v1.11.0, deprecation warnings were added for symbols meant to be internal. This MR addresses most of these instances but still reference a few internal symbols through the _src namespace, that would eventually need to be addressed.

This depends on google-deepmind/mujoco_warp#981.

Also, for the tests to pass, #1295 also needs to be merged first.

Summary by CodeRabbit

  • New Features

    • Added mesh adjacency types, a mesh solidification utility, a Bourke color map, and a GPU image-copy utility (all publicly exported).
  • Bug Fixes

    • Simplified CUDA-graph enablement and conditional-graph support checks.
  • Refactor

    • Standardized device/type references and consolidated internal runtime/import call paths.
  • Chores

    • Adjusted array (de)serialization dtype handling and bumped Warp-related dependency.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 5, 2026

📝 Walkthrough

Walkthrough

Add mesh adjacency and mesh-solidification utilities plus a GPU RGB-copy kernel and Bourke color map; migrate numerous Warp imports/type usages to updated/internal paths; simplify CUDA-graph support checks and adjust several type annotations and small call sites. No public API removals.

Changes

Cohort / File(s) Summary
Mesh utilities & solidification
newton/_src/utils/mesh.py, newton/utils.py
Add MeshEdge dataclass, MeshAdjacency class, solidify_mesh_kernel Warp kernel and solidify_mesh function; re-exported via newton.utils.
Render utilities & RGB copy kernel
newton/_src/utils/render.py, newton/utils.py, newton/_src/viewer/viewer_gl.py, newton/_src/viewer/viewer.py, newton/examples/*
Add bourke_color_map and copy_rgb_frame_uint8 kernel; update viewer and example imports to use newton.utils exports.
Warp public → internal import migration
newton/_src/geometry/sdf_mc.py, newton/_src/sim/builder.py, newton/_src/sim/graph_coloring.py, newton/_src/sim/style3d/builder_style3d.py, newton/_src/solvers/style3d/linear_solver.py, newton/tests/test_coloring.py, newton/examples/diffsim/*
Replace public wp.* runtime/utility references with internal wp._src.* paths for runtime helpers; call semantics unchanged.
Device / Devicelike imports & annotations
newton/_src/core/types.py, newton/_src/sim/contacts.py, newton/_src/solvers/solver.py, newton/_src/solvers/style3d/collision/bvh/bvh.py, newton/_src/utils/recorder.py, newton/examples/robot/*
Change imports/type hints from warp.context.Devicelike / wp.context.Device to warp.DeviceLike as Devicelike and wp.Device; update device-get/conversion calls.
Legacy types → fully-qualified wp types
newton/_src/solvers/vbd/particle_vbd_kernels.py, newton/_src/solvers/vbd/rigid_vbd_kernels.py, newton/_src/utils/import_mjcf.py
Replace unqualified float32, matrix, vector usages with wp.float32, wp.types.matrix(...), wp.types.vector(...).
Struct detection logic updates
docs/generate_api.py, newton/_src/utils/selection.py
Replace wp.codegen.Struct / StructInstance checks with wp.types.type_is_struct(...) / wp.types.is_struct(...).
CUDA-graph support & helper simplification
newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py, newton/_src/utils/__init__.py
Remove try/except/assert; determine conditional graph support via wp.is_conditional_graph_supported() boolean.
Internal utility resolution tweaks
newton/_src/solvers/implicit_mpm/solve_rheology.py, newton/_src/sim/builder.py, newton/_src/sim/style3d/builder_style3d.py
Import helpers (e.g., symmetric_eigenvalues_qr, array_axpy, MeshAdjacency, internal transform multiply) from updated/internal Warp modules; update call sites.
Recorder / (de)serialization dtype handling
newton/_src/utils/recorder.py
Warp Device serialization now reports wp.Device; warp-array dtype resolution uses wp.<dtype> instead of wp.types.<dtype>.
Project config & benchmarking
pyproject.toml, asv.conf.json
Bump warp-lang and related mujoco/mujoco-warp dependency pins.

Sequence Diagram(s)

sequenceDiagram
    actor Caller
    participant solidify_mesh as solidify_mesh()
    participant WarpRuntime as Warp runtime / GPU
    participant OutArrays as out_vertices/out_indices

    Caller->>solidify_mesh: call(faces, vertices, thickness)
    solidify_mesh->>WarpRuntime: allocate & upload arrays, launch solidify_mesh_kernel
    WarpRuntime->>OutArrays: write extruded vertices and faces
    WarpRuntime-->>solidify_mesh: kernel complete
    solidify_mesh-->>Caller: return (out_faces, out_vertices)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • eric-heiden
  • shi-eric
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Address Warp Deprecation Warnings' directly and clearly summarizes the main purpose of the PR, which is to fix deprecation warnings introduced in Warp v1.11.0.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Fix all issues with AI Agents 🤖
In @newton/_src/viewer/viewer_gl.py:
- Line 611: Replace the direct use of the module name "warp" with the
established import alias "wp" for the render function reference: change any
occurrence of warp._src.render.render_opengl.copy_rgb_frame_uint8 to
wp._src.render.render_opengl.copy_rgb_frame_uint8 (reference symbol
copy_rgb_frame_uint8) so the code consistently uses the wp alias and avoids the
static analysis warning.
🧹 Nitpick comments (2)
newton/_src/viewer/viewer.py (1)

586-586: Remove unused noqa directive.

The # noqa: PLC0415 directive is unnecessary since the PLC0415 check is not enabled.

🔎 Proposed fix
-            from warp._src.render.utils import solidify_mesh  # noqa: PLC0415
+            from warp._src.render.utils import solidify_mesh
newton/_src/solvers/style3d/linear_solver.py (1)

230-230: Remove unused noqa directive.

The # noqa: PLC0415 directive is unnecessary since the PLC0415 rule (import-outside-toplevel) is not enabled in your linting configuration.

🔎 Suggested cleanup
-    from warp._src.context import runtime  # noqa: PLC0415
+    from warp._src.context import runtime
📜 Review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b726363 and 02ad8ec.

📒 Files selected for processing (27)
  • docs/generate_api.py
  • newton/_src/core/types.py
  • newton/_src/geometry/sdf_mc.py
  • newton/_src/sim/builder.py
  • newton/_src/sim/contacts.py
  • newton/_src/sim/graph_coloring.py
  • newton/_src/sim/style3d/builder_style3d.py
  • newton/_src/solvers/implicit_mpm/solve_rheology.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/solvers/solver.py
  • newton/_src/solvers/style3d/collision/bvh/bvh.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/solvers/vbd/particle_vbd_kernels.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/utils/__init__.py
  • newton/_src/utils/import_mjcf.py
  • newton/_src/utils/recorder.py
  • newton/_src/utils/selection.py
  • newton/_src/viewer/viewer.py
  • newton/_src/viewer/viewer_gl.py
  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/examples/diffsim/example_diffsim_cloth.py
  • newton/examples/diffsim/example_diffsim_drone.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/examples/robot/example_robot_anymal_c_walk.py
  • newton/tests/test_coloring.py
🧰 Additional context used
🧠 Learnings (32)
📓 Common learnings
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/solvers/featherstone/kernels.py:75-75
Timestamp: 2025-08-12T18:04:06.577Z
Learning: The Newton physics framework requires nightly Warp builds, which means compatibility concerns with older stable Warp versions (like missing functions such as wp.spatial_adjoint) are not relevant for this project.
Learnt from: shi-eric
Repo: newton-physics/newton PR: 521
File: newton/examples/example_cloth_hanging.py:36-36
Timestamp: 2025-08-12T05:17:34.423Z
Learning: The Newton migration guide (docs/migration.rst) is specifically for documenting how to migrate existing warp.sim functionality to Newton equivalents. New Newton-only features that didn't exist in warp.sim do not need migration documentation.
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/tests/test_ik.py:25-26
Timestamp: 2025-08-12T17:58:16.929Z
Learning: In the Newton physics engine codebase, it's acceptable for tests to import and use private `_src` internal modules and functions when needed for testing purposes, even though this breaks the public API boundary. This is an intentional project decision for test code.
📚 Learning: 2025-08-12T18:04:06.577Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/solvers/featherstone/kernels.py:75-75
Timestamp: 2025-08-12T18:04:06.577Z
Learning: The Newton physics framework requires nightly Warp builds, which means compatibility concerns with older stable Warp versions (like missing functions such as wp.spatial_adjoint) are not relevant for this project.

Applied to files:

  • newton/_src/solvers/vbd/particle_vbd_kernels.py
  • newton/_src/viewer/viewer_gl.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/utils/__init__.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/utils/import_mjcf.py
  • newton/_src/sim/builder.py
📚 Learning: 2025-08-12T17:51:37.474Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/geometry.py:16-22
Timestamp: 2025-08-12T17:51:37.474Z
Learning: In the Newton public API refactor, common geometry symbols like ParticleFlags and ShapeFlags are now exposed at the top level in newton/__init__.py rather than through newton.geometry. The newton/geometry.py module is intentionally focused only on broad-phase collision detection classes (BroadPhaseAllPairs, BroadPhaseExplicit, BroadPhaseSAP).

Applied to files:

  • newton/_src/solvers/vbd/particle_vbd_kernels.py
  • newton/_src/core/types.py
  • newton/_src/solvers/style3d/collision/bvh/bvh.py
📚 Learning: 2025-08-12T05:17:34.423Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 521
File: newton/examples/example_cloth_hanging.py:36-36
Timestamp: 2025-08-12T05:17:34.423Z
Learning: The Newton migration guide (docs/migration.rst) is specifically for documenting how to migrate existing warp.sim functionality to Newton equivalents. New Newton-only features that didn't exist in warp.sim do not need migration documentation.

Applied to files:

  • newton/_src/solvers/vbd/particle_vbd_kernels.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/sim/contacts.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/_src/viewer/viewer.py
  • newton/_src/core/types.py
  • newton/examples/robot/example_robot_anymal_c_walk.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/utils/import_mjcf.py
  • newton/_src/sim/builder.py
  • newton/_src/utils/recorder.py
📚 Learning: 2025-08-12T17:52:15.009Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/utils/import_mjcf.py:226-231
Timestamp: 2025-08-12T17:52:15.009Z
Learning: In the Newton codebase, when passing array-like objects (numpy arrays, lists, tuples) to wp.vec3(), the consistent pattern is to use the unpacking operator: wp.vec3(*array) rather than wp.vec3(array). This pattern is used throughout newton/_src/utils/import_mjcf.py and newton/_src/core/types.py.

Applied to files:

  • newton/_src/solvers/vbd/particle_vbd_kernels.py
  • newton/_src/utils/selection.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/utils/import_mjcf.py
📚 Learning: 2025-09-18T07:05:56.836Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 750
File: newton/_src/solvers/implicit_mpm/solve_rheology.py:969-986
Timestamp: 2025-09-18T07:05:56.836Z
Learning: In newton/_src/solvers/implicit_mpm/solve_rheology.py, transposed_strain_mat parameter cannot be None - the type signature was corrected to reflect this guarantee, eliminating the need for None checks when accessing transposed_strain_mat.offsets.

Applied to files:

  • newton/_src/solvers/vbd/particle_vbd_kernels.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/solvers/implicit_mpm/solve_rheology.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
📚 Learning: 2025-09-25T16:14:22.033Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 806
File: newton/_src/sim/ik/ik_objectives.py:0-0
Timestamp: 2025-09-25T16:14:22.033Z
Learning: In NVIDIA Warp's Newton physics library, wp.transform supports direct numerical indexing (e.g., body_tf[0], body_tf[1], body_tf[2] for position and body_tf[3], body_tf[4], body_tf[5], body_tf[6] for quaternion components) to access its elements. This is the standard API used throughout the codebase.

Applied to files:

  • newton/_src/solvers/vbd/particle_vbd_kernels.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-09-22T21:08:31.901Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 806
File: newton/examples/ik/example_ik_franka.py:121-123
Timestamp: 2025-09-22T21:08:31.901Z
Learning: In the newton physics framework, when creating warp arrays for IK solver joint variables using wp.array(self.model.joint_q, shape=(1, coord_count)), the resulting array acts as a reference/pointer to the original model's joint coordinates, so updates from the IK solver automatically reflect in the model's joint_q buffer used for rendering.

Applied to files:

  • newton/_src/solvers/vbd/particle_vbd_kernels.py
  • newton/_src/viewer/viewer_gl.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-09-22T21:08:31.901Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 806
File: newton/examples/ik/example_ik_franka.py:121-123
Timestamp: 2025-09-22T21:08:31.901Z
Learning: In the newton physics framework, when creating warp arrays for IK solver joint variables using wp.array(self.model.joint_q, shape=(1, coord_count)), the resulting array acts as a reference/pointer to the original model's joint coordinates, so updates from the IK solver automatically reflect in the model's joint_q buffer used for rendering, despite the general warp documentation suggesting copies are made by default.

Applied to files:

  • newton/_src/solvers/vbd/particle_vbd_kernels.py
  • newton/_src/viewer/viewer_gl.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/utils/import_mjcf.py
  • newton/_src/utils/recorder.py
📚 Learning: 2025-09-25T16:14:22.033Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 806
File: newton/_src/sim/ik/ik_objectives.py:0-0
Timestamp: 2025-09-25T16:14:22.033Z
Learning: wp.transform in NVIDIA Warp supports indexing using numerical indices (e.g., body_tf[0], body_tf[3], etc.) to access translation and rotation components. The indexing approach used in the Newton codebase is valid and compiles correctly.

Applied to files:

  • newton/_src/solvers/vbd/particle_vbd_kernels.py
📚 Learning: 2025-09-26T05:58:21.013Z
Learnt from: WenchaoHuang
Repo: newton-physics/newton PR: 835
File: newton/_src/solvers/style3d/collision/collision.py:49-53
Timestamp: 2025-09-26T05:58:21.013Z
Learning: In newton/_src/solvers/style3d/collision/collision.py, the broad_phase buffers (broad_phase_ee, broad_phase_ef, broad_phase_vf) created with wp.array() don't need zero-initialization because they follow a write-first-read-later pattern: BVH query kernels in frame_begin() populate these buffers completely (write-only operations), and collision kernels only read from them afterward in accumulate_contact_force(), ensuring no undefined reads occur.

Applied to files:

  • newton/_src/solvers/vbd/particle_vbd_kernels.py
  • newton/_src/solvers/style3d/collision/bvh/bvh.py
📚 Learning: 2025-08-12T05:17:34.423Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 521
File: newton/examples/example_cloth_hanging.py:36-36
Timestamp: 2025-08-12T05:17:34.423Z
Learning: The STYLE3D solver in Newton is a new solver that did not exist in warp.sim, so it does not require any migration documentation.

Applied to files:

  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/sim/style3d/builder_style3d.py
📚 Learning: 2025-08-25T20:10:59.536Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 634
File: newton/examples/ik/example_ik_franka.py:0-0
Timestamp: 2025-08-25T20:10:59.536Z
Learning: In Newton's IK examples, when creating solver arrays with `wp.array(source_array, shape=new_shape)`, this creates a view into the same underlying memory rather than a copy. This means updates to the reshaped array are automatically reflected in the original array without needing explicit copy operations like `wp.copy()`.

Applied to files:

  • newton/_src/solvers/style3d/linear_solver.py
📚 Learning: 2025-08-12T17:58:16.929Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/tests/test_ik.py:25-26
Timestamp: 2025-08-12T17:58:16.929Z
Learning: In the Newton physics engine codebase, it's acceptable for tests to import and use private `_src` internal modules and functions when needed for testing purposes, even though this breaks the public API boundary. This is an intentional project decision for test code.

Applied to files:

  • newton/_src/solvers/style3d/linear_solver.py
  • newton/tests/test_coloring.py
📚 Learning: 2025-12-12T08:45:43.428Z
Learnt from: nvtw
Repo: newton-physics/newton PR: 1221
File: newton/examples/example_sdf.py:277-287
Timestamp: 2025-12-12T08:45:43.428Z
Learning: In Newtown (Newton) example code, specifically files under newton/examples, computing contacts once per frame and reusing them across all substeps is an intentional design choice, not a bug. Reviewers should verify that contacts are computed before the substep loop and reused for every substep within the same frame. This pattern reduces redundant work and preserves frame-consistency; do not flag as a regression unless the behavior is changed for correctness or performance reasons.

Applied to files:

  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/examples/robot/example_robot_anymal_c_walk.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/examples/diffsim/example_diffsim_drone.py
  • newton/examples/diffsim/example_diffsim_cloth.py
📚 Learning: 2025-09-17T21:34:05.267Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 750
File: newton/examples/mpm/example_mpm_granular.py:44-47
Timestamp: 2025-09-17T21:34:05.267Z
Learning: wp.Mesh (Warp mesh objects) expose triangle indices through the `indices` attribute, not `triangles`. The correct usage is `wp.Mesh(...).indices`, not `wp.Mesh(...).triangles`.

Applied to files:

  • newton/_src/sim/style3d/builder_style3d.py
  • newton/_src/solvers/style3d/collision/bvh/bvh.py
  • newton/_src/sim/builder.py
📚 Learning: 2025-08-12T17:58:00.815Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/solvers/featherstone/kernels.py:18-20
Timestamp: 2025-08-12T17:58:00.815Z
Learning: In newton/_src/core/__init__.py, the function transform_twist is properly re-exported from the spatial module via "from .spatial import (..., transform_twist, ...)" and included in __all__, making it available for import as "from ...core import transform_twist" from other modules.

Applied to files:

  • newton/_src/core/types.py
📚 Learning: 2025-07-23T14:36:42.182Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 461
File: asv/benchmarks/envs/example_humanoid.py:40-41
Timestamp: 2025-07-23T14:36:42.182Z
Learning: In Warp benchmarks, explicit wp.init() calls are not needed in most circumstances since the first Warp API call that requires initialization will automatically call wp.init(). Explicit wp.init() in setup() methods is helpful when the ASV benchmark is measuring a Warp API call, as wp.init() has non-trivial overhead that should be excluded from the benchmark timing.

Applied to files:

  • newton/examples/robot/example_robot_anymal_c_walk.py
📚 Learning: 2025-09-26T05:58:21.013Z
Learnt from: WenchaoHuang
Repo: newton-physics/newton PR: 835
File: newton/_src/solvers/style3d/collision/collision.py:49-53
Timestamp: 2025-09-26T05:58:21.013Z
Learning: In newton/_src/solvers/style3d/collision/collision.py, the broad_phase buffers (broad_phase_ee, broad_phase_ef, broad_phase_vf) created with wp.array() don't need zero-initialization because the BVH query kernels that use them always write the count to query_results[0, tid] = 0 first before populating any data, ensuring no undefined reads occur.

Applied to files:

  • newton/_src/solvers/style3d/collision/bvh/bvh.py
📚 Learning: 2025-10-30T07:28:13.112Z
Learnt from: nvtw
Repo: newton-physics/newton PR: 984
File: newton/_src/geometry/broad_phase_nxn.py:318-336
Timestamp: 2025-10-30T07:28:13.112Z
Learning: In Newton's BroadPhaseAllPairs class (newton/_src/geometry/broad_phase_nxn.py), device management is the caller's responsibility. The library intentionally does not perform automatic device transfers for precomputed arrays in the launch method, even if there's a device mismatch. Users must ensure that the device specified in __init__ matches the device used in launch.

Applied to files:

  • newton/_src/solvers/style3d/collision/bvh/bvh.py
📚 Learning: 2025-08-18T15:56:26.587Z
Learnt from: adenzler-nvidia
Repo: newton-physics/newton PR: 552
File: newton/_src/solvers/mujoco/solver_mujoco.py:0-0
Timestamp: 2025-08-18T15:56:26.587Z
Learning: In Newton's MuJoCo solver, when transforming joint axes from Newton's internal frame to MuJoCo's expected frame, use wp.quat_rotate(joint_rot, axis) not wp.quat_rotate_inv(joint_rot, axis). The joint_rot represents rotation from joint-local to body frame, so forward rotation is correct.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-11-24T10:44:09.613Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 1108
File: newton/_src/solvers/implicit_mpm/rasterized_collisions.py:94-129
Timestamp: 2025-11-24T10:44:09.613Z
Learning: In Warp, wp.normalize() returns a zero vector (or zero quaternion) when given a zero-length input, so explicit zero-length checks before normalization are not required.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/utils/import_mjcf.py
📚 Learning: 2025-12-01T17:00:28.889Z
Learnt from: camevor
Repo: newton-physics/newton PR: 1161
File: newton/_src/solvers/mujoco/kernels.py:1268-1268
Timestamp: 2025-12-01T17:00:28.889Z
Learning: MuJoCo Warp spatial vectors (e.g., cacc, cvel) use the convention (angular, linear), which is opposite to Newton's (linear, angular) convention. When converting from MuJoCo Warp to Newton format, spatial_top() on MuJoCo Warp data extracts the angular component, and spatial_bottom() extracts the linear component.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/utils/import_mjcf.py
📚 Learning: 2025-11-28T11:12:40.805Z
Learnt from: camevor
Repo: newton-physics/newton PR: 1146
File: newton/examples/basic/example_basic_joints.py:206-213
Timestamp: 2025-11-28T11:12:40.805Z
Learning: In Newton's standard solvers (XPBD, SemiImplicit, SolverMuJoCo), spatial vectors in State.body_qd use the ordering (linear, angular): wp.spatial_top(qd) returns linear velocity and wp.spatial_bottom(qd) returns angular velocity. This is the opposite of typical Modern Robotics spatial twist notation where (angular, linear) is used.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-11-28T11:12:40.030Z
Learnt from: camevor
Repo: newton-physics/newton PR: 1146
File: newton/examples/basic/example_basic_joints.py:215-222
Timestamp: 2025-11-28T11:12:40.030Z
Learning: In Warp's spatial vector convention used by Newton: spatial_bottom() extracts the angular velocity component (omega) and spatial_top() extracts the linear velocity component (v) from a spatial twist (qd). Similarly for spatial wrenches: spatial_bottom() is torque and spatial_top() is force.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-09-09T11:03:41.928Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 750
File: newton/_src/solvers/implicit_mpm/solve_rheology.py:892-895
Timestamp: 2025-09-09T11:03:41.928Z
Learning: In newton/_src/solvers/implicit_mpm/solve_rheology.py, passing None for compliance_mat_diagonal is intentional to avoid loading zeros from global memory when compliance_mat is None, rather than creating a zero matrix and extracting its diagonal.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solve_rheology.py
📚 Learning: 2025-09-22T21:03:39.624Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 806
File: newton/_src/sim/ik/ik_lbfgs_optimizer.py:739-752
Timestamp: 2025-09-22T21:03:39.624Z
Learning: The L-BFGS optimizer in newton/_src/sim/ik/ik_lbfgs_optimizer.py currently intentionally only supports additive updates (assuming n_coords == n_dofs). Velocity space integration for joints with mismatched coordinate/DOF dimensions (like free/ball joints) is planned for future work and should not be flagged as an issue in current reviews.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solve_rheology.py
📚 Learning: 2025-08-19T12:27:30.629Z
Learnt from: preist-nvidia
Repo: newton-physics/newton PR: 579
File: newton/examples/example_mujoco.py:350-354
Timestamp: 2025-08-19T12:27:30.629Z
Learning: In Newton examples, there's a distinction between solver parameters and Example class attributes. The Example class can have its own use_mujoco attribute for controlling example-level behavior (like CUDA graphs, rendering logic), while the solver uses use_mujoco_cpu for backend selection. These serve different purposes and should not be conflated during API renames.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
📚 Learning: 2025-12-12T15:23:30.014Z
Learnt from: vastsoun
Repo: newton-physics/newton PR: 1019
File: newton/_src/solvers/kamino/examples/sim/example_sim_basics_boxes_fourbar.py:149-163
Timestamp: 2025-12-12T15:23:30.014Z
Learning: In Kamino simulation examples under newton/_src/solvers/kamino/examples/sim/, the pattern where logging=True and use_cuda_graph=True creates a mismatch (SimulationLogger constructed but settings.compute_metrics and logger.log() calls guarded by `if not self.use_cuda_graph`) should not be flagged. These examples will be refactored in a future commit, and this pattern is intentionally deferred.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
📚 Learning: 2025-10-29T14:55:48.171Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 940
File: newton/examples/mpm/example_mpm_granular.py:92-101
Timestamp: 2025-10-29T14:55:48.171Z
Learning: In newton/examples/mpm/example_mpm_granular.py, the capture() method intentionally advances the simulation state once during CUDA graph capture. This is expected behavior because CUDA graph capture records exact memory addresses, so the state arrays (state_0, state_1) cannot be reset or reallocated after capture without invalidating the graph.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
📚 Learning: 2025-08-19T12:27:30.629Z
Learnt from: preist-nvidia
Repo: newton-physics/newton PR: 579
File: newton/examples/example_mujoco.py:350-354
Timestamp: 2025-08-19T12:27:30.629Z
Learning: In Newton examples, Example.use_mujoco is a high-level attribute that controls whether to use MuJoCo solver vs other solvers (like XPBD), while SolverMuJoCo.use_mujoco_cpu controls the backend within MuJoCo (CPU vs Warp). These are separate concepts serving different purposes - the PR rename only applies to the solver parameter, not the Example class attributes.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
📚 Learning: 2025-08-25T20:10:51.009Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 634
File: newton/examples/ik/example_ik_h1.py:0-0
Timestamp: 2025-08-25T20:10:51.009Z
Learning: In Warp, creating a new wp.array() with an existing array and different shape (e.g., wp.array(existing_array, shape=new_shape)) creates a view into the same underlying memory buffer, not a copy. This means modifications through either view are automatically reflected in both arrays.

Applied to files:

  • newton/_src/utils/recorder.py
🧬 Code graph analysis (4)
newton/_src/solvers/solver.py (1)
newton/_src/sim/contacts.py (1)
  • device (110-114)
newton/_src/solvers/style3d/collision/bvh/bvh.py (2)
newton/_src/sim/contacts.py (1)
  • device (110-114)
newton/_src/solvers/solver.py (1)
  • device (169-176)
newton/tests/test_coloring.py (2)
newton/_src/sim/builder.py (1)
  • particle_count (990-994)
newton/_src/sim/graph_coloring.py (1)
  • ColoringAlgorithm (23-25)
newton/examples/diffsim/example_diffsim_cloth.py (2)
newton/examples/diffsim/example_diffsim_ball.py (1)
  • render (176-206)
newton/examples/diffsim/example_diffsim_soft_body.py (1)
  • render (331-359)
🪛 GitHub Actions: Pull Request
newton/_src/core/types.py

[error] 26-26: ImportError: cannot import name 'DeviceLike' from 'warp' while importing the newton package during 'uv run python -c "import newton; print(f'Newton {newton.version} imported successfully')"'.

🪛 Ruff (0.14.10)
newton/_src/viewer/viewer_gl.py

611-611: Undefined name warp

(F821)

newton/_src/solvers/style3d/linear_solver.py

230-230: Unused noqa directive (non-enabled: PLC0415)

Remove unused noqa directive

(RUF100)

newton/_src/viewer/viewer.py

586-586: Unused noqa directive (non-enabled: PLC0415)

Remove unused noqa directive

(RUF100)

⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Run GPU Benchmarks / Run GPU Benchmarks on AWS EC2
🔇 Additional comments (28)
docs/generate_api.py (1)

107-109: LGTM! Updated to use dedicated struct type checker.

The change from isinstance(attr, wp.codegen.Struct) to wp.types.type_is_struct(attr) correctly updates the struct detection mechanism to align with the internal API migration.

newton/_src/solvers/solver.py (1)

169-169: LGTM! Type annotation updated to wp.Device.

The change from wp.context.Device to wp.Device correctly updates the type annotation to align with the updated Warp API structure. The runtime behavior remains unchanged.

newton/_src/utils/import_mjcf.py (1)

236-238: LGTM! Vector constructor updated to internal type API.

The changes from wp.vec(...) to wp.types.vector(...) correctly update the vector constructor usage to align with the internal Warp type API. The runtime behavior is preserved - the same vector values are created.

newton/_src/sim/style3d/builder_style3d.py (1)

601-601: LGTM! Internal API migration addresses deprecation warning.

The update from wp.utils.MeshAdjacency to wp._src.utils.MeshAdjacency correctly addresses the Warp v1.11.0 deprecation. This internal module usage is appropriate for Newton's internal code.

newton/_src/solvers/style3d/linear_solver.py (1)

230-245: LGTM! Internal Warp API migration is correct.

The migration from warp.context.runtime to warp._src.context.runtime and from wp.types.type_length to wp._src.types.type_length correctly addresses the Warp v1.11.0 deprecation warnings.

newton/examples/robot/example_robot_anymal_c_walk.py (1)

81-81: LGTM! Updated to use Warp's namespaced API.

The change from importing device_to_torch to using wp.device_to_torch() directly aligns with Warp's updated API structure and addresses the deprecation warnings.

newton/_src/utils/selection.py (1)

511-511: LGTM! Improved by using public Warp API.

Replacing the isinstance(attrib, wp.codegen.StructInstance) check with wp.types.is_struct(attrib) is a better approach that uses Warp's public API instead of internal implementation details. This makes the code more maintainable.

newton/_src/utils/recorder.py (2)

556-557: LGTM! Updated to use public Device type.

The change from wp.context.Device to wp.Device correctly uses Warp's public API for the Device type, addressing the deprecation warning.


762-762: LGTM! Corrected dtype resolution namespace.

The change from getattr(wp.types, dtype_str) to getattr(wp, dtype_str) correctly resolves Warp dtypes from the public wp namespace where they are exposed (e.g., wp.float32, wp.vec3), rather than the internal wp.types module.

newton/_src/geometry/sdf_mc.py (1)

63-66: Switch to wp._src.marching_cubes maintains the same MC table behavior

The new lookups for tri_range_table, tri_local_inds_table, and corner_offsets_table are device‑correct and consistent with how these tables are consumed later (types and indexing still line up). This looks like a pure import‑path update to silence Warp’s deprecation warnings, with no functional change.

Please just confirm your pinned Warp version is recent enough that wp._src.marching_cubes exposes these symbols and that the marching‑cubes tests pass on both CPU and CUDA devices.

newton/_src/sim/builder.py (2)

1611-1617: Using wp._src.context.runtime.core.wp_builtin_mul_transformf_transformf keeps add_builder semantics intact

Resolving the C transform‑multiply entry point from wp._src.context.runtime.core instead of the deprecated public path preserves the existing transform_mul behavior (float32 transforms in/out, same ctypes call pattern) while avoiding repeated overload resolution. This is a straight import‑path update with no logic change in the builder.

Given this now depends on an internal _src symbol, please verify your Warp pin matches the version that exposes wp_builtin_mul_transformf_transformf under wp._src.context.runtime.core and that add_builder is exercised in your model‑composition tests. Based on learnings, relying on _src is acceptable here because the project already targets nightly Warp builds.


5205-5215: Mesh adjacency via wp._src.utils.MeshAdjacency is consistent with prior behavior

Constructing MeshAdjacency from self.tri_indices[start_tri:end_tri] and end_tri - start_tri is unchanged semantically; only the class is now resolved from wp._src.utils instead of wp.utils. The subsequent edge extraction and calls into add_edges still operate on the same (o0, o1, v0, v1) layout, so cloth bending edge generation remains correct.

Since this now uses wp._src.utils.MeshAdjacency, please confirm your Warp version exposes that symbol and that cloth/MPM tests (especially ones exercising add_cloth_mesh) pass on your supported devices.

newton/_src/solvers/vbd/particle_vbd_kernels.py (1)

54-55: LGTM! Explicit type references address deprecation warnings.

The update to use wp.types.matrix and wp.float32 instead of directly imported aliases is more explicit and aligns with Warp's updated API patterns. This eliminates reliance on legacy type imports that were marked for deprecation.

newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py (1)

1741-1741: LGTM! Simplified CUDA graph enablement logic.

The direct boolean check is cleaner than the previous try/except guarded approach. This change is consistent with the similar update in newton/_src/utils/__init__.py and aligns with the PR's goal of addressing Warp deprecation warnings.

newton/_src/utils/__init__.py (1)

222-229: LGTM! Simplified API usage aligns with Warp deprecation fixes.

The direct boolean check via wp.is_conditional_graph_supported() is cleaner than the previous try/except guarded assertion approach. This simplification aligns with the PR's goal of addressing Warp v1.11.0 deprecation warnings.

newton/_src/solvers/vbd/rigid_vbd_kernels.py (1)

68-68: LGTM: Clean migration to fully-qualified Warp type path.

The update from the old import pattern to wp.types.vector(length=6, dtype=wp.float32) correctly addresses the Warp v1.11.0 deprecation warnings while maintaining the same runtime behavior.

newton/_src/solvers/implicit_mpm/solve_rheology.py (2)

23-23: LGTM: Import path updated to match Warp's internal reorganization.

The migration of symmetric_eigenvalues_qr from warp.fem.utils to warp.fem.linalg aligns with Warp's internal module restructuring.


986-991: LGTM: Correct computation of velocity delta.

The explicit beta=-1.0 parameter correctly computes prev_collider_velocity = collider_velocity - prev_collider_velocity, which is then used as delta_velocity on line 992. This maintains the documented behavior: collider_velocity += rigidity_mat @ (collider_velocity - prev_collider_velocity).

newton/_src/solvers/style3d/collision/bvh/bvh.py (2)

69-69: LGTM: Device type annotation updated to current Warp API.

The change from wp.context.Device to wp.Device addresses the Warp v1.11.0 deprecation warnings. This pattern is consistently applied across all BVH class constructors (lines 69, 248, 394).


552-553: LGTM: Device retrieval updated to non-deprecated API.

The test code correctly uses wp.get_device() instead of the deprecated wp.context.get_device().

newton/examples/diffsim/example_diffsim_ball.py (1)

31-31: LGTM: Import path updated to internal Warp API.

The migration to warp._src.render.utils is consistent with similar changes across other diffsim examples and aligns with Warp v1.11.0's internal API structure.

newton/_src/core/types.py (1)

26-26: The import statement is correct and works in Warp v1.11+.

The code from warp import DeviceLike as Devicelike is valid. DeviceLike is exported at the top level of the warp module in version 1.11.0 and later, which matches Newton's requirement of warp-lang>=1.11.0.dev20251205. The CI minimal-import-test confirms that import newton succeeds across multiple Python versions, which would fail if this import were broken.

Likely an incorrect or invalid review comment.

newton/_src/sim/graph_coloring.py (1)

233-238: LGTM: Internal module appropriately uses Warp internal APIs.

The migration from wp.context.runtime.core to wp._src.context.runtime.core for graph coloring functions is appropriate since this code is within Newton's internal _src module. Internal modules using internal Warp APIs is the expected pattern.

Also applies to: 241-247

newton/tests/test_coloring.py (1)

142-147: LGTM: Test code appropriately uses Warp internal APIs.

The migration to wp._src.context.runtime.core for graph coloring functions in test code is acceptable. Based on learnings, tests in Newton can import and use private _src internal modules when needed for testing purposes.

Also applies to: 155-160, 170-175, 176-182, 190-195, 196-202

newton/examples/diffsim/example_diffsim_spring_cage.py (1)

29-29: Address internal Warp API dependency across multiple examples and internal code.

The import of bourke_color_map from warp._src.render.utils appears in at least 5 example files (example_diffsim_drone.py, example_diffsim_cloth.py, example_diffsim_ball.py, example_diffsim_soft_body.py, and this file) as well as Newton's internal viewer code. This pattern suggests deprecation of a previous public API, but exposes Newton to stability risks if Warp changes this internal module.

Clarify whether Warp provides a public API alternative for bourke_color_map or documents warp._src.render.utils as the official migration path. If no public alternative exists, consider requesting one upstream from Warp or documenting this constraint in Newton's examples.

newton/examples/diffsim/example_diffsim_cloth.py (2)

214-214: LGTM!

The usage of bourke_color_map is correct and consistent with the imported function.


31-31: Using internal _src API in example code that users may copy.

Warp v1.11.0 does not expose bourke_color_map through its public rendering API; it is only available via warp._src.render.utils. While this imports an internal API that may change without notice, this is the necessary interim solution. The approach is consistent across all examples in this PR (cloth, ball, drone, soft_body, spring_cage), and as noted in the PR description, this is temporary while awaiting Warp's public API to stabilize.

newton/_src/sim/contacts.py (1)

20-20: Good refactoring from internal to public API.

This change correctly moves from the internal warp.context.Devicelike path to the public warp.DeviceLike API. The alias maintains Newton's internal naming convention (Devicelike with lowercase 'l').

@christophercrouzet christophercrouzet force-pushed the ccrouzet/fix-warp-deprecations branch from 02ad8ec to 4ecbf43 Compare January 5, 2026 23:40
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Fix all issues with AI Agents 🤖
In @newton/_src/viewer/viewer_gl.py:
- Line 611: The code references an undefined name "warp" when calling
warp._src.render.render_opengl.copy_rgb_frame_uint8; update that reference to
use the imported alias "wp" instead (i.e., call
wp._src.render.render_opengl.copy_rgb_frame_uint8) so the correct module object
is used; locate the occurrence in viewer_gl.py where copy_rgb_frame_uint8 is
referenced and replace "warp" with "wp".
🧹 Nitpick comments (1)
newton/_src/viewer/viewer.py (1)

586-586: Remove unused noqa directive.

The # noqa: PLC0415 directive is unnecessary since PLC0415 (import-outside-toplevel) is not enabled in the Ruff configuration.

🔎 Proposed fix
-            from warp._src.render.utils import solidify_mesh  # noqa: PLC0415
+            from warp._src.render.utils import solidify_mesh
📜 Review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 02ad8ec and 4ecbf43.

📒 Files selected for processing (27)
  • docs/generate_api.py
  • newton/_src/core/types.py
  • newton/_src/geometry/sdf_mc.py
  • newton/_src/sim/builder.py
  • newton/_src/sim/contacts.py
  • newton/_src/sim/graph_coloring.py
  • newton/_src/sim/style3d/builder_style3d.py
  • newton/_src/solvers/implicit_mpm/solve_rheology.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/solvers/solver.py
  • newton/_src/solvers/style3d/collision/bvh/bvh.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/solvers/vbd/particle_vbd_kernels.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/utils/__init__.py
  • newton/_src/utils/import_mjcf.py
  • newton/_src/utils/recorder.py
  • newton/_src/utils/selection.py
  • newton/_src/viewer/viewer.py
  • newton/_src/viewer/viewer_gl.py
  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/examples/diffsim/example_diffsim_cloth.py
  • newton/examples/diffsim/example_diffsim_drone.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/examples/robot/example_robot_anymal_c_walk.py
  • newton/tests/test_coloring.py
🚧 Files skipped from review as they are similar to previous changes (16)
  • newton/_src/sim/style3d/builder_style3d.py
  • newton/_src/utils/recorder.py
  • newton/_src/sim/graph_coloring.py
  • newton/_src/utils/init.py
  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/_src/solvers/vbd/particle_vbd_kernels.py
  • newton/_src/solvers/solver.py
  • newton/_src/sim/contacts.py
  • newton/_src/utils/import_mjcf.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/sim/builder.py
  • newton/examples/diffsim/example_diffsim_drone.py
  • newton/_src/core/types.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/examples/robot/example_robot_anymal_c_walk.py
  • newton/_src/geometry/sdf_mc.py
🧰 Additional context used
🧠 Learnings (23)
📓 Common learnings
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/solvers/featherstone/kernels.py:75-75
Timestamp: 2025-08-12T18:04:06.577Z
Learning: The Newton physics framework requires nightly Warp builds, which means compatibility concerns with older stable Warp versions (like missing functions such as wp.spatial_adjoint) are not relevant for this project.
Learnt from: shi-eric
Repo: newton-physics/newton PR: 521
File: newton/examples/example_cloth_hanging.py:36-36
Timestamp: 2025-08-12T05:17:34.423Z
Learning: The Newton migration guide (docs/migration.rst) is specifically for documenting how to migrate existing warp.sim functionality to Newton equivalents. New Newton-only features that didn't exist in warp.sim do not need migration documentation.
📚 Learning: 2025-08-12T17:58:16.929Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/tests/test_ik.py:25-26
Timestamp: 2025-08-12T17:58:16.929Z
Learning: In the Newton physics engine codebase, it's acceptable for tests to import and use private `_src` internal modules and functions when needed for testing purposes, even though this breaks the public API boundary. This is an intentional project decision for test code.

Applied to files:

  • newton/tests/test_coloring.py
  • newton/_src/solvers/style3d/linear_solver.py
📚 Learning: 2025-08-12T17:52:15.009Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/utils/import_mjcf.py:226-231
Timestamp: 2025-08-12T17:52:15.009Z
Learning: In the Newton codebase, when passing array-like objects (numpy arrays, lists, tuples) to wp.vec3(), the consistent pattern is to use the unpacking operator: wp.vec3(*array) rather than wp.vec3(array). This pattern is used throughout newton/_src/utils/import_mjcf.py and newton/_src/core/types.py.

Applied to files:

  • newton/_src/utils/selection.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-09-18T07:05:56.836Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 750
File: newton/_src/solvers/implicit_mpm/solve_rheology.py:969-986
Timestamp: 2025-09-18T07:05:56.836Z
Learning: In newton/_src/solvers/implicit_mpm/solve_rheology.py, transposed_strain_mat parameter cannot be None - the type signature was corrected to reflect this guarantee, eliminating the need for None checks when accessing transposed_strain_mat.offsets.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solve_rheology.py
  • newton/_src/solvers/style3d/linear_solver.py
📚 Learning: 2025-09-09T11:03:41.928Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 750
File: newton/_src/solvers/implicit_mpm/solve_rheology.py:892-895
Timestamp: 2025-09-09T11:03:41.928Z
Learning: In newton/_src/solvers/implicit_mpm/solve_rheology.py, passing None for compliance_mat_diagonal is intentional to avoid loading zeros from global memory when compliance_mat is None, rather than creating a zero matrix and extracting its diagonal.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solve_rheology.py
📚 Learning: 2025-08-12T05:17:34.423Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 521
File: newton/examples/example_cloth_hanging.py:36-36
Timestamp: 2025-08-12T05:17:34.423Z
Learning: The Newton migration guide (docs/migration.rst) is specifically for documenting how to migrate existing warp.sim functionality to Newton equivalents. New Newton-only features that didn't exist in warp.sim do not need migration documentation.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solve_rheology.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/viewer/viewer.py
📚 Learning: 2025-08-12T05:17:34.423Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 521
File: newton/examples/example_cloth_hanging.py:36-36
Timestamp: 2025-08-12T05:17:34.423Z
Learning: The STYLE3D solver in Newton is a new solver that did not exist in warp.sim, so it does not require any migration documentation.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solve_rheology.py
  • newton/_src/solvers/style3d/linear_solver.py
📚 Learning: 2025-12-12T08:45:43.428Z
Learnt from: nvtw
Repo: newton-physics/newton PR: 1221
File: newton/examples/example_sdf.py:277-287
Timestamp: 2025-12-12T08:45:43.428Z
Learning: In Newtown (Newton) example code, specifically files under newton/examples, computing contacts once per frame and reusing them across all substeps is an intentional design choice, not a bug. Reviewers should verify that contacts are computed before the substep loop and reused for every substep within the same frame. This pattern reduces redundant work and preserves frame-consistency; do not flag as a regression unless the behavior is changed for correctness or performance reasons.

Applied to files:

  • newton/examples/diffsim/example_diffsim_cloth.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
📚 Learning: 2025-08-12T18:04:06.577Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/solvers/featherstone/kernels.py:75-75
Timestamp: 2025-08-12T18:04:06.577Z
Learning: The Newton physics framework requires nightly Warp builds, which means compatibility concerns with older stable Warp versions (like missing functions such as wp.spatial_adjoint) are not relevant for this project.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/viewer/viewer_gl.py
📚 Learning: 2025-09-22T21:08:31.901Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 806
File: newton/examples/ik/example_ik_franka.py:121-123
Timestamp: 2025-09-22T21:08:31.901Z
Learning: In the newton physics framework, when creating warp arrays for IK solver joint variables using wp.array(self.model.joint_q, shape=(1, coord_count)), the resulting array acts as a reference/pointer to the original model's joint coordinates, so updates from the IK solver automatically reflect in the model's joint_q buffer used for rendering.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/viewer/viewer_gl.py
📚 Learning: 2025-09-22T21:08:31.901Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 806
File: newton/examples/ik/example_ik_franka.py:121-123
Timestamp: 2025-09-22T21:08:31.901Z
Learning: In the newton physics framework, when creating warp arrays for IK solver joint variables using wp.array(self.model.joint_q, shape=(1, coord_count)), the resulting array acts as a reference/pointer to the original model's joint coordinates, so updates from the IK solver automatically reflect in the model's joint_q buffer used for rendering, despite the general warp documentation suggesting copies are made by default.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/viewer/viewer_gl.py
📚 Learning: 2025-08-18T15:56:26.587Z
Learnt from: adenzler-nvidia
Repo: newton-physics/newton PR: 552
File: newton/_src/solvers/mujoco/solver_mujoco.py:0-0
Timestamp: 2025-08-18T15:56:26.587Z
Learning: In Newton's MuJoCo solver, when transforming joint axes from Newton's internal frame to MuJoCo's expected frame, use wp.quat_rotate(joint_rot, axis) not wp.quat_rotate_inv(joint_rot, axis). The joint_rot represents rotation from joint-local to body frame, so forward rotation is correct.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-09-25T16:14:22.033Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 806
File: newton/_src/sim/ik/ik_objectives.py:0-0
Timestamp: 2025-09-25T16:14:22.033Z
Learning: In NVIDIA Warp's Newton physics library, wp.transform supports direct numerical indexing (e.g., body_tf[0], body_tf[1], body_tf[2] for position and body_tf[3], body_tf[4], body_tf[5], body_tf[6] for quaternion components) to access its elements. This is the standard API used throughout the codebase.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-11-24T10:44:09.613Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 1108
File: newton/_src/solvers/implicit_mpm/rasterized_collisions.py:94-129
Timestamp: 2025-11-24T10:44:09.613Z
Learning: In Warp, wp.normalize() returns a zero vector (or zero quaternion) when given a zero-length input, so explicit zero-length checks before normalization are not required.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-12-01T17:00:28.889Z
Learnt from: camevor
Repo: newton-physics/newton PR: 1161
File: newton/_src/solvers/mujoco/kernels.py:1268-1268
Timestamp: 2025-12-01T17:00:28.889Z
Learning: MuJoCo Warp spatial vectors (e.g., cacc, cvel) use the convention (angular, linear), which is opposite to Newton's (linear, angular) convention. When converting from MuJoCo Warp to Newton format, spatial_top() on MuJoCo Warp data extracts the angular component, and spatial_bottom() extracts the linear component.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/solvers/style3d/linear_solver.py
📚 Learning: 2025-11-28T11:12:40.805Z
Learnt from: camevor
Repo: newton-physics/newton PR: 1146
File: newton/examples/basic/example_basic_joints.py:206-213
Timestamp: 2025-11-28T11:12:40.805Z
Learning: In Newton's standard solvers (XPBD, SemiImplicit, SolverMuJoCo), spatial vectors in State.body_qd use the ordering (linear, angular): wp.spatial_top(qd) returns linear velocity and wp.spatial_bottom(qd) returns angular velocity. This is the opposite of typical Modern Robotics spatial twist notation where (angular, linear) is used.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-09-26T05:58:21.013Z
Learnt from: WenchaoHuang
Repo: newton-physics/newton PR: 835
File: newton/_src/solvers/style3d/collision/collision.py:49-53
Timestamp: 2025-09-26T05:58:21.013Z
Learning: In newton/_src/solvers/style3d/collision/collision.py, the broad_phase buffers (broad_phase_ee, broad_phase_ef, broad_phase_vf) created with wp.array() don't need zero-initialization because they follow a write-first-read-later pattern: BVH query kernels in frame_begin() populate these buffers completely (write-only operations), and collision kernels only read from them afterward in accumulate_contact_force(), ensuring no undefined reads occur.

Applied to files:

  • newton/_src/solvers/style3d/collision/bvh/bvh.py
📚 Learning: 2025-09-26T05:58:21.013Z
Learnt from: WenchaoHuang
Repo: newton-physics/newton PR: 835
File: newton/_src/solvers/style3d/collision/collision.py:49-53
Timestamp: 2025-09-26T05:58:21.013Z
Learning: In newton/_src/solvers/style3d/collision/collision.py, the broad_phase buffers (broad_phase_ee, broad_phase_ef, broad_phase_vf) created with wp.array() don't need zero-initialization because the BVH query kernels that use them always write the count to query_results[0, tid] = 0 first before populating any data, ensuring no undefined reads occur.

Applied to files:

  • newton/_src/solvers/style3d/collision/bvh/bvh.py
📚 Learning: 2025-10-30T07:28:13.112Z
Learnt from: nvtw
Repo: newton-physics/newton PR: 984
File: newton/_src/geometry/broad_phase_nxn.py:318-336
Timestamp: 2025-10-30T07:28:13.112Z
Learning: In Newton's BroadPhaseAllPairs class (newton/_src/geometry/broad_phase_nxn.py), device management is the caller's responsibility. The library intentionally does not perform automatic device transfers for precomputed arrays in the launch method, even if there's a device mismatch. Users must ensure that the device specified in __init__ matches the device used in launch.

Applied to files:

  • newton/_src/solvers/style3d/collision/bvh/bvh.py
📚 Learning: 2025-09-17T21:34:05.267Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 750
File: newton/examples/mpm/example_mpm_granular.py:44-47
Timestamp: 2025-09-17T21:34:05.267Z
Learning: wp.Mesh (Warp mesh objects) expose triangle indices through the `indices` attribute, not `triangles`. The correct usage is `wp.Mesh(...).indices`, not `wp.Mesh(...).triangles`.

Applied to files:

  • newton/_src/solvers/style3d/collision/bvh/bvh.py
📚 Learning: 2025-08-25T20:10:59.536Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 634
File: newton/examples/ik/example_ik_franka.py:0-0
Timestamp: 2025-08-25T20:10:59.536Z
Learning: In Newton's IK examples, when creating solver arrays with `wp.array(source_array, shape=new_shape)`, this creates a view into the same underlying memory rather than a copy. This means updates to the reshaped array are automatically reflected in the original array without needing explicit copy operations like `wp.copy()`.

Applied to files:

  • newton/_src/solvers/style3d/linear_solver.py
📚 Learning: 2025-08-12T17:58:00.815Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/solvers/featherstone/kernels.py:18-20
Timestamp: 2025-08-12T17:58:00.815Z
Learning: In newton/_src/core/__init__.py, the function transform_twist is properly re-exported from the spatial module via "from .spatial import (..., transform_twist, ...)" and included in __all__, making it available for import as "from ...core import transform_twist" from other modules.

Applied to files:

  • newton/_src/solvers/style3d/linear_solver.py
📚 Learning: 2025-07-23T14:36:42.182Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 461
File: asv/benchmarks/envs/example_humanoid.py:40-41
Timestamp: 2025-07-23T14:36:42.182Z
Learning: In Warp benchmarks, explicit wp.init() calls are not needed in most circumstances since the first Warp API call that requires initialization will automatically call wp.init(). Explicit wp.init() in setup() methods is helpful when the ASV benchmark is measuring a Warp API call, as wp.init() has non-trivial overhead that should be excluded from the benchmark timing.

Applied to files:

  • newton/_src/viewer/viewer_gl.py
🧬 Code graph analysis (4)
newton/tests/test_coloring.py (2)
newton/_src/sim/builder.py (1)
  • particle_count (990-994)
newton/_src/sim/graph_coloring.py (1)
  • ColoringAlgorithm (23-25)
newton/examples/diffsim/example_diffsim_cloth.py (2)
newton/examples/diffsim/example_diffsim_ball.py (1)
  • render (176-206)
newton/examples/diffsim/example_diffsim_soft_body.py (1)
  • render (331-359)
newton/examples/diffsim/example_diffsim_soft_body.py (2)
newton/examples/diffsim/example_diffsim_ball.py (1)
  • render (176-206)
newton/examples/diffsim/example_diffsim_cloth.py (1)
  • render (190-218)
newton/_src/solvers/style3d/collision/bvh/bvh.py (2)
newton/_src/sim/contacts.py (1)
  • device (110-114)
newton/_src/solvers/solver.py (1)
  • device (169-176)
🪛 Ruff (0.14.10)
newton/_src/solvers/style3d/linear_solver.py

230-230: Unused noqa directive (non-enabled: PLC0415)

Remove unused noqa directive

(RUF100)

newton/_src/viewer/viewer.py

586-586: Unused noqa directive (non-enabled: PLC0415)

Remove unused noqa directive

(RUF100)

newton/_src/viewer/viewer_gl.py

611-611: Undefined name warp

(F821)

⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Run GPU Benchmarks / Run GPU Benchmarks on AWS EC2
🔇 Additional comments (16)
newton/examples/diffsim/example_diffsim_soft_body.py (1)

32-32: LGTM! Import and usage correctly updated to internal path.

The import path and function call have been consistently updated to use the internal warp._src.render.utils module, aligning with the PR's objective to address Warp v1.11.0 deprecation warnings.

Also applies to: 355-355

newton/examples/diffsim/example_diffsim_cloth.py (1)

31-31: LGTM! Import and usage correctly updated to internal path.

The import path and function call have been consistently updated to use the internal warp._src.render.utils module, aligning with the PR's objective to address Warp v1.11.0 deprecation warnings.

Also applies to: 214-214

newton/_src/solvers/vbd/rigid_vbd_kernels.py (1)

68-68: LGTM! Public API paths verified correct.

The change correctly addresses deprecation warnings by using fully-qualified public API paths (wp.types.vector and wp.float32) instead of internal symbols. Both are confirmed as public APIs in Warp v1.11.0, and the pattern is consistent with usage throughout the codebase (e.g., solve_rheology.py, ray.py). The 32-bit float precision is preserved.

newton/tests/test_coloring.py (4)

142-147: Internal API usage acceptable for tests.

The migration to wp._src.context.runtime.core.wp_graph_coloring is consistent with the project's practice of allowing tests to use internal _src modules when needed.

Based on learnings, this is an intentional project decision for test code.


155-166: LGTM!

Consistent with the internal API migration for graph coloring.


170-188: LGTM!

Both wp_graph_coloring and wp_balance_coloring correctly migrated to internal _src paths.


190-208: LGTM!

MCS algorithm coloring and balancing correctly use the internal API paths.

docs/generate_api.py (1)

107-109: LGTM! Struct type detection migrated to public API.

The change from isinstance(attr, wp.codegen.Struct) to wp.types.type_is_struct(attr) correctly addresses the deprecation by using Warp's public type-checking function. This properly categorizes struct types in the generated API documentation.

newton/_src/utils/selection.py (1)

511-511: LGTM! Struct detection migrated to public API.

The change from isinstance(attrib, wp.codegen.StructInstance) to wp.types.is_struct(attrib) correctly uses Warp's public type-checking API introduced in 1.11.0. The unwrapping logic remains intact.

newton/_src/solvers/style3d/linear_solver.py (2)

230-230: Remove the unused noqa directive.

The # noqa: PLC0415 directive is flagged as unused because PLC0415 (import-outside-toplevel) is not enabled in the Ruff configuration.

🔎 Proposed fix
-    from warp._src.context import runtime  # noqa: PLC0415
+    from warp._src.context import runtime
⛔ Skipped due to learnings
Learnt from: daniela-hase
Repo: newton-physics/newton PR: 1044
File: newton/_src/sensors/tiled_camera_sensor.py:224-256
Timestamp: 2025-11-07T01:42:36.906Z
Learning: In newton/_src/sensors/tiled_camera_sensor.py, the `# noqa: PLC0415` directives on the local PIL imports (lines 224 and 256 in save_color_image and save_depth_image methods) should be kept because they are required by the pre-commit configuration. The local imports are intentional for optional dependency handling.
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/solvers/featherstone/kernels.py:75-75
Timestamp: 2025-08-12T18:04:06.577Z
Learning: The Newton physics framework requires nightly Warp builds, which means compatibility concerns with older stable Warp versions (like missing functions such as wp.spatial_adjoint) are not relevant for this project.

230-230: Warp's _src APIs are explicitly unstable and undocumented for public use.

Per NVIDIA Warp's official guidance, any symbols in the _src namespace are internal implementation details without API/ABI stability guarantees and may change without notice across releases. Your code directly depends on warp._src.context.runtime and warp._src.types.type_length to access Warp's C++ runtime core functions. While this change addresses Warp v1.11.0 deprecation warnings, it creates ongoing maintenance risk as Newton updates to newer Warp versions.

Also applies to: 244-244

newton/_src/solvers/implicit_mpm/solve_rheology.py (3)

986-991: LGTM! Correct usage of migrated array_axpy function.

The function call correctly uses the imported array_axpy from warp.fem.linalg, computing the velocity delta (prev_collider_velocity = collider_velocity - prev_collider_velocity) as intended. The parameters are preserved and semantics remain unchanged.


1440-1440: LGTM! Correct usage of migrated array_axpy function.

The function call correctly uses the imported array_axpy from warp.fem.linalg, accumulating delta_stress into local_stress for the Jacobi solver iteration. The parameters are preserved and semantics remain unchanged.


23-23: Import migration to warp.fem.linalg is correct for Warp v1.11.0.

The functions array_axpy and symmetric_eigenvalues_qr have been properly migrated to warp.fem.linalg per Warp v1.11.0 API reorganization. No remaining references to the deprecated warp.fem.utils import path exist in the codebase.

newton/_src/solvers/style3d/collision/bvh/bvh.py (2)

552-553: LGTM! Test code updated to use public device API.

The test code correctly uses wp.get_device() instead of wp.context.get_device(), consistent with the migration to Warp's public API.


69-69: INCORRECT: Changes appear to move away from the canonical public API.

According to Warp v1.11.0 documentation, wp.context.Device is the canonical public Device class, not wp.Device. The type annotation changes from wp.context.Device to wp.Device move away from the public API toward older notation, contradicting the review comment's claim that they "use the public API."

The wp.get_device() usage in test code is correct as it is part of the public API; however, the type annotations should remain as wp.context.Device rather than wp.Device.

Likely an incorrect or invalid review comment.

@christophercrouzet christophercrouzet self-assigned this Jan 6, 2026
@christophercrouzet christophercrouzet marked this pull request as draft January 6, 2026 01:07
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Fix all issues with AI Agents 🤖
In @pyproject.toml:
- Line 28: The dependency constraint in pyproject.toml is invalid for the NVIDIA
PyPI index because stable warp-lang 1.11.0 doesn't exist there; update the
dependencies line that currently reads `dependencies = ["warp-lang>=1.11.0"]` to
reference a nightly build available on the NVIDIA index (for example
`warp-lang>=1.12.0.dev0` or a specific `1.12.0.dev*` release you verify exists)
so the package resolver can find warp-lang from the configured NVIDIA source.
📜 Review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4ecbf43 and 3c90440.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • pyproject.toml
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/solvers/featherstone/kernels.py:75-75
Timestamp: 2025-08-12T18:04:06.577Z
Learning: The Newton physics framework requires nightly Warp builds, which means compatibility concerns with older stable Warp versions (like missing functions such as wp.spatial_adjoint) are not relevant for this project.
Learnt from: shi-eric
Repo: newton-physics/newton PR: 521
File: newton/examples/example_cloth_hanging.py:36-36
Timestamp: 2025-08-12T05:17:34.423Z
Learning: The Newton migration guide (docs/migration.rst) is specifically for documenting how to migrate existing warp.sim functionality to Newton equivalents. New Newton-only features that didn't exist in warp.sim do not need migration documentation.
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/tests/test_ik.py:25-26
Timestamp: 2025-08-12T17:58:16.929Z
Learning: In the Newton physics engine codebase, it's acceptable for tests to import and use private `_src` internal modules and functions when needed for testing purposes, even though this breaks the public API boundary. This is an intentional project decision for test code.
Learnt from: shi-eric
Repo: newton-physics/newton PR: 461
File: asv/benchmarks/envs/example_humanoid.py:40-41
Timestamp: 2025-07-23T14:36:42.182Z
Learning: In Warp benchmarks, explicit wp.init() calls are not needed in most circumstances since the first Warp API call that requires initialization will automatically call wp.init(). Explicit wp.init() in setup() methods is helpful when the ASV benchmark is measuring a Warp API call, as wp.init() has non-trivial overhead that should be excluded from the benchmark timing.
📚 Learning: 2025-08-27T23:33:32.527Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 660
File: pyproject.toml:28-28
Timestamp: 2025-08-27T23:33:32.527Z
Learning: In Python projects, it's normal and correct to have different warp-lang version specifications across files: pyproject.toml should specify minimum compatible versions using >= for flexibility, while specific environments like asv.conf.json can pin exact versions using == for reproducibility. These serve different purposes and should not be "aligned" to the same version.

Applied to files:

  • pyproject.toml
📚 Learning: 2025-08-21T15:51:07.824Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 592
File: pyproject.toml:64-70
Timestamp: 2025-08-21T15:51:07.824Z
Learning: Self-referencing optional dependencies (e.g., "package[extra]") have been supported since pip 21.2 and are valid in pyproject.toml. However, build backends differ in metadata emission: some flatten dependencies while others preserve self-references. This can affect lockfile generators and tooling. Testing with the specific build backend and dependency tools is recommended to ensure expected behavior.

Applied to files:

  • pyproject.toml
📚 Learning: 2025-08-12T18:04:06.577Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/solvers/featherstone/kernels.py:75-75
Timestamp: 2025-08-12T18:04:06.577Z
Learning: The Newton physics framework requires nightly Warp builds, which means compatibility concerns with older stable Warp versions (like missing functions such as wp.spatial_adjoint) are not relevant for this project.

Applied to files:

  • pyproject.toml
📚 Learning: 2025-08-27T23:32:48.670Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 660
File: pyproject.toml:54-59
Timestamp: 2025-08-27T23:32:48.670Z
Learning: In the newton project's pyproject.toml, self-referential extras (e.g., `examples = ["newton[sim]", "newton[importers]", ...]`) are normal and encouraged for dependency management, rather than inlining the dependencies.

Applied to files:

  • pyproject.toml
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Run GPU Benchmarks / Run GPU Benchmarks on AWS EC2
  • GitHub Check: Run GPU Tests / Run GPU Unit Tests on AWS EC2

@christophercrouzet christophercrouzet force-pushed the ccrouzet/fix-warp-deprecations branch from 3c90440 to 8334066 Compare January 6, 2026 02:26
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
newton/_src/solvers/style3d/linear_solver.py (1)

230-245: array_inner internals look correct; adjust lint suppression comment

The switch to warp._src.context.runtime and wp.types.type_size(a.dtype) matches the Warp-internal API and the expected signature for wp_array_inner_float_*. The only issue is the # noqa: PLC0415 marker, which Ruff flags as an unused noqa (RUF100).

Consider making this a Pylint-only suppression to avoid Ruff warnings:

Proposed lint-only change
-    from warp._src.context import runtime  # noqa: PLC0415
+    from warp._src.context import runtime  # pylint: disable=import-outside-toplevel
newton/_src/viewer/viewer.py (1)

580-592: solidify_mesh import path is fine; fix unused noqa directive

Using warp._src.render.utils.solidify_mesh here is consistent with the rest of the PR. However, the inline # noqa: PLC0415 is flagged by Ruff as an unused noqa directive.

If you still want to silence Pylint for this local import, prefer a Pylint-specific disable instead of # noqa:

Proposed lint-only change
-            from warp._src.render.utils import solidify_mesh  # noqa: PLC0415
+            from warp._src.render.utils import solidify_mesh  # pylint: disable=import-outside-toplevel
🧹 Nitpick comments (1)
newton/_src/sim/builder.py (1)

1609-1617: Direct use of wp._src transform cfunc looks fine; consider a small robustness guard

The switch to wp._src.context.runtime.core.wp_builtin_mul_transformf_transformf keeps the existing call pattern and should preserve behavior while satisfying Warp’s deprecation changes. Given this is an internal _src symbol, you might optionally wrap the lookup in a small try/except to fail with a clearer message if Warp ever shuffles internals:

Optional defensive guard
-        transform_mul_cfunc = wp._src.context.runtime.core.wp_builtin_mul_transformf_transformf
+        try:
+            transform_mul_cfunc = wp._src.context.runtime.core.wp_builtin_mul_transformf_transformf
+        except AttributeError as e:
+            raise RuntimeError(
+                "Required Warp symbol 'wp_builtin_mul_transformf_transformf' not found. "
+                "Ensure you are running a compatible Warp (>=1.11.x) build."
+            ) from e

Please also double‑check that this symbol path matches the Warp 1.11+ version you are targeting. Based on learnings, depending on wp._src in core Newton code is acceptable for this project.

📜 Review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3c90440 and 8334066.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (28)
  • docs/generate_api.py
  • newton/_src/core/types.py
  • newton/_src/geometry/sdf_mc.py
  • newton/_src/sim/builder.py
  • newton/_src/sim/contacts.py
  • newton/_src/sim/graph_coloring.py
  • newton/_src/sim/style3d/builder_style3d.py
  • newton/_src/solvers/implicit_mpm/solve_rheology.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/solvers/solver.py
  • newton/_src/solvers/style3d/collision/bvh/bvh.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/solvers/vbd/particle_vbd_kernels.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/utils/__init__.py
  • newton/_src/utils/import_mjcf.py
  • newton/_src/utils/recorder.py
  • newton/_src/utils/selection.py
  • newton/_src/viewer/viewer.py
  • newton/_src/viewer/viewer_gl.py
  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/examples/diffsim/example_diffsim_cloth.py
  • newton/examples/diffsim/example_diffsim_drone.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/examples/robot/example_robot_anymal_c_walk.py
  • newton/tests/test_coloring.py
  • pyproject.toml
🚧 Files skipped from review as they are similar to previous changes (14)
  • newton/_src/utils/selection.py
  • newton/examples/diffsim/example_diffsim_drone.py
  • newton/_src/utils/recorder.py
  • newton/_src/solvers/style3d/collision/bvh/bvh.py
  • newton/examples/robot/example_robot_anymal_c_walk.py
  • newton/_src/core/types.py
  • newton/_src/sim/style3d/builder_style3d.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/_src/sim/contacts.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • pyproject.toml
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/utils/import_mjcf.py
🧰 Additional context used
🧠 Learnings (24)
📓 Common learnings
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/solvers/featherstone/kernels.py:75-75
Timestamp: 2025-08-12T18:04:06.577Z
Learning: The Newton physics framework requires nightly Warp builds, which means compatibility concerns with older stable Warp versions (like missing functions such as wp.spatial_adjoint) are not relevant for this project.
Learnt from: shi-eric
Repo: newton-physics/newton PR: 521
File: newton/examples/example_cloth_hanging.py:36-36
Timestamp: 2025-08-12T05:17:34.423Z
Learning: The Newton migration guide (docs/migration.rst) is specifically for documenting how to migrate existing warp.sim functionality to Newton equivalents. New Newton-only features that didn't exist in warp.sim do not need migration documentation.
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/tests/test_ik.py:25-26
Timestamp: 2025-08-12T17:58:16.929Z
Learning: In the Newton physics engine codebase, it's acceptable for tests to import and use private `_src` internal modules and functions when needed for testing purposes, even though this breaks the public API boundary. This is an intentional project decision for test code.
Learnt from: shi-eric
Repo: newton-physics/newton PR: 461
File: asv/benchmarks/envs/example_humanoid.py:40-41
Timestamp: 2025-07-23T14:36:42.182Z
Learning: In Warp benchmarks, explicit wp.init() calls are not needed in most circumstances since the first Warp API call that requires initialization will automatically call wp.init(). Explicit wp.init() in setup() methods is helpful when the ASV benchmark is measuring a Warp API call, as wp.init() has non-trivial overhead that should be excluded from the benchmark timing.
📚 Learning: 2025-08-12T05:17:34.423Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 521
File: newton/examples/example_cloth_hanging.py:36-36
Timestamp: 2025-08-12T05:17:34.423Z
Learning: The Newton migration guide (docs/migration.rst) is specifically for documenting how to migrate existing warp.sim functionality to Newton equivalents. New Newton-only features that didn't exist in warp.sim do not need migration documentation.

Applied to files:

  • newton/_src/utils/__init__.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/sim/builder.py
  • newton/_src/viewer/viewer.py
  • newton/_src/solvers/implicit_mpm/solve_rheology.py
  • newton/_src/solvers/style3d/linear_solver.py
📚 Learning: 2025-08-12T18:04:06.577Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/solvers/featherstone/kernels.py:75-75
Timestamp: 2025-08-12T18:04:06.577Z
Learning: The Newton physics framework requires nightly Warp builds, which means compatibility concerns with older stable Warp versions (like missing functions such as wp.spatial_adjoint) are not relevant for this project.

Applied to files:

  • newton/_src/utils/__init__.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/sim/builder.py
  • newton/_src/solvers/vbd/particle_vbd_kernels.py
  • newton/_src/solvers/implicit_mpm/solve_rheology.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/viewer/viewer_gl.py
📚 Learning: 2025-09-18T07:05:56.836Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 750
File: newton/_src/solvers/implicit_mpm/solve_rheology.py:969-986
Timestamp: 2025-09-18T07:05:56.836Z
Learning: In newton/_src/solvers/implicit_mpm/solve_rheology.py, transposed_strain_mat parameter cannot be None - the type signature was corrected to reflect this guarantee, eliminating the need for None checks when accessing transposed_strain_mat.offsets.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/solvers/implicit_mpm/solve_rheology.py
  • newton/_src/solvers/style3d/linear_solver.py
📚 Learning: 2025-12-12T15:23:30.014Z
Learnt from: vastsoun
Repo: newton-physics/newton PR: 1019
File: newton/_src/solvers/kamino/examples/sim/example_sim_basics_boxes_fourbar.py:149-163
Timestamp: 2025-12-12T15:23:30.014Z
Learning: In Kamino simulation examples under newton/_src/solvers/kamino/examples/sim/, the pattern where logging=True and use_cuda_graph=True creates a mismatch (SimulationLogger constructed but settings.compute_metrics and logger.log() calls guarded by `if not self.use_cuda_graph`) should not be flagged. These examples will be refactored in a future commit, and this pattern is intentionally deferred.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
📚 Learning: 2025-08-19T12:27:30.629Z
Learnt from: preist-nvidia
Repo: newton-physics/newton PR: 579
File: newton/examples/example_mujoco.py:350-354
Timestamp: 2025-08-19T12:27:30.629Z
Learning: In Newton examples, there's a distinction between solver parameters and Example class attributes. The Example class can have its own use_mujoco attribute for controlling example-level behavior (like CUDA graphs, rendering logic), while the solver uses use_mujoco_cpu for backend selection. These serve different purposes and should not be conflated during API renames.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/solvers/solver.py
📚 Learning: 2025-10-29T14:55:48.171Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 940
File: newton/examples/mpm/example_mpm_granular.py:92-101
Timestamp: 2025-10-29T14:55:48.171Z
Learning: In newton/examples/mpm/example_mpm_granular.py, the capture() method intentionally advances the simulation state once during CUDA graph capture. This is expected behavior because CUDA graph capture records exact memory addresses, so the state arrays (state_0, state_1) cannot be reset or reallocated after capture without invalidating the graph.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
📚 Learning: 2025-08-19T12:27:30.629Z
Learnt from: preist-nvidia
Repo: newton-physics/newton PR: 579
File: newton/examples/example_mujoco.py:350-354
Timestamp: 2025-08-19T12:27:30.629Z
Learning: In Newton examples, Example.use_mujoco is a high-level attribute that controls whether to use MuJoCo solver vs other solvers (like XPBD), while SolverMuJoCo.use_mujoco_cpu controls the backend within MuJoCo (CPU vs Warp). These are separate concepts serving different purposes - the PR rename only applies to the solver parameter, not the Example class attributes.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/solvers/solver.py
📚 Learning: 2025-09-17T21:34:05.267Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 750
File: newton/examples/mpm/example_mpm_granular.py:44-47
Timestamp: 2025-09-17T21:34:05.267Z
Learning: wp.Mesh (Warp mesh objects) expose triangle indices through the `indices` attribute, not `triangles`. The correct usage is `wp.Mesh(...).indices`, not `wp.Mesh(...).triangles`.

Applied to files:

  • newton/_src/sim/builder.py
📚 Learning: 2025-08-12T17:51:37.474Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/geometry.py:16-22
Timestamp: 2025-08-12T17:51:37.474Z
Learning: In the Newton public API refactor, common geometry symbols like ParticleFlags and ShapeFlags are now exposed at the top level in newton/__init__.py rather than through newton.geometry. The newton/geometry.py module is intentionally focused only on broad-phase collision detection classes (BroadPhaseAllPairs, BroadPhaseExplicit, BroadPhaseSAP).

Applied to files:

  • newton/_src/solvers/vbd/particle_vbd_kernels.py
📚 Learning: 2025-08-12T17:52:15.009Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/utils/import_mjcf.py:226-231
Timestamp: 2025-08-12T17:52:15.009Z
Learning: In the Newton codebase, when passing array-like objects (numpy arrays, lists, tuples) to wp.vec3(), the consistent pattern is to use the unpacking operator: wp.vec3(*array) rather than wp.vec3(array). This pattern is used throughout newton/_src/utils/import_mjcf.py and newton/_src/core/types.py.

Applied to files:

  • newton/_src/solvers/vbd/particle_vbd_kernels.py
📚 Learning: 2025-09-25T16:14:22.033Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 806
File: newton/_src/sim/ik/ik_objectives.py:0-0
Timestamp: 2025-09-25T16:14:22.033Z
Learning: In NVIDIA Warp's Newton physics library, wp.transform supports direct numerical indexing (e.g., body_tf[0], body_tf[1], body_tf[2] for position and body_tf[3], body_tf[4], body_tf[5], body_tf[6] for quaternion components) to access its elements. This is the standard API used throughout the codebase.

Applied to files:

  • newton/_src/solvers/vbd/particle_vbd_kernels.py
📚 Learning: 2025-09-22T21:08:31.901Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 806
File: newton/examples/ik/example_ik_franka.py:121-123
Timestamp: 2025-09-22T21:08:31.901Z
Learning: In the newton physics framework, when creating warp arrays for IK solver joint variables using wp.array(self.model.joint_q, shape=(1, coord_count)), the resulting array acts as a reference/pointer to the original model's joint coordinates, so updates from the IK solver automatically reflect in the model's joint_q buffer used for rendering.

Applied to files:

  • newton/_src/solvers/vbd/particle_vbd_kernels.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/viewer/viewer_gl.py
📚 Learning: 2025-09-22T21:08:31.901Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 806
File: newton/examples/ik/example_ik_franka.py:121-123
Timestamp: 2025-09-22T21:08:31.901Z
Learning: In the newton physics framework, when creating warp arrays for IK solver joint variables using wp.array(self.model.joint_q, shape=(1, coord_count)), the resulting array acts as a reference/pointer to the original model's joint coordinates, so updates from the IK solver automatically reflect in the model's joint_q buffer used for rendering, despite the general warp documentation suggesting copies are made by default.

Applied to files:

  • newton/_src/solvers/vbd/particle_vbd_kernels.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/viewer/viewer_gl.py
📚 Learning: 2025-09-25T16:14:22.033Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 806
File: newton/_src/sim/ik/ik_objectives.py:0-0
Timestamp: 2025-09-25T16:14:22.033Z
Learning: wp.transform in NVIDIA Warp supports indexing using numerical indices (e.g., body_tf[0], body_tf[3], etc.) to access translation and rotation components. The indexing approach used in the Newton codebase is valid and compiles correctly.

Applied to files:

  • newton/_src/solvers/vbd/particle_vbd_kernels.py
📚 Learning: 2025-09-26T05:58:21.013Z
Learnt from: WenchaoHuang
Repo: newton-physics/newton PR: 835
File: newton/_src/solvers/style3d/collision/collision.py:49-53
Timestamp: 2025-09-26T05:58:21.013Z
Learning: In newton/_src/solvers/style3d/collision/collision.py, the broad_phase buffers (broad_phase_ee, broad_phase_ef, broad_phase_vf) created with wp.array() don't need zero-initialization because they follow a write-first-read-later pattern: BVH query kernels in frame_begin() populate these buffers completely (write-only operations), and collision kernels only read from them afterward in accumulate_contact_force(), ensuring no undefined reads occur.

Applied to files:

  • newton/_src/solvers/vbd/particle_vbd_kernels.py
📚 Learning: 2025-12-12T08:45:43.428Z
Learnt from: nvtw
Repo: newton-physics/newton PR: 1221
File: newton/examples/example_sdf.py:277-287
Timestamp: 2025-12-12T08:45:43.428Z
Learning: In Newtown (Newton) example code, specifically files under newton/examples, computing contacts once per frame and reusing them across all substeps is an intentional design choice, not a bug. Reviewers should verify that contacts are computed before the substep loop and reused for every substep within the same frame. This pattern reduces redundant work and preserves frame-consistency; do not flag as a regression unless the behavior is changed for correctness or performance reasons.

Applied to files:

  • newton/examples/diffsim/example_diffsim_cloth.py
📚 Learning: 2025-08-12T17:58:16.929Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/tests/test_ik.py:25-26
Timestamp: 2025-08-12T17:58:16.929Z
Learning: In the Newton physics engine codebase, it's acceptable for tests to import and use private `_src` internal modules and functions when needed for testing purposes, even though this breaks the public API boundary. This is an intentional project decision for test code.

Applied to files:

  • newton/tests/test_coloring.py
📚 Learning: 2025-09-09T11:03:41.928Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 750
File: newton/_src/solvers/implicit_mpm/solve_rheology.py:892-895
Timestamp: 2025-09-09T11:03:41.928Z
Learning: In newton/_src/solvers/implicit_mpm/solve_rheology.py, passing None for compliance_mat_diagonal is intentional to avoid loading zeros from global memory when compliance_mat is None, rather than creating a zero matrix and extracting its diagonal.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solve_rheology.py
📚 Learning: 2025-08-12T05:17:34.423Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 521
File: newton/examples/example_cloth_hanging.py:36-36
Timestamp: 2025-08-12T05:17:34.423Z
Learning: The STYLE3D solver in Newton is a new solver that did not exist in warp.sim, so it does not require any migration documentation.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solve_rheology.py
  • newton/_src/solvers/style3d/linear_solver.py
📚 Learning: 2025-08-25T20:10:59.536Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 634
File: newton/examples/ik/example_ik_franka.py:0-0
Timestamp: 2025-08-25T20:10:59.536Z
Learning: In Newton's IK examples, when creating solver arrays with `wp.array(source_array, shape=new_shape)`, this creates a view into the same underlying memory rather than a copy. This means updates to the reshaped array are automatically reflected in the original array without needing explicit copy operations like `wp.copy()`.

Applied to files:

  • newton/_src/solvers/style3d/linear_solver.py
📚 Learning: 2025-12-01T17:00:28.889Z
Learnt from: camevor
Repo: newton-physics/newton PR: 1161
File: newton/_src/solvers/mujoco/kernels.py:1268-1268
Timestamp: 2025-12-01T17:00:28.889Z
Learning: MuJoCo Warp spatial vectors (e.g., cacc, cvel) use the convention (angular, linear), which is opposite to Newton's (linear, angular) convention. When converting from MuJoCo Warp to Newton format, spatial_top() on MuJoCo Warp data extracts the angular component, and spatial_bottom() extracts the linear component.

Applied to files:

  • newton/_src/solvers/style3d/linear_solver.py
📚 Learning: 2025-11-12T23:53:29.478Z
Learnt from: daniela-hase
Repo: newton-physics/newton PR: 1044
File: newton/_src/sensors/tiled_camera_sensor.py:451-466
Timestamp: 2025-11-12T23:53:29.478Z
Learning: In newton/_src/sensors/tiled_camera_sensor.py, the convert_camera_to_warp_arrays method extracts [:3, :3] from camera.get_view_matrix().reshape(4, 4) without transposing. This is correct because Pyglet's Mat4.look_at returns a column-major view matrix, and reshaping it as row-major in NumPy creates an implicit transpose, converting the world→camera rotation into the camera→world rotation that the renderer expects.

Applied to files:

  • newton/_src/viewer/viewer_gl.py
📚 Learning: 2025-08-25T20:10:51.009Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 634
File: newton/examples/ik/example_ik_h1.py:0-0
Timestamp: 2025-08-25T20:10:51.009Z
Learning: In Warp, creating a new wp.array() with an existing array and different shape (e.g., wp.array(existing_array, shape=new_shape)) creates a view into the same underlying memory buffer, not a copy. This means modifications through either view are automatically reflected in both arrays.

Applied to files:

  • newton/_src/viewer/viewer_gl.py
🧬 Code graph analysis (4)
newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py (2)
newton/_src/sim/contacts.py (1)
  • device (110-114)
newton/_src/solvers/solver.py (1)
  • device (169-176)
newton/examples/diffsim/example_diffsim_cloth.py (3)
newton/examples/diffsim/example_diffsim_ball.py (1)
  • render (176-206)
newton/examples/diffsim/example_diffsim_drone.py (1)
  • render (763-796)
newton/examples/diffsim/example_diffsim_soft_body.py (1)
  • render (331-359)
newton/tests/test_coloring.py (2)
newton/_src/sim/builder.py (1)
  • particle_count (990-994)
newton/_src/sim/graph_coloring.py (1)
  • ColoringAlgorithm (23-25)
newton/_src/solvers/solver.py (1)
newton/_src/sim/contacts.py (1)
  • device (110-114)
🪛 Ruff (0.14.10)
newton/_src/viewer/viewer.py

586-586: Unused noqa directive (non-enabled: PLC0415)

Remove unused noqa directive

(RUF100)

newton/_src/solvers/style3d/linear_solver.py

230-230: Unused noqa directive (non-enabled: PLC0415)

Remove unused noqa directive

(RUF100)

newton/_src/viewer/viewer_gl.py

611-611: Undefined name warp

(F821)

⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Run GPU Tests / Run GPU Unit Tests on AWS EC2
  • GitHub Check: Run GPU Benchmarks / Run GPU Benchmarks on AWS EC2
🔇 Additional comments (14)
newton/_src/utils/__init__.py (1)

222-229: Direct delegation in check_conditional_graph_support looks good

Returning wp.is_conditional_graph_supported() directly matches the documented intent and simplifies the helper without changing its external contract.

newton/_src/solvers/vbd/particle_vbd_kernels.py (1)

54-56: Updated mat32 matrix type aligns with newer Warp type patterns

Defining mat32 via wp.types.matrix(shape=(3, 2), dtype=wp.float32) preserves the original 3×2 layout and integrates cleanly with the existing uses of mat32 in this module.

newton/_src/solvers/implicit_mpm/solve_rheology.py (3)

986-991: LGTM! Usage updated consistently with import change.

The call to array_axpy() correctly uses the updated import from warp.fem.linalg.


1440-1440: LGTM! Usage updated consistently with import change.

The call to array_axpy() correctly uses the updated import from warp.fem.linalg.


23-23: LGTM! Import paths updated to new Warp module organization.

The import change from warp.fem.utils to warp.fem.linalg for array_axpy and symmetric_eigenvalues_qr reflects Warp's module reorganization, appropriately placing linear algebra operations in the linalg module. Both functions are present in Warp 1.11.0's fem.linalg module and are correctly used throughout the file.

newton/examples/diffsim/example_diffsim_cloth.py (2)

214-214: Usage consistent with updated import.

The usage of bourke_color_map() correctly matches the updated import from warp._src.render.utils.


31-31: No action required—the code correctly uses the public Warp API.

The file already imports and uses wp.render.bourke_color_map from the public warp.render module (line 31: import warp.render, line 214: wp.render.bourke_color_map(...)). The review comment references a non-existent internal import path (warp._src.render.utils.bourke_color_map). Web search confirms that bourke_color_map is documented and available in Warp 1.11.0's public warp.render API, so the current implementation follows best practices and requires no changes.

Likely an incorrect or invalid review comment.

newton/_src/solvers/solver.py (1)

169-169: Type annotation correctly uses Warp's public Device API.

The return type annotation wp.Device is the recommended public type for device type hints in Warp, as documented in the official Warp Device API reference. Using the public export instead of the internal wp.context.Device path is correct and aligns with Warp's best practices.

newton/_src/geometry/sdf_mc.py (1)

63-65: Reconsider dependency on internal Warp marching cubes lookup table functions.

Lines 63-65 access internal Warp APIs from wp._src.marching_cubes to obtain lookup tables for marching cubes implementation. While Warp 1.11.0 provides public marching cubes APIs (extract_surface_marching_cubes function and MarchingCubes class), the code requires low-level lookup table access to implement custom GPU kernels. Verify whether public APIs expose equivalent lookup table access or if internal dependency is unavoidable. If internal usage is necessary, document the justification to acknowledge the maintainability risk.

docs/generate_api.py (1)

107-107: Acknowledge new file using appropriate Warp public API functions.

This file is newly created and correctly uses the public Warp API functions wp.types.type_is_struct() and wp.types.type_is_value() to identify struct and value types rather than relying on internal implementation details. The implementation is sound.

newton/_src/sim/builder.py (1)

5205-5218: MeshAdjacency _src path change is consistent with the existing usage

Using wp._src.utils.MeshAdjacency(self.tri_indices[start_tri:end_tri], end_tri - start_tri) keeps the previous semantics: you pass the local triangle slice plus its count and then derive edge tuples as before. This should address the Warp deprecation without changing behavior.

Please just confirm that MeshAdjacency is indeed exported from wp._src.utils in the Warp version you pin to (>=1.11.x). Based on learnings, relying on _src here is in line with the project’s acceptance of Warp internals.

newton/tests/test_coloring.py (1)

142-142: Test usage of internal Warp API is acceptable per project guidelines.

The migration from wp.context.runtime.core.wp_graph_coloring and wp.context.runtime.core.wp_balance_coloring to their _src equivalents is consistent with the project's approach to testing. Based on learnings, test code in Newton intentionally uses private internal modules when needed for testing purposes.

Also applies to: 155-155, 170-170, 176-176, 190-190, 196-196

newton/_src/sim/graph_coloring.py (1)

233-238: Clarify the stability and migration plan for internal Warp APIs.

This code uses internal Warp APIs (wp._src.context.runtime.core.wp_graph_coloring and wp._src.context.runtime.core.wp_balance_coloring) at lines 233 and 241. While Newton's design around nightly Warp builds is established, internal API dependencies still warrant clarity:

  • Confirm whether these internal APIs have stability guarantees across nightly Warp releases
  • Clarify if there are plans to migrate to public APIs when available, or if these will remain the recommended approach for this functionality in nightly builds
  • Note that the same APIs are also used directly in tests (test_coloring.py), suggesting intentional design; document whether this pattern is expected to continue

The PR notes mention "further changes" for other _src references—confirm whether these graph coloring APIs are included in that effort.

newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py (1)

1741-1741: The code change uses proper public API — no concerns.

wp.is_conditional_graph_supported() is part of the stable public Warp API (documented in the Warp API index and runtime reference) and reports CUDA-graph conditional-node availability. The simplified logic is appropriate and cleaner than the previous try/except approach.

@christophercrouzet christophercrouzet force-pushed the ccrouzet/fix-warp-deprecations branch 5 times, most recently from 9933d6e to 44e0fbd Compare January 14, 2026 21:10
@codecov
Copy link

codecov bot commented Jan 14, 2026

Codecov Report

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

Files with missing lines Patch % Lines
newton/_src/utils/mesh.py 76.59% 11 Missing ⚠️
newton/_src/solvers/implicit_mpm/solve_rheology.py 66.66% 1 Missing ⚠️
newton/_src/utils/__init__.py 0.00% 1 Missing ⚠️
newton/_src/utils/render.py 95.23% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@newton/_src/utils/mesh.py`:
- Around line 652-686: The kernel currently computes a per-triangle normal and
writes offsets into shared slots out_vertices[i*2], out_vertices[j*2], etc.,
causing race conditions when vertices are shared; fix by adding a separate pass
to compute per-vertex normals (e.g., implement a compute_vertex_normals kernel
that accumulates area-weighted triangle normals into a vertex_normals array
using indices and vertices, normalizes them, and returns vertex_normals) and
then modify the solidification kernel to use vertex_normals[i],
vertex_normals[j], vertex_normals[k] (replace the per-triangle normal and
ti/tj/tk computations) so each vertex gets a deterministic offset using
thickness[i] * vertex_normals[i]; alternatively (if you prefer no
precomputation) avoid shared writes by allocating unique triangle-local vertices
(use tid*6..tid*6+5 indices instead of i*2/j*2/k*2) so each thread writes its
own vertices.

In `@newton/_src/utils/render.py`:
- Around line 21-60: The function bourke_color_map can divide by dv = high - low
which may be zero or negative; modify bourke_color_map to detect if high <= low
and handle it before computing dv by either returning a neutral color (e.g.,
[1.0,1.0,1.0] or a grayscale) or by setting high = low + eps (or dv = 1.0) and
clamping v to low so subsequent math never divides by zero; ensure you update
the early clamping logic for v and then proceed with the existing branch logic
so all divisions use a non-zero positive dv.

In `@newton/utils.py`:
- Around line 61-64: Remove the unnecessary noqa directive on the import from
._src.utils.render; the E402 suppression is not needed. Edit the import
statement that brings in bourke_color_map and copy_rgb_frame_uint8 and delete
the trailing "# noqa: E402" so Ruff no longer flags an unused directive.
🧹 Nitpick comments (5)
newton/_src/solvers/style3d/linear_solver.py (1)

230-230: Remove unused noqa directive.

The noqa: PLC0415 directive is unnecessary since that rule is not enabled in the project's linter configuration.

Proposed fix
-    from warp._src.context import runtime  # noqa: PLC0415
+    from warp._src.context import runtime

Additionally, as noted in the PR description, this import still relies on Warp's internal _src namespace and will need to be addressed in follow-up work.

newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py (1)

1741-1742: Consider a tiny compatibility guard around wp.is_conditional_graph_supported().
If that symbol is missing in any supported Warp build, solver init will crash now. If that’s impossible given your Warp constraints, ignore; otherwise consider getattr fallback.

Proposed diff
-        self._use_cuda_graph = self.model.device.is_cuda and wp.is_conditional_graph_supported()
+        is_graph_supported = getattr(wp, "is_conditional_graph_supported", lambda: False)()
+        self._use_cuda_graph = self.model.device.is_cuda and is_graph_supported
newton/_src/utils/render.py (1)

63-93: Add a defensive bounds check in copy_rgb_frame_uint8() to tolerate launch/arg mismatches.
If dim, width/height, or output_img disagree, this can go OOB; a cheap early-return keeps it safe.

Proposed diff
 `@wp.kernel`
 def copy_rgb_frame_uint8(
@@
 ):
@@
     w, v = wp.tid()
+    if w >= width or v >= height:
+        return
     pixel = v * width + w
     pixel *= 3
newton/_src/utils/mesh.py (2)

65-72: Consider prefixing unused parameter with underscore.

The num_tris parameter is documented as unused but kept for API compatibility. Consider using the conventional underscore prefix (_num_tris) to signal intent to static analysis tools and readers.

Suggested change
-    def __init__(self, indices, num_tris):
+    def __init__(self, indices, _num_tris=None):
         """Build edge adjacency from triangle indices.

         Args:
             indices: Array-like of triangle indices, where each element is a
                 sequence of 3 vertex indices defining a triangle.
-            num_tris: Number of triangles (currently unused, kept for API compatibility).
+            _num_tris: Number of triangles (currently unused, kept for API compatibility).
         """

744-745: Consider simplifying thickness scalar handling.

The type check can be made more concise using np.isscalar() or a single check.

Suggested simplification
-    if not isinstance(thickness, np.ndarray) and not isinstance(thickness, list):
+    if np.isscalar(thickness):
         thickness = [thickness] * len(vertices)
📜 Review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8334066 and 44e0fbd.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (31)
  • docs/generate_api.py
  • newton/_src/core/types.py
  • newton/_src/geometry/sdf_mc.py
  • newton/_src/sim/builder.py
  • newton/_src/sim/contacts.py
  • newton/_src/sim/graph_coloring.py
  • newton/_src/sim/style3d/builder_style3d.py
  • newton/_src/solvers/implicit_mpm/solve_rheology.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/solvers/solver.py
  • newton/_src/solvers/style3d/collision/bvh/bvh.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/solvers/vbd/particle_vbd_kernels.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/utils/__init__.py
  • newton/_src/utils/import_mjcf.py
  • newton/_src/utils/mesh.py
  • newton/_src/utils/recorder.py
  • newton/_src/utils/render.py
  • newton/_src/utils/selection.py
  • newton/_src/viewer/viewer.py
  • newton/_src/viewer/viewer_gl.py
  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/examples/diffsim/example_diffsim_cloth.py
  • newton/examples/diffsim/example_diffsim_drone.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/examples/robot/example_robot_anymal_c_walk.py
  • newton/tests/test_coloring.py
  • newton/utils.py
  • pyproject.toml
🚧 Files skipped from review as they are similar to previous changes (17)
  • newton/_src/viewer/viewer_gl.py
  • newton/_src/sim/style3d/builder_style3d.py
  • newton/_src/sim/graph_coloring.py
  • newton/_src/geometry/sdf_mc.py
  • newton/_src/sim/contacts.py
  • newton/_src/utils/selection.py
  • newton/examples/robot/example_robot_anymal_c_walk.py
  • newton/_src/utils/recorder.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/_src/utils/import_mjcf.py
  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/examples/diffsim/example_diffsim_drone.py
  • newton/_src/sim/builder.py
  • newton/_src/solvers/vbd/particle_vbd_kernels.py
  • newton/_src/solvers/implicit_mpm/solve_rheology.py
  • newton/_src/solvers/style3d/collision/bvh/bvh.py
  • newton/_src/viewer/viewer.py
🧰 Additional context used
📓 Path-based instructions (5)
newton/_src/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

The newton/_src/ directory is internal library implementation only and must not be imported by user code (examples, documentation, or external users)

Files:

  • newton/_src/core/types.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/utils/render.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/utils/mesh.py
  • newton/_src/solvers/solver.py
  • newton/_src/utils/__init__.py
newton/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Any user-facing class/function/object added under _src must be exposed via the public Newton API through re-exports

Files:

  • newton/_src/core/types.py
  • newton/examples/diffsim/example_diffsim_cloth.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/utils/render.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/utils/mesh.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/tests/test_coloring.py
  • newton/_src/solvers/solver.py
  • newton/utils.py
  • newton/_src/utils/__init__.py
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

**/*.py: Use prefix-first naming for classes: ActuatorPD, ActuatorPID (not PDActuator, PIDActuator)
Use prefix-first naming for methods: add_shape_sphere() (not add_sphere_shape())
Method names must use snake_case
Prefer nested classes when self-contained: if a helper type or enum is only meaningful inside one parent class and doesn't need a public identity, define it as a nested class instead of a top-level class/module
Follow PEP 8 for Python code
Use Google-style docstrings with clear, concise explanations of what functions do, their parameters, and return values

Files:

  • newton/_src/core/types.py
  • newton/examples/diffsim/example_diffsim_cloth.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • docs/generate_api.py
  • newton/_src/utils/render.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/utils/mesh.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/tests/test_coloring.py
  • newton/_src/solvers/solver.py
  • newton/utils.py
  • newton/_src/utils/__init__.py
**/*

📄 CodeRabbit inference engine (AGENTS.md)

CLI arguments must use kebab-case (e.g., --use-cuda-graph, not --use_cuda_graph)

Files:

  • newton/_src/core/types.py
  • pyproject.toml
  • newton/examples/diffsim/example_diffsim_cloth.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • docs/generate_api.py
  • newton/_src/utils/render.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/utils/mesh.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/tests/test_coloring.py
  • newton/_src/solvers/solver.py
  • newton/utils.py
  • newton/_src/utils/__init__.py
newton/examples/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

newton/examples/**/*.py: Examples must not import from newton._src, only from the public Newton API
Examples must follow the format with an Example class and must be registered in README.md with a uv run command and screenshot
Examples must implement a test_final() method that verifies the simulation state is valid after the example has run
Examples may optionally implement a test_post_step() method that is evaluated after every step() call

Files:

  • newton/examples/diffsim/example_diffsim_cloth.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
🧠 Learnings (32)
📓 Common learnings
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/solvers/featherstone/kernels.py:75-75
Timestamp: 2025-08-12T18:04:06.577Z
Learning: The Newton physics framework requires nightly Warp builds, which means compatibility concerns with older stable Warp versions (like missing functions such as wp.spatial_adjoint) are not relevant for this project.
Learnt from: shi-eric
Repo: newton-physics/newton PR: 521
File: newton/examples/example_cloth_hanging.py:36-36
Timestamp: 2025-08-12T05:17:34.423Z
Learning: The Newton migration guide (docs/migration.rst) is specifically for documenting how to migrate existing warp.sim functionality to Newton equivalents. New Newton-only features that didn't exist in warp.sim do not need migration documentation.
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/tests/test_ik.py:25-26
Timestamp: 2025-08-12T17:58:16.929Z
Learning: In the Newton physics engine codebase, it's acceptable for tests to import and use private `_src` internal modules and functions when needed for testing purposes, even though this breaks the public API boundary. This is an intentional project decision for test code.
Learnt from: shi-eric
Repo: newton-physics/newton PR: 461
File: asv/benchmarks/envs/example_humanoid.py:40-41
Timestamp: 2025-07-23T14:36:42.182Z
Learning: In Warp benchmarks, explicit wp.init() calls are not needed in most circumstances since the first Warp API call that requires initialization will automatically call wp.init(). Explicit wp.init() in setup() methods is helpful when the ASV benchmark is measuring a Warp API call, as wp.init() has non-trivial overhead that should be excluded from the benchmark timing.
Learnt from: CR
Repo: newton-physics/newton PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-13T07:40:13.635Z
Learning: Applies to newton/**/*.py : Any user-facing class/function/object added under `_src` must be exposed via the public Newton API through re-exports
📚 Learning: 2025-08-12T05:17:34.423Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 521
File: newton/examples/example_cloth_hanging.py:36-36
Timestamp: 2025-08-12T05:17:34.423Z
Learning: The Newton migration guide (docs/migration.rst) is specifically for documenting how to migrate existing warp.sim functionality to Newton equivalents. New Newton-only features that didn't exist in warp.sim do not need migration documentation.

Applied to files:

  • newton/_src/core/types.py
  • pyproject.toml
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/_src/utils/__init__.py
📚 Learning: 2025-08-12T17:51:37.474Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/geometry.py:16-22
Timestamp: 2025-08-12T17:51:37.474Z
Learning: In the Newton public API refactor, common geometry symbols like ParticleFlags and ShapeFlags are now exposed at the top level in newton/__init__.py rather than through newton.geometry. The newton/geometry.py module is intentionally focused only on broad-phase collision detection classes (BroadPhaseAllPairs, BroadPhaseExplicit, BroadPhaseSAP).

Applied to files:

  • newton/_src/core/types.py
  • newton/utils.py
📚 Learning: 2026-01-13T07:40:13.635Z
Learnt from: CR
Repo: newton-physics/newton PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-13T07:40:13.635Z
Learning: Applies to newton/**/*.py : Any user-facing class/function/object added under `_src` must be exposed via the public Newton API through re-exports

Applied to files:

  • newton/_src/core/types.py
  • newton/utils.py
📚 Learning: 2026-01-13T03:11:40.556Z
Learnt from: jumyungc
Repo: newton-physics/newton PR: 1333
File: newton/_src/sim/builder.py:0-0
Timestamp: 2026-01-13T03:11:40.556Z
Learning: Ensure all VBD damping semantics follow Rayleigh-style damping and are unitless. This convention, demonstrated in SolverVBD, should be applied consistently across all VBD-related constraints in the codebase. In newton/_src/sim/builder.py, validate that any damping terms use the same normalization and are treated as dimensionless; add comments and unit tests to enforce consistency across VBD components.

Applied to files:

  • newton/_src/core/types.py
  • newton/examples/diffsim/example_diffsim_cloth.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/utils/render.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/utils/mesh.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/tests/test_coloring.py
  • newton/_src/solvers/solver.py
  • newton/utils.py
  • newton/_src/utils/__init__.py
📚 Learning: 2025-08-27T23:33:32.527Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 660
File: pyproject.toml:28-28
Timestamp: 2025-08-27T23:33:32.527Z
Learning: In Python projects, it's normal and correct to have different warp-lang version specifications across files: pyproject.toml should specify minimum compatible versions using >= for flexibility, while specific environments like asv.conf.json can pin exact versions using == for reproducibility. These serve different purposes and should not be "aligned" to the same version.

Applied to files:

  • pyproject.toml
📚 Learning: 2025-08-12T18:04:06.577Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/solvers/featherstone/kernels.py:75-75
Timestamp: 2025-08-12T18:04:06.577Z
Learning: The Newton physics framework requires nightly Warp builds, which means compatibility concerns with older stable Warp versions (like missing functions such as wp.spatial_adjoint) are not relevant for this project.

Applied to files:

  • pyproject.toml
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/_src/utils/__init__.py
📚 Learning: 2025-10-04T06:44:52.713Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 879
File: .gitlab-ci.yml:125-145
Timestamp: 2025-10-04T06:44:52.713Z
Learning: In the Newton project, the "linux-x86_64 test warp nightly" GitLab CI job intentionally runs on every pipeline (not limited to `.test_common` rules) to detect Warp nightly integration issues early, since Warp nightly releases are unpredictable. This design is acceptable because `allow_failure: true` prevents blocking the pipeline.

Applied to files:

  • pyproject.toml
📚 Learning: 2025-08-27T23:32:48.670Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 660
File: pyproject.toml:54-59
Timestamp: 2025-08-27T23:32:48.670Z
Learning: In the newton project's pyproject.toml, self-referential extras (e.g., `examples = ["newton[sim]", "newton[importers]", ...]`) are normal and encouraged for dependency management, rather than inlining the dependencies.

Applied to files:

  • pyproject.toml
📚 Learning: 2025-09-22T21:08:31.901Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 806
File: newton/examples/ik/example_ik_franka.py:121-123
Timestamp: 2025-09-22T21:08:31.901Z
Learning: In the newton physics framework, when creating warp arrays for IK solver joint variables using wp.array(self.model.joint_q, shape=(1, coord_count)), the resulting array acts as a reference/pointer to the original model's joint coordinates, so updates from the IK solver automatically reflect in the model's joint_q buffer used for rendering, despite the general warp documentation suggesting copies are made by default.

Applied to files:

  • newton/examples/diffsim/example_diffsim_cloth.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
📚 Learning: 2025-12-12T08:45:43.428Z
Learnt from: nvtw
Repo: newton-physics/newton PR: 1221
File: newton/examples/example_sdf.py:277-287
Timestamp: 2025-12-12T08:45:43.428Z
Learning: In Newtown (Newton) example code, specifically files under newton/examples, computing contacts once per frame and reusing them across all substeps is an intentional design choice, not a bug. Reviewers should verify that contacts are computed before the substep loop and reused for every substep within the same frame. This pattern reduces redundant work and preserves frame-consistency; do not flag as a regression unless the behavior is changed for correctness or performance reasons.

Applied to files:

  • newton/examples/diffsim/example_diffsim_cloth.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
📚 Learning: 2025-12-12T15:23:30.014Z
Learnt from: vastsoun
Repo: newton-physics/newton PR: 1019
File: newton/_src/solvers/kamino/examples/sim/example_sim_basics_boxes_fourbar.py:149-163
Timestamp: 2025-12-12T15:23:30.014Z
Learning: In Kamino simulation examples under newton/_src/solvers/kamino/examples/sim/, the pattern where logging=True and use_cuda_graph=True creates a mismatch (SimulationLogger constructed but settings.compute_metrics and logger.log() calls guarded by `if not self.use_cuda_graph`) should not be flagged. These examples will be refactored in a future commit, and this pattern is intentionally deferred.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
📚 Learning: 2025-09-18T07:05:56.836Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 750
File: newton/_src/solvers/implicit_mpm/solve_rheology.py:969-986
Timestamp: 2025-09-18T07:05:56.836Z
Learning: In newton/_src/solvers/implicit_mpm/solve_rheology.py, transposed_strain_mat parameter cannot be None - the type signature was corrected to reflect this guarantee, eliminating the need for None checks when accessing transposed_strain_mat.offsets.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/solvers/style3d/linear_solver.py
📚 Learning: 2025-08-19T12:27:30.629Z
Learnt from: preist-nvidia
Repo: newton-physics/newton PR: 579
File: newton/examples/example_mujoco.py:350-354
Timestamp: 2025-08-19T12:27:30.629Z
Learning: In Newton examples, there's a distinction between solver parameters and Example class attributes. The Example class can have its own use_mujoco attribute for controlling example-level behavior (like CUDA graphs, rendering logic), while the solver uses use_mujoco_cpu for backend selection. These serve different purposes and should not be conflated during API renames.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/solvers/solver.py
📚 Learning: 2025-10-29T14:55:48.171Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 940
File: newton/examples/mpm/example_mpm_granular.py:92-101
Timestamp: 2025-10-29T14:55:48.171Z
Learning: In newton/examples/mpm/example_mpm_granular.py, the capture() method intentionally advances the simulation state once during CUDA graph capture. This is expected behavior because CUDA graph capture records exact memory addresses, so the state arrays (state_0, state_1) cannot be reset or reallocated after capture without invalidating the graph.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
📚 Learning: 2025-08-25T20:10:59.536Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 634
File: newton/examples/ik/example_ik_franka.py:0-0
Timestamp: 2025-08-25T20:10:59.536Z
Learning: In Newton's IK examples, when creating solver arrays with `wp.array(source_array, shape=new_shape)`, this creates a view into the same underlying memory rather than a copy. This means updates to the reshaped array are automatically reflected in the original array without needing explicit copy operations like `wp.copy()`.

Applied to files:

  • newton/_src/solvers/style3d/linear_solver.py
📚 Learning: 2025-08-12T17:52:15.009Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/utils/import_mjcf.py:226-231
Timestamp: 2025-08-12T17:52:15.009Z
Learning: In the Newton codebase, when passing array-like objects (numpy arrays, lists, tuples) to wp.vec3(), the consistent pattern is to use the unpacking operator: wp.vec3(*array) rather than wp.vec3(array). This pattern is used throughout newton/_src/utils/import_mjcf.py and newton/_src/core/types.py.

Applied to files:

  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-08-12T05:17:34.423Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 521
File: newton/examples/example_cloth_hanging.py:36-36
Timestamp: 2025-08-12T05:17:34.423Z
Learning: The STYLE3D solver in Newton is a new solver that did not exist in warp.sim, so it does not require any migration documentation.

Applied to files:

  • newton/_src/solvers/style3d/linear_solver.py
📚 Learning: 2025-09-22T21:08:31.901Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 806
File: newton/examples/ik/example_ik_franka.py:121-123
Timestamp: 2025-09-22T21:08:31.901Z
Learning: In the newton physics framework, when creating warp arrays for IK solver joint variables using wp.array(self.model.joint_q, shape=(1, coord_count)), the resulting array acts as a reference/pointer to the original model's joint coordinates, so updates from the IK solver automatically reflect in the model's joint_q buffer used for rendering.

Applied to files:

  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-08-25T20:10:51.009Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 634
File: newton/examples/ik/example_ik_h1.py:0-0
Timestamp: 2025-08-25T20:10:51.009Z
Learning: In Warp, creating a new wp.array() with an existing array and different shape (e.g., wp.array(existing_array, shape=new_shape)) creates a view into the same underlying memory buffer, not a copy. This means modifications through either view are automatically reflected in both arrays.

Applied to files:

  • newton/_src/solvers/style3d/linear_solver.py
📚 Learning: 2025-09-26T05:58:21.013Z
Learnt from: WenchaoHuang
Repo: newton-physics/newton PR: 835
File: newton/_src/solvers/style3d/collision/collision.py:49-53
Timestamp: 2025-09-26T05:58:21.013Z
Learning: In newton/_src/solvers/style3d/collision/collision.py, the broad_phase buffers (broad_phase_ee, broad_phase_ef, broad_phase_vf) created with wp.array() don't need zero-initialization because they follow a write-first-read-later pattern: BVH query kernels in frame_begin() populate these buffers completely (write-only operations), and collision kernels only read from them afterward in accumulate_contact_force(), ensuring no undefined reads occur.

Applied to files:

  • newton/_src/solvers/style3d/linear_solver.py
📚 Learning: 2025-08-18T15:56:26.587Z
Learnt from: adenzler-nvidia
Repo: newton-physics/newton PR: 552
File: newton/_src/solvers/mujoco/solver_mujoco.py:0-0
Timestamp: 2025-08-18T15:56:26.587Z
Learning: In Newton's MuJoCo solver, when transforming joint axes from Newton's internal frame to MuJoCo's expected frame, use wp.quat_rotate(joint_rot, axis) not wp.quat_rotate_inv(joint_rot, axis). The joint_rot represents rotation from joint-local to body frame, so forward rotation is correct.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-09-25T16:14:22.033Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 806
File: newton/_src/sim/ik/ik_objectives.py:0-0
Timestamp: 2025-09-25T16:14:22.033Z
Learning: In NVIDIA Warp's Newton physics library, wp.transform supports direct numerical indexing (e.g., body_tf[0], body_tf[1], body_tf[2] for position and body_tf[3], body_tf[4], body_tf[5], body_tf[6] for quaternion components) to access its elements. This is the standard API used throughout the codebase.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-11-24T10:44:09.613Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 1108
File: newton/_src/solvers/implicit_mpm/rasterized_collisions.py:94-129
Timestamp: 2025-11-24T10:44:09.613Z
Learning: In Warp, wp.normalize() returns a zero vector (or zero quaternion) when given a zero-length input, so explicit zero-length checks before normalization are not required.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-12-01T17:00:28.889Z
Learnt from: camevor
Repo: newton-physics/newton PR: 1161
File: newton/_src/solvers/mujoco/kernels.py:1268-1268
Timestamp: 2025-12-01T17:00:28.889Z
Learning: MuJoCo Warp spatial vectors (e.g., cacc, cvel) use the convention (angular, linear), which is opposite to Newton's (linear, angular) convention. When converting from MuJoCo Warp to Newton format, spatial_top() on MuJoCo Warp data extracts the angular component, and spatial_bottom() extracts the linear component.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-11-28T11:12:40.805Z
Learnt from: camevor
Repo: newton-physics/newton PR: 1146
File: newton/examples/basic/example_basic_joints.py:206-213
Timestamp: 2025-11-28T11:12:40.805Z
Learning: In Newton's standard solvers (XPBD, SemiImplicit, SolverMuJoCo), spatial vectors in State.body_qd use the ordering (linear, angular): wp.spatial_top(qd) returns linear velocity and wp.spatial_bottom(qd) returns angular velocity. This is the opposite of typical Modern Robotics spatial twist notation where (angular, linear) is used.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-09-17T21:34:05.267Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 750
File: newton/examples/mpm/example_mpm_granular.py:44-47
Timestamp: 2025-09-17T21:34:05.267Z
Learning: wp.Mesh (Warp mesh objects) expose triangle indices through the `indices` attribute, not `triangles`. The correct usage is `wp.Mesh(...).indices`, not `wp.Mesh(...).triangles`.

Applied to files:

  • newton/_src/utils/mesh.py
📚 Learning: 2025-08-12T17:58:16.929Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/tests/test_ik.py:25-26
Timestamp: 2025-08-12T17:58:16.929Z
Learning: In the Newton physics engine codebase, it's acceptable for tests to import and use private `_src` internal modules and functions when needed for testing purposes, even though this breaks the public API boundary. This is an intentional project decision for test code.

Applied to files:

  • newton/tests/test_coloring.py
📚 Learning: 2025-08-19T12:27:30.629Z
Learnt from: preist-nvidia
Repo: newton-physics/newton PR: 579
File: newton/examples/example_mujoco.py:350-354
Timestamp: 2025-08-19T12:27:30.629Z
Learning: In Newton examples, Example.use_mujoco is a high-level attribute that controls whether to use MuJoCo solver vs other solvers (like XPBD), while SolverMuJoCo.use_mujoco_cpu controls the backend within MuJoCo (CPU vs Warp). These are separate concepts serving different purposes - the PR rename only applies to the solver parameter, not the Example class attributes.

Applied to files:

  • newton/_src/solvers/solver.py
📚 Learning: 2026-01-13T07:40:13.635Z
Learnt from: CR
Repo: newton-physics/newton PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-13T07:40:13.635Z
Learning: Applies to newton/examples/**/*.py : Examples must not import from `newton._src`, only from the public Newton API

Applied to files:

  • newton/utils.py
📚 Learning: 2025-08-12T17:58:00.815Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/solvers/featherstone/kernels.py:18-20
Timestamp: 2025-08-12T17:58:00.815Z
Learning: In newton/_src/core/__init__.py, the function transform_twist is properly re-exported from the spatial module via "from .spatial import (..., transform_twist, ...)" and included in __all__, making it available for import as "from ...core import transform_twist" from other modules.

Applied to files:

  • newton/utils.py
📚 Learning: 2025-08-14T17:38:36.106Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/__init__.py:25-29
Timestamp: 2025-08-14T17:38:36.106Z
Learning: The Newton project prefers incremental __all__ building using __all__ += [...] pattern to group exports with their related imports, rather than a single consolidated __all__ at the end of the file.

Applied to files:

  • newton/utils.py
🧬 Code graph analysis (6)
newton/examples/diffsim/example_diffsim_cloth.py (1)
newton/_src/utils/render.py (1)
  • bourke_color_map (21-60)
newton/_src/utils/mesh.py (1)
newton/_src/sim/builder.py (1)
  • add_edge (5144-5197)
newton/examples/diffsim/example_diffsim_soft_body.py (1)
newton/_src/utils/render.py (1)
  • bourke_color_map (21-60)
newton/tests/test_coloring.py (2)
newton/_src/sim/builder.py (1)
  • particle_count (1157-1161)
newton/_src/sim/graph_coloring.py (1)
  • ColoringAlgorithm (24-26)
newton/_src/solvers/solver.py (1)
newton/_src/sim/contacts.py (1)
  • device (110-114)
newton/utils.py (2)
newton/_src/utils/mesh.py (3)
  • MeshAdjacency (53-111)
  • MeshEdge (27-50)
  • solidify_mesh (715-754)
newton/_src/utils/render.py (2)
  • bourke_color_map (21-60)
  • copy_rgb_frame_uint8 (64-93)
🪛 Ruff (0.14.11)
newton/_src/solvers/style3d/linear_solver.py

230-230: Unused noqa directive (non-enabled: PLC0415)

Remove unused noqa directive

(RUF100)

newton/_src/utils/mesh.py

65-65: Unused method argument: num_tris

(ARG002)

newton/utils.py

61-61: Unused noqa directive (non-enabled: E402)

Remove unused noqa directive

(RUF100)

⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Run GPU Tests / Run GPU Unit Tests on AWS EC2
  • GitHub Check: Run GPU Benchmarks / Run GPU Benchmarks on AWS EC2
🔇 Additional comments (14)
docs/generate_api.py (1)

107-109: LGTM! Correct migration to public Warp API.

This change appropriately replaces access to the internal wp.codegen.Struct with the public wp.types.type_is_struct() API, addressing the Warp v1.11.0 deprecation warnings as intended by this PR.

newton/_src/solvers/style3d/linear_solver.py (1)

237-245: The change from type_length to type_size is correct.

wp.types.type_size() returns the number of scalar components (e.g., 3 for vec3), as confirmed by the NVIDIA Warp API documentation. This is the semantically correct replacement for the deprecated type_length() function and will not break the inner product calculation.

newton/_src/utils/__init__.py (1)

222-229: LGTM! Clean simplification using public Warp API.

The switch from the deprecated assert_conditional_graph_support try/except pattern to directly using wp.is_conditional_graph_supported() is a good improvement. This removes internal API usage and simplifies the control flow while maintaining the same public interface.

newton/tests/test_coloring.py (1)

142-147: Appropriate use of internal Warp APIs in test code.

The switch to wp._src.context.runtime.core.wp_graph_coloring and wp._src.context.runtime.core.wp_balance_coloring is acceptable for test code. Based on learnings, Newton tests are permitted to use private _src internal modules when needed for testing purposes. The function signatures and arguments remain unchanged, and this aligns with the corresponding changes in newton/_src/sim/graph_coloring.py.

Also applies to: 155-160, 170-182, 190-202

newton/_src/solvers/solver.py (1)

168-176: LGTM! Type annotation updated to use public Warp API.

The change from wp.context.Device to wp.Device correctly uses the public type alias instead of the internal path, consistent with the PR's objective of addressing deprecation warnings. The runtime behavior remains unchanged.

newton/examples/diffsim/example_diffsim_cloth.py (2)

35-35: LGTM! Import correctly uses public Newton API.

The import of bourke_color_map from newton.utils instead of wp.render complies with the coding guidelines that examples must only import from the public Newton API. As per coding guidelines, examples must not import from newton._src.


214-214: LGTM! Function call updated to use imported utility.

The call to bourke_color_map correctly uses the function imported from the public Newton API with the same arguments as before.

pyproject.toml (1)

28-28: Version 1.12.0.dev20251219 is available on NVIDIA PyPI and supports all major platforms (macOS ARM64, Linux x86_64, Linux aarch64, Windows x86_64). The dependency specification is valid.

newton/_src/solvers/vbd/rigid_vbd_kernels.py (1)

68-71: vec6 type migration looks right; please confirm Warp supports this subclassing pattern.
Moving to wp.types.vector(..., dtype=wp.float32) is consistent with the Warp public API direction, but this relies on Warp allowing subclassing of the type factory result (vs using a simple alias). Please confirm this works in the repo’s pinned/nightly Warp build.

newton/_src/core/types.py (1)

25-27: Verify DeviceLike is exported from warp (not just warp.context).
The aliasing approach is clean, but it will hard-fail on environments where warp.DeviceLike isn’t present. Please confirm this matches the minimum Warp version used in CI.

newton/utils.py (1)

32-56: Good: new _src utilities are properly re-exported via newton.utils.
This matches the project expectation that user-facing additions under _src are exposed through the public API. Based on learnings, this is the right shape.

Also applies to: 58-69

newton/examples/diffsim/example_diffsim_soft_body.py (1)

37-37: LGTM!

The import correctly uses the public Newton API (newton.utils) instead of the deprecated Warp internal API (warp.render), aligning with the PR objectives and coding guidelines for examples.

newton/_src/utils/mesh.py (2)

16-20: LGTM!

Appropriate imports for the new dataclass, warning handling, and Warp kernel functionality.


26-51: LGTM!

Well-documented dataclass with clear field descriptions. The edge representation is consistent with edge handling patterns elsewhere in the codebase (e.g., add_edge in builder.py).

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@newton/_src/utils/mesh.py`:
- Around line 627-713: The kernel solidify_mesh_kernel currently has a race
where multiple threads write to shared out_vertices entries (out_vertices[i*2],
out_vertices[i*2+1]) because normals are computed per-face; fix by either (A)
computing/feeding per-vertex averaged normals on the host and replace the
per-face normal math in solidify_mesh_kernel so each thread only reads and
writes its unique per-vertex outputs deterministically, or (B) change the output
layout to per-face duplicated vertices (allocate out_vertices of size
num_triangles*6 and use per-triangle local indices instead of i0/i1/j0/j1/k0/k1)
so each thread writes only its own slice; update out_indices logic to match the
chosen layout (references: solidify_mesh_kernel, indices, vertices, thickness,
out_vertices, out_indices).

In `@newton/_src/utils/render.py`:
- Around line 21-60: Protect against division-by-zero in bourke_color_map by
checking dv = high - low immediately after it's computed; if dv == 0, return the
default color (c) or another sensible constant instead of performing the
subsequent divisions. This change in the bourke_color_map function prevents
ZeroDivisionError when low == high while preserving the existing return type and
value range.
🧹 Nitpick comments (2)
newton/_src/utils/selection.py (1)

511-514: Use consistent direct import for is_struct alongside is_array.

The migration from the internal API to wp.types.is_struct() is correct. However, for consistency with how is_array is imported and used elsewhere in the file, import is_struct directly:

-from warp.types import is_array
+from warp.types import is_array, is_struct

Then update line 511:

-        if wp.types.is_struct(attrib):
+        if is_struct(attrib):

This matches the pattern used on line 586 where is_array is called directly.

newton/_src/solvers/style3d/linear_solver.py (1)

230-230: Remove unused noqa directive.

Per static analysis, PLC0415 is not enabled, making this directive unnecessary.

Suggested fix
-    from warp._src.context import runtime  # noqa: PLC0415
+    from warp._src.context import runtime
📜 Review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8334066 and 44e0fbd.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (31)
  • docs/generate_api.py
  • newton/_src/core/types.py
  • newton/_src/geometry/sdf_mc.py
  • newton/_src/sim/builder.py
  • newton/_src/sim/contacts.py
  • newton/_src/sim/graph_coloring.py
  • newton/_src/sim/style3d/builder_style3d.py
  • newton/_src/solvers/implicit_mpm/solve_rheology.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/solvers/solver.py
  • newton/_src/solvers/style3d/collision/bvh/bvh.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/solvers/vbd/particle_vbd_kernels.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/utils/__init__.py
  • newton/_src/utils/import_mjcf.py
  • newton/_src/utils/mesh.py
  • newton/_src/utils/recorder.py
  • newton/_src/utils/render.py
  • newton/_src/utils/selection.py
  • newton/_src/viewer/viewer.py
  • newton/_src/viewer/viewer_gl.py
  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/examples/diffsim/example_diffsim_cloth.py
  • newton/examples/diffsim/example_diffsim_drone.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/examples/robot/example_robot_anymal_c_walk.py
  • newton/tests/test_coloring.py
  • newton/utils.py
  • pyproject.toml
🚧 Files skipped from review as they are similar to previous changes (22)
  • newton/_src/utils/recorder.py
  • newton/_src/sim/graph_coloring.py
  • newton/_src/utils/init.py
  • newton/_src/sim/builder.py
  • newton/_src/core/types.py
  • newton/_src/utils/import_mjcf.py
  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/_src/solvers/style3d/collision/bvh/bvh.py
  • newton/examples/diffsim/example_diffsim_drone.py
  • newton/_src/geometry/sdf_mc.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/solvers/vbd/particle_vbd_kernels.py
  • newton/_src/viewer/viewer_gl.py
  • newton/_src/viewer/viewer.py
  • docs/generate_api.py
  • newton/examples/robot/example_robot_anymal_c_walk.py
  • pyproject.toml
  • newton/examples/diffsim/example_diffsim_cloth.py
  • newton/tests/test_coloring.py
  • newton/_src/sim/style3d/builder_style3d.py
  • newton/_src/solvers/implicit_mpm/solve_rheology.py
  • newton/_src/sim/contacts.py
🧰 Additional context used
📓 Path-based instructions (5)
newton/_src/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

The newton/_src/ directory is internal library implementation only and must not be imported by user code (examples, documentation, or external users)

Files:

  • newton/_src/utils/render.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/utils/selection.py
  • newton/_src/solvers/solver.py
  • newton/_src/utils/mesh.py
  • newton/_src/solvers/style3d/linear_solver.py
newton/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Any user-facing class/function/object added under _src must be exposed via the public Newton API through re-exports

Files:

  • newton/_src/utils/render.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/utils/selection.py
  • newton/utils.py
  • newton/_src/solvers/solver.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/_src/utils/mesh.py
  • newton/_src/solvers/style3d/linear_solver.py
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

**/*.py: Use prefix-first naming for classes: ActuatorPD, ActuatorPID (not PDActuator, PIDActuator)
Use prefix-first naming for methods: add_shape_sphere() (not add_sphere_shape())
Method names must use snake_case
Prefer nested classes when self-contained: if a helper type or enum is only meaningful inside one parent class and doesn't need a public identity, define it as a nested class instead of a top-level class/module
Follow PEP 8 for Python code
Use Google-style docstrings with clear, concise explanations of what functions do, their parameters, and return values

Files:

  • newton/_src/utils/render.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/utils/selection.py
  • newton/utils.py
  • newton/_src/solvers/solver.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/_src/utils/mesh.py
  • newton/_src/solvers/style3d/linear_solver.py
**/*

📄 CodeRabbit inference engine (AGENTS.md)

CLI arguments must use kebab-case (e.g., --use-cuda-graph, not --use_cuda_graph)

Files:

  • newton/_src/utils/render.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/utils/selection.py
  • newton/utils.py
  • newton/_src/solvers/solver.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/_src/utils/mesh.py
  • newton/_src/solvers/style3d/linear_solver.py
newton/examples/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

newton/examples/**/*.py: Examples must not import from newton._src, only from the public Newton API
Examples must follow the format with an Example class and must be registered in README.md with a uv run command and screenshot
Examples must implement a test_final() method that verifies the simulation state is valid after the example has run
Examples may optionally implement a test_post_step() method that is evaluated after every step() call

Files:

  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
🧠 Learnings (20)
📓 Common learnings
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/solvers/featherstone/kernels.py:75-75
Timestamp: 2025-08-12T18:04:06.577Z
Learning: The Newton physics framework requires nightly Warp builds, which means compatibility concerns with older stable Warp versions (like missing functions such as wp.spatial_adjoint) are not relevant for this project.
Learnt from: shi-eric
Repo: newton-physics/newton PR: 521
File: newton/examples/example_cloth_hanging.py:36-36
Timestamp: 2025-08-12T05:17:34.423Z
Learning: The Newton migration guide (docs/migration.rst) is specifically for documenting how to migrate existing warp.sim functionality to Newton equivalents. New Newton-only features that didn't exist in warp.sim do not need migration documentation.
📚 Learning: 2026-01-13T03:11:40.556Z
Learnt from: jumyungc
Repo: newton-physics/newton PR: 1333
File: newton/_src/sim/builder.py:0-0
Timestamp: 2026-01-13T03:11:40.556Z
Learning: Ensure all VBD damping semantics follow Rayleigh-style damping and are unitless. This convention, demonstrated in SolverVBD, should be applied consistently across all VBD-related constraints in the codebase. In newton/_src/sim/builder.py, validate that any damping terms use the same normalization and are treated as dimensionless; add comments and unit tests to enforce consistency across VBD components.

Applied to files:

  • newton/_src/utils/render.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/utils/selection.py
  • newton/utils.py
  • newton/_src/solvers/solver.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/_src/utils/mesh.py
  • newton/_src/solvers/style3d/linear_solver.py
📚 Learning: 2025-09-18T07:05:56.836Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 750
File: newton/_src/solvers/implicit_mpm/solve_rheology.py:969-986
Timestamp: 2025-09-18T07:05:56.836Z
Learning: In newton/_src/solvers/implicit_mpm/solve_rheology.py, transposed_strain_mat parameter cannot be None - the type signature was corrected to reflect this guarantee, eliminating the need for None checks when accessing transposed_strain_mat.offsets.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/solvers/style3d/linear_solver.py
📚 Learning: 2025-08-19T12:27:30.629Z
Learnt from: preist-nvidia
Repo: newton-physics/newton PR: 579
File: newton/examples/example_mujoco.py:350-354
Timestamp: 2025-08-19T12:27:30.629Z
Learning: In Newton examples, there's a distinction between solver parameters and Example class attributes. The Example class can have its own use_mujoco attribute for controlling example-level behavior (like CUDA graphs, rendering logic), while the solver uses use_mujoco_cpu for backend selection. These serve different purposes and should not be conflated during API renames.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
📚 Learning: 2025-10-29T14:55:48.171Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 940
File: newton/examples/mpm/example_mpm_granular.py:92-101
Timestamp: 2025-10-29T14:55:48.171Z
Learning: In newton/examples/mpm/example_mpm_granular.py, the capture() method intentionally advances the simulation state once during CUDA graph capture. This is expected behavior because CUDA graph capture records exact memory addresses, so the state arrays (state_0, state_1) cannot be reset or reallocated after capture without invalidating the graph.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
📚 Learning: 2025-12-12T15:23:30.014Z
Learnt from: vastsoun
Repo: newton-physics/newton PR: 1019
File: newton/_src/solvers/kamino/examples/sim/example_sim_basics_boxes_fourbar.py:149-163
Timestamp: 2025-12-12T15:23:30.014Z
Learning: In Kamino simulation examples under newton/_src/solvers/kamino/examples/sim/, the pattern where logging=True and use_cuda_graph=True creates a mismatch (SimulationLogger constructed but settings.compute_metrics and logger.log() calls guarded by `if not self.use_cuda_graph`) should not be flagged. These examples will be refactored in a future commit, and this pattern is intentionally deferred.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
📚 Learning: 2025-08-12T18:04:06.577Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/solvers/featherstone/kernels.py:75-75
Timestamp: 2025-08-12T18:04:06.577Z
Learning: The Newton physics framework requires nightly Warp builds, which means compatibility concerns with older stable Warp versions (like missing functions such as wp.spatial_adjoint) are not relevant for this project.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/_src/solvers/style3d/linear_solver.py
📚 Learning: 2025-08-12T05:17:34.423Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 521
File: newton/examples/example_cloth_hanging.py:36-36
Timestamp: 2025-08-12T05:17:34.423Z
Learning: The Newton migration guide (docs/migration.rst) is specifically for documenting how to migrate existing warp.sim functionality to Newton equivalents. New Newton-only features that didn't exist in warp.sim do not need migration documentation.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/_src/solvers/style3d/linear_solver.py
📚 Learning: 2025-08-12T17:52:15.009Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/utils/import_mjcf.py:226-231
Timestamp: 2025-08-12T17:52:15.009Z
Learning: In the Newton codebase, when passing array-like objects (numpy arrays, lists, tuples) to wp.vec3(), the consistent pattern is to use the unpacking operator: wp.vec3(*array) rather than wp.vec3(array). This pattern is used throughout newton/_src/utils/import_mjcf.py and newton/_src/core/types.py.

Applied to files:

  • newton/_src/utils/selection.py
📚 Learning: 2026-01-13T07:40:13.635Z
Learnt from: CR
Repo: newton-physics/newton PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-13T07:40:13.635Z
Learning: Applies to newton/**/*.py : Any user-facing class/function/object added under `_src` must be exposed via the public Newton API through re-exports

Applied to files:

  • newton/utils.py
📚 Learning: 2025-08-12T17:51:37.474Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/geometry.py:16-22
Timestamp: 2025-08-12T17:51:37.474Z
Learning: In the Newton public API refactor, common geometry symbols like ParticleFlags and ShapeFlags are now exposed at the top level in newton/__init__.py rather than through newton.geometry. The newton/geometry.py module is intentionally focused only on broad-phase collision detection classes (BroadPhaseAllPairs, BroadPhaseExplicit, BroadPhaseSAP).

Applied to files:

  • newton/utils.py
📚 Learning: 2025-08-14T17:38:36.106Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/__init__.py:25-29
Timestamp: 2025-08-14T17:38:36.106Z
Learning: The Newton project prefers incremental __all__ building using __all__ += [...] pattern to group exports with their related imports, rather than a single consolidated __all__ at the end of the file.

Applied to files:

  • newton/utils.py
📚 Learning: 2026-01-13T07:40:13.635Z
Learnt from: CR
Repo: newton-physics/newton PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-13T07:40:13.635Z
Learning: Applies to newton/examples/**/*.py : Examples must not import from `newton._src`, only from the public Newton API

Applied to files:

  • newton/utils.py
📚 Learning: 2025-08-12T17:58:00.815Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/solvers/featherstone/kernels.py:18-20
Timestamp: 2025-08-12T17:58:00.815Z
Learning: In newton/_src/core/__init__.py, the function transform_twist is properly re-exported from the spatial module via "from .spatial import (..., transform_twist, ...)" and included in __all__, making it available for import as "from ...core import transform_twist" from other modules.

Applied to files:

  • newton/utils.py
📚 Learning: 2026-01-13T07:40:13.635Z
Learnt from: CR
Repo: newton-physics/newton PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-13T07:40:13.635Z
Learning: Applies to newton/_src/**/*.py : The `newton/_src/` directory is internal library implementation only and must not be imported by user code (examples, documentation, or external users)

Applied to files:

  • newton/utils.py
📚 Learning: 2025-09-22T21:08:31.901Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 806
File: newton/examples/ik/example_ik_franka.py:121-123
Timestamp: 2025-09-22T21:08:31.901Z
Learning: In the newton physics framework, when creating warp arrays for IK solver joint variables using wp.array(self.model.joint_q, shape=(1, coord_count)), the resulting array acts as a reference/pointer to the original model's joint coordinates, so updates from the IK solver automatically reflect in the model's joint_q buffer used for rendering, despite the general warp documentation suggesting copies are made by default.

Applied to files:

  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/_src/solvers/style3d/linear_solver.py
📚 Learning: 2025-12-12T08:45:43.428Z
Learnt from: nvtw
Repo: newton-physics/newton PR: 1221
File: newton/examples/example_sdf.py:277-287
Timestamp: 2025-12-12T08:45:43.428Z
Learning: In Newtown (Newton) example code, specifically files under newton/examples, computing contacts once per frame and reusing them across all substeps is an intentional design choice, not a bug. Reviewers should verify that contacts are computed before the substep loop and reused for every substep within the same frame. This pattern reduces redundant work and preserves frame-consistency; do not flag as a regression unless the behavior is changed for correctness or performance reasons.

Applied to files:

  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
📚 Learning: 2025-09-17T21:34:05.267Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 750
File: newton/examples/mpm/example_mpm_granular.py:44-47
Timestamp: 2025-09-17T21:34:05.267Z
Learning: wp.Mesh (Warp mesh objects) expose triangle indices through the `indices` attribute, not `triangles`. The correct usage is `wp.Mesh(...).indices`, not `wp.Mesh(...).triangles`.

Applied to files:

  • newton/_src/utils/mesh.py
📚 Learning: 2025-08-12T05:17:34.423Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 521
File: newton/examples/example_cloth_hanging.py:36-36
Timestamp: 2025-08-12T05:17:34.423Z
Learning: The STYLE3D solver in Newton is a new solver that did not exist in warp.sim, so it does not require any migration documentation.

Applied to files:

  • newton/_src/solvers/style3d/linear_solver.py
📚 Learning: 2025-08-25T20:10:59.536Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 634
File: newton/examples/ik/example_ik_franka.py:0-0
Timestamp: 2025-08-25T20:10:59.536Z
Learning: In Newton's IK examples, when creating solver arrays with `wp.array(source_array, shape=new_shape)`, this creates a view into the same underlying memory rather than a copy. This means updates to the reshaped array are automatically reflected in the original array without needing explicit copy operations like `wp.copy()`.

Applied to files:

  • newton/_src/solvers/style3d/linear_solver.py
🧬 Code graph analysis (4)
newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py (2)
newton/_src/sim/contacts.py (1)
  • device (110-114)
newton/_src/solvers/solver.py (1)
  • device (169-176)
newton/utils.py (2)
newton/_src/utils/mesh.py (3)
  • MeshAdjacency (53-111)
  • MeshEdge (27-50)
  • solidify_mesh (715-754)
newton/_src/utils/render.py (2)
  • bourke_color_map (21-60)
  • copy_rgb_frame_uint8 (64-93)
newton/_src/solvers/solver.py (1)
newton/_src/sim/contacts.py (1)
  • device (110-114)
newton/examples/diffsim/example_diffsim_soft_body.py (1)
newton/_src/utils/render.py (1)
  • bourke_color_map (21-60)
🪛 Ruff (0.14.11)
newton/utils.py

61-61: Unused noqa directive (non-enabled: E402)

Remove unused noqa directive

(RUF100)

newton/_src/utils/mesh.py

65-65: Unused method argument: num_tris

(ARG002)

newton/_src/solvers/style3d/linear_solver.py

230-230: Unused noqa directive (non-enabled: PLC0415)

Remove unused noqa directive

(RUF100)

⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Run GPU Benchmarks / Run GPU Benchmarks on AWS EC2
🔇 Additional comments (13)
newton/_src/solvers/solver.py (1)

168-176: LGTM!

The return type annotation update from wp.context.Device to wp.Device correctly addresses the Warp deprecation warning by using the public API instead of the internal path. The docstring is already consistent with the new type annotation.

newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py (1)

1741-1741: LGTM! Clean simplification of CUDA graph support check.

The change correctly uses the public Warp API wp.is_conditional_graph_supported() to gate CUDA graph usage on both device type and runtime capability.

newton/_src/utils/render.py (1)

63-93: LGTM!

The kernel correctly handles the coordinate flip from OpenGL's bottom-left origin to top-left origin. The launch dimension documentation is clear and the indexing logic is sound.

newton/examples/diffsim/example_diffsim_spring_cage.py (2)

33-33: LGTM!

Correctly imports bourke_color_map from the public Newton API (newton.utils) instead of internal Warp symbols, adhering to the coding guidelines.


268-268: LGTM!

The call site correctly uses the imported bourke_color_map function with the expected arguments.

newton/_src/utils/mesh.py (4)

26-51: LGTM!

Well-documented dataclass with clear field descriptions and boundary edge handling conventions.


65-79: LGTM!

The num_tris parameter is intentionally kept for API compatibility as documented. The edge construction correctly processes all three edges per triangle.


81-112: LGTM!

Correct edge adjacency logic with proper handling of boundary edges and non-manifold detection.


715-754: LGTM on the wrapper logic.

The function correctly handles thickness conversion and array marshalling. The main concern is the kernel's race condition noted above.

newton/utils.py (2)

32-56: LGTM!

Correctly re-exports MeshAdjacency, MeshEdge, and solidify_mesh from the internal implementation to the public API surface, following the established pattern.


58-69: LGTM!

Correctly exposes bourke_color_map and copy_rgb_frame_uint8 via the public API. The noqa: E402 comment maintains consistency with the rest of the file's import pattern, though Ruff notes it may be unnecessary.

newton/examples/diffsim/example_diffsim_soft_body.py (2)

37-37: LGTM!

Correctly imports bourke_color_map from the public Newton API (newton.utils) instead of internal Warp symbols, adhering to the coding guidelines.


356-356: LGTM!

The call site correctly uses the imported bourke_color_map function. The loss_history access is safe since render() is called after step() which populates the list.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@christophercrouzet christophercrouzet force-pushed the ccrouzet/fix-warp-deprecations branch from 44e0fbd to aad7eac Compare January 14, 2026 21:45
@christophercrouzet christophercrouzet marked this pull request as ready for review January 14, 2026 22:29
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@pyproject.toml`:
- Line 28: The specified nightly version in the dependency string dependencies =
["warp-lang>=1.12.0.dev20251219"] is invalid on the NVIDIA PyPI index; update
that version to an existing nightly (for example change it to dependencies =
["warp-lang>=1.12.0.dev20251231"] or a newer dev build) so the package resolver
can find the release.
♻️ Duplicate comments (3)
newton/_src/utils/mesh.py (1)

652-713: Race condition on shared vertex writes persists.

This issue was identified in previous reviews but remains unaddressed. The kernel computes a per-triangle face normal and writes to out_vertices[i*2], out_vertices[j*2], etc. When a vertex is shared by multiple triangles with different face normals, multiple threads write conflicting values to the same output locations, resulting in non-deterministic geometry.

The recommended fixes from previous reviews remain valid:

  1. Pre-compute per-vertex averaged normals in a separate kernel pass
  2. Duplicate vertices per-face (change output to num_triangles * 6 vertices)
newton/utils.py (1)

61-64: Remove unused # noqa: E402 directive.

Ruff reports this directive is unused since E402 is not enabled.

Proposed diff
-from ._src.utils.render import (  # noqa: E402
+from ._src.utils.render import (
     bourke_color_map,
     copy_rgb_frame_uint8,
 )
newton/_src/utils/render.py (1)

21-60: Guard against division by zero when low == high.

When low == high, dv = 0 and the subsequent divisions will raise ZeroDivisionError. This edge case can occur when all values in a dataset are identical.

Proposed fix
     if v > high:
         v = high
     dv = high - low
+
+    if dv == 0.0:
+        return c  # Return default white color for degenerate range

     if v < (low + 0.25 * dv):
🧹 Nitpick comments (2)
newton/_src/solvers/style3d/linear_solver.py (1)

230-230: Remove unused noqa directive.

The # noqa: PLC0415 directive is flagged as unused because the PLC0415 rule (import-outside-toplevel) is not enabled in the linter configuration.

Suggested fix
-    from warp._src.context import runtime  # noqa: PLC0415
+    from warp._src.context import runtime
newton/_src/sim/builder.py (1)

5481-5494: MeshAdjacency swap looks correct; consider locking dtype for edge_indices. np.fromiter(..., int) produces platform int (often int64), then gets fed into later int32 paths; not usually wrong, but easy to make deterministic/consistent. Also, ensure MeshEdge fields o0/o1/v0/v1 match the new MeshEdge definition.

Proposed tweak (dtype stability)
-        edge_indices = np.fromiter(
+        edge_indices = np.fromiter(
             (x for e in adj.edges.values() for x in (e.o0, e.o1, e.v0, e.v1)),
-            int,
+            dtype=np.int32,
         ).reshape(-1, 4)
📜 Review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 44e0fbd and aad7eac.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (31)
  • docs/generate_api.py
  • newton/_src/core/types.py
  • newton/_src/geometry/sdf_mc.py
  • newton/_src/sim/builder.py
  • newton/_src/sim/contacts.py
  • newton/_src/sim/graph_coloring.py
  • newton/_src/sim/style3d/builder_style3d.py
  • newton/_src/solvers/implicit_mpm/solve_rheology.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/solvers/solver.py
  • newton/_src/solvers/style3d/collision/bvh/bvh.py
  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/solvers/vbd/particle_vbd_kernels.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/utils/__init__.py
  • newton/_src/utils/import_mjcf.py
  • newton/_src/utils/mesh.py
  • newton/_src/utils/recorder.py
  • newton/_src/utils/render.py
  • newton/_src/utils/selection.py
  • newton/_src/viewer/viewer.py
  • newton/_src/viewer/viewer_gl.py
  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/examples/diffsim/example_diffsim_cloth.py
  • newton/examples/diffsim/example_diffsim_drone.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/examples/robot/example_robot_anymal_c_walk.py
  • newton/tests/test_coloring.py
  • newton/utils.py
  • pyproject.toml
🚧 Files skipped from review as they are similar to previous changes (15)
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/_src/viewer/viewer.py
  • newton/_src/solvers/solver.py
  • newton/_src/utils/init.py
  • newton/_src/sim/graph_coloring.py
  • newton/tests/test_coloring.py
  • newton/_src/utils/import_mjcf.py
  • newton/_src/geometry/sdf_mc.py
  • newton/examples/robot/example_robot_anymal_c_walk.py
  • newton/_src/core/types.py
  • newton/_src/solvers/vbd/particle_vbd_kernels.py
  • docs/generate_api.py
  • newton/_src/viewer/viewer_gl.py
  • newton/examples/diffsim/example_diffsim_cloth.py
  • newton/_src/solvers/style3d/collision/bvh/bvh.py
🧰 Additional context used
📓 Path-based instructions (5)
newton/_src/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

The newton/_src/ directory is internal library implementation only and must not be imported by user code (examples, documentation, or external users)

Files:

  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/sim/style3d/builder_style3d.py
  • newton/_src/utils/recorder.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/utils/render.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/utils/mesh.py
  • newton/_src/sim/builder.py
  • newton/_src/solvers/implicit_mpm/solve_rheology.py
  • newton/_src/utils/selection.py
  • newton/_src/sim/contacts.py
newton/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Any user-facing class/function/object added under _src must be exposed via the public Newton API through re-exports

Files:

  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/sim/style3d/builder_style3d.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/_src/utils/recorder.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/utils/render.py
  • newton/examples/diffsim/example_diffsim_drone.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/utils/mesh.py
  • newton/_src/sim/builder.py
  • newton/_src/solvers/implicit_mpm/solve_rheology.py
  • newton/_src/utils/selection.py
  • newton/_src/sim/contacts.py
  • newton/utils.py
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

**/*.py: Use prefix-first naming for classes: ActuatorPD, ActuatorPID (not PDActuator, PIDActuator)
Use prefix-first naming for methods: add_shape_sphere() (not add_sphere_shape())
Method names must use snake_case
Prefer nested classes when self-contained: if a helper type or enum is only meaningful inside one parent class and doesn't need a public identity, define it as a nested class instead of a top-level class/module
Follow PEP 8 for Python code
Use Google-style docstrings with clear, concise explanations of what functions do, their parameters, and return values

Files:

  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/sim/style3d/builder_style3d.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/_src/utils/recorder.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/utils/render.py
  • newton/examples/diffsim/example_diffsim_drone.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/utils/mesh.py
  • newton/_src/sim/builder.py
  • newton/_src/solvers/implicit_mpm/solve_rheology.py
  • newton/_src/utils/selection.py
  • newton/_src/sim/contacts.py
  • newton/utils.py
**/*

📄 CodeRabbit inference engine (AGENTS.md)

CLI arguments must use kebab-case (e.g., --use-cuda-graph, not --use_cuda_graph)

Files:

  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/sim/style3d/builder_style3d.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/examples/diffsim/example_diffsim_ball.py
  • pyproject.toml
  • newton/_src/utils/recorder.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/utils/render.py
  • newton/examples/diffsim/example_diffsim_drone.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/utils/mesh.py
  • newton/_src/sim/builder.py
  • newton/_src/solvers/implicit_mpm/solve_rheology.py
  • newton/_src/utils/selection.py
  • newton/_src/sim/contacts.py
  • newton/utils.py
newton/examples/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

newton/examples/**/*.py: Examples must not import from newton._src, only from the public Newton API
Examples must follow the format with an Example class and must be registered in README.md with a uv run command and screenshot
Examples must implement a test_final() method that verifies the simulation state is valid after the example has run
Examples may optionally implement a test_post_step() method that is evaluated after every step() call

Files:

  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/examples/diffsim/example_diffsim_drone.py
🧠 Learnings (36)
📓 Common learnings
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/solvers/featherstone/kernels.py:75-75
Timestamp: 2025-08-12T18:04:06.577Z
Learning: The Newton physics framework requires nightly Warp builds, which means compatibility concerns with older stable Warp versions (like missing functions such as wp.spatial_adjoint) are not relevant for this project.
Learnt from: shi-eric
Repo: newton-physics/newton PR: 521
File: newton/examples/example_cloth_hanging.py:36-36
Timestamp: 2025-08-12T05:17:34.423Z
Learning: The Newton migration guide (docs/migration.rst) is specifically for documenting how to migrate existing warp.sim functionality to Newton equivalents. New Newton-only features that didn't exist in warp.sim do not need migration documentation.
Learnt from: shi-eric
Repo: newton-physics/newton PR: 461
File: asv/benchmarks/envs/example_humanoid.py:40-41
Timestamp: 2025-07-23T14:36:42.182Z
Learning: In Warp benchmarks, explicit wp.init() calls are not needed in most circumstances since the first Warp API call that requires initialization will automatically call wp.init(). Explicit wp.init() in setup() methods is helpful when the ASV benchmark is measuring a Warp API call, as wp.init() has non-trivial overhead that should be excluded from the benchmark timing.
📚 Learning: 2025-08-12T05:17:34.423Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 521
File: newton/examples/example_cloth_hanging.py:36-36
Timestamp: 2025-08-12T05:17:34.423Z
Learning: The STYLE3D solver in Newton is a new solver that did not exist in warp.sim, so it does not require any migration documentation.

Applied to files:

  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/solvers/implicit_mpm/solve_rheology.py
📚 Learning: 2025-09-18T07:05:56.836Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 750
File: newton/_src/solvers/implicit_mpm/solve_rheology.py:969-986
Timestamp: 2025-09-18T07:05:56.836Z
Learning: In newton/_src/solvers/implicit_mpm/solve_rheology.py, transposed_strain_mat parameter cannot be None - the type signature was corrected to reflect this guarantee, eliminating the need for None checks when accessing transposed_strain_mat.offsets.

Applied to files:

  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/solvers/implicit_mpm/solve_rheology.py
📚 Learning: 2025-08-12T05:17:34.423Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 521
File: newton/examples/example_cloth_hanging.py:36-36
Timestamp: 2025-08-12T05:17:34.423Z
Learning: The Newton migration guide (docs/migration.rst) is specifically for documenting how to migrate existing warp.sim functionality to Newton equivalents. New Newton-only features that didn't exist in warp.sim do not need migration documentation.

Applied to files:

  • newton/_src/solvers/style3d/linear_solver.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • pyproject.toml
  • newton/_src/utils/recorder.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/examples/diffsim/example_diffsim_drone.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/sim/builder.py
  • newton/_src/solvers/implicit_mpm/solve_rheology.py
  • newton/_src/sim/contacts.py
📚 Learning: 2025-09-22T21:08:31.901Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 806
File: newton/examples/ik/example_ik_franka.py:121-123
Timestamp: 2025-09-22T21:08:31.901Z
Learning: In the newton physics framework, when creating warp arrays for IK solver joint variables using wp.array(self.model.joint_q, shape=(1, coord_count)), the resulting array acts as a reference/pointer to the original model's joint coordinates, so updates from the IK solver automatically reflect in the model's joint_q buffer used for rendering, despite the general warp documentation suggesting copies are made by default.

Applied to files:

  • newton/_src/solvers/style3d/linear_solver.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/examples/diffsim/example_diffsim_drone.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-08-12T18:04:06.577Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/solvers/featherstone/kernels.py:75-75
Timestamp: 2025-08-12T18:04:06.577Z
Learning: The Newton physics framework requires nightly Warp builds, which means compatibility concerns with older stable Warp versions (like missing functions such as wp.spatial_adjoint) are not relevant for this project.

Applied to files:

  • newton/_src/solvers/style3d/linear_solver.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • pyproject.toml
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/sim/builder.py
📚 Learning: 2026-01-13T03:11:40.556Z
Learnt from: jumyungc
Repo: newton-physics/newton PR: 1333
File: newton/_src/sim/builder.py:0-0
Timestamp: 2026-01-13T03:11:40.556Z
Learning: Ensure all VBD damping semantics follow Rayleigh-style damping and are unitless. This convention, demonstrated in SolverVBD, should be applied consistently across all VBD-related constraints in the codebase. In newton/_src/sim/builder.py, validate that any damping terms use the same normalization and are treated as dimensionless; add comments and unit tests to enforce consistency across VBD components.

Applied to files:

  • newton/_src/solvers/style3d/linear_solver.py
  • newton/_src/sim/style3d/builder_style3d.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/_src/utils/recorder.py
  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
  • newton/_src/utils/render.py
  • newton/examples/diffsim/example_diffsim_drone.py
  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
  • newton/_src/utils/mesh.py
  • newton/_src/sim/builder.py
  • newton/_src/solvers/implicit_mpm/solve_rheology.py
  • newton/_src/utils/selection.py
  • newton/_src/sim/contacts.py
  • newton/utils.py
📚 Learning: 2025-09-17T21:34:05.267Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 750
File: newton/examples/mpm/example_mpm_granular.py:44-47
Timestamp: 2025-09-17T21:34:05.267Z
Learning: wp.Mesh (Warp mesh objects) expose triangle indices through the `indices` attribute, not `triangles`. The correct usage is `wp.Mesh(...).indices`, not `wp.Mesh(...).triangles`.

Applied to files:

  • newton/_src/sim/style3d/builder_style3d.py
  • newton/_src/utils/mesh.py
  • newton/_src/sim/builder.py
📚 Learning: 2025-12-12T08:45:43.428Z
Learnt from: nvtw
Repo: newton-physics/newton PR: 1221
File: newton/examples/example_sdf.py:277-287
Timestamp: 2025-12-12T08:45:43.428Z
Learning: In Newtown (Newton) example code, specifically files under newton/examples, computing contacts once per frame and reusing them across all substeps is an intentional design choice, not a bug. Reviewers should verify that contacts are computed before the substep loop and reused for every substep within the same frame. This pattern reduces redundant work and preserves frame-consistency; do not flag as a regression unless the behavior is changed for correctness or performance reasons.

Applied to files:

  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/examples/diffsim/example_diffsim_drone.py
📚 Learning: 2026-01-13T07:40:13.635Z
Learnt from: CR
Repo: newton-physics/newton PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-13T07:40:13.635Z
Learning: Applies to newton/examples/**/*.py : Examples must not import from `newton._src`, only from the public Newton API

Applied to files:

  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/utils.py
📚 Learning: 2025-08-27T23:33:32.527Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 660
File: pyproject.toml:28-28
Timestamp: 2025-08-27T23:33:32.527Z
Learning: In Python projects, it's normal and correct to have different warp-lang version specifications across files: pyproject.toml should specify minimum compatible versions using >= for flexibility, while specific environments like asv.conf.json can pin exact versions using == for reproducibility. These serve different purposes and should not be "aligned" to the same version.

Applied to files:

  • pyproject.toml
📚 Learning: 2025-10-04T06:44:52.713Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 879
File: .gitlab-ci.yml:125-145
Timestamp: 2025-10-04T06:44:52.713Z
Learning: In the Newton project, the "linux-x86_64 test warp nightly" GitLab CI job intentionally runs on every pipeline (not limited to `.test_common` rules) to detect Warp nightly integration issues early, since Warp nightly releases are unpredictable. This design is acceptable because `allow_failure: true` prevents blocking the pipeline.

Applied to files:

  • pyproject.toml
📚 Learning: 2025-08-27T23:32:48.670Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 660
File: pyproject.toml:54-59
Timestamp: 2025-08-27T23:32:48.670Z
Learning: In the newton project's pyproject.toml, self-referential extras (e.g., `examples = ["newton[sim]", "newton[importers]", ...]`) are normal and encouraged for dependency management, rather than inlining the dependencies.

Applied to files:

  • pyproject.toml
📚 Learning: 2025-08-25T20:10:51.009Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 634
File: newton/examples/ik/example_ik_h1.py:0-0
Timestamp: 2025-08-25T20:10:51.009Z
Learning: In Warp, creating a new wp.array() with an existing array and different shape (e.g., wp.array(existing_array, shape=new_shape)) creates a view into the same underlying memory buffer, not a copy. This means modifications through either view are automatically reflected in both arrays.

Applied to files:

  • newton/_src/utils/recorder.py
📚 Learning: 2025-08-19T12:27:30.629Z
Learnt from: preist-nvidia
Repo: newton-physics/newton PR: 579
File: newton/examples/example_mujoco.py:350-354
Timestamp: 2025-08-19T12:27:30.629Z
Learning: In Newton examples, there's a distinction between solver parameters and Example class attributes. The Example class can have its own use_mujoco attribute for controlling example-level behavior (like CUDA graphs, rendering logic), while the solver uses use_mujoco_cpu for backend selection. These serve different purposes and should not be conflated during API renames.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
📚 Learning: 2025-12-12T15:23:30.014Z
Learnt from: vastsoun
Repo: newton-physics/newton PR: 1019
File: newton/_src/solvers/kamino/examples/sim/example_sim_basics_boxes_fourbar.py:149-163
Timestamp: 2025-12-12T15:23:30.014Z
Learning: In Kamino simulation examples under newton/_src/solvers/kamino/examples/sim/, the pattern where logging=True and use_cuda_graph=True creates a mismatch (SimulationLogger constructed but settings.compute_metrics and logger.log() calls guarded by `if not self.use_cuda_graph`) should not be flagged. These examples will be refactored in a future commit, and this pattern is intentionally deferred.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
📚 Learning: 2025-10-29T14:55:48.171Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 940
File: newton/examples/mpm/example_mpm_granular.py:92-101
Timestamp: 2025-10-29T14:55:48.171Z
Learning: In newton/examples/mpm/example_mpm_granular.py, the capture() method intentionally advances the simulation state once during CUDA graph capture. This is expected behavior because CUDA graph capture records exact memory addresses, so the state arrays (state_0, state_1) cannot be reset or reallocated after capture without invalidating the graph.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
📚 Learning: 2025-08-19T12:27:30.629Z
Learnt from: preist-nvidia
Repo: newton-physics/newton PR: 579
File: newton/examples/example_mujoco.py:350-354
Timestamp: 2025-08-19T12:27:30.629Z
Learning: In Newton examples, Example.use_mujoco is a high-level attribute that controls whether to use MuJoCo solver vs other solvers (like XPBD), while SolverMuJoCo.use_mujoco_cpu controls the backend within MuJoCo (CPU vs Warp). These are separate concepts serving different purposes - the PR rename only applies to the solver parameter, not the Example class attributes.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py
📚 Learning: 2025-08-12T17:52:15.009Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/utils/import_mjcf.py:226-231
Timestamp: 2025-08-12T17:52:15.009Z
Learning: In the Newton codebase, when passing array-like objects (numpy arrays, lists, tuples) to wp.vec3(), the consistent pattern is to use the unpacking operator: wp.vec3(*array) rather than wp.vec3(array). This pattern is used throughout newton/_src/utils/import_mjcf.py and newton/_src/core/types.py.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-09-22T21:08:31.901Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 806
File: newton/examples/ik/example_ik_franka.py:121-123
Timestamp: 2025-09-22T21:08:31.901Z
Learning: In the newton physics framework, when creating warp arrays for IK solver joint variables using wp.array(self.model.joint_q, shape=(1, coord_count)), the resulting array acts as a reference/pointer to the original model's joint coordinates, so updates from the IK solver automatically reflect in the model's joint_q buffer used for rendering.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-08-18T15:56:26.587Z
Learnt from: adenzler-nvidia
Repo: newton-physics/newton PR: 552
File: newton/_src/solvers/mujoco/solver_mujoco.py:0-0
Timestamp: 2025-08-18T15:56:26.587Z
Learning: In Newton's MuJoCo solver, when transforming joint axes from Newton's internal frame to MuJoCo's expected frame, use wp.quat_rotate(joint_rot, axis) not wp.quat_rotate_inv(joint_rot, axis). The joint_rot represents rotation from joint-local to body frame, so forward rotation is correct.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-09-25T16:14:22.033Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 806
File: newton/_src/sim/ik/ik_objectives.py:0-0
Timestamp: 2025-09-25T16:14:22.033Z
Learning: In NVIDIA Warp's Newton physics library, wp.transform supports direct numerical indexing (e.g., body_tf[0], body_tf[1], body_tf[2] for position and body_tf[3], body_tf[4], body_tf[5], body_tf[6] for quaternion components) to access its elements. This is the standard API used throughout the codebase.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-11-24T10:44:09.613Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 1108
File: newton/_src/solvers/implicit_mpm/rasterized_collisions.py:94-129
Timestamp: 2025-11-24T10:44:09.613Z
Learning: In Warp, wp.normalize() returns a zero vector (or zero quaternion) when given a zero-length input, so explicit zero-length checks before normalization are not required.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-12-01T17:00:28.889Z
Learnt from: camevor
Repo: newton-physics/newton PR: 1161
File: newton/_src/solvers/mujoco/kernels.py:1268-1268
Timestamp: 2025-12-01T17:00:28.889Z
Learning: MuJoCo Warp spatial vectors (e.g., cacc, cvel) use the convention (angular, linear), which is opposite to Newton's (linear, angular) convention. When converting from MuJoCo Warp to Newton format, spatial_top() on MuJoCo Warp data extracts the angular component, and spatial_bottom() extracts the linear component.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-11-28T11:12:40.805Z
Learnt from: camevor
Repo: newton-physics/newton PR: 1146
File: newton/examples/basic/example_basic_joints.py:206-213
Timestamp: 2025-11-28T11:12:40.805Z
Learning: In Newton's standard solvers (XPBD, SemiImplicit, SolverMuJoCo), spatial vectors in State.body_qd use the ordering (linear, angular): wp.spatial_top(qd) returns linear velocity and wp.spatial_bottom(qd) returns angular velocity. This is the opposite of typical Modern Robotics spatial twist notation where (angular, linear) is used.

Applied to files:

  • newton/_src/solvers/vbd/rigid_vbd_kernels.py
📚 Learning: 2025-09-26T05:58:21.013Z
Learnt from: WenchaoHuang
Repo: newton-physics/newton PR: 835
File: newton/_src/solvers/style3d/collision/collision.py:49-53
Timestamp: 2025-09-26T05:58:21.013Z
Learning: In newton/_src/solvers/style3d/collision/collision.py, the broad_phase buffers (broad_phase_ee, broad_phase_ef, broad_phase_vf) created with wp.array() don't need zero-initialization because they follow a write-first-read-later pattern: BVH query kernels in frame_begin() populate these buffers completely (write-only operations), and collision kernels only read from them afterward in accumulate_contact_force(), ensuring no undefined reads occur.

Applied to files:

  • newton/_src/utils/mesh.py
  • newton/_src/solvers/implicit_mpm/solve_rheology.py
📚 Learning: 2025-12-12T17:45:26.847Z
Learnt from: vastsoun
Repo: newton-physics/newton PR: 1019
File: newton/_src/solvers/kamino/geometry/primitives.py:0-0
Timestamp: 2025-12-12T17:45:26.847Z
Learning: In newton/_src/solvers/kamino/geometry/primitives.py, the narrow-phase kernel `_primitive_narrowphase` does not need to handle symmetric shape-pair orderings (e.g., both SPHERE-BOX and BOX-SPHERE) because `kamino.core.builder.ModelBuilder` and `kamino.geometry.primitive.broadphase` guarantee that explicit candidate geometry pairs are always defined with GIDs in ascending order.

Applied to files:

  • newton/_src/utils/mesh.py
📚 Learning: 2026-01-12T10:11:39.312Z
Learnt from: nvtw
Repo: newton-physics/newton PR: 1314
File: newton/_src/sim/builder.py:6061-6091
Timestamp: 2026-01-12T10:11:39.312Z
Learning: In finalize() validation logic (e.g., newton/_src/sim/builder.py and similar files), keep the validation lightweight. Do not add union-find/connected-components validation for loop joints. The current behavior—allowing non-articulated joints when the child is in any articulation—is acceptable. Avoid overengineering here.

Applied to files:

  • newton/_src/sim/builder.py
📚 Learning: 2026-01-13T03:11:40.555Z
Learnt from: jumyungc
Repo: newton-physics/newton PR: 1333
File: newton/_src/sim/builder.py:0-0
Timestamp: 2026-01-13T03:11:40.555Z
Learning: In newton/_src/sim/builder.py, follow VBD conventions: treat radians as dimensionless. Prefer wording 'torque per radian' instead of writing 'N·m/rad' in any docs, strings, or generated text within this file. Ensure consistent usage in docstrings, comments, and documentation strings associated with this module.

Applied to files:

  • newton/_src/sim/builder.py
📚 Learning: 2025-09-09T11:03:41.928Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 750
File: newton/_src/solvers/implicit_mpm/solve_rheology.py:892-895
Timestamp: 2025-09-09T11:03:41.928Z
Learning: In newton/_src/solvers/implicit_mpm/solve_rheology.py, passing None for compliance_mat_diagonal is intentional to avoid loading zeros from global memory when compliance_mat is None, rather than creating a zero matrix and extracting its diagonal.

Applied to files:

  • newton/_src/solvers/implicit_mpm/solve_rheology.py
📚 Learning: 2026-01-13T07:40:13.635Z
Learnt from: CR
Repo: newton-physics/newton PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-13T07:40:13.635Z
Learning: Applies to newton/**/*.py : Any user-facing class/function/object added under `_src` must be exposed via the public Newton API through re-exports

Applied to files:

  • newton/utils.py
📚 Learning: 2025-08-12T17:51:37.474Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/geometry.py:16-22
Timestamp: 2025-08-12T17:51:37.474Z
Learning: In the Newton public API refactor, common geometry symbols like ParticleFlags and ShapeFlags are now exposed at the top level in newton/__init__.py rather than through newton.geometry. The newton/geometry.py module is intentionally focused only on broad-phase collision detection classes (BroadPhaseAllPairs, BroadPhaseExplicit, BroadPhaseSAP).

Applied to files:

  • newton/utils.py
📚 Learning: 2025-08-14T17:38:36.106Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/__init__.py:25-29
Timestamp: 2025-08-14T17:38:36.106Z
Learning: The Newton project prefers incremental __all__ building using __all__ += [...] pattern to group exports with their related imports, rather than a single consolidated __all__ at the end of the file.

Applied to files:

  • newton/utils.py
📚 Learning: 2025-08-12T17:58:00.815Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/solvers/featherstone/kernels.py:18-20
Timestamp: 2025-08-12T17:58:00.815Z
Learning: In newton/_src/core/__init__.py, the function transform_twist is properly re-exported from the spatial module via "from .spatial import (..., transform_twist, ...)" and included in __all__, making it available for import as "from ...core import transform_twist" from other modules.

Applied to files:

  • newton/utils.py
📚 Learning: 2026-01-13T07:40:13.635Z
Learnt from: CR
Repo: newton-physics/newton PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-13T07:40:13.635Z
Learning: Applies to newton/_src/**/*.py : The `newton/_src/` directory is internal library implementation only and must not be imported by user code (examples, documentation, or external users)

Applied to files:

  • newton/utils.py
📚 Learning: 2025-11-07T01:42:36.906Z
Learnt from: daniela-hase
Repo: newton-physics/newton PR: 1044
File: newton/_src/sensors/tiled_camera_sensor.py:224-256
Timestamp: 2025-11-07T01:42:36.906Z
Learning: In newton/_src/sensors/tiled_camera_sensor.py, the `# noqa: PLC0415` directives on the local PIL imports (lines 224 and 256 in save_color_image and save_depth_image methods) should be kept because they are required by the pre-commit configuration. The local imports are intentional for optional dependency handling.

Applied to files:

  • newton/utils.py
🧬 Code graph analysis (7)
newton/_src/sim/style3d/builder_style3d.py (1)
newton/_src/utils/mesh.py (1)
  • MeshAdjacency (53-111)
newton/examples/diffsim/example_diffsim_spring_cage.py (1)
newton/_src/utils/render.py (1)
  • bourke_color_map (21-60)
newton/examples/diffsim/example_diffsim_ball.py (1)
newton/_src/utils/render.py (1)
  • bourke_color_map (21-60)
newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py (2)
newton/_src/sim/contacts.py (1)
  • device (110-114)
newton/_src/solvers/solver.py (1)
  • device (169-176)
newton/examples/diffsim/example_diffsim_drone.py (1)
newton/_src/utils/render.py (1)
  • bourke_color_map (21-60)
newton/_src/sim/builder.py (1)
newton/_src/utils/mesh.py (1)
  • MeshAdjacency (53-111)
newton/utils.py (1)
newton/_src/utils/mesh.py (4)
  • MeshAdjacency (53-111)
  • MeshEdge (27-50)
  • create_box_mesh (515-580)
  • solidify_mesh (715-754)
🪛 Ruff (0.14.11)
newton/_src/solvers/style3d/linear_solver.py

230-230: Unused noqa directive (non-enabled: PLC0415)

Remove unused noqa directive

(RUF100)

newton/_src/utils/mesh.py

65-65: Unused method argument: num_tris

(ARG002)

newton/utils.py

61-61: Unused noqa directive (non-enabled: E402)

Remove unused noqa directive

(RUF100)

🔇 Additional comments (28)
newton/_src/solvers/style3d/linear_solver.py (1)

242-244: LGTM on the deprecation fix.

The change from type_length to type_size aligns with the Warp v1.11.0 API updates. The surrounding calls to type_size_in_bytes on lines 242-243 remain unchanged and correctly use the public wp.types namespace.

newton/_src/solvers/implicit_mpm/solver_implicit_mpm.py (1)

1741-1741: LGTM! Clean simplification for CUDA graph support check.

The change correctly migrates from the deprecated internal assert_conditional_graph_support to the public wp.is_conditional_graph_supported() API, addressing the Warp v1.11.0 deprecation warnings. The boolean expression is clear and correctly gates CUDA graph usage on both device type and Warp's conditional graph support.

newton/_src/utils/recorder.py (2)

556-557: LGTM!

The migration from wp.context.Device to wp.Device correctly addresses the Warp v1.11.0 deprecation warning by using the public API instead of the internal symbol.


760-764: LGTM!

The migration from wp.types.<dtype> to wp.<dtype> correctly addresses the Warp v1.11.0 deprecation warning. Standard Warp dtypes like uint64, float32, vec3, etc. are accessible directly from the wp namespace as part of the public API.

newton/_src/solvers/implicit_mpm/solve_rheology.py (3)

986-991: LGTM! Velocity delta computation is correct.

The array_axpy call computes prev_collider_velocity = alpha * collider_velocity + beta * prev_collider_velocity, which with alpha=1.0, beta=-1.0 yields collider_velocity - prev_collider_velocity. This correctly computes the velocity delta as documented in the function's docstring, and the result is then aliased as delta_velocity for the subsequent matrix operations.


1442-1442: LGTM! Jacobi stress update is correct.

The array_axpy call with alpha=1.0, beta=1.0 correctly accumulates the delta stress into the local stress: local_stress += delta_stress. This is consistent with the Jacobi iteration logic following the transposed strain matrix multiplication.


23-23: Import path update is correct.

The change from warp.fem.utils to warp.fem.linalg for array_axpy and symmetric_eigenvalues_qr aligns with Warp's current API and the PR's objective to address deprecation warnings in Warp v1.11.0+. Both functions are properly exported from warp.fem.linalg.

newton/_src/utils/selection.py (1)

511-514: LGTM — correctly migrates from deprecated internal symbol.

The switch from wp.codegen.StructInstance to wp.types.is_struct() aligns with the PR objective of addressing Warp v1.11.0 deprecation warnings. The logic for handling struct attributes remains unchanged.

Minor: for consistency with line 21 where is_array is imported directly, you could add is_struct to that import. This is optional.

newton/_src/sim/builder.py (2)

59-61: Good move switching cloth adjacency off Warp helpers. This localizes the deprecation surface and keeps the builder logic unchanged.


1780-1789: Remove this concern; Newton's nightly Warp pin makes internal API access safe. The project explicitly requires warp-lang>=1.12.0.dev20251219 (nightly builds), where internal symbols like wp._src.context.runtime.core.wp_builtin_mul_transformf_transformf are part of the stable contract. Similar unguarded wp._src access patterns exist throughout the codebase (sdf_mc.py, graph_coloring.py), confirming this is the intended approach.

newton/_src/sim/contacts.py (1)

20-20: LGTM!

The import change from the internal warp.context.Devicelike to the public warp.DeviceLike correctly addresses Warp deprecation warnings while maintaining the Devicelike alias for backward compatibility throughout the codebase.

newton/_src/solvers/vbd/rigid_vbd_kernels.py (1)

68-71: LGTM!

The vec6 class definition correctly migrates from importing internal Warp symbols (float32, vector) to using fully-qualified public API paths (wp.types.vector, wp.float32), addressing the deprecation warnings while preserving the same functionality.

newton/_src/utils/mesh.py (4)

16-20: LGTM!

The new imports are appropriate for the added functionality: warnings for non-manifold edge detection, dataclass for MeshEdge, and warp for the GPU kernel.


26-51: LGTM!

The MeshEdge dataclass is well-documented with clear explanations of the winding order convention and boundary edge handling.


53-111: LGTM!

The MeshAdjacency class correctly implements edge adjacency building with proper non-manifold edge detection. The unused num_tris parameter is documented as kept for API compatibility with the previous wp.utils.MeshAdjacency implementation.


715-754: LGTM!

The solidify_mesh wrapper function correctly handles different thickness input types and provides a clean interface. Note that the underlying kernel has the race condition issue flagged above.

newton/_src/sim/style3d/builder_style3d.py (2)

33-33: LGTM!

The import correctly references Newton's own MeshAdjacency implementation from newton._src.utils.mesh, replacing the deprecated internal Warp utility.


602-602: LGTM!

The usage change from wp.utils.MeshAdjacency to MeshAdjacency correctly migrates to Newton's implementation. The API is compatible as both take (indices, num_tris) parameters and provide the same edges dictionary structure.

newton/examples/diffsim/example_diffsim_ball.py (1)

35-35: LGTM!

The import correctly uses the public Newton API (newton.utils) instead of the internal warp.render module, aligning with the PR objective to address Warp deprecation warnings. As per coding guidelines, examples must not import from newton._src.

newton/examples/diffsim/example_diffsim_spring_cage.py (2)

33-33: LGTM!

Import correctly updated to use the public Newton API.


268-268: LGTM!

Usage updated to call bourke_color_map directly, consistent with the new import from newton.utils.

newton/examples/diffsim/example_diffsim_drone.py (2)

40-40: LGTM!

Import correctly updated to use the public Newton API.


786-786: LGTM!

Usage updated to call bourke_color_map directly with the same arguments, maintaining the color inversion logic for rollout visualization.

newton/utils.py (3)

33-42: LGTM!

New mesh utilities (MeshAdjacency, MeshEdge, solidify_mesh) correctly exposed via the public API. This follows the project convention of re-exporting internal implementations through the public surface.


45-56: LGTM!

__all__ exports updated correctly using the incremental pattern. Based on learnings, the Newton project prefers this __all__ += [...] pattern to group exports with their related imports.


66-69: LGTM!

Render utilities correctly exported via __all__, making bourke_color_map and copy_rgb_frame_uint8 part of the public API.

newton/_src/utils/render.py (2)

1-18: LGTM!

License header and imports are correct.


63-93: LGTM!

The kernel correctly implements vertical flip for OpenGL-to-standard image coordinate conversion. The pixel indexing logic and the documented launch dimensions (width, height) are correct.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@shi-eric
Copy link
Member

asv.conf.json also needs to be manually updated with the appropriate Warp, MJ Warp, and Mujoco versions

@christophercrouzet christophercrouzet force-pushed the ccrouzet/fix-warp-deprecations branch 2 times, most recently from 95adf44 to d4d50bb Compare January 14, 2026 22:56
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
newton/_src/sim/builder.py (1)

1780-1788: Consider fallback for private Warp API dependency, or document the risk.

The code hard-binds to wp._src.context.runtime.core.wp_builtin_mul_transformf_transformf for performance optimization (avoiding repeated overload resolution). While this pattern is already used elsewhere in Newton for graph coloring without fallbacks, intentional reliance on private APIs in nightly builds carries risk if Warp refactors.

Either add a defensive fallback using the public wp.transform_multiply() API, or explicitly document why this private API binding is acceptable (e.g., the optimization necessity and acceptance of nightly-build breakage risk). If a fallback is added, note that the proposed a * b operator may not work—use wp.transform_multiply(a, b) instead.

♻️ Duplicate comments (3)
newton/_src/utils/render.py (1)

21-60: Division by zero when low == high.

When low == high, dv = 0 and subsequent divisions by dv (e.g., 4.0 * (v - low) / dv) will raise ZeroDivisionError. Add a guard clause to return a default color when dv == 0.

🐛 Proposed fix
     if v > high:
         v = high
     dv = high - low
+
+    if dv == 0.0:
+        return c
 
     if v < (low + 0.25 * dv):
newton/_src/utils/mesh.py (1)

652-686: Race condition on shared vertex writes.

Multiple triangles sharing the same vertex will have different threads writing to out_vertices[i*2] with different normal directions (computed per-face). The final vertex position is non-deterministic.

Consider either:

  1. Pre-computing per-vertex averaged normals in a separate pass
  2. Duplicating vertices per-face (changing output to num_triangles * 6 vertices)
newton/utils.py (1)

61-64: Remove unused # noqa: E402 directive.

Ruff reports this directive is unused. The import is not actually after non-import code relative to the module structure.

🐛 Proposed fix
-from ._src.utils.render import (  # noqa: E402
+from ._src.utils.render import (
     bourke_color_map,
     copy_rgb_frame_uint8,
 )
🧹 Nitpick comments (2)
newton/_src/utils/mesh.py (1)

65-79: Consider removing unused num_tris parameter.

The num_tris parameter is documented as "kept for API compatibility" but is never used. If this is intentional for backward compatibility with existing callers, consider adding a # noqa: ARG002 comment to silence the linter warning. Otherwise, removing it would simplify the API.

newton/_src/sim/builder.py (1)

5481-5494: Add regression test for MeshAdjacency edge extraction to validate consistency.

The edge tuple ordering (o0, o1, v0, v1) is clearly documented in the MeshEdge docstring and correctly extracted in builder.py. However, there are no tests validating that edge adjacency is correctly computed for known mesh configurations (e.g., simple quad mesh, non-manifold cases). Add a test that constructs a known manifold mesh and asserts edge_indices matches an expected frozen list—this catches silent behavioral changes if the edge iteration or canonical ordering logic shifts.

📜 Review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aad7eac and 95adf44.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (13)
  • newton/_src/sim/builder.py
  • newton/_src/sim/style3d/builder_style3d.py
  • newton/_src/utils/mesh.py
  • newton/_src/utils/render.py
  • newton/_src/viewer/viewer.py
  • newton/_src/viewer/viewer_gl.py
  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/examples/diffsim/example_diffsim_cloth.py
  • newton/examples/diffsim/example_diffsim_drone.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/utils.py
  • pyproject.toml
🚧 Files skipped from review as they are similar to previous changes (5)
  • newton/examples/diffsim/example_diffsim_drone.py
  • pyproject.toml
  • newton/_src/viewer/viewer_gl.py
  • newton/examples/diffsim/example_diffsim_soft_body.py
  • newton/examples/diffsim/example_diffsim_cloth.py
🧰 Additional context used
📓 Path-based instructions (5)
newton/examples/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

newton/examples/**/*.py: Examples must not import from newton._src, only from the public Newton API
Examples must follow the format with an Example class and must be registered in README.md with a uv run command and screenshot
Examples must implement a test_final() method that verifies the simulation state is valid after the example has run
Examples may optionally implement a test_post_step() method that is evaluated after every step() call

Files:

  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/examples/diffsim/example_diffsim_ball.py
newton/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Any user-facing class/function/object added under _src must be exposed via the public Newton API through re-exports

Files:

  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/_src/utils/mesh.py
  • newton/_src/utils/render.py
  • newton/_src/sim/style3d/builder_style3d.py
  • newton/_src/viewer/viewer.py
  • newton/_src/sim/builder.py
  • newton/utils.py
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

**/*.py: Use prefix-first naming for classes: ActuatorPD, ActuatorPID (not PDActuator, PIDActuator)
Use prefix-first naming for methods: add_shape_sphere() (not add_sphere_shape())
Method names must use snake_case
Prefer nested classes when self-contained: if a helper type or enum is only meaningful inside one parent class and doesn't need a public identity, define it as a nested class instead of a top-level class/module
Follow PEP 8 for Python code
Use Google-style docstrings with clear, concise explanations of what functions do, their parameters, and return values

Files:

  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/_src/utils/mesh.py
  • newton/_src/utils/render.py
  • newton/_src/sim/style3d/builder_style3d.py
  • newton/_src/viewer/viewer.py
  • newton/_src/sim/builder.py
  • newton/utils.py
**/*

📄 CodeRabbit inference engine (AGENTS.md)

CLI arguments must use kebab-case (e.g., --use-cuda-graph, not --use_cuda_graph)

Files:

  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/_src/utils/mesh.py
  • newton/_src/utils/render.py
  • newton/_src/sim/style3d/builder_style3d.py
  • newton/_src/viewer/viewer.py
  • newton/_src/sim/builder.py
  • newton/utils.py
newton/_src/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

The newton/_src/ directory is internal library implementation only and must not be imported by user code (examples, documentation, or external users)

Files:

  • newton/_src/utils/mesh.py
  • newton/_src/utils/render.py
  • newton/_src/sim/style3d/builder_style3d.py
  • newton/_src/viewer/viewer.py
  • newton/_src/sim/builder.py
🧠 Learnings (17)
📓 Common learnings
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/solvers/featherstone/kernels.py:75-75
Timestamp: 2025-08-12T18:04:06.577Z
Learning: The Newton physics framework requires nightly Warp builds, which means compatibility concerns with older stable Warp versions (like missing functions such as wp.spatial_adjoint) are not relevant for this project.
Learnt from: shi-eric
Repo: newton-physics/newton PR: 521
File: newton/examples/example_cloth_hanging.py:36-36
Timestamp: 2025-08-12T05:17:34.423Z
Learning: The Newton migration guide (docs/migration.rst) is specifically for documenting how to migrate existing warp.sim functionality to Newton equivalents. New Newton-only features that didn't exist in warp.sim do not need migration documentation.
Learnt from: shi-eric
Repo: newton-physics/newton PR: 461
File: asv/benchmarks/envs/example_humanoid.py:40-41
Timestamp: 2025-07-23T14:36:42.182Z
Learning: In Warp benchmarks, explicit wp.init() calls are not needed in most circumstances since the first Warp API call that requires initialization will automatically call wp.init(). Explicit wp.init() in setup() methods is helpful when the ASV benchmark is measuring a Warp API call, as wp.init() has non-trivial overhead that should be excluded from the benchmark timing.
📚 Learning: 2025-08-12T05:17:34.423Z
Learnt from: shi-eric
Repo: newton-physics/newton PR: 521
File: newton/examples/example_cloth_hanging.py:36-36
Timestamp: 2025-08-12T05:17:34.423Z
Learning: The Newton migration guide (docs/migration.rst) is specifically for documenting how to migrate existing warp.sim functionality to Newton equivalents. New Newton-only features that didn't exist in warp.sim do not need migration documentation.

Applied to files:

  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/_src/sim/builder.py
📚 Learning: 2025-08-12T18:04:06.577Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/_src/solvers/featherstone/kernels.py:75-75
Timestamp: 2025-08-12T18:04:06.577Z
Learning: The Newton physics framework requires nightly Warp builds, which means compatibility concerns with older stable Warp versions (like missing functions such as wp.spatial_adjoint) are not relevant for this project.

Applied to files:

  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/_src/sim/builder.py
📚 Learning: 2025-09-22T21:08:31.901Z
Learnt from: dylanturpin
Repo: newton-physics/newton PR: 806
File: newton/examples/ik/example_ik_franka.py:121-123
Timestamp: 2025-09-22T21:08:31.901Z
Learning: In the newton physics framework, when creating warp arrays for IK solver joint variables using wp.array(self.model.joint_q, shape=(1, coord_count)), the resulting array acts as a reference/pointer to the original model's joint coordinates, so updates from the IK solver automatically reflect in the model's joint_q buffer used for rendering, despite the general warp documentation suggesting copies are made by default.

Applied to files:

  • newton/examples/diffsim/example_diffsim_spring_cage.py
📚 Learning: 2025-12-12T08:45:43.428Z
Learnt from: nvtw
Repo: newton-physics/newton PR: 1221
File: newton/examples/example_sdf.py:277-287
Timestamp: 2025-12-12T08:45:43.428Z
Learning: In Newtown (Newton) example code, specifically files under newton/examples, computing contacts once per frame and reusing them across all substeps is an intentional design choice, not a bug. Reviewers should verify that contacts are computed before the substep loop and reused for every substep within the same frame. This pattern reduces redundant work and preserves frame-consistency; do not flag as a regression unless the behavior is changed for correctness or performance reasons.

Applied to files:

  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/examples/diffsim/example_diffsim_ball.py
📚 Learning: 2026-01-13T03:11:40.556Z
Learnt from: jumyungc
Repo: newton-physics/newton PR: 1333
File: newton/_src/sim/builder.py:0-0
Timestamp: 2026-01-13T03:11:40.556Z
Learning: Ensure all VBD damping semantics follow Rayleigh-style damping and are unitless. This convention, demonstrated in SolverVBD, should be applied consistently across all VBD-related constraints in the codebase. In newton/_src/sim/builder.py, validate that any damping terms use the same normalization and are treated as dimensionless; add comments and unit tests to enforce consistency across VBD components.

Applied to files:

  • newton/examples/diffsim/example_diffsim_spring_cage.py
  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/_src/utils/mesh.py
  • newton/_src/utils/render.py
  • newton/_src/sim/style3d/builder_style3d.py
  • newton/_src/viewer/viewer.py
  • newton/_src/sim/builder.py
  • newton/utils.py
📚 Learning: 2026-01-13T07:40:13.635Z
Learnt from: CR
Repo: newton-physics/newton PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-13T07:40:13.635Z
Learning: Applies to newton/examples/**/*.py : Examples must not import from `newton._src`, only from the public Newton API

Applied to files:

  • newton/examples/diffsim/example_diffsim_ball.py
  • newton/utils.py
📚 Learning: 2026-01-13T07:40:13.635Z
Learnt from: CR
Repo: newton-physics/newton PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-13T07:40:13.635Z
Learning: Applies to newton/**/*.py : Any user-facing class/function/object added under `_src` must be exposed via the public Newton API through re-exports

Applied to files:

  • newton/_src/utils/mesh.py
  • newton/_src/viewer/viewer.py
  • newton/utils.py
📚 Learning: 2025-09-26T05:58:21.013Z
Learnt from: WenchaoHuang
Repo: newton-physics/newton PR: 835
File: newton/_src/solvers/style3d/collision/collision.py:49-53
Timestamp: 2025-09-26T05:58:21.013Z
Learning: In newton/_src/solvers/style3d/collision/collision.py, the broad_phase buffers (broad_phase_ee, broad_phase_ef, broad_phase_vf) created with wp.array() don't need zero-initialization because they follow a write-first-read-later pattern: BVH query kernels in frame_begin() populate these buffers completely (write-only operations), and collision kernels only read from them afterward in accumulate_contact_force(), ensuring no undefined reads occur.

Applied to files:

  • newton/_src/utils/mesh.py
📚 Learning: 2025-12-12T17:45:26.847Z
Learnt from: vastsoun
Repo: newton-physics/newton PR: 1019
File: newton/_src/solvers/kamino/geometry/primitives.py:0-0
Timestamp: 2025-12-12T17:45:26.847Z
Learning: In newton/_src/solvers/kamino/geometry/primitives.py, the narrow-phase kernel `_primitive_narrowphase` does not need to handle symmetric shape-pair orderings (e.g., both SPHERE-BOX and BOX-SPHERE) because `kamino.core.builder.ModelBuilder` and `kamino.geometry.primitive.broadphase` guarantee that explicit candidate geometry pairs are always defined with GIDs in ascending order.

Applied to files:

  • newton/_src/utils/mesh.py
📚 Learning: 2025-09-17T21:34:05.267Z
Learnt from: gdaviet
Repo: newton-physics/newton PR: 750
File: newton/examples/mpm/example_mpm_granular.py:44-47
Timestamp: 2025-09-17T21:34:05.267Z
Learning: wp.Mesh (Warp mesh objects) expose triangle indices through the `indices` attribute, not `triangles`. The correct usage is `wp.Mesh(...).indices`, not `wp.Mesh(...).triangles`.

Applied to files:

  • newton/_src/utils/mesh.py
  • newton/_src/sim/style3d/builder_style3d.py
  • newton/_src/sim/builder.py
📚 Learning: 2025-08-12T17:51:37.474Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/geometry.py:16-22
Timestamp: 2025-08-12T17:51:37.474Z
Learning: In the Newton public API refactor, common geometry symbols like ParticleFlags and ShapeFlags are now exposed at the top level in newton/__init__.py rather than through newton.geometry. The newton/geometry.py module is intentionally focused only on broad-phase collision detection classes (BroadPhaseAllPairs, BroadPhaseExplicit, BroadPhaseSAP).

Applied to files:

  • newton/_src/viewer/viewer.py
  • newton/utils.py
📚 Learning: 2026-01-12T10:11:39.312Z
Learnt from: nvtw
Repo: newton-physics/newton PR: 1314
File: newton/_src/sim/builder.py:6061-6091
Timestamp: 2026-01-12T10:11:39.312Z
Learning: In finalize() validation logic (e.g., newton/_src/sim/builder.py and similar files), keep the validation lightweight. Do not add union-find/connected-components validation for loop joints. The current behavior—allowing non-articulated joints when the child is in any articulation—is acceptable. Avoid overengineering here.

Applied to files:

  • newton/_src/sim/builder.py
📚 Learning: 2026-01-13T03:11:40.555Z
Learnt from: jumyungc
Repo: newton-physics/newton PR: 1333
File: newton/_src/sim/builder.py:0-0
Timestamp: 2026-01-13T03:11:40.555Z
Learning: In newton/_src/sim/builder.py, follow VBD conventions: treat radians as dimensionless. Prefer wording 'torque per radian' instead of writing 'N·m/rad' in any docs, strings, or generated text within this file. Ensure consistent usage in docstrings, comments, and documentation strings associated with this module.

Applied to files:

  • newton/_src/sim/builder.py
📚 Learning: 2026-01-13T07:40:13.635Z
Learnt from: CR
Repo: newton-physics/newton PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-13T07:40:13.635Z
Learning: Applies to newton/_src/**/*.py : The `newton/_src/` directory is internal library implementation only and must not be imported by user code (examples, documentation, or external users)

Applied to files:

  • newton/utils.py
📚 Learning: 2025-08-14T17:38:36.106Z
Learnt from: nvlukasz
Repo: newton-physics/newton PR: 519
File: newton/__init__.py:25-29
Timestamp: 2025-08-14T17:38:36.106Z
Learning: The Newton project prefers incremental __all__ building using __all__ += [...] pattern to group exports with their related imports, rather than a single consolidated __all__ at the end of the file.

Applied to files:

  • newton/utils.py
📚 Learning: 2025-11-07T01:42:36.906Z
Learnt from: daniela-hase
Repo: newton-physics/newton PR: 1044
File: newton/_src/sensors/tiled_camera_sensor.py:224-256
Timestamp: 2025-11-07T01:42:36.906Z
Learning: In newton/_src/sensors/tiled_camera_sensor.py, the `# noqa: PLC0415` directives on the local PIL imports (lines 224 and 256 in save_color_image and save_depth_image methods) should be kept because they are required by the pre-commit configuration. The local imports are intentional for optional dependency handling.

Applied to files:

  • newton/utils.py
🧬 Code graph analysis (6)
newton/examples/diffsim/example_diffsim_spring_cage.py (1)
newton/_src/utils/render.py (1)
  • bourke_color_map (21-60)
newton/examples/diffsim/example_diffsim_ball.py (1)
newton/_src/utils/render.py (1)
  • bourke_color_map (21-60)
newton/_src/sim/style3d/builder_style3d.py (1)
newton/_src/utils/mesh.py (1)
  • MeshAdjacency (53-111)
newton/_src/viewer/viewer.py (1)
newton/_src/utils/mesh.py (1)
  • solidify_mesh (715-754)
newton/_src/sim/builder.py (1)
newton/_src/utils/mesh.py (1)
  • MeshAdjacency (53-111)
newton/utils.py (2)
newton/_src/utils/mesh.py (3)
  • MeshAdjacency (53-111)
  • MeshEdge (27-50)
  • solidify_mesh (715-754)
newton/_src/utils/render.py (2)
  • bourke_color_map (21-60)
  • copy_rgb_frame_uint8 (64-93)
🪛 Ruff (0.14.11)
newton/_src/utils/mesh.py

65-65: Unused method argument: num_tris

(ARG002)

newton/utils.py

61-61: Unused noqa directive (non-enabled: E402)

Remove unused noqa directive

(RUF100)

🔇 Additional comments (14)
newton/_src/utils/render.py (1)

63-93: LGTM!

The kernel correctly implements the vertical flip for OpenGL-to-standard image coordinate conversion. The documentation clearly explains the expected launch dimensions and purpose.

newton/_src/utils/mesh.py (2)

26-51: LGTM!

Well-documented dataclass with clear field descriptions for edge adjacency information.


715-754: Wrapper logic is sound, pending kernel fix.

The function correctly handles different thickness input types and properly allocates output arrays. The implementation will work correctly once the race condition in the kernel is addressed.

newton/utils.py (2)

32-56: LGTM!

The new mesh utilities are properly exposed through the public API, following the incremental __all__ += [...] pattern used throughout the codebase. Based on learnings, this pattern groups exports with their related imports.


66-69: LGTM!

Render utilities correctly added to the public API exports.

newton/_src/viewer/viewer.py (2)

26-36: LGTM!

Moving solidify_mesh to a module-level import is cleaner and consistent with the other mesh utilities already imported from newton.utils.


619-624: Usage is correct.

The solidify_mesh call correctly handles the non-solid mesh case. Note that the race condition issue in solidify_mesh_kernel (flagged in newton/_src/utils/mesh.py) would affect the output here.

newton/examples/diffsim/example_diffsim_ball.py (2)

35-35: LGTM!

Correctly imports bourke_color_map from the public Newton API (newton.utils) instead of warp.render, which aligns with the PR objective of addressing Warp deprecation warnings. As per coding guidelines, examples must not import from newton._src.


205-211: LGTM!

The bourke_color_map usage is correct with a well-defined range [0.0, 7.0] that won't trigger the division-by-zero edge case.

newton/_src/sim/style3d/builder_style3d.py (2)

33-33: LGTM!

The import correctly references Newton's internal MeshAdjacency utility, which replaces the deprecated wp.utils.MeshAdjacency. Since this is an internal _src file, importing from ...utils.mesh is appropriate.


602-607: No issues found. The MeshEdge class correctly exposes all required attributes (v0, v1, o0, o1, f0, f1) with the expected names, maintaining full API compatibility with the code usage in builder_style3d.py.

newton/examples/diffsim/example_diffsim_spring_cage.py (2)

33-33: LGTM!

The import correctly uses the public Newton API (newton.utils) instead of the deprecated wp.render module. This follows the coding guidelines requiring examples to import only from the public Newton API.


268-269: LGTM!

Direct drop-in replacement of wp.render.bourke_color_map with Newton's utility. The function signature and return type are identical.

newton/_src/sim/builder.py (1)

59-61: Good swap: prefer Newton MeshAdjacency over Warp utils to avoid deprecation noise.
This keeps adjacency logic in-repo and avoids relying on Warp’s (now noisy) utility surface.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@christophercrouzet christophercrouzet force-pushed the ccrouzet/fix-warp-deprecations branch from d4d50bb to 8022873 Compare January 14, 2026 23:03
@christophercrouzet
Copy link
Member Author

pre-commit.ci run

@christophercrouzet
Copy link
Member Author

pre-commit.ci run

1 similar comment
@christophercrouzet
Copy link
Member Author

pre-commit.ci run

@christophercrouzet christophercrouzet force-pushed the ccrouzet/fix-warp-deprecations branch from 8022873 to da2038a Compare January 15, 2026 01:38
@christophercrouzet christophercrouzet changed the title Draft: Address Warp Deprecation Warnings Address Warp Deprecation Warnings Jan 15, 2026
Copy link
Member

@eric-heiden eric-heiden left a comment

Choose a reason for hiding this comment

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

Thanks!

@eric-heiden eric-heiden added this pull request to the merge queue Jan 15, 2026
Merged via the queue into newton-physics:main with commit 55a2ceb Jan 15, 2026
38 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants