Skip to content

Commit 9895933

Browse files
committed
Pass one NDM to backend init
Pull Request resolved: #10528 Take external NDM if it exists, otherwise internal. Note: by default, xnnpack uses the named_data_map. Constants are not stored with the delegated blob anymore. ghstack-source-id: 281201577 Differential Revision: [D73679710](https://our.internmc.facebook.com/intern/diff/D73679710/)
1 parent 2fb26e8 commit 9895933

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

runtime/executor/method.cpp

+10-1
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,15 @@ Error Method::init(
805805
pte_data_map = pte_data_map_res.get();
806806
}
807807

808+
ET_CHECK_OR_RETURN_ERROR(
809+
!(pte_data_map && named_data_map),
810+
NotSupported,
811+
"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");
812+
813+
if (named_data_map && named_data_map->get_num_keys().get() > 0) {
814+
named_data_map = pte_data_map;
815+
}
816+
808817
// n_delegate_ counts the number of successfully-initialized delegates for
809818
// ~Method() to clean up, and is incremented at the bottom of the loop. This
810819
// makes it safe for errors to return without updating any state.
@@ -816,7 +825,7 @@ Error Method::init(
816825
method_allocator,
817826
/*event_tracer=*/event_tracer_,
818827
/*method_name=*/serialization_plan_->name()->c_str(),
819-
/*named_data_map=*/pte_data_map);
828+
/*named_data_map=*/named_data_map);
820829
Error err = BackendDelegate::Init(
821830
delegate, program_, backend_init_context, &delegates_[i]);
822831
if (err != Error::Ok) {

0 commit comments

Comments
 (0)