Repository navigation
Conversation
A tiled lidar product traces every environment, so any due environment triggered a capture that overwrote all environments' returns. After a partial reset this refreshed not-due environments on the reset clock instead of their own update_period. Pass the sensor's outdated mask through render_lidar to the point-cloud copy. The CUDA kernel and the CPU fallback write only the masked tiles. Forced captures and update_period == 0 use the all-true mask.
|
run-ci |
| masked = self.cfg.update_period > 0.0 and not self._force_capture | ||
| if masked and not bool(env_mask.numpy().any()): |
There was a problem hiding this comment.
masked sound weird for the two conditions it represents.
There was a problem hiding this comment.
Renamed to due_envs_only in a follow-up commit: it is True when only the due environments are written (a positive update_period and no forced capture).
|
run-ci |
There was a problem hiding this comment.
Isaac Lab Review Bot
Needs attention: Compatibility and deprecation (3), Implementation (1), Style consistency (1), Test quality (1). Other reviewed categories look good.
- PR description: Correct the non-breaking label; title and validation match selective publication, but fallback allocation costs need reproducible baseline/candidate latency and peak-memory measurements specifying revisions, command/workload, hardware, backend, environment/ray counts, and warmup.
- Design and architecture: Architecture looks good.
- Scope and over-engineering: No over-engineering issues.
- API: API changes look good.
- Compatibility and deprecation: Breaking changes: mask-free render_lidar and copy_tiled_point_cloud calls and seven-input kernel launches now fail; preserve their all-environment behavior until a warned, documented, tested deprecation transition completes.
- Implementation: CPU fallback creates three full-sized selection outputs and then copies them into existing buffers; use torch.where with destination out= arguments to remove those allocations and copies.
- Style consistency: render_lidar requires env_mask without documenting its dtype, shape, or device; specify a boolean (num_envs,) mask on the lidar data device.
- Test quality: The exact mask assertion checks a mocked private handoff already exercised observably by integration; retain submission checks and assert publication occurred, while keeping distinct kernel and CPU-fallback coverage.
Significant concerns. Posted 6 inline findings.
Automated review; human maintainers own approval decisions.
|
|
||
| def copy_tiled_point_cloud(mapped, points: torch.Tensor, intensity: torch.Tensor, valid: torch.Tensor) -> None: | ||
| def copy_tiled_point_cloud( | ||
| mapped, points: torch.Tensor, intensity: torch.Tensor, valid: torch.Tensor, *, env_mask: wp.array |
There was a problem hiding this comment.
🟡 Warning · Compatibility — Preserve mask-free point-cloud copies
Existing four-argument copy_tiled_point_cloud calls now raise TypeError. Keep omission copying every tile; requiring a mask later needs a warned, documented, tested deprecation transition.
| intensity.copy_(signal) | ||
| valid.copy_(hits) | ||
| due = wp.to_torch(env_mask).unsqueeze(-1) | ||
| points.copy_(torch.where(due.unsqueeze(-1), filled, points)) |
There was a problem hiding this comment.
🟡 Warning · Implementation — Avoid fallback selection temporaries
Each CPU-map capture allocates three full-sized torch.where outputs and copies them into existing buffers. Write each selection directly to its destination with out=.
| mapping.unmap(stream=stream) | ||
|
|
||
| def render_lidar(self, render_data: OVRTXLidarRenderData, lidar_data: LidarData) -> None: | ||
| def render_lidar(self, render_data: OVRTXLidarRenderData, lidar_data: LidarData, *, env_mask: wp.array) -> None: |
There was a problem hiding this comment.
🟡 Warning · Compatibility — Preserve mask-free lidar captures
Existing two-argument render_lidar calls now raise TypeError. Make omission retain all-environment publication; requiring the mask later needs a warned, documented, tested deprecation transition.
| captures, so including it here would replace its buffers with a scan from a stale pose. | ||
| Camera products stay on the camera step. A lidar needs the point cloud immediately, so this | ||
| submission waits. | ||
| submission waits. The product traces every tile; only the tiles in ``env_mask`` are written. |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Specify the required mask
The public method now requires env_mask, but its docstring gives no dtype, shape, or device requirement. Document the boolean (num_envs,) mask on the lidar data device.
| intensity_out: wp.array(dtype=wp.float32), | ||
| valid: wp.array(dtype=wp.bool), | ||
| spherical: bool, | ||
| env_mask: wp.array(dtype=wp.bool), |
There was a problem hiding this comment.
🟡 Warning · Compatibility — Preserve the existing kernel launch
Existing seven-input launches no longer match this public kernel. Keep that launch functional and add a masked variant; retire the original only through a documented, warned, tested transition.
| renderer.render_lidar(lidar, data, env_mask=env_mask) | ||
| native.step.assert_called_with(render_products={lidar.render_product_path}, delta_time=0.1) | ||
| publish.assert_called_once_with(lidar, native.step.return_value, data) | ||
| publish.assert_called_once_with(lidar, native.step.return_value, data, env_mask=env_mask) |
There was a problem hiding this comment.
🟡 Warning · Test Quality — Drop private mask forwarding assertion
The new exact mask assertion checks a mocked private handoff, while integration checks its observable effect. Retain the separate-step assertion and check only that publication occurred.
[Medium impact] The change is limited to OVRTX lidar sampling across simulation environments. Fix the CPU-map fallback's stream ordering before merging so due scans cannot be skipped. Findings
SummaryThis PR carries the per-environment sampling mask through lidar capture to the output copies.
Reviews (1) · Last reviewed commit: "Rename the OvRTX lidar due-environment f..." · Reviewed by Greptile |
| due = wp.to_torch(env_mask).unsqueeze(-1) | ||
| points.copy_(torch.where(due.unsqueeze(-1), filled, points)) | ||
| intensity.copy_(torch.where(due, signal, intensity)) | ||
| valid.copy_(torch.where(due, hits, valid)) |
There was a problem hiding this comment.
If Torch and Warp use different CUDA streams, the CPU-map fallback can read env_mask after SensorBase clears it. The three torch.where calls queue reads on Torch's current stream, but the caller immediately queues the clear on Warp's stream without waiting for those reads.
A due environment can keep old returns or get mismatched points, intensity, and validity, while its sampling clock is marked updated. Run the fallback copies on Warp's consuming stream too, so they read the mask before it is cleared.
Description
With
update_period > 0,OVRTXLidarkeeps one sampling clock per environment, but a tiled lidar product tracesevery environment and the capture wrote the returns of every environment. Any due environment therefore refreshed
all of them. After a partial reset the clocks drift apart, so environments that were not due received new scans
on other environments' schedules and
update_periodno longer held per environment.This PR passes the sensor's outdated mask through
render_lidarto the point-cloud copy:copy_dense_lidar_points_kernelreturns early for slots whose environment is not due, the same pattern as thereset kernel.
torch.where, so it adds no GPU-to-CPU sync.update_period == 0use the all-true mask thatSensorBasealready allocates.The capture still traces every tile, because OvRTX cannot render a subset of a tiled product, so this does not
reduce tracing. The existing
env_mask.numpy().any()skip is unchanged.Validation
Linux GPU machine, main at
cb71c9bplus this change. Ruff and the changelog check pass.test_ovrtx_renderer_contract.py(114),test_ovrtx_lidar.py(10) andtest_ovrtx_renderer_kernels.py(13)pass, each file in its own process. The kernel, CPU-fallback and integration tests now include an environment
that is not due and must keep its previous returns.
update_period=0.1, and environments 1, 2 and 3 reset at steps30, 55 and 80: before the change every capture rewrote all four environments; after it each environment's
points change every 12 steps. Captures stay at about 40 per second, since every tile is still traced.
mainfails the same way.
Type of change
Checklist
pre-commitchecks withuv run isaaclab --formatsource/<pkg>/changelog.d/for every touched package (do not editCHANGELOG.rstor bump package versions — CI handles that)CONTRIBUTORS.mdor my name already exists thereRelease backport
main