Skip to content

Commit a2e7a27

Browse files
[ET-VK] Fix SDK event_name for inputs and outputs
Pull Request resolved: #7738 ## Issue In the ET-SDK, we assign an `event_name` to each operation. In ET-VK, we compose a unique `event_name` using the `node_id`. The `node_id` exists for every `OperatorCall` but not for input/output with `nchw_to_image`/`image_to_nchw`. Those cases collapse into `node_id == 0` which means all `nchw_to_image` had the same `event_name` and hence only one was stored. The same reasoning results in storage of only one `image_to_nchw`. ## Solution Ignore the serialized `node_id` and use the operation's `prepack_node`/`execute_node` vector index. TODO: Determine if we can remove the serialized `node_id`, or whether this should be fixed differently and still reference it. ghstack-source-id: 262309622 @exported-using-ghexport Differential Revision: [D68344534](https://our.internmc.facebook.com/intern/diff/D68344534/) Co-authored-by: jorgep31415 <[email protected]>
1 parent 07113ec commit a2e7a27

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

backends/vulkan/runtime/VulkanBackend.cpp

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,6 @@ class GraphBuilder {
334334
}
335335

336336
// Parse the operators
337-
uint32_t last_prepack_node_ct = 0;
338-
uint32_t last_execute_node_ct = 0;
339-
340337
for (OpCallPtr op_call : *(flatbuffer_->chain())) {
341338
std::string op_name = op_call->name()->str();
342339
ET_CHECK_MSG(VK_HAS_OP(op_name), "Missing operator: %s", op_name.c_str());
@@ -351,22 +348,6 @@ class GraphBuilder {
351348

352349
auto vkFn = VK_GET_OP_FN(op_name);
353350
vkFn(*compute_graph_, args);
354-
if (compute_graph_->graphconfig().enable_querypool) {
355-
for (uint32_t idx_prepack = last_prepack_node_ct;
356-
idx_prepack < compute_graph_->prepack_nodes().size();
357-
idx_prepack++) {
358-
compute_graph_->prepack_nodes()[idx_prepack]->set_node_id(
359-
op_call->node_id());
360-
}
361-
for (uint32_t idx_execute = last_execute_node_ct;
362-
idx_execute < compute_graph_->execute_nodes().size();
363-
idx_execute++) {
364-
compute_graph_->execute_nodes()[idx_execute]->set_node_id(
365-
op_call->node_id());
366-
}
367-
last_prepack_node_ct = compute_graph_->prepack_nodes().size();
368-
last_execute_node_ct = compute_graph_->execute_nodes().size();
369-
}
370351
}
371352

372353
// Parse the outputs, which will be mostly tensors. For some reason,
@@ -379,6 +360,15 @@ class GraphBuilder {
379360
compute_graph_->set_output_tensor(ref);
380361
}
381362
}
363+
364+
if (compute_graph_->graphconfig().enable_querypool) {
365+
for (uint32_t i = 0; i < compute_graph_->prepack_nodes().size(); ++i) {
366+
compute_graph_->prepack_nodes()[i]->set_node_id(i);
367+
}
368+
for (uint32_t i = 0; i < compute_graph_->execute_nodes().size(); ++i) {
369+
compute_graph_->execute_nodes()[i]->set_node_id(i);
370+
}
371+
}
382372
}
383373
};
384374

0 commit comments

Comments
 (0)