From 6b67af0b0540e59dae692a572fcd04facbb9ea54 Mon Sep 17 00:00:00 2001 From: David Reveman Date: Thu, 19 Nov 2026 18:02:18 -0800 Subject: [PATCH] protos: Add GPU domain IDs to GPU tracks and counters Let GPU TrackDescriptors and GPU counter descriptors identify the domain of the GPU they belong to with a `gpu_domain_id` scoped to the GPU. A domain can be a hardware block, such as an SM or a PE, or a producer-defined logical grouping. Like `gpu_id`, this identifies the same domain in both data sources without either referencing the other, so that GPU counters can be associated with the detailed track events of the domain they measure and its hardware queues, the way processes and threads are. Producers use one counter descriptor per domain, so a sample takes one `GpuCounterEvent` per domain, each still encoding any subset of that domain's counters. Test plan: `tools/gen_merged_protos`, `contrib/rust-sdk/tools/gen_rust_protos`, building `trace_processor_shell` and `perfetto`, and `tools/run_presubmit`. --- .../src/protos/trace/gpu/gpu_counter_event.pz.rs | 1 + .../src/protos/trace/gpu/gpu_track_event.pz.rs | 1 + protos/perfetto/trace/gpu/gpu_counter_event.proto | 5 +++++ protos/perfetto/trace/gpu/gpu_track_event.proto | 7 +++++++ protos/perfetto/trace/perfetto_trace.proto | 5 +++++ 5 files changed, 19 insertions(+) diff --git a/contrib/rust-sdk/perfetto-protos-gpu/src/protos/trace/gpu/gpu_counter_event.pz.rs b/contrib/rust-sdk/perfetto-protos-gpu/src/protos/trace/gpu/gpu_counter_event.pz.rs index ab519eb7f0d..859b3562d88 100644 --- a/contrib/rust-sdk/perfetto-protos-gpu/src/protos/trace/gpu/gpu_counter_event.pz.rs +++ b/contrib/rust-sdk/perfetto-protos-gpu/src/protos/trace/gpu/gpu_counter_event.pz.rs @@ -23,6 +23,7 @@ pb_msg!(InternedGpuCounterDescriptor { iid: u64, primitive, 1, counter_descriptor: GpuCounterDescriptor, msg, 2, gpu_id: i32, primitive, 3, + gpu_domain_id: u32, primitive, 4, }); pb_msg!(GpuCounterEvent { diff --git a/contrib/rust-sdk/perfetto-protos-gpu/src/protos/trace/gpu/gpu_track_event.pz.rs b/contrib/rust-sdk/perfetto-protos-gpu/src/protos/trace/gpu/gpu_track_event.pz.rs index 945882bad92..a82eee07fcd 100644 --- a/contrib/rust-sdk/perfetto-protos-gpu/src/protos/trace/gpu/gpu_track_event.pz.rs +++ b/contrib/rust-sdk/perfetto-protos-gpu/src/protos/trace/gpu/gpu_track_event.pz.rs @@ -35,6 +35,7 @@ pb_msg!(GpuTrackDescriptor { gpu_id: i32, primitive, 1, hw_queue_iid: u64, primitive, 2, logical_queue_id: u64, primitive, 3, + gpu_domain_id: u32, primitive, 4, }); pb_msg!(GpuCorrelation { diff --git a/protos/perfetto/trace/gpu/gpu_counter_event.proto b/protos/perfetto/trace/gpu/gpu_counter_event.proto index ff50bf14471..146126deb09 100644 --- a/protos/perfetto/trace/gpu/gpu_counter_event.proto +++ b/protos/perfetto/trace/gpu/gpu_counter_event.proto @@ -69,4 +69,9 @@ message InternedGpuCounterDescriptor { // optional. Identifier for GPU in a multi-gpu device. optional int32 gpu_id = 3; + + // optional. The domain of the GPU (e.g. a hardware block such as an SM or a + // PE) the counters belong to, scoped to `gpu_id`. See + // GpuTrackDescriptor.gpu_domain_id. + optional uint32 gpu_domain_id = 4; } diff --git a/protos/perfetto/trace/gpu/gpu_track_event.proto b/protos/perfetto/trace/gpu/gpu_track_event.proto index a0c1cb3a24e..aef8fad3371 100644 --- a/protos/perfetto/trace/gpu/gpu_track_event.proto +++ b/protos/perfetto/trace/gpu/gpu_track_event.proto @@ -80,6 +80,13 @@ message GpuTrackDescriptor { // from a process TrackDescriptor ancestor. uint64 logical_queue_id = 3; } + + // The domain of the GPU this track and all tracks below it belong to: a + // hardware block (e.g. an SM or a PE) or a producer-defined logical + // grouping, scoped to `gpu_id`. Other data sources identify the same domain + // with the same ID, e.g. InternedGpuCounterDescriptor.gpu_domain_id. Tracks + // below it must not declare a different `gpu_domain_id`. + optional uint32 gpu_domain_id = 4; } message GpuTrackDescriptorExtension { diff --git a/protos/perfetto/trace/perfetto_trace.proto b/protos/perfetto/trace/perfetto_trace.proto index fb20a6fc271..0dfb1fdb056 100644 --- a/protos/perfetto/trace/perfetto_trace.proto +++ b/protos/perfetto/trace/perfetto_trace.proto @@ -14020,6 +14020,11 @@ message InternedGpuCounterDescriptor { // optional. Identifier for GPU in a multi-gpu device. optional int32 gpu_id = 3; + + // optional. The domain of the GPU (e.g. a hardware block such as an SM or a + // PE) the counters belong to, scoped to `gpu_id`. See + // GpuTrackDescriptor.gpu_domain_id. + optional uint32 gpu_domain_id = 4; } // End of protos/perfetto/trace/gpu/gpu_counter_event.proto