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 <michael.cheng@intel.com>
This commit is contained in:
Michael Cheng 2026-05-06 17:04:22 -07:00 committed by michaelonchrome
parent 1b4963e382
commit 6373bb0faf

View file

@ -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)