Skip to content

Fix raycast_mesh auxiliary output shapes - #7267

Merged
StafaH merged 6 commits into
isaac-sim:developfrom
sylvesterkaczmarek:fix/raycast-mesh-output-shapes
Sep 26, 2026
Merged

StafaH merged 6 commits into
isaac-sim:developfrom
sylvesterkaczmarek:fix/raycast-mesh-output-shapes

Conversation

@sylvesterkaczmarek

@sylvesterkaczmarek sylvesterkaczmarek commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes #2416.

raycast_mesh() allocates one distance and face ID per flattened ray, but reshapes those scalar outputs using the first two input dimensions. For documented (N, 3) inputs, requesting either output raises; higher-rank inputs can raise or silently return the wrong shape.

Both scalar outputs now use ray_starts.shape[:-1], restoring all leading ray dimensions. Existing (B, N, 3) callers retain their (B, N) outputs. Hit positions and normals already restore the full input shape. The runtime fix remains two reshape targets, with no new dependencies or input-validation changes.

Updated against develop at d9c0862035f8dadf9bf979448fa21a333942bf8d. The added regression-test file has been removed; the final diff contains only the runtime fix and its changelog fragment.

Validation

  • Ran a temporary standalone check using a real CPU Warp triangle mesh: 16 cases spanning unbatched, batched, and higher-rank ray layouts, with distance and face-ID outputs enabled independently, together, or neither. Verified output shapes, hit positions, distances, and face IDs.
  • Compared the same cases against unpatched current develop: reproduced the exceptions and silent shape mismatch; confirmed existing batched output values remain unchanged.
  • uv run isaaclab -f passed, including formatting, lint, and changelog checks against the fetched upstream base.
  • Changelog validation and git diff --check passed.
  • No new tests are retained in the repository. The full simulation suite was not run.

Type of change

  • Bug fix

Checklist

  • Followed the contribution guidelines
  • Ran formatting and lint checks
  • Verified the fix against the unfixed baseline
  • Added the required package changelog fragment
  • No new dependencies

Release backport

  • Backport this pull request to the active release branch after it merges into develop

@sylvesterkaczmarek
sylvesterkaczmarek requested a review from a team August 21, 2026 12:19
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Aug 21, 2026
@greptile-apps

greptile-apps Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR corrects raycast_mesh() auxiliary output reshaping so distance and face-ID tensors preserve all leading ray dimensions.

  • Uses ray_starts.shape[:-1] for distance and face-ID outputs.
  • Adds a CPU regression test for documented (N, 3) ray inputs, including shape and value assertions.
  • Adds the corresponding changelog fragment.

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness, security, or quality issues identified.

The new reshape target matches the number of allocated auxiliary values for documented and batched ray inputs, while existing callers and tests reveal no incompatible shape expectation.

Important Files Changed

Filename Overview
source/isaaclab/isaaclab/utils/warp/ops.py Correctly reshapes one distance and face ID per ray to the input tensor's leading dimensions.
source/isaaclab/test/utils/warp/test_raycast_mesh.py Adds focused regression coverage for unbatched ray inputs and validates all returned shapes and auxiliary values.
source/isaaclab/changelog.d/sylvesterkaczmarek-raycast-mesh-output-shapes.patch.rst Accurately documents the corrected auxiliary output-shape behavior.

Reviews (1): Last reviewed commit: "Add raycast mesh shape changelog" | Re-trigger Greptile

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Isaac Lab Review Bot

The change corrects raycast_mesh auxiliary output reshaping by using all leading ray dimensions, fixing distance and face-id returns for documented (N, 3) inputs while preserving (B, N, 3) behavior.

  • Design and architecture: The existing flatten-launch-restore design remains intact. Deriving scalar auxiliary output shapes from ray_starts.shape[:-1] is consistent with restoring vector outputs to the full input shape and supports leading batched dimensions without additional branching.
  • API: The documented (N, 3) input now yields (N,) distance and face-id outputs, while batched (B, N, 3) inputs retain (B, N) outputs. Dtypes, devices, flags, and return tuple structure are unchanged. The package changelog fragment accurately records the user-visible fix.
  • Implementation: The distance and face-id buffers contain one element per ray, so reshaping them to the ray input’s leading dimensions matches their allocation and kernel launch cardinality. The CPU Warp regression test checks public output shapes and verifies representative distance and face-id values. A rank-one (3,) ray input would produce scalar auxiliary outputs, but that shape is outside the documented (N, 3) contract.

No blocking issues. No inline issue met the actionable-evidence threshold; the assessment above records the review feedback.

Automated review; human maintainers own approval decisions.

@AntoineRichard AntoineRichard left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AI review disclosure: This review was produced with assistance from multiple AI systems.

Thank you for putting this PR together.

Assessment: shape[:-1] correctly yields one scalar distance and face ID per ray for both unbatched and batched inputs.

Findings: Invalid .patch.rst changelog filename.

Requested changes: Rename the changelog fragment from .patch.rst to .rst; no code changes needed.

Changelog filename: Rename the current <slug>.patch.rst fragment to <slug>.rst for this patch-level change. IsaacLab accepts <slug>.rst (patch), <slug>.minor.rst, and <slug>.major.rst; it does not accept a .patch.rst suffix.

Test scope: Focused CPU regression is sufficient.

Documentation / AI skills: No additional documentation update is required: existing docstrings already specify the corrected shapes. No AI-skill update is required.

@sylvesterkaczmarek

Copy link
Copy Markdown
Contributor Author

Addressed the review: renamed the patch-level changelog fragment to the accepted .rst form. No code changes were needed.

@StafaH

StafaH commented Sep 26, 2026

Copy link
Copy Markdown
Collaborator

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Sep 26, 2026
@StafaH
StafaH merged commit c791679 into isaac-sim:develop Sep 26, 2026
53 checks passed
@isaaclab-bot

isaaclab-bot Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Backported to release/3.0.0 as b970149.

isaaclab-bot Bot pushed a commit that referenced this pull request Sep 26, 2026
## Description

Fixes #2416.

`raycast_mesh()` allocates one distance and face ID per flattened ray,
but reshapes those scalar outputs using the first two input dimensions.
For documented `(N, 3)` inputs, requesting either output raises;
higher-rank inputs can raise or silently return the wrong shape.

Both scalar outputs now use `ray_starts.shape[:-1]`, restoring all
leading ray dimensions. Existing `(B, N, 3)` callers retain their `(B,
N)` outputs. Hit positions and normals already restore the full input
shape. The runtime fix remains two reshape targets, with no new
dependencies or input-validation changes.

Updated against `develop` at `d9c0862035f8dadf9bf979448fa21a333942bf8d`.
The added regression-test file has been removed; the final diff contains
only the runtime fix and its changelog fragment.

## Validation

- Ran a temporary standalone check using a real CPU Warp triangle mesh:
16 cases spanning unbatched, batched, and higher-rank ray layouts, with
distance and face-ID outputs enabled independently, together, or
neither. Verified output shapes, hit positions, distances, and face IDs.
- Compared the same cases against unpatched current `develop`:
reproduced the exceptions and silent shape mismatch; confirmed existing
batched output values remain unchanged.
- `uv run isaaclab -f` passed, including formatting, lint, and changelog
checks against the fetched upstream base.
- Changelog validation and `git diff --check` passed.
- No new tests are retained in the repository. The full simulation suite
was not run.

## Type of change

- Bug fix

## Checklist

- [x] Followed the contribution guidelines
- [x] Ran formatting and lint checks
- [x] Verified the fix against the unfixed baseline
- [x] Added the required package changelog fragment
- [x] No new dependencies

## Release backport

- [x] <!-- backport-active-release --> Backport this pull request to the
active release branch after it merges into `develop`

---------

Co-authored-by: Mustafa Haiderbhai <[email protected]>

(cherry picked from commit c791679)
@sylvesterkaczmarek
sylvesterkaczmarek deleted the fix/raycast-mesh-output-shapes branch December 2, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug in source/isaaclab/isaaclab/utils/warp/ops.py ray_distance.view(shape[0], shape[1]) causes shape mismatch

3 participants