Skip to content

Commit 84f541c

Browse files
ssjiaSS-JIA
authored andcommitted
[ET-VK][runtime][ez] Add delegate node IDs to profiling metadata
Include the serialized Vulkan OperatorCall node ID in event-tracing operator metadata. This provides a stable delegate identity that resolves directly through ETRecord mappings, enabling exact operator-instance profiling without relying on process-global dispatch order. Every dispatch emitted by a multi-dispatch operator inherits the same delegate node ID through the existing operator context. Differential Revision: [D116509340](https://our.internmc.facebook.com/intern/diff/D116509340/) ghstack-source-id: 417637897 Pull-Request: pytorch#21994
1 parent a0f860b commit 84f541c

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

‎backends/vulkan/runtime/VulkanBackend.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ class GraphBuilder {
487487

488488
#ifdef ET_EVENT_TRACER_ENABLED
489489
std::string operator_json =
490-
make_operator_json(compute_graph_, op_name, args);
490+
make_operator_json(compute_graph_, op_name, args, op_call->node_id());
491491
set_and_get_current_operator_json(operator_json);
492492
get_current_operator_count(true);
493493
#endif // ET_EVENT_TRACER_ENABLED

‎backends/vulkan/runtime/graph/Logging.cpp‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,11 @@ std::string make_arg_json(ComputeGraph* const compute_graph, ValueRef arg) {
8383
std::string make_operator_json(
8484
ComputeGraph* const compute_graph,
8585
std::string& op_name,
86-
std::vector<ValueRef>& args) {
86+
std::vector<ValueRef>& args,
87+
const uint32_t delegate_node_id) {
8788
std::stringstream ss;
88-
ss << "\"name\": \"" << op_name << "\", \"args\": [";
89+
ss << "\"name\": \"" << op_name
90+
<< "\", \"delegate_node_id\": " << delegate_node_id << ", \"args\": [";
8991
for (size_t i = 0; i < args.size(); ++i) {
9092
ss << make_arg_json(compute_graph, args[i]);
9193
if (i + 1 < args.size()) {

‎backends/vulkan/runtime/graph/Logging.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ std::string make_arg_json(ComputeGraph* const compute_graph, ValueRef arg);
6161
std::string make_operator_json(
6262
ComputeGraph* const compute_graph,
6363
std::string& op_name,
64-
std::vector<ValueRef>& args);
64+
std::vector<ValueRef>& args,
65+
uint32_t delegate_node_id);
6566

6667
} // namespace vkcompute

0 commit comments

Comments
 (0)