[Mesa-dev] [PATCH] radv: dump the SHA1 of SPIRV in the hang report

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Thu Apr 19 05:50:11 UTC 2018


Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

On Wed, Apr 18, 2018 at 6:53 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> Might be useful for debugging purposes, especially when we
> want to replace a shader on the fly.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  src/amd/vulkan/radv_debug.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/src/amd/vulkan/radv_debug.c b/src/amd/vulkan/radv_debug.c
> index a0d01b24897..368bc4b5d05 100644
> --- a/src/amd/vulkan/radv_debug.c
> +++ b/src/amd/vulkan/radv_debug.c
> @@ -29,6 +29,7 @@
>  #include <stdio.h>
>  #include <sys/utsname.h>
>
> +#include "util/mesa-sha1.h"
>  #include "sid.h"
>  #include "gfx9d.h"
>  #include "ac_debug.h"
> @@ -499,7 +500,13 @@ radv_dump_shader(struct radv_pipeline *pipeline,
>         fprintf(f, "%s:\n\n", radv_get_shader_name(shader, stage));
>
>         if (shader->spirv) {
> -               fprintf(f, "SPIRV:\n");
> +               unsigned char sha1[21];
> +               char sha1buf[41];
> +
> +               _mesa_sha1_compute(shader->spirv, shader->spirv_size, sha1);
> +               _mesa_sha1_format(sha1buf, sha1);
> +
> +               fprintf(f, "SPIRV (sha1: %s):\n", sha1buf);
>                 radv_print_spirv(shader->spirv, shader->spirv_size, f);
>         }
>
> --
> 2.17.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list