Skip to content

Conversation

mergennachin
Copy link
Contributor

@mergennachin mergennachin commented Sep 4, 2025

Fixes #13552

🐛 Problem

The unbind_copy kernel crashed with fatal error when processing boolean tensors:
[op_unbind_copy.cpp:79] assert failed (false): Unhandled dtype Bool for unbind_copy.int_out
zsh: abort

✅ Solution

Extended type support to include boolean tensors by switching from ET_SWITCH_REALHBF16_TYPES to ET_SWITCH_REALHBBF16_TYPES macro.

📝 Changes

kernels/portable/cpu/op_unbind_copy.cpp:
// Before: Crashed on boolean tensors
ET_SWITCH_REALHBF16_TYPES(...)

// After: Supports boolean tensors
ET_SWITCH_REALHBBF16_TYPES(...) // Includes Bool type

kernels/test/op_unbind_copy_test.cpp:

  • Added BooleanTensorUnbindDim2 test case with input torch.bool (1, 7, 4) unbinding on dimension 2
  • Validates correct output shape and data integrity

🛡️ Benefits

  • No more crashes: Boolean tensors are now properly handled
  • Broader compatibility: Supports additional data type for unbind operations
  • Regression protection: Test ensures boolean support is maintained

✅ Testing

Verified boolean tensor unbinding works correctly on both portable and optimized kernels with comprehensive test coverage.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 4, 2025
Copy link

pytorch-bot bot commented Sep 4, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/13956

Note: Links to docs will display an error until the docs builds have been completed.

❌ 2 New Failures

As of commit 69bfa50 with merge base 0eed262 (image):

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

Copy link

github-actions bot commented Sep 4, 2025

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@facebook-github-bot
Copy link
Contributor

@mergennachin has imported this pull request. If you are a Meta employee, you can view this in D81705165.

ScalarType out_type = out[0].scalar_type();

ET_SWITCH_REALHBF16_TYPES(
// Use ET_SWITCH_REALHBBF16_TYPES instead of ET_SWITCH_REALHBF16_TYPES
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Delete this comment.

Summary:
Fixes #13552

🐛 Problem

The unbind_copy kernel crashed with fatal error when processing boolean tensors:
[op_unbind_copy.cpp:79] assert failed (false): Unhandled dtype Bool for unbind_copy.int_out
zsh: abort

✅ Solution

Extended type support to include boolean tensors by switching from ET_SWITCH_REALHBF16_TYPES to ET_SWITCH_REALHBBF16_TYPES macro.

📝 Changes

kernels/portable/cpu/op_unbind_copy.cpp:
// Before: Crashed on boolean tensors
ET_SWITCH_REALHBF16_TYPES(...)

// After: Supports boolean tensors
ET_SWITCH_REALHBBF16_TYPES(...)  // Includes Bool type

kernels/test/op_unbind_copy_test.cpp:
- Added BooleanTensorUnbindDim2 test case with input torch.bool (1, 7, 4) unbinding on dimension 2
- Validates correct output shape and data integrity

🛡️ Benefits

- No more crashes: Boolean tensors are now properly handled
- Broader compatibility: Supports additional data type for unbind operations
- Regression protection: Test ensures boolean support is maintained

✅ Testing

Verified boolean tensor unbinding works correctly on both portable and optimized kernels with comprehensive test coverage.


Reviewed By: manuelcandales

Differential Revision: D81705165

Pulled By: mergennachin
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D81705165

@facebook-github-bot facebook-github-bot merged commit 303e2a0 into main Sep 5, 2025
115 of 126 checks passed
@facebook-github-bot facebook-github-bot deleted the op_unbind_copy branch September 5, 2025 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ExecuTorch execution crashed for unbind_copy.int
3 participants