pytorch
2c350960 - [SR] Make sigrid_transforms fusion work on graph outputs (#73091)

Commit
2 years ago
[SR] Make sigrid_transforms fusion work on graph outputs (#73091) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/73091 This is a re-work of D33669034 (https://github.com/pytorch/pytorch/commit/c76c4912bbd6c1f2cb3e04d532643ca19393415e); the change was backed out due to a data race causing crashes. The `output_types` vector was the culprit. It was previously lazily initialized on the first iteration. This was problematic because of static runtime's hidden assumption that ops are thread-safe. The re-work now only does the list unpack fusion if the output dtypes can be statically determined, e.g. if the sigrid transforms instance and `use_offsets` are both constant. Note that this is true for all the models we care about. Also, we were already partially making this assumption by dereferencing the `std::optional` sigrid transforms instance in most of the ops. Another advantage of this is that it makes the code simpler compared to D33669034 (https://github.com/pytorch/pytorch/commit/c76c4912bbd6c1f2cb3e04d532643ca19393415e). Once the output types are determined, they can be moved into the op lambda and shared as read-only data. ghstack-source-id: 150704445 Reviewed By: d1jang Differential Revision: D34290401 fbshipit-source-id: 9573e6f08ee9e8282de961bf5f5cc8d32b81e601 (cherry picked from commit 715b0077bd18cb144b9653f5f51057b9440252ad)
Author
Mike Iovine
Committer
Parents
Loading