Skip to content

Conversation

mergennachin
Copy link
Contributor

@mergennachin mergennachin commented Sep 4, 2025

Fixes #13551

🐛 Problem

The optimized log_softmax kernel crashed with fatal assertions when encountering unsupported double precision dtypes:
F 00:00:00.005478 executorch:op_log_softmax.cpp:156] assert failed (false): Unhandled out dtype 7

✅ Solution

Replaced fatal ET_CHECK_MSG with graceful ET_KERNEL_CHECK error handling:

Before: Program termination on unsupported dtypesAfter: Returns error codes, allows program to continue

📝 Changes

kernels/optimized/cpu/op_log_softmax.cpp:

  • Converted log_softmax_wrapper to return bool success status
  • Replaced fatal assertions with graceful error returns
  • Added proper error state handling via ET_KERNEL_CHECK

kernels/test/op_log_softmax_test.cpp:

  • Added DoubleCase test for comprehensive double precision validation
  • Implemented smart conditional testing: runs full validation on portable kernels, verifies graceful failure + skips on optimized kernels
  • Uses expect_failure() for CI-friendly error state handling

🎯 Results

Kernel Double Precision Support Behavior CI Status
Portable ✅ Full support Test passes with validation 🟢 PASSED
Optimized ❌ Not supported Graceful error + skip 🟢 SKIPPED

🛡️ Benefits

  • No more crashes: Applications can handle unsupported operations gracefully
  • Better testability: Error conditions can now be tested and validated
  • CI compatibility: Green builds for both supported and unsupported operations
  • Regression protection: Prevents future reintroduction of fatal errors

Testing: Verified on both portable and optimized kernel test suites ✅

Copy link

pytorch-bot bot commented Sep 4, 2025

🔗 Helpful Links

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

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

❌ 2 New Failures

As of commit 53e3e2b 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.

@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

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 D81703958.

facebook-github-bot pushed a commit that referenced this pull request Sep 5, 2025
Summary:
Fixes #13551

🐛 Problem

The optimized log_softmax kernel crashed with fatal assertions when encountering unsupported double precision dtypes:
F 00:00:00.005478 executorch:op_log_softmax.cpp:156] assert failed (false): Unhandled out dtype 7

✅ Solution

Replaced fatal ET_CHECK_MSG with graceful ET_KERNEL_CHECK error handling:

Before: Program termination on unsupported dtypesAfter: Returns error codes, allows program to continue

📝 Changes

kernels/optimized/cpu/op_log_softmax.cpp:
- Converted log_softmax_wrapper to return bool success status
- Replaced fatal assertions with graceful error returns
- Added proper error state handling via ET_KERNEL_CHECK

kernels/test/op_log_softmax_test.cpp:
- Added DoubleCase test for comprehensive double precision validation
- Implemented smart conditional testing: runs full validation on portable kernels, verifies graceful failure + skips on optimized kernels
- Uses expect_failure() for CI-friendly error state handling

🎯 Results

| Kernel    | Double Precision Support | Behavior                    | CI Status  |
|-----------|--------------------------|-----------------------------|------------|
| Portable  | ✅ Full support           | Test passes with validation | 🟢 PASSED  |
| Optimized | ❌ Not supported          | Graceful error + skip       | 🟢 SKIPPED |

🛡️ Benefits

- No more crashes: Applications can handle unsupported operations gracefully
- Better testability: Error conditions can now be tested and validated
- CI compatibility: Green builds for both supported and unsupported operations
- Regression protection: Prevents future reintroduction of fatal errors

Testing: Verified on both portable and optimized kernel test suites ✅


Reviewed By: manuelcandales

Differential Revision: D81703958

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

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

Summary:
Fixes #13551

🐛 Problem

The optimized log_softmax kernel crashed with fatal assertions when encountering unsupported double precision dtypes:
F 00:00:00.005478 executorch:op_log_softmax.cpp:156] assert failed (false): Unhandled out dtype 7

✅ Solution

Replaced fatal ET_CHECK_MSG with graceful ET_KERNEL_CHECK error handling:

Before: Program termination on unsupported dtypesAfter: Returns error codes, allows program to continue

📝 Changes

kernels/optimized/cpu/op_log_softmax.cpp:
- Converted log_softmax_wrapper to return bool success status
- Replaced fatal assertions with graceful error returns
- Added proper error state handling via ET_KERNEL_CHECK

kernels/test/op_log_softmax_test.cpp:
- Added DoubleCase test for comprehensive double precision validation
- Implemented smart conditional testing: runs full validation on portable kernels, verifies graceful failure + skips on optimized kernels
- Uses expect_failure() for CI-friendly error state handling

🎯 Results

| Kernel    | Double Precision Support | Behavior                    | CI Status  |
|-----------|--------------------------|-----------------------------|------------|
| Portable  | ✅ Full support           | Test passes with validation | 🟢 PASSED  |
| Optimized | ❌ Not supported          | Graceful error + skip       | 🟢 SKIPPED |

🛡️ Benefits

- No more crashes: Applications can handle unsupported operations gracefully
- Better testability: Error conditions can now be tested and validated
- CI compatibility: Green builds for both supported and unsupported operations
- Regression protection: Prevents future reintroduction of fatal errors

Testing: Verified on both portable and optimized kernel test suites ✅


Reviewed By: manuelcandales

Differential Revision: D81703958

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

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

@facebook-github-bot facebook-github-bot merged commit accc65e into main Sep 5, 2025
115 of 118 checks passed
@facebook-github-bot facebook-github-bot deleted the fix_log_sample_2 branch September 5, 2025 18:38
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 _log_softmax.default
3 participants