pytorch
bb4e9e91 - functionalization: error during mutations on mem overlap (#99919)

Commit
2 years ago
functionalization: error during mutations on mem overlap (#99919) Fixes https://github.com/pytorch/pytorch/issues/98143. If a user mutates a tensor that has overlapping memory, this can cause silent correctness issues with torch.compile. This PR adds a few checks to detect that situation and error. Unfortunately `at::has_internal_overlap()` wasn't smart enough to detect the one linked in the issue, so I added a (simple) check that only runs in functionalization, that can catch the overlapping memory. We might need to revisit and add more complex checks later though (luckily, functionalization runs during compilation time so we can afford more expensive checks). Pull Request resolved: https://github.com/pytorch/pytorch/pull/99919 Approved by: https://github.com/ezyang, https://github.com/albanD
Author
Committer
Parents
Loading