Mesa (master): iris: Add a kernel_input_size field for compiled shaders

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Aug 12 10:29:16 UTC 2020


Module: Mesa
Branch: master
Commit: 6dfe41c54e2cc1554a64c4291f83f39966457154
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6dfe41c54e2cc1554a64c4291f83f39966457154

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Tue Aug 11 10:07:55 2020 -0500

iris: Add a kernel_input_size field for compiled shaders

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6280>

---

 src/gallium/drivers/iris/iris_context.h       |  4 ++++
 src/gallium/drivers/iris/iris_disk_cache.c    |  6 +++++-
 src/gallium/drivers/iris/iris_program.c       | 12 ++++++------
 src/gallium/drivers/iris/iris_program_cache.c |  4 +++-
 4 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h
index e34e3e93475..1cdb035cfe5 100644
--- a/src/gallium/drivers/iris/iris_context.h
+++ b/src/gallium/drivers/iris/iris_context.h
@@ -438,6 +438,9 @@ struct iris_compiled_shader {
    enum brw_param_builtin *system_values;
    unsigned num_system_values;
 
+   /** Size (in bytes) of the kernel input data */
+   unsigned kernel_input_size;
+
    /** Number of constbufs expected by the shader. */
    unsigned num_cbufs;
 
@@ -886,6 +889,7 @@ struct iris_compiled_shader *iris_upload_shader(struct iris_context *ice,
                                                 uint32_t *streamout,
                                                 enum brw_param_builtin *sysv,
                                                 unsigned num_system_values,
+                                                unsigned kernel_input_size,
                                                 unsigned num_cbufs,
                                                 const struct iris_binding_table *bt);
 const void *iris_find_previous_compile(const struct iris_context *ice,
diff --git a/src/gallium/drivers/iris/iris_disk_cache.c b/src/gallium/drivers/iris/iris_disk_cache.c
index f55a83487a7..5554b5c2f17 100644
--- a/src/gallium/drivers/iris/iris_disk_cache.c
+++ b/src/gallium/drivers/iris/iris_disk_cache.c
@@ -114,6 +114,7 @@ iris_disk_cache_store(struct disk_cache *cache,
    blob_write_uint32(&blob, shader->num_system_values);
    blob_write_bytes(&blob, shader->system_values,
                     shader->num_system_values * sizeof(enum brw_param_builtin));
+   blob_write_uint32(&blob, shader->kernel_input_size);
    blob_write_bytes(&blob, prog_data->param,
                     prog_data->nr_params * sizeof(uint32_t));
    blob_write_bytes(&blob, &shader->bt, sizeof(shader->bt));
@@ -164,6 +165,7 @@ iris_disk_cache_retrieve(struct iris_context *ice,
    struct brw_stage_prog_data *prog_data = ralloc_size(NULL, prog_data_size);
    const void *assembly;
    uint32_t num_system_values;
+   uint32_t kernel_input_size;
    uint32_t *system_values = NULL;
    uint32_t *so_decls = NULL;
 
@@ -179,6 +181,8 @@ iris_disk_cache_retrieve(struct iris_context *ice,
                       num_system_values * sizeof(enum brw_param_builtin));
    }
 
+   kernel_input_size = blob_read_uint32(&blob);
+
    prog_data->param = NULL;
    prog_data->pull_param = NULL;
    assert(prog_data->nr_pull_params == 0);
@@ -218,7 +222,7 @@ iris_disk_cache_retrieve(struct iris_context *ice,
    struct iris_compiled_shader *shader =
       iris_upload_shader(ice, stage, key_size, prog_key, assembly,
                          prog_data, so_decls, system_values,
-                         num_system_values, num_cbufs, &bt);
+                         num_system_values, kernel_input_size, num_cbufs, &bt);
 
    free(buffer);
 
diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c
index f38afc5726d..80af3323bb9 100644
--- a/src/gallium/drivers/iris/iris_program.c
+++ b/src/gallium/drivers/iris/iris_program.c
@@ -1139,7 +1139,7 @@ iris_compile_vs(struct iris_context *ice,
    struct iris_compiled_shader *shader =
       iris_upload_shader(ice, IRIS_CACHE_VS, sizeof(*key), key, program,
                          prog_data, so_decls, system_values, num_system_values,
-                         num_cbufs, &bt);
+                         0, num_cbufs, &bt);
 
    iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key));
 
@@ -1345,7 +1345,7 @@ iris_compile_tcs(struct iris_context *ice,
    struct iris_compiled_shader *shader =
       iris_upload_shader(ice, IRIS_CACHE_TCS, sizeof(*key), key, program,
                          prog_data, NULL, system_values, num_system_values,
-                         num_cbufs, &bt);
+                         0, num_cbufs, &bt);
 
    if (ish)
       iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key));
@@ -1474,7 +1474,7 @@ iris_compile_tes(struct iris_context *ice,
    struct iris_compiled_shader *shader =
       iris_upload_shader(ice, IRIS_CACHE_TES, sizeof(*key), key, program,
                          prog_data, so_decls, system_values, num_system_values,
-                         num_cbufs, &bt);
+                         0, num_cbufs, &bt);
 
    iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key));
 
@@ -1595,7 +1595,7 @@ iris_compile_gs(struct iris_context *ice,
    struct iris_compiled_shader *shader =
       iris_upload_shader(ice, IRIS_CACHE_GS, sizeof(*key), key, program,
                          prog_data, so_decls, system_values, num_system_values,
-                         num_cbufs, &bt);
+                         0, num_cbufs, &bt);
 
    iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key));
 
@@ -1710,7 +1710,7 @@ iris_compile_fs(struct iris_context *ice,
    struct iris_compiled_shader *shader =
       iris_upload_shader(ice, IRIS_CACHE_FS, sizeof(*key), key, program,
                          prog_data, NULL, system_values, num_system_values,
-                         num_cbufs, &bt);
+                         0, num_cbufs, &bt);
 
    iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key));
 
@@ -1992,7 +1992,7 @@ iris_compile_cs(struct iris_context *ice,
    struct iris_compiled_shader *shader =
       iris_upload_shader(ice, IRIS_CACHE_CS, sizeof(*key), key, program,
                          prog_data, NULL, system_values, num_system_values,
-                         num_cbufs, &bt);
+                         0, num_cbufs, &bt);
 
    iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key));
 
diff --git a/src/gallium/drivers/iris/iris_program_cache.c b/src/gallium/drivers/iris/iris_program_cache.c
index 085f4a50b95..f7f7d63cce3 100644
--- a/src/gallium/drivers/iris/iris_program_cache.c
+++ b/src/gallium/drivers/iris/iris_program_cache.c
@@ -199,6 +199,7 @@ iris_upload_shader(struct iris_context *ice,
                    uint32_t *streamout,
                    enum brw_param_builtin *system_values,
                    unsigned num_system_values,
+                   unsigned kernel_input_size,
                    unsigned num_cbufs,
                    const struct iris_binding_table *bt)
 {
@@ -234,6 +235,7 @@ iris_upload_shader(struct iris_context *ice,
    shader->streamout = streamout;
    shader->system_values = system_values;
    shader->num_system_values = num_system_values;
+   shader->kernel_input_size = kernel_input_size;
    shader->num_cbufs = num_cbufs;
    shader->bt = *bt;
 
@@ -296,7 +298,7 @@ iris_blorp_upload_shader(struct blorp_batch *blorp_batch, uint32_t stage,
 
    struct iris_compiled_shader *shader =
       iris_upload_shader(ice, IRIS_CACHE_BLORP, key_size, key, kernel,
-                         prog_data, NULL, NULL, 0, 0, &bt);
+                         prog_data, NULL, NULL, 0, 0, 0, &bt);
 
    struct iris_bo *bo = iris_resource_bo(shader->assembly.res);
    *kernel_out =



More information about the mesa-commit mailing list