Skip to content

Enable MuJoCo Warp (mjw) backend on macOS#3171

Open
tkelestemur wants to merge 3 commits intogoogle-deepmind:mainfrom
tkelestemur:enable-mjw-macos
Open

Enable MuJoCo Warp (mjw) backend on macOS#3171
tkelestemur wants to merge 3 commits intogoogle-deepmind:mainfrom
tkelestemur:enable-mjw-macos

Conversation

@tkelestemur
Copy link

Allow impl="warp" to run on macOS by falling back to CPU when no CUDA GPU is available. Previously, the warp backend required CUDA, making it unusable on macOS for local development and debugging.

Changes:

  • Device resolution falls back to CPU when no CUDA GPU is found
  • Device compatibility check accepts both CUDA GPU and CPU for warp
  • FFI targets registered on both CUDA and Host platforms
  • Kernel launch dispatches to wp_cpu_launch_kernel on CPU
  • CUDA graph traits and capture modes gated on wp.is_cuda_available()
  • Module preloading extended to CPU devices
  • Removed has_cuda_gpu_device() skip conditions from warp tests
  • Fixed lexsort precision issue in test_util.py causing flaky test on macOS due to floating point sort key differences

See #2947

This is on top of @hartikainen 's PR here: #2948

Allow impl="warp" to run on macOS by falling back to CPU when no CUDA
GPU is available. Previously, the warp backend required CUDA, making it
unusable on macOS for local development and debugging.

Changes:
- Device resolution falls back to CPU when no CUDA GPU is found
- Device compatibility check accepts both CUDA GPU and CPU for warp
- FFI targets registered on both CUDA and Host platforms
- Kernel launch dispatches to wp_cpu_launch_kernel on CPU
- CUDA graph traits and capture modes gated on wp.is_cuda_available()
- Module preloading extended to CPU devices
- Removed has_cuda_gpu_device() skip conditions from warp tests
- Fixed lexsort precision issue in test_util.py causing flaky test on
  macOS due to floating point sort key differences

See google-deepmind#2947
@google-cla
Copy link

google-cla bot commented Mar 12, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Allow mujoco-mjx to be installed with mujoco 3.6.0 since the macOS warp
changes do not depend on any 3.7.0-specific APIs.
When render_rgb=False or render_depth=False, the condition
`if render_rgb and isinstance(render_rgb, bool)` short-circuits because
False is falsy, skipping the bool-to-list expansion. This causes a
TypeError downstream. Fix by checking isinstance first.
@kevinzakka
Copy link
Collaborator

cc @btaba

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