Commit 53e3e2b
Fix crash in optimized log softmax (#13953)
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: mergennachin1 parent 0eed262 commit 53e3e2b
File tree
2 files changed
+74
-12
lines changed- kernels
- optimized/cpu
- test
2 files changed
+74
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
| 114 | + | |
118 | 115 | | |
119 | 116 | | |
120 | 117 | | |
| |||
146 | 143 | | |
147 | 144 | | |
148 | 145 | | |
149 | | - | |
150 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
151 | 149 | | |
| 150 | + | |
152 | 151 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
| 152 | + | |
157 | 153 | | |
158 | 154 | | |
159 | 155 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
0 commit comments