Skip to content

Commit 47e536d

Browse files
authored
Resolve Operator fallback to method allocator if temp alloc fails (pytorch#20981) (pytorch#20981)
Differential Revision: D109855815 Pull Request resolved: pytorch#20981
1 parent c43b055 commit 47e536d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎runtime/executor/method.cpp‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,10 @@ Error Method::resolve_operator(
761761
// However, it does not have to be provided, so if it
762762
// is not provided (or an empty one is provided), we
763763
// fall back to the method allocator.
764-
if (allocator == nullptr || allocator->size() == 0) {
764+
if (allocator == nullptr || allocator->size() == 0 ||
765+
allocator->size() < (sizeof(TensorMeta) * n_args) +
766+
(sizeof(executorch::aten::DimOrderType) * kTensorDimensionLimit *
767+
n_args)) {
765768
allocator = memory_manager_->method_allocator();
766769
}
767770
TensorMeta* meta = allocator->allocateList<TensorMeta>(n_args);

0 commit comments

Comments
 (0)