Skip to content

Fixes physx replication and scene query performance issues#4791

Merged
kellyguo11 merged 16 commits intoisaac-sim:developfrom
kellyguo11:fix-more-issues
Mar 2, 2026
Merged

Fixes physx replication and scene query performance issues#4791
kellyguo11 merged 16 commits intoisaac-sim:developfrom
kellyguo11:fix-more-issues

Conversation

@kellyguo11
Copy link
Contributor

@kellyguo11 kellyguo11 commented Mar 2, 2026

Description

Fixes issue with PhysX cloning replication logic where it was causing overflows of GPU buffers in PhysX as collisions across environments were not being filtered correctly. Adds back the scene query flag that was not being correctly set into the physics scene, which also caused a performance regression.

Fixes UDIM parsing in the asset download logic.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@kellyguo11 kellyguo11 marked this pull request as draft March 2, 2026 19:36
@github-actions github-actions bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Mar 2, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 2, 2026

Greptile Summary

This PR fixes two PhysX simulation correctness/performance regressions and a UDIM asset-download bug.

  • PhysX replication fix (physx_replicate.py): attach_fn now excludes both /World/template and /World/envs so PhysX does not independently parse environment prims; the replicator owns all bodies under /World/envs. Self-replication is excluded by default (exclude_self_replication=True) when a source maps to other environments, preventing GPU buffer overflows caused by duplicate collision pairs. A num_envs > 1 guard skips registration entirely for single-environment setups where normal USD parsing is sufficient. As an acknowledged trade-off, useEnvIds is hardcoded to False (with a TODO) until heterogeneous-source support is added.
  • Scene query support fix (physx_manager.py / physx_manager_cfg.py): Restores the enable_scene_query_support flag that was not being forwarded from SimulationCfg to the PhysX scene, recovering the associated raycasting/sweep performance that regressed when the flag defaulted to False.
  • UDIM download fix (assets.py): UDIM texture placeholders are now expanded to individual tile URLs (1001–1100) before downloading, preventing broken texture downloads.
  • Cleanup: Several task configs that had replicate_physics = False as a workaround have that override removed now that replication works correctly. The Dexsuite env no longer needs oversized GPU aggregate-pair buffers that compensated for the collision-filtering overflow.

Issues found:

  • prettytable==3.3.0 was removed from isaaclab_newton/setup.py but PrettyTable is still imported in isaaclab_newton/assets/articulation/articulation.py, which will cause a runtime ImportError on fresh installs.
  • The UDIM tile expansion stops at the first missing tile (break), silently skipping any tiles after a gap in a non-contiguous UDIM set.
  • useEnvIds=False is a known performance regression for GPU multi-env simulations (TODO comment present).

Confidence Score: 3/5

  • Safe to merge for simulation correctness, but the prettytable removal will cause a runtime ImportError for isaaclab_newton users and should be resolved first.
  • The core PhysX replication and scene-query fixes are well-reasoned and backed by updated tests. However, dropping prettytable from INSTALL_REQUIRES while it is still imported in articulation.py is a clear packaging regression that will break isaaclab_newton on fresh installs. The useEnvIds=False trade-off is acknowledged technical debt. These lower the score from an otherwise solid bug-fix PR.
  • source/isaaclab_newton/setup.pyprettytable removed but still used in articulation.py. source/isaaclab_physx/isaaclab_physx/cloner/physx_replicate.pyuseEnvIds=False performance TODO needs follow-up tracking.

Important Files Changed

Filename Overview
source/isaaclab_physx/isaaclab_physx/cloner/physx_replicate.py Core fix: adds /World/envs to attach_fn exclusion list, pre-computes effective world lists with self-exclusion, and wraps all registration in a num_envs > 1 guard. useEnvIds is hardcoded to False with a TODO, which is a known performance trade-off.
source/isaaclab/isaaclab/utils/assets.py Adds UDIM placeholder expansion via tile-probing (1001–1100); assumes contiguous tile numbering and stops at the first missing tile. Non-contiguous UDIM sets would be partially downloaded.
source/isaaclab_physx/isaaclab_physx/physics/physx_manager.py Restores enable_scene_query_support forwarding from SimulationCfg to the PhysX scene and overrides to True when the GUI is active. The value is correctly applied via the generic cfg.to_dict() loop.
source/isaaclab_physx/isaaclab_physx/physics/physx_manager_cfg.py Adds enable_scene_query_support: bool = False field with clear docstring; default is False for headless performance with GUI override logic documented.
source/isaaclab_newton/setup.py Removes prettytable==3.3.0 from INSTALL_REQUIRES, but prettytable is still imported in isaaclab_newton/assets/articulation/articulation.py, which will cause a runtime ImportError.
source/isaaclab_physx/test/sim/test_cloner.py Tests updated to reflect new exclude-self default, num_envs > 1 guard, and /World/envs exclusion from attach_fn. The test_physx_replicate_vs_no_replicate xfail reason is updated to match the new replicator behavior.
source/isaaclab_tasks/isaaclab_tasks/manager_based/manipulation/dexsuite/dexsuite_env_cfg.py Removes gpu_found_lost_aggregate_pairs_capacity=2**29 and gpu_total_aggregate_pairs_capacity=2**25 overrides that were workarounds for the collision-filtering overflow; now falls back to sensible defaults.
source/isaaclab_tasks/isaaclab_tasks/direct/automate/assembly_env.py Captures the return value of retrieve_file_path instead of reconstructing the path with os.path.basename; cleaner and avoids path construction bugs.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant physx_replicate
    participant PhysXReplicatorInterface
    participant PhysXEngine

    Caller->>physx_replicate: physx_replicate(stage, sources, destinations, mapping, ...)

    alt num_envs == 1
        Note over physx_replicate: Skip replicator registration entirely.<br/>PhysX parses /World/envs normally.
    else num_envs > 1
        physx_replicate->>physx_replicate: Pre-compute effective_worlds[i]<br/>(exclude self when other envs exist)
        physx_replicate->>PhysXReplicatorInterface: register_replicator(stage_id, attach_fn, attach_end_fn, rename_fn)

        PhysXReplicatorInterface->>physx_replicate: attach_fn(stage_id)
        physx_replicate-->>PhysXReplicatorInterface: ["/World/template", "/World/envs"]
        Note over PhysXEngine: PhysX skips independent parsing<br/>of /World/template and /World/envs

        PhysXReplicatorInterface->>physx_replicate: attach_end_fn(stage_id)
        loop for each source i
            physx_replicate->>PhysXReplicatorInterface: rep.replicate(stage_id, src, len(worlds), useEnvIds=False)
            Note over PhysXReplicatorInterface: rename_fn called per copy:<br/>current_template.format(current_worlds[j])
        end
        physx_replicate->>PhysXReplicatorInterface: unregister_replicator(stage_id)
    end
Loading

Last reviewed commit: d6039b4

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

16 files reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

Comment on lines +64 to +65
def attach_fn(_stage_id: int):
return ["/World/template"]
return ["/World/envs", *sources]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverts the fix from PR #4731 which changed this to return ["/World/template"] to prevent bugs from cloning the source environment - verify this doesn't re-introduce those issues

)
sim_utils.safe_set_attribute_on_usd_prim(scene_prim, "physxScene:enableGPUDynamics", is_gpu, camel_case=False)

# scene query support (from SimulationCfg, not PhysxCfg)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm this may needs from physx

Signed-off-by: Kelly Guo <kellyg@nvidia.com>
@kellyguo11 kellyguo11 changed the title Fix more issues Fixes physx replication and scene query performance issues Mar 2, 2026
@kellyguo11 kellyguo11 marked this pull request as ready for review March 2, 2026 22:47
@kellyguo11 kellyguo11 requested a review from hhansen-bdai as a code owner March 2, 2026 22:47
Comment on lines 17 to 24

# Minimum dependencies required prior to installation
INSTALL_REQUIRES = [
# generic
"prettytable==3.3.0",
# newton
"warp-lang==1.12.0rc2", # avoids pulling newton dep from newton package that could end up being a dev build
"mujoco==3.5.0",
"mujoco-warp==3.5.0",
"warp-lang==1.12.0rc2",
"newton @ git+https://github.com/newton-physics/newton.git@v0.2.3",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prettytable removed but still used in articulation.py

prettytable==3.3.0 has been dropped from INSTALL_REQUIRES, but source/isaaclab_newton/isaaclab_newton/assets/articulation/articulation.py still contains:

from prettytable import PrettyTable

This will raise an ImportError at runtime for any user who installs isaaclab_newton without prettytable already present in their environment (e.g. a fresh install). Either add prettytable back to INSTALL_REQUIRES (or update it to allow a version range), or remove the import and its usages from articulation.py.

Comment on lines +131 to +139
if _UDIM_RE.search(cur_url):
for tile in range(1001, 1101):
tile_url = _UDIM_RE.sub(str(tile), cur_url)
if omni.client.stat(tile_url.replace(os.sep, "/"))[0] == omni.client.Result.OK:
if tile_url not in visited:
to_visit.append(tile_url)
else:
break
continue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UDIM tile expansion assumes perfectly contiguous tiles

The break on the first missing tile is correct for the common case, but UDIM sets can occasionally have gaps (e.g. tiles 1001–1002 exist, 1003 is absent, 1004–1006 exist). In that scenario tiles after the first gap would silently be skipped, leading to a partial download that only fails at render time.

Consider whether a non-contiguous walk (continue instead of break, stopping only at the cap) or at least a warning log would be safer:

# Option: warn instead of silently stopping
else:
    logger.debug("UDIM tile %d missing for %s; stopping expansion.", tile, cur_url)
    break

If the project's assets are guaranteed to be contiguous this is fine to leave as-is, but documenting that assumption in the comment would help future maintainers.

Comment on lines +104 to +105
# TODO: envIds needs to support heterogeneous setup. for now, we rely on USD collision filtering
useEnvIds=False, # (len(current_worlds) == num_envs - 1) and device != "cpu",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useEnvIds=False disables GPU inter-env collision filtering optimisation

The previous logic used useEnvIds=True when the source covered all environments on CUDA, which lets PhysX use its fast GPU-side per-environment ID tracking to filter cross-env collisions. Hard-coding False falls back to USD collision filtering for every call, which should be correct but may introduce a performance regression on large GPU simulations.

The TODO comment captures this, so this is acknowledged debt — just flagging it to make sure it is tracked in the issue/PR backlog and not forgotten after the merge.

@kellyguo11 kellyguo11 merged commit 96e2948 into isaac-sim:develop Mar 2, 2026
6 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working infrastructure isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants