SIGN IN SIGN UP

Make HierarchicalAllocator use buffers instead of MemoryAllocators (#387)

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

The only operations that HierarchicalAllocator performs on its MemoryAllocator entries are `base_address()` and `size()`, which means that they're not really allocators, they're just buffers.

Move to using an array of simple "pointer and size" elements (represented by Spans).

This will ultimately let us remove `base_address()` and `size()` from `MemoryAllocator`, which are incompatible with dynamic subclasses like `MallocMemoryAllocator`.

To help demonstrate that the new version works, make `ManagedMemoryManager` use spans. This will cause a few dozen tests around the tree to start using spans as well.
ghstack-source-id: 201128784
exported-using-ghexport

Reviewed By: JacobSzwejbka

Differential Revision: D49344931

fbshipit-source-id: f2fec0655e0c8a88478d98a38506e436b2702fc0
D
Dave Bort committed
58c8c924fc90a4128947ed23a5b46952624faf4f
Parent: 650333e
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> on 9/19/2023, 4:01:07 AM