Skip to content

[BUG] CPU graph replay drops array-inner reductions #1663

Description

@shi-eric

Bug Description

Host array-inner reductions run while a CPU graph is being captured, but they are not replayed when the graph is launched. Capture succeeds without reporting that the operation was omitted.

The following reproducer compares eager execution with graph replay:

import numpy as np

import warp as wp


with wp.ScopedDevice("cpu"):
    a = wp.array([1.0, 2.0], dtype=wp.float32)
    eager_out = wp.zeros(1, dtype=wp.float32)
    captured_out = wp.zeros(1, dtype=wp.float32)

    wp.utils.array_inner(a, a, out=eager_out)

    with wp.ScopedCapture() as capture:
        wp.utils.array_inner(a, a, out=captured_out)

    captured_out.zero_()
    wp.capture_launch(capture.graph)

    eager = eager_out.numpy()
    captured = captured_out.numpy()
    print(f"eager={eager.tolist()}, captured={captured.tolist()}")
    np.testing.assert_allclose(captured, eager)

Output:

eager=[5.0], captured=[0.0]

AssertionError:
 ACTUAL: array([0.], dtype=float32)
 DESIRED: array([5.], dtype=float32)

The replay should recompute the reduction or capture should report that the operation is unsupported. It should not leave the capture-time result stale.

Newton's Style3D PCG solver reaches runtime.core.wp_array_inner_float_host() for its dot products. After CPU graph capture was enabled in newton-physics/newton#3387, the three affected Style3D cloth paths produced inert simulation or intermittent non-finite particle state. CPU capture was disabled for those paths in newton-physics/newton#3497.

Related: #1431, newton-physics/newton#3387, and newton-physics/newton#3497.

System Information

  • Warp 1.16.0.dev0
  • Commit 2e1b1ddb517c4c4cb582db54f5d9375c1ac0de52
  • Python 3.12.13
  • Linux x86_64

Metadata

Metadata

Assignees

Labels

feature requestRequest for something to be added

Fields

No fields configured for Enhancement.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions