Fixes physx replication and scene query performance issues#4791
Fixes physx replication and scene query performance issues#4791kellyguo11 merged 16 commits intoisaac-sim:developfrom
Conversation
Greptile SummaryThis PR fixes two PhysX simulation correctness/performance regressions and a UDIM asset-download bug.
Issues found:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
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
Last reviewed commit: d6039b4 |
| def attach_fn(_stage_id: int): | ||
| return ["/World/template"] | ||
| return ["/World/envs", *sources] |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
hmmm this may needs from physx
Signed-off-by: Kelly Guo <kellyg@nvidia.com>
source/isaaclab_physx/isaaclab_physx/physics/physx_manager_cfg.py
Outdated
Show resolved
Hide resolved
Signed-off-by: Kelly Guo <kellyg@nvidia.com>
…ic into fix-more-issues
|
|
||
| # 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", |
There was a problem hiding this comment.
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 PrettyTableThis 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.
| 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 |
There was a problem hiding this comment.
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)
breakIf 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.
| # 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", |
There was a problem hiding this comment.
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.
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
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there