trunk/0ccbf972a39fc88cb17348079bca7332ef022bfc: [BE][MPS] Use `dispatch_sync_with_rethrow` (#196893)
- PyTorch: 871 events in the last 90 days
- PyTorch: 860th Release in the last 90 days
- Previous: earlier the same day · trunk/36d813411f98c73ba65b56cdc4f950df6dfed2de
What happened
A C++ exception thrown inside an Objective-C block passed to dispatch_sync aborts the process, as it unwinds into libdispatch's frame and ends up in std::terminate . dispatch_sync_with_rethrow exists precisely to avoid that, so use it if block can throw. Test Plan: python -c "import torch; torch.zeros(4, device='mps').clamp_min(1e40)" python -c "import torch; torch.nn.functional.hardshrink(torch.zeros(4, device='mps…
Summary assembled by rule from the sources below