#8121·IsaacLab

[Bug Report] PhysX backend: any articulation with more than 64 links corrupts other environments (GPU, default gpu_max_num_partitions)

Author: NeoZngCreated Sep 29, 2026Updated Sep 30, 2026
Labelsbug

Describe the bug

With the PhysX backend on GPU and the default PhysxCfg (gpu_max_num_partitions = 8), environments corrupt each other when any articulation in the scene has more than 64 links. It happens when the scene has more than 32 articulations and articulation constraints go through the regular solver partitions (e.g. more than 16 static contact pairs per articulation).

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.

The defect is in the PhysX GPU articulation solver: a per-partition bitfield is indexed without its word-size stride. Root cause and a proposed fix: NVIDIA-Omniverse/PhysX#530.

Steps to reproduce

Run the single-file script below. It uses no assets: it builds N capsule chains of L links on a ground plane, the physics scene comes from PhysxCfg, and the chains are driven by ImplicitActuatorCfg.

bash
./isaaclab.sh -p physx64_isaaclab_repro.py --links 65 --envs 64                  # envs 0-31 run away
./isaaclab.sh -p physx64_isaaclab_repro.py --links 64 --envs 64                  # none
./isaaclab.sh -p physx64_isaaclab_repro.py --links 65 --envs 64 --partitions 1   # none
physx64_isaaclab_repro.py
python
"""Minimal repro (Isaac Lab): with the default PhysX settings, the PhysX GPU articulation solver
corrupts articulations when any articulation in the scene has more than 64 links.

Run from the Isaac Lab repository:
    ./isaaclab.sh -p physx64_isaaclab_repro.py --links 64 --envs 64                  # control: no env affected
    ./isaaclab.sh -p physx64_isaaclab_repro.py --links 65 --envs 64                  # ~32 envs affected (pairs k, k+32)
    ./isaaclab.sh -p physx64_isaaclab_repro.py --links 65 --envs 64 --partitions 1   # no env affected

Scene: N floating-base capsule chains ("snakes", L links, revolute joints alternating Z/Y) lying on a
static plane, driven by an ImplicitActuator towards random joint targets. 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. The physics scene is created by Isaac Lab from `PhysxCfg`
(default `gpu_max_num_partitions=8`). 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.
"""

import argparse
import math
import os

from isaaclab.app import AppLauncher

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=None, help="PhysxCfg.gpu_max_num_partitions (default: Isaac Lab's 8)")
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")
AppLauncher.add_app_launcher_args(ap)
a = ap.parse_args()
app = AppLauncher(a).app

import numpy as np  # noqa: E402
import torch  # noqa: E402
from pxr import Gf, Sdf, Usd, UsdGeom, UsdPhysics, UsdShade  # noqa: E402

import isaaclab.sim as sim_utils  # noqa: E402
from isaaclab.actuators import ImplicitActuatorCfg  # noqa: E402
from isaaclab.assets import Articulation, ArticulationCfg  # noqa: E402
from isaaclab.sim import SimulationCfg, SimulationContext  # noqa: E402
from isaaclab_physx.physics import PhysxCfg  # 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}_lab.usda"))
    build(usd, a.links, a.envs, 8, a.kd, a.armature)
    # the scene prim is removed: Isaac Lab creates the physics scene from PhysxCfg
    layer = Sdf.Layer.FindOrOpen(usd)
    stage_file = Usd.Stage.Open(layer)
    stage_file.RemovePrim("/World/physicsScene")
    layer.Save()

    physx_cfg = PhysxCfg() if a.partitions is None else PhysxCfg(gpu_max_num_partitions=a.partitions)
    sim = SimulationContext(SimulationCfg(dt=1.0 / 200.0, physics=physx_cfg))
    sim_utils.UsdFileCfg(usd_path=usd).func("/World/Scene", sim_utils.UsdFileCfg(usd_path=usd))
    robot = Articulation(ArticulationCfg(
        prim_path="/World/Scene/envs/env_.*/snake",
        spawn=None,
        actuators={"joints": ImplicitActuatorCfg(joint_names_expr=[".*"], stiffness=1.0, damping=a.kd)},
    ))
    sim.reset()
    n, dofs = robot.num_instances, robot.num_joints
    assert n == a.envs, (n, a.envs)

    rs = np.random.RandomState(a.seed)
    onset = np.full(n, -1)
    vmax = np.zeros(n)
    dt = sim.get_physics_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(sim.device)
            robot.set_joint_position_target_index(target=tgt)
        robot.write_data_to_sim()
        sim.step(render=False)
        robot.update(dt)
        m = robot.data.joint_vel.torch.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))

    parts = physx_cfg.gpu_max_num_partitions
    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 parts > 1) else []
    pairs = sorted(set(lower) | {k + 32 for k in lower})
    print(f"Isaac Lab PhysX backend: L={a.links} N={n} gpu_max_num_partitions={parts} 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'}")


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

System Info

  • Commit: 4d6241e (release/3.0.0)
  • Isaac Sim Version: 6.1.0-rc.26+release.49347.2d230af4.gl
  • OS: Ubuntu 24.04.2 LTS
  • GPU: NVIDIA RTX PRO 5000 Blackwell (72 GB)
  • CUDA: 13.0
  • GPU Driver: 580.126.20

Additional context

Until the PhysX fix ships, a warning in Isaac Lab would help users. It would fire when any articulation has more than 64 links, the GPU pipeline is used, gpu_max_num_partitions > 1, and there are more than 32 articulations. The warning could point to the workaround PhysxCfg(gpu_max_num_partitions=1).

Checklist

  • I have checked that there is no similar issue in the repo (required)
  • I have checked that the issue is not in running Isaac Sim itself and is related to the repo (the defect is in PhysX; reported there too)

Acceptance Criteria

  • Isaac Lab warns when the conditions above are met and points to the workaround.
  • The repro reports no affected environments once omni.physx ships the fix.