Avoid disk I/O when preparing USD stage for OVRTX renderer#5631
Conversation
There was a problem hiding this comment.
📋 Code Review: Avoid file-backed exporting/importing of USD stage in OVRTX renderer
Summary
This PR refactors the OVRTX renderer to avoid file-backed export/import of USD stages, instead using in-memory string serialization with stage.ExportToString() and open_usd_from_string(). This is a welcome performance improvement that eliminates unnecessary disk I/O in the rendering pipeline.
Overall Assessment: ✅ Approve with minor suggestions — The implementation is well-structured with good backward compatibility handling for OVRTX < 0.3.0.
🔍 Key Findings
✅ Strengths
-
Clean API Modernization (
ovrtx_usd.py:106-148)- Renamed
inject_cameras_into_usd→build_render_product_as_stringwith a cleaner interface - Function now returns just the USD string snippet rather than writing to disk
- Removed dependency on
OVRTXRendererCfgparameter, improving modularity
- Renamed
-
Backward Compatibility (
ovrtx_renderer.py:234-249)- Correctly handles OVRTX < 0.3.0 which lacks
open_usd_from_string() - Falls back to temp file materialization when needed
- Uses
tempfile.gettempdir()for fallback path
- Correctly handles OVRTX < 0.3.0 which lacks
-
Config Simplification (
ovrtx_renderer_cfg.py:26-29)temp_usd_dirnow defaults toNoneinstead of always creating temp files- Removed unused
temp_usd_suffixfield - Cleaner config with optional debug output
-
Improved Logging (
ovrtx_usd.py:196-201)- Changed verbose per-environment logging to
DEBUGlevel - Added summary log at
INFOlevel for better signal-to-noise ratio
- Changed verbose per-environment logging to
📁 Files Changed
| File | Changes | Assessment |
|---|---|---|
ovrtx_renderer.py |
+45/-22 | ✅ Clean refactor with proper version gating |
ovrtx_renderer_cfg.py |
+2/-7 | ✅ Simplified config, removed unused fields |
ovrtx_usd.py |
+23/-44 | ✅ Cleaner API, better separation of concerns |
✅ Checklist Verification
- Changelog fragment — Added
- Code follows project conventions
- No apparent regressions in functionality
- Backward compatibility maintained
Update (commit 573ac20): ✅ Reviewed new commits pushed since last review.
Summary of Changes Since c4a315d:
The PR has been rebased on top of the latest develop branch. The OVRTX-specific changes include:
-
Memory release implemented —
self._exported_usd_stringis now set toNoneafter concatenation (line 225), addressing the memory concern from my previous comment. ✅ -
Code clean-up finalized:
- Renamed
inject_cameras_into_usd→build_render_product_as_string(clearer interface) - Renamed
export_stage_for_ovrtx→export_stage_to_string(returns string, not file path) - Parameter renamed
use_cloning→use_ovrtx_cloningfor clarity - Removed unused
usd_file_pathparameter from_update_scene_partitions_after_clone - Improved logging: per-environment deactivation logs changed to
DEBUGlevel with anINFO-level summary
- Renamed
-
Changelog fragment added — Properly documents the Changed/Removed/Fixed sections
Status of Previous Suggestions:
| Item | Status |
|---|---|
| P1: Temp filename collision for OVRTX < 0.3.0 | ℹ️ Low risk - fixed filename is fine for debug use case |
P2: Missing use_ovrtx_cloning docstring |
ℹ️ Minor - Args section could document the new param name, but not blocking |
| Memory concern | ✅ Fixed in this commit |
Assessment:
No new issues introduced. The implementation is clean and complete. PR approved by maintainer. ✅
Recommendation: ✅ Approve
Update (commit 9a7fbc7): ✅ Reviewed incremental changes since 573ac20.
Summary of Changes:
The PR has been rebased onto the latest develop branch with additional improvements:
-
Multi-GPU device handling fixed — The renderer now correctly uses
spec.deviceinstead of hardcodedcuda:0. Added_device_idproperty for OVRTXbinding.map()calls. ✅ -
Heterogeneous env detection — Added
is_homogeneous()check that falls back to full-stage export when the simulation uses a heterogeneous env setup, preventing incorrect cloning behavior. ✅ -
ProxyArray compatibility — Updated
set_outputs()andupdate_camera()to acceptProxyArraytypes, matching the updatedBaseRendererinterface. ✅ -
Config default changed —
use_ovrtx_cloningnow defaults toTrue(wasFalse), enabling the performance benefits by default for compatible setups. -
Kernel module cleanup — Removed hardcoded
DEVICE = "cuda:0"constant fromovrtx_renderer_kernels.py; device is now passed dynamically. -
Changelog updated — Version bumped to 0.2.0 with comprehensive changelog entries.
Assessment:
All changes are improvements that enhance robustness (multi-GPU, heterogeneous env handling) and align with the broader codebase refactor (ProxyArray types). No new concerns introduced.
Recommendation: ✅ Approve — PR is ready to merge.
Update (commit 2b68928): ✅ Reviewed incremental changes since 9a7fbc7.
Summary of Changes:
Minor logging additions to ovrtx_renderer.py:
-
Success logging for in-memory loading — Added
logger.info("OVRTX loaded USD from string successfully")afteropen_usd_from_string()call (OVRTX ≥ 0.3.0 path). -
Success logging for file-based loading — Added
logger.info("OVRTX loaded USD from file successfully (path: %s, handle: %s)")afteradd_usd()call (OVRTX < 0.3.0 fallback path).
Assessment:
These are purely diagnostic improvements that help with debugging USD loading issues. No functional changes, no concerns.
Recommendation: ✅ Approve — PR remains ready to merge.
Greptile SummaryThis PR eliminates disk I/O during OVRTX stage preparation by switching from
Confidence Score: 5/5The in-memory path for OVRTX >= 0.3.0 is clean and removes unnecessary disk I/O; the legacy fallback writes to a shared fixed path which is safe in single-process setups. The string-based stage export and in-memory loading follow the same structural pattern as the previous file-based implementation, minimising regression risk. No new correctness issues were found in the changed code paths. The legacy OVRTX < 0.3.0 fallback in ovrtx_renderer.py (fixed shared temp path) warrants a second look in multi-process training scenarios. Important Files Changed
Reviews (2): Last reviewed commit: "Avoid disk I/O when preparing USD stage ..." | Re-trigger Greptile |
…#5631) # Description Avoid disk I/O when preparing USD stage for OVRTX renderer ## Type of change - Bug fix (non-breaking change which fixes an issue) ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there
Description
Avoid disk I/O when preparing USD stage for OVRTX renderer
Type of change
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there