Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions runtime/executor/tensor_parser_exec_aten.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ ET_NODISCARD Result<void*> getMemPlannedPtr(
const executorch_flatbuffer::AllocationDetails* allocation_info,
size_t nbytes,
HierarchicalAllocator* allocator) {
ET_CHECK_OR_RETURN_ERROR(
allocator != nullptr,
InvalidState,
"HierarchicalAllocator must not be null for memory-planned tensor");
// Normal non-constant Tensor. Allocate data using mem_id and offset.

// TODO(T142455629): make the allocator actually id based and not indexed
Expand Down Expand Up @@ -189,6 +193,13 @@ ET_NODISCARD Result<void*> getTensorDataPtr(
const executorch_flatbuffer::AllocationDetails* allocation_info =
s_tensor->allocation_info();

if (allocation_info != nullptr) {
ET_CHECK_OR_RETURN_ERROR(
allocator != nullptr,
InvalidState,
"HierarchicalAllocator is null but tensor has allocation_info requiring memory-planned buffers");
}

// External tensors.
if (s_tensor->extra_tensor_info() != nullptr &&
s_tensor->extra_tensor_info()->location() ==
Expand Down
Loading