pan/bi: report stats only if the shaders got compiled
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

There are some situations where we don't get a binary. In those cases
it is not relevant to report the statistics.

This was detected while using shader-db, with a shader that has a xfb
vertex shader that was not writing to gl_Position. It that case
IDVS_POSITION binary was zero, so later compiling IDVS_VARYING was
skipped. Due the skip, the pan_stat structure was not initialized, so
the debug used the wrong isa, that used different measurements. This
lead to shader-db report tool failing, due having a mix-up of
measurements.

Although an alternative would be to try to ensure that the structure
is always initialized, seems just more natural to just not report on
shaders with empty binaries (as the stats would be zero for all
measurements).

Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39310>
This commit is contained in:
Alejandro Piñeiro 2026-01-14 11:31:30 +01:00 committed by Marge Bot
parent cc81c7de23
commit ec4bcbd26d

View file

@ -234,14 +234,17 @@ panfrost_shader_compile(struct panfrost_screen *screen, const nir_shader *ir,
screen->vtbl.compile_shader(s, &inputs, &out->binary, &out->info);
if (s->info.stage == MESA_SHADER_VERTEX && out->info.vs.idvs) {
pan_stats_util_debug(dbg, "MESA_SHADER_POSITION",
&out->info.stats);
pan_stats_util_debug(dbg, "MESA_SHADER_VERTEX",
&out->info.stats_idvs_varying);
} else {
pan_stats_util_debug(dbg, mesa_shader_stage_name(s->info.stage),
&out->info.stats);
/* Report stats only if we really got the shader compiled */
if (out->binary.size > 0) {
if (s->info.stage == MESA_SHADER_VERTEX && out->info.vs.idvs) {
pan_stats_util_debug(dbg, "MESA_SHADER_POSITION",
&out->info.stats);
pan_stats_util_debug(dbg, "MESA_SHADER_VERTEX",
&out->info.stats_idvs_varying);
} else {
pan_stats_util_debug(dbg, mesa_shader_stage_name(s->info.stage),
&out->info.stats);
}
}
assert(req_local_mem >= out->info.wls_size);