Skip to content

Review draft for upstream #2332#5

Closed
adenzler-nvidia wants to merge 5 commits intomainfrom
reviews/pr-2332-head
Closed

Review draft for upstream #2332#5
adenzler-nvidia wants to merge 5 commits intomainfrom
reviews/pr-2332-head

Conversation

@adenzler-nvidia
Copy link
Copy Markdown
Owner

Scratch pad for iterating on re-review of upstream newton-physics#2332. Do not merge.

jsw7460 added 5 commits April 20, 2026 09:00
convert_warp_coords_to_mj_kernel used per-world joint index for joint_type, joint_child, and joint_dof_dim lookups instead of the global
  index. This caused wrong body CoM references for worldid > 0. The sibling convert_mj_coords_to_warp_kernel already uses the global index.

Extract joint_id = joints_per_world * worldid + jntid once and reuse it for all
  per-joint lookups. Rename the shadowed type local to jtype for consistency with other kernels in the file.

Add regression test that exercises the CoM lookup path via per-world body_com overrides and non-zero initial
  angular velocity. The test uses get_test_devices() and auto-skips on CPU-only runners since the buggy code path only executes on CUDA (SolverMuJoCo with use_mujoco_cpu=False).
  Reduce the test model to a single free-floating body per world
  (the articulated 2-link structure was not required to trigger the
  indexing bug). Build each world directly via add_builder with its
  target base CoM
):
worldid, jntid = wp.tid()

joint_id = joints_per_world * worldid + jntid
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

📝 Review comment (will ship upstream) — v1

Kernel indexing looks right: joint_id for the Newton-side arrays that span all replicated worlds (joint_type/joint_child/joint_dof_dim), per-world jntid retained for the MuJoCo-side mj_q_start/mj_qd_start. LGTM.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

drop.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

❌ Dropped from review

Reason: user dropped.


Regression test for a bug in convert_warp_coords_to_mj_kernel where
joint_type and joint_child were indexed with the per-world joint index
instead of the global index, causing incorrect CoM references for
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

📝 Review comment (will ship upstream) — v1

Thanks for addressing all three test-scope questions from the earlier review — explicit device coverage, the comment now correctly identifies angular velocity (not multi-joint) as the critical factor, and begin_world()/end_world() per template is a cleaner setup than the earlier post-finalize body_com mutation.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

drop.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

❌ Dropped from review

Reason: user dropped.

@adenzler-nvidia
Copy link
Copy Markdown
Owner Author

Synced to upstream newton-physics#2332 as review newton-physics#2332 (review).

@adenzler-nvidia adenzler-nvidia deleted the reviews/pr-2332-head branch April 22, 2026 10:42
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.

2 participants