SIGN IN SIGN UP

Fix interval construction in `storage_overlap()` (#1905)

Summary:
Pull Request resolved: https://github.com/pytorch/executorch/pull/1905

## Context

[PR #1868](https://github.com/pytorch/executorch/pull/1868)  broke some internal tests due to a change in behaviour of the `Verifier` of the `MemoryPlanningPass`. Specifically, when checking for storage overlap the memory interval for a tensor was calculated as

```
[spec.mem_offset, spec.mem_offset + spec.allocated_memory - 1]
```

For tensors with `spec.allocated_memory == 0`, this would result in a constructed interval of `[N, N-1]`. [PR #1868](https://github.com/pytorch/executorch/pull/1868) updated the interval calculation to

```
[spec.mem_offset, max(spec.mem_offset + spec.allocated_memory - 1, 0)]
```

Which would produce an interval of `[N, N]` instead. However, this change broke some existing behaviour so this changeset reverts to the original interval calculation method.

Reviewed By: mcremon-meta

Differential Revision: D53599825

fbshipit-source-id: 73a1edfd4b1f2f3e3350e388bae7cdfb6715d426
S
Stephen Jia committed
316468850a9310a0563533809d1bcf9c4b496df7
Parent: 4e7a6fd
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> on 2/9/2024, 7:08:32 AM