Skip to content

Pass one NDM to backend init #10528

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

Open
wants to merge 8 commits into
base: gh/lucylq/69/base
Choose a base branch
from
Open
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: 10 additions & 1 deletion runtime/executor/method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,15 @@ Error Method::init(
pte_data_map = pte_data_map_res.get();
}

ET_CHECK_OR_RETURN_ERROR(
!(pte_data_map && named_data_map),
NotSupported,
"NamedDataMap merge not supported; both pte_data_map and named_data_map are non-empty. If you see this error please file an issue at https://github.com/pytorch/executorch/issues");

if (!named_data_map || named_data_map->get_num_keys().get() == 0) {
named_data_map = pte_data_map;
}

// n_delegate_ counts the number of successfully-initialized delegates for
// ~Method() to clean up, and is incremented at the bottom of the loop. This
// makes it safe for errors to return without updating any state.
Expand All @@ -816,7 +825,7 @@ Error Method::init(
method_allocator,
/*event_tracer=*/event_tracer_,
/*method_name=*/serialization_plan_->name()->c_str(),
/*named_data_map=*/pte_data_map);
/*named_data_map=*/named_data_map);
Error err = BackendDelegate::Init(
delegate, program_, backend_init_context, &delegates_[i]);
if (err != Error::Ok) {
Expand Down
Loading