Skip to content

PhysX GPU articulations corrupt each other when any articulation has more than 64 links (omni.physx 110.3.2 / PhysX 5.9.1) #855

Closed

Description

@NeoZng

Description

The PhysX GPU articulation solver in Isaac Sim 6.1.0 (omni.physx.gpu 110.3.2, PhysX 5.9.1) corrupts
articulations when any articulation in the scene has more than 64 links. It happens when:

  • the scene has more than 32 articulations;
  • articulation constraints go through the regular solver partitions (e.g. more than 16 static contact pairs per
    articulation);
  • gpuMaxNumPartitions is greater than 1 (the default is 8).

In most pairs of articulations (k, k+32) in PhysX's internal order (environments k and k+32 in the repro below), one runs away: joint velocities reach 1e19 rad/s or more, then NaN.
No error is reported.

Root cause and fix: NVIDIA-Omniverse/PhysX#530 and NVIDIA-Omniverse/PhysX#531. A per-partition bitfield is
indexed without its word-size stride. Please pick up the fix in a future omni.physx release.

Repro: a single file for Isaac Sim's python.sh, with no assets. It builds N capsule chains of L links on a
ground plane and reports which chains run away.

Command (3000 steps) Result
--links 65 --envs 64 32 chains run away
--links 64 --envs 64 none
--links 65 --envs 64 --partitions 1 none
--links 65 --envs 32 none
physx64_isaacsim_repro.py
"""Minimal repro: PhysX GPU articulation solver corrupts articulations when any articulation
in the scene has more than 64 links (Isaac Sim / omni.physx).

Run with Isaac Sim's Python (no Isaac Lab needed):
    ./python.sh physx64_isaacsim_repro.py --links 64 --envs 64                  # control: no env affected
    ./python.sh physx64_isaacsim_repro.py --links 65 --envs 64                  # ~32 envs affected, one per pair (k, k+32)
    ./python.sh physx64_isaacsim_repro.py --links 65 --envs 64 --partitions 1   # no env affected
    ./python.sh physx64_isaacsim_repro.py --links 65 --envs 32                  # one warp only: no env affected

Scene: N floating-base capsule chains ("snakes", L links, revolute joints alternating Z/Y, PD drives
tracking random targets) lying on a static plane. Every articulation has ~L static contact pairs,
more than the 16-slot articulation-static fast path, so its contacts go through the regular GPU
solver partitions. TGS, GPU dynamics, 200 Hz, 8/4 solver iterations on every articulation,
self-collision off. Envs are 16 m apart and never touch each other.
Metric: per env, the first step where max |joint velocity| exceeds --threshold rad/s or becomes
non-finite. Unaffected envs stay far below the threshold.
"""

import argparse
import math
import os

ap = argparse.ArgumentParser()
ap.add_argument("--links", type=int, default=65)
ap.add_argument("--envs", type=int, default=64)
ap.add_argument("--partitions", type=int, default=8, help="physxScene:gpuMaxNumPartitions")
ap.add_argument("--steps", type=int, default=3000)
ap.add_argument("--kd", type=float, default=0.1, help="drive damping, N m s/rad")
ap.add_argument("--armature", type=float, default=0.01, help="joint armature, kg m^2 (keeps the chain model well conditioned)")
ap.add_argument("--threshold", type=float, default=454.0, help="rad/s")
ap.add_argument("--seed", type=int, default=12345)
ap.add_argument("--workdir", default=".", help="where the generated .usda is written")
a = ap.parse_args()

from isaacsim import SimulationApp  # noqa: E402

app = SimulationApp({"headless": True})

import carb  # noqa: E402
import numpy as np  # noqa: E402
import omni.physics.tensors  # noqa: E402
import omni.kit.app  # noqa: E402
import omni.physx  # noqa: E402
import omni.usd  # noqa: E402
import torch  # noqa: E402
from pxr import Gf, Sdf, Usd, UsdGeom, UsdPhysics, UsdShade  # noqa: E402

DEG = math.pi / 180.0


def attr(prim, name, vtype, value, uniform=False):
    prim.CreateAttribute(name, vtype, False, Sdf.VariabilityUniform if uniform else Sdf.VariabilityVarying).Set(value)


def build(path, L, N, partitions, kd, armature=0.0):
    T, U, B, F, I = (Sdf.ValueTypeNames.Token, Sdf.ValueTypeNames.UInt, Sdf.ValueTypeNames.Bool,
                     Sdf.ValueTypeNames.Float, Sdf.ValueTypeNames.Int)
    st = Usd.Stage.CreateNew(path)
    UsdGeom.SetStageUpAxis(st, UsdGeom.Tokens.z)
    UsdGeom.SetStageMetersPerUnit(st, 1.0)
    UsdPhysics.SetStageKilogramsPerUnit(st, 1.0)
    st.SetDefaultPrim(UsdGeom.Xform.Define(st, "/World").GetPrim())
    sc = UsdPhysics.Scene.Define(st, "/World/physicsScene")
    sc.CreateGravityDirectionAttr().Set(Gf.Vec3f(0, 0, -1))
    sc.CreateGravityMagnitudeAttr().Set(9.81)
    p = sc.GetPrim()
    p.AddAppliedSchema("PhysxSceneAPI")
    attr(p, "physxScene:solverType", T, "TGS", True)
    attr(p, "physxScene:broadphaseType", T, "GPU", True)
    attr(p, "physxScene:enableGPUDynamics", B, True)
    attr(p, "physxScene:enableStabilization", B, False)
    attr(p, "physxScene:timeStepsPerSecond", U, 200)
    attr(p, "physxScene:gpuMaxNumPartitions", U, partitions)
    attr(p, "physxScene:collisionSystem", T, "PCM", True)
    attr(p, "physxScene:enableCCD", B, False)
    attr(p, "physxScene:bounceThreshold", F, 0.5)
    attr(p, "physxScene:frictionOffsetThreshold", F, 0.04)
    attr(p, "physxScene:frictionCorrelationDistance", F, 0.025)
    attr(p, "physxScene:minPositionIterationCount", U, 1, True)
    attr(p, "physxScene:maxPositionIterationCount", U, 255, True)
    attr(p, "physxScene:minVelocityIterationCount", U, 0, True)
    attr(p, "physxScene:maxVelocityIterationCount", U, 255, True)
    for k, v in (("gpuMaxRigidContactCount", 2**23), ("gpuMaxRigidPatchCount", 5 * 2**15),
                 ("gpuFoundLostPairsCapacity", 2**21), ("gpuFoundLostAggregatePairsCapacity", 2**25),
                 ("gpuTotalAggregatePairsCapacity", 2**21), ("gpuHeapCapacity", 2**26),
                 ("gpuCollisionStackSize", 2**26)):
        attr(p, f"physxScene:{k}", U, v)
    mat = UsdShade.Material.Define(st, "/World/material")
    m = UsdPhysics.MaterialAPI.Apply(mat.GetPrim())
    m.CreateStaticFrictionAttr().Set(1.0)
    m.CreateDynamicFrictionAttr().Set(1.0)
    m.CreateRestitutionAttr().Set(0.0)

    def collider(prim):
        UsdPhysics.CollisionAPI.Apply(prim)
        prim.AddAppliedSchema("PhysxCollisionAPI")
        attr(prim, "physxCollision:contactOffset", F, 0.01)
        attr(prim, "physxCollision:restOffset", F, 0.0)
        UsdShade.MaterialBindingAPI.Apply(prim).Bind(mat, UsdShade.Tokens.weakerThanDescendants, "physics")

    ground = UsdGeom.Plane.Define(st, "/World/ground")
    ground.CreateAxisAttr().Set("Z")
    collider(ground.GetPrim())
    # every intermediate prim must be an Xform: ovstage 0.2.0 drops ancestor transforms across typeless prims
    UsdGeom.Xform.Define(st, "/World/envs")
    cols = int(math.ceil(math.sqrt(N)))
    inertia = Gf.Vec3f(0.1 * 0.025**2 / 2, 0.1 * (3 * 0.025**2 + 0.01) / 12, 0.1 * (3 * 0.025**2 + 0.01) / 12)
    for i in range(N):  # zero-padded names, authored in sorted order
        env = UsdGeom.Xform.Define(st, f"/World/envs/env_{i:03d}")
        env.AddTranslateOp().Set(Gf.Vec3d((i % cols) * 16.0, (i // cols) * 16.0, 0))
        UsdGeom.Xform.Define(st, f"/World/envs/env_{i:03d}/snake")
        links = []
        for k in range(L):
            lp = f"/World/envs/env_{i:03d}/snake/link_{k:03d}"
            x = UsdGeom.Xform.Define(st, lp)
            x.AddTranslateOp().Set(Gf.Vec3d(0.1 * k, 0, 0.026))
            q = x.GetPrim()
            UsdPhysics.RigidBodyAPI.Apply(q)
            ma = UsdPhysics.MassAPI.Apply(q)
            ma.CreateMassAttr().Set(0.1)
            ma.CreateDiagonalInertiaAttr().Set(inertia)
            ma.CreateCenterOfMassAttr().Set(Gf.Vec3f(0, 0, 0))
            ma.CreatePrincipalAxesAttr().Set(Gf.Quatf(1, 0, 0, 0))
            q.AddAppliedSchema("PhysxRigidBodyAPI")
            attr(q, "physxRigidBody:sleepThreshold", F, 0.0)
            attr(q, "physxRigidBody:stabilizationThreshold", F, 0.0)
            attr(q, "physxRigidBody:maxDepenetrationVelocity", F, 1.0)
            attr(q, "physxRigidBody:maxAngularVelocity", F, 1.0e6)
            attr(q, "physxRigidBody:linearDamping", F, 0.0)
            attr(q, "physxRigidBody:angularDamping", F, 0.0)
            if k == 0:
                UsdPhysics.ArticulationRootAPI.Apply(q)
                q.AddAppliedSchema("PhysxArticulationAPI")
                attr(q, "physxArticulation:enabledSelfCollisions", B, False)
                attr(q, "physxArticulation:solverPositionIterationCount", I, 8)
                attr(q, "physxArticulation:solverVelocityIterationCount", I, 4)
                attr(q, "physxArticulation:sleepThreshold", F, 0.0)
                attr(q, "physxArticulation:stabilizationThreshold", F, 0.0)
            cap = UsdGeom.Capsule.Define(st, lp + "/collider")
            cap.CreateAxisAttr().Set("X")
            cap.CreateHeightAttr().Set(0.06)
            cap.CreateRadiusAttr().Set(0.025)
            collider(cap.GetPrim())
            links.append(Sdf.Path(lp))
        for k in range(1, L):
            j = UsdPhysics.RevoluteJoint.Define(st, f"/World/envs/env_{i:03d}/snake/joint_{k:03d}")
            j.CreateBody0Rel().SetTargets([links[k - 1]])
            j.CreateBody1Rel().SetTargets([links[k]])
            j.CreateLocalPos0Attr().Set(Gf.Vec3f(0.05, 0, 0))
            j.CreateLocalPos1Attr().Set(Gf.Vec3f(-0.05, 0, 0))
            j.CreateLocalRot0Attr().Set(Gf.Quatf(1, 0, 0, 0))
            j.CreateLocalRot1Attr().Set(Gf.Quatf(1, 0, 0, 0))
            j.CreateAxisAttr().Set("Z" if k % 2 else "Y")
            j.CreateLowerLimitAttr().Set(-90.0)
            j.CreateUpperLimitAttr().Set(90.0)
            d = UsdPhysics.DriveAPI.Apply(j.GetPrim(), "angular")
            d.CreateTypeAttr().Set("force")
            d.CreateStiffnessAttr().Set(1.0 * DEG)   # 1 N m/rad (USD angular gains are per degree)
            d.CreateDampingAttr().Set(kd * DEG)
            d.CreateMaxForceAttr().Set(1000.0)
            d.CreateTargetPositionAttr().Set(0.0)
            d.CreateTargetVelocityAttr().Set(0.0)
            j.GetPrim().AddAppliedSchema("PhysxJointAPI")
            attr(j.GetPrim(), "physxJoint:maxJointVelocity", F, 1.0e6)
            attr(j.GetPrim(), "physxJoint:armature", F, armature)
            attr(j.GetPrim(), "physxJoint:jointFriction", F, 0.0)
    st.GetRootLayer().Save()



def main():
    os.makedirs(a.workdir, exist_ok=True)
    usd = os.path.abspath(os.path.join(a.workdir, f"snakes_L{a.links}_N{a.envs}_p{a.partitions}.usda"))
    build(usd, a.links, a.envs, a.partitions, a.kd, a.armature)

    # GPU pipeline settings as used by Isaac Lab's PhysX manager (direct GPU tensor access)
    s = carb.settings.get_settings()
    s.set("/physics/suppressReadback", True)
    for key in ("updateToUsd", "updateVelocitiesToUsd"):
        s.set(f"/physics/{key}", False)

    ctx = omni.usd.get_context()
    if not ctx.open_stage(usd):
        raise RuntimeError(f"could not open {usd}")
    for _ in range(5):
        app.update()
    stage_id = ctx.get_stage_id()

    physx = omni.physx.get_physx_interface()
    physx_sim = omni.physx.get_physx_simulation_interface()
    physx_sim.attach_stage(stage_id)
    physx.force_load_physics_from_usd()
    physx.start_simulation()
    dt = 1.0 / 200.0
    physx.update_simulation(dt, 0.0)
    physx_sim.fetch_results()

    view = omni.physics.tensors.create_simulation_view("torch", stage_id=stage_id)
    view.set_subspace_roots("/")
    arts = view.create_articulation_view("/World/envs/env_*/snake/link_000")
    n, dofs = arts.count, arts.max_dofs
    assert n == a.envs, (n, a.envs)
    dev = torch.device("cuda:0")
    idx = torch.arange(n, dtype=torch.int32, device=dev)

    rs = np.random.RandomState(a.seed)
    onset = np.full(n, -1)
    vmax = np.zeros(n)
    sim_time = dt
    for t in range(a.steps):
        if t % 20 == 0:
            tgt = torch.from_numpy(rs.uniform(-1.0, 1.0, size=(n, dofs)).astype(np.float32)).to(dev)
            arts.set_dof_position_targets(tgt, idx)
        physx_sim.simulate(dt, sim_time)
        physx_sim.fetch_results()
        sim_time += dt
        m = arts.get_dof_velocities().abs().amax(dim=1).cpu().numpy()
        bad = ~np.isfinite(m) | (m > a.threshold)
        onset[(onset < 0) & bad] = t
        vmax = np.maximum(vmax, np.where(np.isfinite(m), m, np.inf))

    aff = [int(i) for i in np.where(onset >= 0)[0]]
    lower = [k for k in range(n) if k + 32 < n] if (a.links > 64 and a.partitions > 1) else []
    pairs = sorted(set(lower) | {k + 32 for k in lower})
    ext = omni.kit.app.get_app().get_extension_manager()
    print(f"omni.physx: {ext.get_enabled_extension_id('omni.physx')}  L={a.links} N={n} "
          f"partitions={a.partitions} steps={a.steps}")
    print(f"envs with max|qd| > {a.threshold:g} rad/s or non-finite: {aff if aff else 'none'}")
    print("onset steps:", {i: int(onset[i]) for i in aff})
    rest = np.delete(vmax, aff)
    print(f"max |qd| of the other envs: {rest.max() if rest.size else float('nan'):.1f} rad/s")
    print(f"aliased pairs (k, k+32) predicted by the index formula: {pairs if pairs else 'none'}")
    print(f"affected envs outside the predicted pairs: {sorted(set(aff) - set(pairs)) or 'none'}")

    view.invalidate()
    physx_sim.detach_stage()


if __name__ == "__main__":
    main()
    app.close()

Workaround: keep every articulation at 64 links or fewer, or set physxScene:gpuMaxNumPartitions = 1.

Isaac Sim version

6.1.0-rc.26+release.49347.2d230af4.gl

Operating System (OS)

Ubuntu 24.04.2 LTS

GPU Name

NVIDIA RTX PRO 5000 Blackwell (72 GB)

GPU Driver and CUDA versions

Driver 580.126.20, CUDA 13.0

Logs

omni.physx: omni.physx-110.3.2  L=65 N=64 partitions=8 steps=3000
envs with max|qd| > 454 rad/s or non-finite: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]
max |qd| of the other envs: 51.2 rad/s

Additional information

The same code is present up to PhysX 5.11.0.

Activity

  1. NeoZng commented on Sep 29, 2026

    @NeoZng
    Author

    Related Isaac Lab report (default PhysxCfg, with a single-file Isaac Lab repro): isaac-sim/IsaacLab#8121

  2. PeterL-NV commented on Sep 29, 2026

    @PeterL-NV

    Hi, thanks for the report and all the related posts. We will keep an eye on the PhysX fix.

  3. PeterL-NV commented on Oct 8, 2026

    @PeterL-NV

    The fix was already in PhysX as part of another fix. I am closing this issue as nothing is pending on Isaac Sim side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions