From e8b6f61a5061083c02cb0a7561b033633edb5b00 Mon Sep 17 00:00:00 2001 From: Michael Cheng Date: Fri, 8 May 2026 01:14:11 -0700 Subject: [PATCH] intel/ds: Label compute events with dispatch dimensions in Perfetto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Format compute events as compute(x,y,z) using the end-payload group dimensions. Trailing dimensions that equal 1 are omitted to keep labels concise — e.g. compute(128,1,1) becomes compute(128). For compute_indirect, the dispatch dimensions are not known at command record time since they live in GPU memory as a VkDispatchIndirectCommand. The u_trace framework reads them back at trace flush time via the is_indirect mechanism: the GPU address is recorded alongside the tracepoint, and u_trace copies the pointed-to struct into indirect_data once the GPU has finished. The same trailing-1 trimming is applied when indirect tracing is enabled (MESA_GPU_TRACES=indirects); otherwise the event falls back to the static "compute_indirect" name. Signed-off-by: Michael Cheng Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/ds/intel_driver_ds.cc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/intel/ds/intel_driver_ds.cc b/src/intel/ds/intel_driver_ds.cc index 7d0b287f620..ff426caedac 100644 --- a/src/intel/ds/intel_driver_ds.cc +++ b/src/intel/ds/intel_driver_ds.cc @@ -596,8 +596,21 @@ 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_DYN(compute, INTEL_DS_QUEUE_STAGE_COMPUTE, + payload->group_z != 1 ? "compute(%u,%u,%u)" : + payload->group_y != 1 ? "compute(%u,%u)" : + "compute(%u)", + payload->group_x, payload->group_y, payload->group_z) +CREATE_DUAL_EVENT_CALLBACK_DYN(compute_indirect, INTEL_DS_QUEUE_STAGE_COMPUTE, + ((p_atomic_read_relaxed(&device->trace_context.enabled_traces) & + U_TRACE_TYPE_INDIRECTS) && indirect) ? + (indirect[2] != 1 ? "compute_indirect(%u,%u,%u)" : + indirect[1] != 1 ? "compute_indirect(%u,%u)" : + "compute_indirect(%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)