iris: Add a kernel_input_size field for compiled shaders
authorJason Ekstrand <jason@jlekstrand.net>
Tue, 11 Aug 2020 15:07:55 +0000 (10:07 -0500)
committerMarge Bot <eric+marge@anholt.net>
Wed, 12 Aug 2020 10:11:06 +0000 (10:11 +0000)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6280>

src/gallium/drivers/iris/iris_context.h
src/gallium/drivers/iris/iris_disk_cache.c
src/gallium/drivers/iris/iris_program.c
src/gallium/drivers/iris/iris_program_cache.c

index e34e3e93475983a4706d86b8c771e56dcd29d2ec..1cdb035cfe52b44a334bd6c89126bd19f75c1b59 100644 (file)
@@ -438,6 +438,9 @@ struct iris_compiled_shader {
    enum brw_param_builtin *system_values;
    unsigned num_system_values;
 
    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;
 
    /** 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,
                                                 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,
                                                 unsigned num_cbufs,
                                                 const struct iris_binding_table *bt);
 const void *iris_find_previous_compile(const struct iris_context *ice,
index f55a83487a7b76e0facb732fa8aee45c096c0129..5554b5c2f17b5fcddf19faad3ae312df54601bea 100644 (file)
@@ -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->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));
    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;
    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;
 
    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));
    }
 
                       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);
    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,
    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);
 
 
    free(buffer);
 
index f38afc5726d9b7d0a886ff8d0765d50efb201cfc..80af3323bb9019532b217a9654494492904ba6e7 100644 (file)
@@ -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,
    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));
 
 
    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,
    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));
 
    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,
    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));
 
 
    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,
    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));
 
 
    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,
    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));
 
 
    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,
    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));
 
 
    iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key));
 
index 085f4a50b9543190e20d8bd6559e527bb94c2100..f7f7d63cce3ed032a8ea38fa735c901e0c4e9600 100644 (file)
@@ -199,6 +199,7 @@ iris_upload_shader(struct iris_context *ice,
                    uint32_t *streamout,
                    enum brw_param_builtin *system_values,
                    unsigned num_system_values,
                    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)
 {
                    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->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;
 
    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,
 
    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 =
 
    struct iris_bo *bo = iris_resource_bo(shader->assembly.res);
    *kernel_out =