Skip to content

fix: enable mempool by default on HIP when graph capture is supported (for PR #15)#16

Merged
rtmadduri merged 1 commit into
AMD-Ecosystem:fet/hip-graph-capturefrom
zhihuidu-amd:fix/hip-mempool-enable-for-graph-capture
Jul 20, 2026
Merged

fix: enable mempool by default on HIP when graph capture is supported (for PR #15)#16
rtmadduri merged 1 commit into
AMD-Ecosystem:fet/hip-graph-capturefrom
zhihuidu-amd:fix/hip-mempool-enable-for-graph-capture

Conversation

@zhihuidu-amd

Copy link
Copy Markdown

Problem

PR #15 enables graph capture on HIP (supports_graph_capture=True), but the device initialization still disables mempool by default (enable_mempools_at_init=False). This causes hipGraph allocation to fail during capture:

Failed to allocate memory during graph capture because memory pools are not enabled on device 'cuda:0'.
Try calling wp.set_mempool_enabled('cuda:0', True) before capture begins.

The [WARNING] CUDA Graphs disabled: mempool disabled warning then causes mjlab (and other frameworks) to disable graph capture entirely, negating PR #15's benefit.

Fix

When a HIP device supports both mempool AND graph capture, enable mempool by default at device initialization. This is safe on ROCm 7.2+ where graph capture has been validated by PR #15.

Users can still disable mempool explicitly:

  • wp.set_mempool_enabled(device, False) at runtime
  • warp.config.enable_mempools_at_init = False before wp.init()

Without this fix

Users must set wp.config.enable_mempools_at_init = True before wp.init() as a workaround — which is not documented or discoverable.

Testing

Validated on AMD MI325X (gfx942, ROCm 7.2) with mujoco_warp physics simulation using mjlab RL framework. Graph capture now works end-to-end without the mempool workaround.

Related: AIOSS-5496, AIOSS-5700

PR AMD-Ecosystem#15 enables graph capture on HIP (supports_graph_capture=True).
However, the device initialization still disables mempool by default
(enable_mempools_at_init=False), which causes hipGraph allocation to fail:

  Failed to allocate memory during graph capture because memory pools
  are not enabled on device. Try calling wp.set_mempool_enabled(True).

Fix: when a HIP device supports both mempool and graph capture, enable
mempool by default. This is safe on ROCm 7.2+ where graph capture has
been validated. Users can still disable mempool explicitly via
wp.set_mempool_enabled(device, False) or by unsetting
warp.config.enable_mempools_at_init before warp.init().

Without this fix, users must call wp.config.enable_mempools_at_init=True
before wp.init() as a workaround — which is not discoverable.
@rtmadduri

Copy link
Copy Markdown

LGTM! I will merge this into PR#15

@rtmadduri
rtmadduri merged commit 5460235 into AMD-Ecosystem:fet/hip-graph-capture Jul 20, 2026
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