Skip to content

Commit 3327260

Browse files
committed
Update base for Update on "[Executorch] Use temp allocator for allocating scratch memory"
This allows us to leverage temp memory allocator and if that allocator is caching allocator it reduces the allocaiton overhead. Differential Revision: [D85532076](https://our.internmc.facebook.com/intern/diff/D85532076/) [ghstack-poisoned]
1 parent c0d76f8 commit 3327260

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

extension/memory_allocator/cpu_caching_malloc_allocator.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ class CPUCachingAllocator : public executorch::runtime::MemoryAllocator {
7373
// Checks the cache to see if allocation of size bytes can be found.
7474
// If so return cached memory, else
7575
// allocates memory, records it for caching and returns.
76-
void* allocate(size_t size, size_t alignment = kCachingAllocatorDefaultAlignment) override;
76+
void* allocate(
77+
size_t size,
78+
size_t alignment = kCachingAllocatorDefaultAlignment) override;
7779
void reset() override;
7880
~CPUCachingAllocator();
7981
};

extension/memory_allocator/test/cpu_caching_malloc_allocator_test.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
using namespace ::testing;
1313
using executorch::extension::CPUCachingAllocator;
1414

15-
constexpr auto kDefaultAlignment = executorch::extension::kCachingAllocatorDefaultAlignment;
15+
constexpr auto kDefaultAlignment =
16+
executorch::extension::kCachingAllocatorDefaultAlignment;
1617

1718
class CPUCachingAllocatorTest : public ::testing::Test {
1819
protected:

0 commit comments

Comments
 (0)