-
Notifications
You must be signed in to change notification settings - Fork 712
Introduce PlatformMemoryAllocator #5121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce PlatformMemoryAllocator #5121
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/5121
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 5e0c38a with merge base 657789e ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
This pull request was exported from Phabricator. Differential Revision: D60601742 |
|
This pull request was exported from Phabricator. Differential Revision: D60601742 |
Summary: Pull Request resolved: pytorch#5121 We want to establish a pattern where portable ops fall back to some default allocator if the temp allocator isn't available. This would let users override how the memory is allocated if they care about it, but provide a reasonable default if they don't. We add new PAL hooks for allocation, which default to calling malloc and free. This lets bare metal users inject their own allocator if malloc isn't defined for them. This diff: - Adds et_pal_allocate() and et_pal_free() to platform.h - Provides default implementations of those in posix.cpp and minimal.cpp. Posix uses malloc/free, and minimal returns nullptr when trying to allocate. - Adds a MemoryAllocator subclass that uses the new PAL fallback allocator We allocate a little more than requested and use that memory as a node in a linked list, pushing the allocated buffers onto a list that's iterated and freed when the KernelRuntimeContext is destroyed. The runtime installs the default temp allocator (that uses the PAL hook to allocate) if one isn't provided Differential Revision: D60601742
6c3a18f to
62ca667
Compare
|
This pull request was exported from Phabricator. Differential Revision: D60601742 |
Summary: Pull Request resolved: pytorch#5121 We want to establish a pattern where portable ops fall back to some default allocator if the temp allocator isn't available. This would let users override how the memory is allocated if they care about it, but provide a reasonable default if they don't. We add new PAL hooks for allocation, which default to calling malloc and free. This lets bare metal users inject their own allocator if malloc isn't defined for them. This diff: - Adds et_pal_allocate() and et_pal_free() to platform.h - Provides default implementations of those in posix.cpp and minimal.cpp. Posix uses malloc/free, and minimal returns nullptr when trying to allocate. - Adds a MemoryAllocator subclass that uses the new PAL fallback allocator We allocate a little more than requested and use that memory as a node in a linked list, pushing the allocated buffers onto a list that's iterated and freed when the KernelRuntimeContext is destroyed. The runtime installs the default temp allocator (that uses the PAL hook to allocate) if one isn't provided Differential Revision: D60601742
62ca667 to
2c9c6b0
Compare
|
This pull request was exported from Phabricator. Differential Revision: D60601742 |
2c9c6b0 to
c2f9dfa
Compare
Summary: Pull Request resolved: pytorch#5121 We want to establish a pattern where portable ops fall back to some default allocator if the temp allocator isn't available. This would let users override how the memory is allocated if they care about it, but provide a reasonable default if they don't. We add new PAL hooks for allocation, which default to calling malloc and free. This lets bare metal users inject their own allocator if malloc isn't defined for them. This diff: - Adds et_pal_allocate() and et_pal_free() to platform.h - Provides default implementations of those in posix.cpp and minimal.cpp. Posix uses malloc/free, and minimal returns nullptr when trying to allocate. - Adds a MemoryAllocator subclass that uses the new PAL fallback allocator We allocate a little more than requested and use that memory as a node in a linked list, pushing the allocated buffers onto a list that's iterated and freed when the KernelRuntimeContext is destroyed. The runtime installs the default temp allocator (that uses the PAL hook to allocate) if one isn't provided Differential Revision: D60601742
|
This pull request was exported from Phabricator. Differential Revision: D60601742 |
Summary: Pull Request resolved: pytorch#5121 We want to establish a pattern where portable ops fall back to some default allocator if the temp allocator isn't available. This would let users override how the memory is allocated if they care about it, but provide a reasonable default if they don't. We add new PAL hooks for allocation, which default to calling malloc and free. This lets bare metal users inject their own allocator if malloc isn't defined for them. This diff: - Adds et_pal_allocate() and et_pal_free() to platform.h - Provides default implementations of those in posix.cpp and minimal.cpp. Posix uses malloc/free, and minimal returns nullptr when trying to allocate. - Adds a MemoryAllocator subclass that uses the new PAL fallback allocator We allocate a little more than requested and use that memory as a node in a linked list, pushing the allocated buffers onto a list that's iterated and freed when the KernelRuntimeContext is destroyed. The runtime installs the default temp allocator (that uses the PAL hook to allocate) if one isn't provided Differential Revision: D60601742
c2f9dfa to
d53fb22
Compare
|
This pull request was exported from Phabricator. Differential Revision: D60601742 |
Summary: Pull Request resolved: pytorch#5121 We want to establish a pattern where portable ops fall back to some default allocator if the temp allocator isn't available. This would let users override how the memory is allocated if they care about it, but provide a reasonable default if they don't. We add new PAL hooks for allocation, which default to calling malloc and free. This lets bare metal users inject their own allocator if malloc isn't defined for them. This diff: - Adds et_pal_allocate() and et_pal_free() to platform.h - Provides default implementations of those in posix.cpp and minimal.cpp. Posix uses malloc/free, and minimal returns nullptr when trying to allocate. - Adds a MemoryAllocator subclass that uses the new PAL fallback allocator We allocate a little more than requested and use that memory as a node in a linked list, pushing the allocated buffers onto a list that's iterated and freed when the KernelRuntimeContext is destroyed. The runtime installs the default temp allocator (that uses the PAL hook to allocate) if one isn't provided Differential Revision: D60601742
d53fb22 to
eeafc29
Compare
|
This pull request was exported from Phabricator. Differential Revision: D60601742 |
Summary: Pull Request resolved: pytorch#5121 We want to establish a pattern where portable ops fall back to some default allocator if the temp allocator isn't available. This would let users override how the memory is allocated if they care about it, but provide a reasonable default if they don't. We add new PAL hooks for allocation, which default to calling malloc and free. This lets bare metal users inject their own allocator if malloc isn't defined for them. This diff: - Adds et_pal_allocate() and et_pal_free() to platform.h - Provides default implementations of those in posix.cpp and minimal.cpp. Posix uses malloc/free, and minimal returns nullptr when trying to allocate. - Adds a MemoryAllocator subclass that uses the new PAL fallback allocator We allocate a little more than requested and use that memory as a node in a linked list, pushing the allocated buffers onto a list that's iterated and freed when the KernelRuntimeContext is destroyed. The runtime installs the default temp allocator (that uses the PAL hook to allocate) if one isn't provided Differential Revision: D60601742
eeafc29 to
888a55e
Compare
Summary: Pull Request resolved: pytorch#5121 We want to establish a pattern where portable ops fall back to some default allocator if the temp allocator isn't available. This would let users override how the memory is allocated if they care about it, but provide a reasonable default if they don't. We add new PAL hooks for allocation, which default to calling malloc and free. This lets bare metal users inject their own allocator if malloc isn't defined for them. This diff: - Adds et_pal_allocate() and et_pal_free() to platform.h - Provides default implementations of those in posix.cpp and minimal.cpp. Posix uses malloc/free, and minimal returns nullptr when trying to allocate. - Adds a MemoryAllocator subclass that uses the new PAL fallback allocator We allocate a little more than requested and use that memory as a node in a linked list, pushing the allocated buffers onto a list that's iterated and freed when the KernelRuntimeContext is destroyed. The runtime installs the default temp allocator (that uses the PAL hook to allocate) if one isn't provided Differential Revision: D60601742
|
This pull request was exported from Phabricator. Differential Revision: D60601742 |
888a55e to
5e0c38a
Compare
The introduction of the PlatformMemoryAllocator in pytorch#5121 introduced a hard fault in arm_executor_runner when not supplying the temp_allocator in the MemoryManager, so add it to get tests running again. Signed-off-by: Per Åstrand <per.astrand@arm.com> Change-Id: I357244a15c1b1fdee567ad828e09e3607e43e2e7
Summary: The introduction of the PlatformMemoryAllocator in #5121 introduced a hard fault in arm_executor_runner when not supplying the temp_allocator in the MemoryManager, so add it to get tests running again. Change-Id: I357244a15c1b1fdee567ad828e09e3607e43e2e7 Pull Request resolved: #5302 Reviewed By: manuelcandales Differential Revision: D62582281 Pulled By: digantdesai fbshipit-source-id: c650771d5ad2eddf80b30fcbafaf6e731ca9eed3
Summary:
We want to establish a pattern where portable ops fall back to some default allocator if the temp allocator isn't available. This would let users override how the memory is allocated if they care about it, but provide a reasonable default if they don't.
We add new PAL hooks for allocation, which default to calling malloc and free. This lets bare metal users inject their own allocator if malloc isn't defined for them.
This diff:
We allocate a little more than requested and use that memory as a node in a linked list, pushing the allocated buffers onto a list that's iterated and freed when the KernelRuntimeContext is destroyed.
The runtime installs the default temp allocator (that uses the PAL hook to allocate) if one isn't provided
Differential Revision: D60601742