Skip to content

Commit f3ec959

Browse files
committed
[executorch] Migrate pybindings to use the new HierarchicalAllocator span ctor
Stop using the deprecated HierarchicalAllocator ctor. Differential Revision: [D49344928](https://our.internmc.facebook.com/intern/diff/D49344928/) ghstack-source-id: 200970941 Pull Request resolved: #389
1 parent d6fcb2a commit f3ec959

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

extension/pybindings/pybindings.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,9 @@ class Module final {
183183
explicit Memory(std::vector<std::vector<uint8_t>>&& non_const_buffers)
184184
: runtime_allocator_(),
185185
non_const_buffers_(std::move(non_const_buffers)),
186-
non_const_allocator_list_(create_non_const_allocators()),
186+
non_const_spans_(create_non_const_spans()),
187187
non_const_allocator_(
188-
non_const_allocator_list_.size(),
189-
non_const_allocator_list_.data()),
188+
{non_const_spans_.data(), non_const_spans_.size()}),
190189
mem_manager_(
191190
&const_allocator_,
192191
&non_const_allocator_,
@@ -211,17 +210,17 @@ class Module final {
211210

212211
std::vector<std::vector<uint8_t>> non_const_buffers_;
213212

214-
std::vector<MemoryAllocator> non_const_allocator_list_;
213+
std::vector<Span<uint8_t>> non_const_spans_;
215214

216215
HierarchicalAllocator non_const_allocator_;
217216

218217
MemoryManager mem_manager_;
219218

220-
std::vector<MemoryAllocator> create_non_const_allocators() {
221-
std::vector<MemoryAllocator> result;
219+
std::vector<Span<uint8_t>> create_non_const_spans() {
220+
std::vector<Span<uint8_t>> result;
222221
for (size_t i = 0; i < non_const_buffers_.size(); i++) {
223-
result.push_back(MemoryAllocator(
224-
non_const_buffers_[i].size(), non_const_buffers_[i].data()));
222+
result.push_back(
223+
{non_const_buffers_[i].data(), non_const_buffers_[i].size()});
225224
}
226225
return result;
227226
}

0 commit comments

Comments
 (0)