Repository navigation
Conversation
|
There was a problem hiding this comment.
Isaac Lab Review Bot
The cardinality guard correctly prevents silent partial camera updates, but the changelog should include migration guidance for callers that previously supplied one matrix to a multi-camera selection.
- Design and architecture: The validation is placed after matrix and camera-ID normalization but before USD writes, preventing partial calibration updates without changing the existing camera-selection flow.
- API: Batch cardinality is now explicitly enforced with a documented ValueError. Because formerly accepted mismatched batches now fail, the changelog should tell callers to provide one matrix per selected camera or narrow env_ids accordingly.
- Implementation: The implementation checks both undersized and oversized batches before mutation, preserves single-matrix use for a single selected camera, and adds focused regression coverage. The remaining action is to complete the changelog migration note.
Minor fixes needed. Posted 1 actionable finding inline.
Automated review; human maintainers own approval decisions.
| Fixed | ||
| ^^^^^ | ||
|
|
||
| * Rejected camera intrinsic matrix batches whose size did not match the selected camera IDs, |
There was a problem hiding this comment.
🔵 Suggestion · Api — Changelog omits migration note for newly rejected input
Passing a single (3, 3) or (1, 3, 3) matrix to a multi-camera view previously succeeded (updating only the first camera) and now raises ValueError. Per the repository changelog rules, changed behavior needs explicit migration guidance; note that callers relying on the old call should expand/repeat the matrix to one per selected camera, or pass matching env_ids.
|
#7916 can you please check if this solve the same issue? |
## Description Runtime camera calibration previously copied matrices to the CPU, authored USD attributes for every camera, and reread USD to reconstruct the reported projection. OVRTX did not propagate runtime calibration into its renderer-owned scene, and Newton built its ray field only at initialization. Use NumPy for initial camera calibration and Warp for runtime updates. The camera owns persistent calibration buffers; each renderer owns its camera-specific bindings and queries. - **Initialization:** read authored USD values once, build the pinhole matrices with NumPy array operations, preserve authored OpenCV calibration, and upload the completed arrays. Do not preload runtime calibration kernels. The two setter kernels share a separate Warp compilation unit within the existing camera file, so pose initialization cannot compile them incidentally. - **Runtime:** `set_intrinsic_matrices` accepts NumPy, Torch, and Warp matrices. Upload host inputs, then validate indices, resolve duplicates, and convert projection parameters on the camera device. Keep matrix/index batches on device. Submit pending buffers to `BaseRenderer.update_camera_intrinsics` before committing public storage in place. Register float32/float64 specializations together; compilation happens on first use and subsequent updates reuse it. - **Kit:** write five projection columns directly into Fabric with one Warp kernel, compiled on first use. Render data owns the selection and releases its tags on cleanup. Reinitialization restores authored calibration in both Fabric and the reported matrices. - **OVRTX:** write GPU columns through native bindings or an ovstage query owned by each camera's render data. Cameras sharing a renderer retain independent handles; cleanup releases only that camera's resources. - **Newton Warp:** regenerate the persistent shared ray field in Warp without changing its address. Reject nonuniform calibration before committing camera buffers. Avoid the native convenience helper's scalar GPU-to-host readbacks. Errors are atomic, duplicate indices retain the last row, OpenCV distortion calibration stays fixed, and ordinary pinhole cameras retain the centered, square-pixel projection. This also addresses the cardinality issue in #7898. Runtime preparation has one device path, with no batch-size threshold or first-call switching. All production changes stay in existing Python files. Camera-specific `AGENTS.md` additions are removed. ## Migration and limitations **Breaking:** `Camera.set_intrinsic_matrices` changes runtime calibration without authoring USD. USD edit-target/layer composition no longer controls the result, and exporting USD does not persist runtime overrides. Use `PinholeCameraCfg.from_intrinsic_matrix` when spawning cameras to persist calibration. Custom renderers must implement `update_camera_intrinsics` for runtime updates. Initial authored calibration uses NumPy. The public setter always uses Warp, including when called during setup. Its first invocation can incur JIT compilation; repeated invocations reuse compiled kernels. Renderer initialization still performs its existing native setup, including Newton's initial ray construction. Synchronous index errors and projection warnings require one status integer readback. Newton also reads a scalar for its shared-calibration constraint. The setter is **not CUDA graph capturable**. Host inputs are uploaded; CPU-configured cameras retain CPU support. All three backends support uniform runtime updates. On the tested Kit/OVRTX tiled runtimes, views share the first camera's projection: per-view attributes and reported matrices change, but independent rendered projections do not. Direct USD writes reproduce the same restriction. Newton explicitly rejects differing per-environment calibration and leaves active calibration unchanged. These limitations are documented in the API. ## Performance Compared the actual implementation against the prior eager-compilation version (`fbf82be7d`) on a Threadripper PRO 7965WX and RTX 5090. Three fresh-process, empty-Warp-cache trials per camera count gave these medians: | Calibration phase | 1 camera: before → after | 4,096 cameras: before → after | | --- | ---: | ---: | | Initialization: USD import, matrices, device buffers | 312.37 → 3.15 ms | 358.17 → 45.27 ms | | First GPU setter, including any JIT | 0.36 → 71.31 ms | 0.38 → 72.53 ms | These measurements exclude USD scene creation, process/CUDA initialization, renderer setup/writes, and rendering. NumPy initialization avoids setter compilation entirely; the first runtime setter pays its one-time compilation cost. For repeated updates, both implementations use the same native Fabric writer. GPU float32 matrices alternate focal lengths; five warm-up calls precede 50 paired measurements with alternating implementation order. Timings include validation, Fabric writes, and completed GPU work, excluding initialization and rendering: | Cameras | Previous GPU setter + Fabric | NumPy initialization / GPU setter + Fabric | | ---: | ---: | ---: | | 1 | 0.413 ms | 0.411 ms | | 64 | 0.409 ms | 0.403 ms | | 1,024 | 0.411 ms | 0.412 ms | | 4,096 | 0.409 ms | 0.408 ms | With explicitly reversed GPU indices at 4,096 cameras, the runtime setter took 0.408 ms versus 0.411 ms previously. Repeated GPU throughput is preserved. ## Validation - **109 checks passed:** 91 calibration cases, two architecture gates, four shared Kit rendered cases, two OVRTX rendered cases (bindings/ovstage), three Newton rendered/ray-field cases, and seven existing Kit camera cases. - Existing calibration tests prohibit kernel launches, preloading, and compilation during initial calibration. The regression selection failed at the eager preload before the fix and passed afterward. Structural assertions ensure runtime calibration kernels cannot share the pose initialization compilation unit. - Runtime tests prohibit matrix/index batch readbacks and compilation after the first update. Covered float32/64, NumPy/Torch/Warp and strided matrices, negative/repeated/empty selections, both focal-length modes, distortion skipping, atomic backend rejection, unchanged USD, native rendered projection changes, per-view Fabric values, and initialization/reset behavior. - Full `uv run --no-sync isaaclab -f`, `git diff --check`, and a file-by-file architecture audit passed. All Python changes remain in existing files; no new scene or subprocess test harness was added. Local runtime: PyTorch 2.11.0+cu128, Warp 1.17.0, Isaac Sim 6.0.1 / Kit 110.1.2, OVRTX 0.4.1.364340, ovstage 0.1.1.355824. The branch pins PyTorch 2.12/CUDA 13 and CI's newer Isaac Sim image; CI covers that exact environment. ## Type of change - Performance improvement - Bug fix - Breaking runtime-authoring behavior change ## Release backport - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `develop` ## Checklist - [x] Ran pre-commit checks. - [x] Updated API documentation and package changelog fragments, including migration guidance. - [x] Verified rendered behavior and regression failure before the change. - [x] Measured cold and warmed setters, including GPU input transfers and native Fabric writes.
## Description Runtime camera calibration previously copied matrices to the CPU, authored USD attributes for every camera, and reread USD to reconstruct the reported projection. OVRTX did not propagate runtime calibration into its renderer-owned scene, and Newton built its ray field only at initialization. Use NumPy for initial camera calibration and Warp for runtime updates. The camera owns persistent calibration buffers; each renderer owns its camera-specific bindings and queries. - **Initialization:** read authored USD values once, build the pinhole matrices with NumPy array operations, preserve authored OpenCV calibration, and upload the completed arrays. Do not preload runtime calibration kernels. The two setter kernels share a separate Warp compilation unit within the existing camera file, so pose initialization cannot compile them incidentally. - **Runtime:** `set_intrinsic_matrices` accepts NumPy, Torch, and Warp matrices. Upload host inputs, then validate indices, resolve duplicates, and convert projection parameters on the camera device. Keep matrix/index batches on device. Submit pending buffers to `BaseRenderer.update_camera_intrinsics` before committing public storage in place. Register float32/float64 specializations together; compilation happens on first use and subsequent updates reuse it. - **Kit:** write five projection columns directly into Fabric with one Warp kernel, compiled on first use. Render data owns the selection and releases its tags on cleanup. Reinitialization restores authored calibration in both Fabric and the reported matrices. - **OVRTX:** write GPU columns through native bindings or an ovstage query owned by each camera's render data. Cameras sharing a renderer retain independent handles; cleanup releases only that camera's resources. - **Newton Warp:** regenerate the persistent shared ray field in Warp without changing its address. Reject nonuniform calibration before committing camera buffers. Avoid the native convenience helper's scalar GPU-to-host readbacks. Errors are atomic, duplicate indices retain the last row, OpenCV distortion calibration stays fixed, and ordinary pinhole cameras retain the centered, square-pixel projection. This also addresses the cardinality issue in #7898. Runtime preparation has one device path, with no batch-size threshold or first-call switching. All production changes stay in existing Python files. Camera-specific `AGENTS.md` additions are removed. ## Migration and limitations **Breaking:** `Camera.set_intrinsic_matrices` changes runtime calibration without authoring USD. USD edit-target/layer composition no longer controls the result, and exporting USD does not persist runtime overrides. Use `PinholeCameraCfg.from_intrinsic_matrix` when spawning cameras to persist calibration. Custom renderers must implement `update_camera_intrinsics` for runtime updates. Initial authored calibration uses NumPy. The public setter always uses Warp, including when called during setup. Its first invocation can incur JIT compilation; repeated invocations reuse compiled kernels. Renderer initialization still performs its existing native setup, including Newton's initial ray construction. Synchronous index errors and projection warnings require one status integer readback. Newton also reads a scalar for its shared-calibration constraint. The setter is **not CUDA graph capturable**. Host inputs are uploaded; CPU-configured cameras retain CPU support. All three backends support uniform runtime updates. On the tested Kit/OVRTX tiled runtimes, views share the first camera's projection: per-view attributes and reported matrices change, but independent rendered projections do not. Direct USD writes reproduce the same restriction. Newton explicitly rejects differing per-environment calibration and leaves active calibration unchanged. These limitations are documented in the API. ## Performance Compared the actual implementation against the prior eager-compilation version (`fbf82be7d`) on a Threadripper PRO 7965WX and RTX 5090. Three fresh-process, empty-Warp-cache trials per camera count gave these medians: | Calibration phase | 1 camera: before → after | 4,096 cameras: before → after | | --- | ---: | ---: | | Initialization: USD import, matrices, device buffers | 312.37 → 3.15 ms | 358.17 → 45.27 ms | | First GPU setter, including any JIT | 0.36 → 71.31 ms | 0.38 → 72.53 ms | These measurements exclude USD scene creation, process/CUDA initialization, renderer setup/writes, and rendering. NumPy initialization avoids setter compilation entirely; the first runtime setter pays its one-time compilation cost. For repeated updates, both implementations use the same native Fabric writer. GPU float32 matrices alternate focal lengths; five warm-up calls precede 50 paired measurements with alternating implementation order. Timings include validation, Fabric writes, and completed GPU work, excluding initialization and rendering: | Cameras | Previous GPU setter + Fabric | NumPy initialization / GPU setter + Fabric | | ---: | ---: | ---: | | 1 | 0.413 ms | 0.411 ms | | 64 | 0.409 ms | 0.403 ms | | 1,024 | 0.411 ms | 0.412 ms | | 4,096 | 0.409 ms | 0.408 ms | With explicitly reversed GPU indices at 4,096 cameras, the runtime setter took 0.408 ms versus 0.411 ms previously. Repeated GPU throughput is preserved. ## Validation - **109 checks passed:** 91 calibration cases, two architecture gates, four shared Kit rendered cases, two OVRTX rendered cases (bindings/ovstage), three Newton rendered/ray-field cases, and seven existing Kit camera cases. - Existing calibration tests prohibit kernel launches, preloading, and compilation during initial calibration. The regression selection failed at the eager preload before the fix and passed afterward. Structural assertions ensure runtime calibration kernels cannot share the pose initialization compilation unit. - Runtime tests prohibit matrix/index batch readbacks and compilation after the first update. Covered float32/64, NumPy/Torch/Warp and strided matrices, negative/repeated/empty selections, both focal-length modes, distortion skipping, atomic backend rejection, unchanged USD, native rendered projection changes, per-view Fabric values, and initialization/reset behavior. - Full `uv run --no-sync isaaclab -f`, `git diff --check`, and a file-by-file architecture audit passed. All Python changes remain in existing files; no new scene or subprocess test harness was added. Local runtime: PyTorch 2.11.0+cu128, Warp 1.17.0, Isaac Sim 6.0.1 / Kit 110.1.2, OVRTX 0.4.1.364340, ovstage 0.1.1.355824. The branch pins PyTorch 2.12/CUDA 13 and CI's newer Isaac Sim image; CI covers that exact environment. ## Type of change - Performance improvement - Bug fix - Breaking runtime-authoring behavior change ## Release backport - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `develop` ## Checklist - [x] Ran pre-commit checks. - [x] Updated API documentation and package changelog fragments, including migration guidance. - [x] Verified rendered behavior and regression failure before the change. - [x] Measured cold and warmed setters, including GPU input transfers and native Fabric writes. (cherry picked from commit 27d66c0)
Summary
Verification
git diff --checkpython -m py_compileFixes #7798