From 6373bb0fafd1c8c2aec151b953d29b0aa536dd97 Mon Sep 17 00:00:00 2001 From: Michael Cheng Date: Wed, 6 May 2026 17:04:22 -0700 Subject: [PATCH] intel/ds: Label compute events with dispatch dimensions Format compute Perfetto events as compute(x,y,z) using end-payload group dimensions. For compute_indirect, the dispatch dimensions live in GPU memory at command record time (VkDispatchIndirectCommand). The u_trace framework copies them into a trace-local buffer at trace flush time via the is_indirect mechanism: indirect args are passed as u_trace_address (GPU address + bo), and u_trace copies the pointed-to struct into indirect_data alongside the payload. The end callback receives this as a const uint32_t* indirect pointer, which contains the x/y/z dispatch sizes read back from the GPU. Include these dimensions when indirect tracing is enabled (MESA_GPU_TRACES=indirects), otherwise fall back to the static name. Signed-off-by: Michael Cheng --- src/intel/ds/intel_driver_ds.cc | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/intel/ds/intel_driver_ds.cc b/src/intel/ds/intel_driver_ds.cc index 9bfa637baf0..4052f5b3d2d 100644 --- a/src/intel/ds/intel_driver_ds.cc +++ b/src/intel/ds/intel_driver_ds.cc @@ -484,8 +484,11 @@ intel_ds_format_event_name(char *buf, size_t buf_size, const char *fmt, ...) char event_name[64]; \ UNUSED const uint32_t *indirect = \ (const uint32_t *) indirect_data; \ - const char *name = intel_ds_format_event_name( \ - event_name, sizeof(event_name), (name_fmt), ##__VA_ARGS__); \ + const char *name = NULL; \ + if ((name_fmt) != NULL) { \ + name = intel_ds_format_event_name(event_name, sizeof(event_name), \ + (name_fmt), ##__VA_ARGS__); \ + } \ end_event(flush->queue, ts_ns, stage, flush->submission_id, \ tp_idx, name, payload, indirect_data, \ (trace_payload_as_extra_func) \ @@ -512,8 +515,16 @@ CREATE_DUAL_EVENT_CALLBACK(draw_mesh, INTEL_DS_QUEUE_STAGE_DRAW_MESH) CREATE_DUAL_EVENT_CALLBACK(draw_mesh_indirect, INTEL_DS_QUEUE_STAGE_DRAW_MESH) CREATE_DUAL_EVENT_CALLBACK(draw_mesh_indirect_count, INTEL_DS_QUEUE_STAGE_DRAW_MESH) CREATE_DUAL_EVENT_CALLBACK(xfb, INTEL_DS_QUEUE_STAGE_CMD_BUFFER) -CREATE_DUAL_EVENT_CALLBACK(compute, INTEL_DS_QUEUE_STAGE_COMPUTE) -CREATE_DUAL_EVENT_CALLBACK(compute_indirect, INTEL_DS_QUEUE_STAGE_COMPUTE) +CREATE_DUAL_EVENT_CALLBACK(compute, INTEL_DS_QUEUE_STAGE_COMPUTE, + "compute(%u,%u,%u)", + payload->group_x, payload->group_y, payload->group_z) +CREATE_DUAL_EVENT_CALLBACK(compute_indirect, INTEL_DS_QUEUE_STAGE_COMPUTE, + ((p_atomic_read_relaxed(&device->trace_context.enabled_traces) & + U_TRACE_TYPE_INDIRECTS) && indirect) ? + "compute_indirect(%u,%u,%u)" : "compute_indirect", + indirect ? indirect[0] : 0, + indirect ? indirect[1] : 0, + indirect ? indirect[2] : 0) CREATE_DUAL_EVENT_CALLBACK(generate_draws, INTEL_DS_QUEUE_STAGE_INTERNAL_OPS) CREATE_DUAL_EVENT_CALLBACK(generate_cmds_pre, INTEL_DS_QUEUE_STAGE_INTERNAL_OPS) CREATE_DUAL_EVENT_CALLBACK(generate_cmds_post, INTEL_DS_QUEUE_STAGE_INTERNAL_OPS)