[Mesa-dev] [PATCH 2/2] i965: Give compile stats through KHR_debug.
Eric Anholt
eric at anholt.net
Thu Dec 4 16:09:58 PST 2014
Matt Turner <mattst88 at gmail.com> writes:
> ---
> src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 10 ++++++++++
> src/mesa/drivers/dri/i965/brw_vec4_generator.cpp | 10 ++++++++++
> 2 files changed, 20 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
> index bbed4cc..4ae35ac 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
> @@ -2035,6 +2035,16 @@ fs_generator::generate_code(const cfg_t *cfg, int dispatch_width)
> ralloc_free(annotation.ann);
> }
>
> + static GLuint msg_id = 0;
> + _mesa_gl_debug(&brw->ctx, &msg_id,
> + MESA_DEBUG_SOURCE_SHADER_COMPILER,
> + MESA_DEBUG_TYPE_OTHER,
> + MESA_DEBUG_SEVERITY_NOTIFICATION,
> + "FS SIMD%d shader: %d inst, %d loops, "
> + "compacted %d to %d bytes.\n",
> + dispatch_width, before_size / 16, loop_count,
> + before_size, after_size);
> +
> return start_offset;
> }
>
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
> index b353539..e998bf2 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
> @@ -1588,6 +1588,16 @@ vec4_generator::generate_code(const cfg_t *cfg)
> dump_assembly(p->store, annotation.ann_count, annotation.ann, brw, prog);
> ralloc_free(annotation.ann);
> }
> +
> + static GLuint msg_id = 0;
> + _mesa_gl_debug(&brw->ctx, &msg_id,
> + MESA_DEBUG_SOURCE_SHADER_COMPILER,
> + MESA_DEBUG_TYPE_OTHER,
> + MESA_DEBUG_SEVERITY_NOTIFICATION,
> + "VS vec4 shader: %d inst, %d loops, "
> + "compacted %d to %d bytes.\n",
> + before_size / 16, loop_count,
> + before_size, after_size);
> }
Nice idea. Patch 1/2 is:
Reviewed-by: Eric Anholt <eric at anholt.net>
Not having the ability to call back out for things like this in the GL
sucks about gallium, and I'll have to fix it if I'm going to actually
ship a gallium driver. Right now I'm doing my shader-db stats using an
env var to trigger printfs.
I'd recommend also including some sort of ID for the shader (prog->Name
or something) and how many recompiles have happened on the shader. Then
you can make nice shader-db regression reports on apitraces then go do
full shader dumps to see how a particular shader regressed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20141204/ae653ed7/attachment.sig>
More information about the mesa-dev
mailing list