[Mesa-dev] [PATCH v3 1/6] spirv: Add a mechanism for dumping failing shaders

Lionel Landwerlin lionel.g.landwerlin at intel.com
Mon Jan 8 16:40:49 UTC 2018


Hmm... The email subject says it's the v3.
Am I missing something? (it's at the top of the list in my client, so 
it's probably the last you sent).

On 08/01/18 16:38, Jason Ekstrand wrote:
> There's a v3 of this
>
> On Mon, Jan 8, 2018 at 8:36 AM, Lionel Landwerlin 
> <lionel.g.landwerlin at intel.com <mailto:lionel.g.landwerlin at intel.com>> 
> wrote:
>
>     This series is :
>
>     Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com
>     <mailto:lionel.g.landwerlin at intel.com>>
>
>
>     On 04/01/18 01:34, Jason Ekstrand wrote:
>
>         ---
>           src/compiler/spirv/spirv_to_nir.c | 28
>         ++++++++++++++++++++++++++++
>           src/compiler/spirv/vtn_private.h  |  1 +
>           2 files changed, 29 insertions(+)
>
>         diff --git a/src/compiler/spirv/spirv_to_nir.c
>         b/src/compiler/spirv/spirv_to_nir.c
>         index dcff56f..66ea267 100644
>         --- a/src/compiler/spirv/spirv_to_nir.c
>         +++ b/src/compiler/spirv/spirv_to_nir.c
>         @@ -31,6 +31,8 @@
>           #include "nir/nir_constant_expressions.h"
>           #include "spirv_info.h"
>           +#include <stdio.h>
>         +
>           void
>           vtn_log(struct vtn_builder *b, enum nir_spirv_debug_level level,
>                   size_t spirv_offset, const char *message)
>         @@ -94,6 +96,27 @@ vtn_log_err(struct vtn_builder *b,
>              ralloc_free(msg);
>           }
>           +static void
>         +vtn_dump_shader(struct vtn_builder *b, const char *path,
>         const char *prefix)
>         +{
>         +   static int idx = 0;
>         +
>         +   char filename[1024];
>         +   int len = snprintf(filename, sizeof(filename),
>         "%s/%s-%d.spirv",
>         +                      path, prefix, idx++);
>         +   if (len < 0 || len >= sizeof(filename))
>         +      return;
>         +
>         +   FILE *f = fopen(filename, "w");
>         +   if (f == NULL)
>         +      return;
>         +
>         +   fwrite(b->spirv, sizeof(*b->spirv), b->spirv_word_count, f);
>         +   fclose(f);
>         +
>         +   vtn_info("SPIR-V shader dumped to %s", filename);
>         +}
>         +
>           void
>           _vtn_warn(struct vtn_builder *b, const char *file, unsigned
>         line,
>                     const char *fmt, ...)
>         @@ -117,6 +140,10 @@ _vtn_fail(struct vtn_builder *b, const
>         char *file, unsigned line,
>                          file, line, fmt, args);
>              va_end(args);
>           +   const char *dump_path = getenv("MESA_SPIRV_FAIL_DUMP_PATH");
>         +   if (dump_path)
>         +      vtn_dump_shader(b, dump_path, "fail");
>         +
>              longjmp(b->fail_jump, 1);
>           }
>           @@ -3690,6 +3717,7 @@ spirv_to_nir(const uint32_t *words,
>         size_t word_count,
>              /* Initialize the stn_builder object */
>              struct vtn_builder *b = rzalloc(NULL, struct vtn_builder);
>              b->spirv = words;
>         +   b->spirv_word_count = word_count;
>              b->file = NULL;
>              b->line = -1;
>              b->col = -1;
>         diff --git a/src/compiler/spirv/vtn_private.h
>         b/src/compiler/spirv/vtn_private.h
>         index f7d8f49..374643a 100644
>         --- a/src/compiler/spirv/vtn_private.h
>         +++ b/src/compiler/spirv/vtn_private.h
>         @@ -531,6 +531,7 @@ struct vtn_builder {
>              jmp_buf fail_jump;
>                const uint32_t *spirv;
>         +   size_t spirv_word_count;
>                nir_shader *shader;
>              const struct spirv_to_nir_options *options;
>
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180108/66586376/attachment.html>


More information about the mesa-dev mailing list