pytorch
af238221 - Gracefully handle failure of DataPtr extraction in CUDAFuture (#56511)

Commit
3 years ago
Gracefully handle failure of DataPtr extraction in CUDAFuture (#56511) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/56511 CUDAFuture needs to inspect the value in order to extract DataPtrs. Sometimes it's unable to do so. So far we've handled this by raising an error when `markCompleted` is called. In this PR I'm proposing a change, which makes `markCompleted` return successfully, but instead causes the Future to be set to an error if the DataPtr extraction fails. The advantages I see are that user code calling `markCompleted` didn't expect it to throw, and thus wasn't catching and handle that error. Which in the best case could lead to a crash, and in the worst case could lead to the Future remaining incomplete, thus not unblocking any client waiting on it. With this change those clients would be woken up and would see the error. ghstack-source-id: 127035772 Test Plan: Unit tests Reviewed By: mrshenli Differential Revision: D27861070 fbshipit-source-id: 4bb6100a488ab35fbe3c2bc3ac6f98d166c60a0b
Author
lw lw
Parents
Loading