Skip to content

Commit c90d4e5

Browse files
committed
Update on "Pass one NDM to backend init"
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. Differential Revision: [D73679710](https://our.internmc.facebook.com/intern/diff/D73679710/) [ghstack-poisoned]
2 parents 98b386c + 1a7aa92 commit c90d4e5

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

extension/flat_tensor/flat_tensor_data_map.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,8 @@ ET_NODISCARD Result<const char*> FlatTensorDataMap::get_key(
253253
index,
254254
num_keys);
255255

256-
if (flat_tensor_->named_data() != nullptr && index < flat_tensor_->named_data()->size()) {
256+
if (flat_tensor_->named_data() != nullptr &&
257+
index < flat_tensor_->named_data()->size()) {
257258
return flat_tensor_->named_data()->Get(index)->key()->c_str();
258259
} else {
259260
if (flat_tensor_->named_data() != nullptr) {

runtime/executor/method.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -805,16 +805,16 @@ Error Method::init(
805805
pte_data_map = pte_data_map_res.get();
806806
}
807807

808-
int named_data_map_items =
808+
size_t named_data_map_items =
809809
(named_data_map != nullptr) ? named_data_map->get_num_keys().get() : 0;
810-
int pte_map_items =
810+
size_t pte_map_items =
811811
(pte_data_map != nullptr) ? pte_data_map->get_num_keys().get() : 0;
812812

813813
// TODO: implement ndm merge.
814814
ET_CHECK_OR_RETURN_ERROR(
815815
(pte_map_items == 0 || named_data_map_items == 0),
816816
NotImplemented,
817-
"NamedDataMap merge not supported. Both pte_data_map and named_data_map are non-empty, don't know what to do.");
817+
"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");
818818

819819
if (named_data_map_items == 0) {
820820
named_data_map = pte_data_map;

0 commit comments

Comments
 (0)