From aff078eb5a79dc53330ee8edfc755a995a041c74 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 7 Aug 2020 22:31:44 -0500 Subject: [PATCH] anv: Stop storing the shader constant data side-band Reviewed-by: Kenneth Graunke Part-of: --- src/intel/vulkan/anv_blorp.c | 1 - src/intel/vulkan/anv_pipeline.c | 4 ---- src/intel/vulkan/anv_pipeline_cache.c | 31 --------------------------- src/intel/vulkan/anv_private.h | 8 ------- src/intel/vulkan/genX_cmd_buffer.c | 7 +++--- 5 files changed, 4 insertions(+), 47 deletions(-) diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c index 8570879f37a..af7f7cb9416 100644 --- a/src/intel/vulkan/anv_blorp.c +++ b/src/intel/vulkan/anv_blorp.c @@ -72,7 +72,6 @@ upload_blorp_shader(struct blorp_batch *batch, uint32_t stage, struct anv_shader_bin *bin = anv_pipeline_cache_upload_kernel(&device->default_pipeline_cache, stage, key, key_size, kernel, kernel_size, - NULL, 0, prog_data, prog_data_size, NULL, 0, NULL, &bind_map); diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 8313f471a67..664a916033b 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -1580,8 +1580,6 @@ anv_pipeline_compile_graphics(struct anv_graphics_pipeline *pipeline, sizeof(stages[s].cache_key), stages[s].code, stages[s].prog_data.base.program_size, - stages[s].nir->constant_data, - stages[s].nir->constant_data_size, &stages[s].prog_data.base, brw_prog_data_size(s), stages[s].stats, stages[s].num_stats, @@ -1770,8 +1768,6 @@ anv_pipeline_compile_cs(struct anv_compute_pipeline *pipeline, MESA_SHADER_COMPUTE, &stage.cache_key, sizeof(stage.cache_key), stage.code, code_size, - stage.nir->constant_data, - stage.nir->constant_data_size, &stage.prog_data.base, sizeof(stage.prog_data.cs), stage.stats, stage.num_stats, diff --git a/src/intel/vulkan/anv_pipeline_cache.c b/src/intel/vulkan/anv_pipeline_cache.c index fa9cfe4f777..12257dd7641 100644 --- a/src/intel/vulkan/anv_pipeline_cache.c +++ b/src/intel/vulkan/anv_pipeline_cache.c @@ -36,7 +36,6 @@ anv_shader_bin_create(struct anv_device *device, gl_shader_stage stage, const void *key_data, uint32_t key_size, const void *kernel_data, uint32_t kernel_size, - const void *constant_data, uint32_t constant_data_size, const struct brw_stage_prog_data *prog_data_in, uint32_t prog_data_size, const struct brw_compile_stats *stats, uint32_t num_stats, @@ -81,16 +80,6 @@ anv_shader_bin_create(struct anv_device *device, memcpy(shader->kernel.map, kernel_data, kernel_size); shader->kernel_size = kernel_size; - if (constant_data_size) { - shader->constant_data = - anv_state_pool_alloc(&device->dynamic_state_pool, - constant_data_size, 32); - memcpy(shader->constant_data.map, constant_data, constant_data_size); - } else { - shader->constant_data = ANV_STATE_NULL; - } - shader->constant_data_size = constant_data_size; - memcpy(prog_data, prog_data_in, prog_data_size); memset(prog_data_param, 0, prog_data->nr_params * sizeof(*prog_data_param)); @@ -128,7 +117,6 @@ anv_shader_bin_destroy(struct anv_device *device, { assert(shader->ref_cnt == 0); anv_state_pool_free(&device->instruction_state_pool, shader->kernel); - anv_state_pool_free(&device->dynamic_state_pool, shader->constant_data); vk_free(&device->vk.alloc, shader); } @@ -144,10 +132,6 @@ anv_shader_bin_write_to_blob(const struct anv_shader_bin *shader, blob_write_uint32(blob, shader->kernel_size); blob_write_bytes(blob, shader->kernel.map, shader->kernel_size); - blob_write_uint32(blob, shader->constant_data_size); - blob_write_bytes(blob, shader->constant_data.map, - shader->constant_data_size); - blob_write_uint32(blob, shader->prog_data_size); blob_write_bytes(blob, shader->prog_data, shader->prog_data_size); @@ -196,9 +180,6 @@ anv_shader_bin_create_from_blob(struct anv_device *device, uint32_t kernel_size = blob_read_uint32(blob); const void *kernel_data = blob_read_bytes(blob, kernel_size); - uint32_t constant_data_size = blob_read_uint32(blob); - const void *constant_data = blob_read_bytes(blob, constant_data_size); - uint32_t prog_data_size = blob_read_uint32(blob); const struct brw_stage_prog_data *prog_data = blob_read_bytes(blob, prog_data_size); @@ -234,7 +215,6 @@ anv_shader_bin_create_from_blob(struct anv_device *device, return anv_shader_bin_create(device, stage, key_data, key_size, kernel_data, kernel_size, - constant_data, constant_data_size, prog_data, prog_data_size, stats, num_stats, xfb_info, &bind_map); } @@ -403,8 +383,6 @@ anv_pipeline_cache_add_shader_locked(struct anv_pipeline_cache *cache, const void *key_data, uint32_t key_size, const void *kernel_data, uint32_t kernel_size, - const void *constant_data, - uint32_t constant_data_size, const struct brw_stage_prog_data *prog_data, uint32_t prog_data_size, const struct brw_compile_stats *stats, @@ -421,7 +399,6 @@ anv_pipeline_cache_add_shader_locked(struct anv_pipeline_cache *cache, anv_shader_bin_create(cache->device, stage, key_data, key_size, kernel_data, kernel_size, - constant_data, constant_data_size, prog_data, prog_data_size, stats, num_stats, xfb_info, bind_map); if (!bin) @@ -437,8 +414,6 @@ anv_pipeline_cache_upload_kernel(struct anv_pipeline_cache *cache, gl_shader_stage stage, const void *key_data, uint32_t key_size, const void *kernel_data, uint32_t kernel_size, - const void *constant_data, - uint32_t constant_data_size, const struct brw_stage_prog_data *prog_data, uint32_t prog_data_size, const struct brw_compile_stats *stats, @@ -452,7 +427,6 @@ anv_pipeline_cache_upload_kernel(struct anv_pipeline_cache *cache, struct anv_shader_bin *bin = anv_pipeline_cache_add_shader_locked(cache, stage, key_data, key_size, kernel_data, kernel_size, - constant_data, constant_data_size, prog_data, prog_data_size, stats, num_stats, xfb_info, bind_map); @@ -469,7 +443,6 @@ anv_pipeline_cache_upload_kernel(struct anv_pipeline_cache *cache, return anv_shader_bin_create(cache->device, stage, key_data, key_size, kernel_data, kernel_size, - constant_data, constant_data_size, prog_data, prog_data_size, stats, num_stats, xfb_info, bind_map); @@ -703,8 +676,6 @@ anv_device_upload_kernel(struct anv_device *device, gl_shader_stage stage, const void *key_data, uint32_t key_size, const void *kernel_data, uint32_t kernel_size, - const void *constant_data, - uint32_t constant_data_size, const struct brw_stage_prog_data *prog_data, uint32_t prog_data_size, const struct brw_compile_stats *stats, @@ -716,14 +687,12 @@ anv_device_upload_kernel(struct anv_device *device, if (cache) { bin = anv_pipeline_cache_upload_kernel(cache, stage, key_data, key_size, kernel_data, kernel_size, - constant_data, constant_data_size, prog_data, prog_data_size, stats, num_stats, xfb_info, bind_map); } else { bin = anv_shader_bin_create(device, stage, key_data, key_size, kernel_data, kernel_size, - constant_data, constant_data_size, prog_data, prog_data_size, stats, num_stats, xfb_info, bind_map); diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 46f64cfd8b2..f73b695ab99 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1293,8 +1293,6 @@ anv_pipeline_cache_upload_kernel(struct anv_pipeline_cache *cache, gl_shader_stage stage, const void *key_data, uint32_t key_size, const void *kernel_data, uint32_t kernel_size, - const void *constant_data, - uint32_t constant_data_size, const struct brw_stage_prog_data *prog_data, uint32_t prog_data_size, const struct brw_compile_stats *stats, @@ -1314,8 +1312,6 @@ anv_device_upload_kernel(struct anv_device *device, gl_shader_stage stage, const void *key_data, uint32_t key_size, const void *kernel_data, uint32_t kernel_size, - const void *constant_data, - uint32_t constant_data_size, const struct brw_stage_prog_data *prog_data, uint32_t prog_data_size, const struct brw_compile_stats *stats, @@ -3351,9 +3347,6 @@ struct anv_shader_bin { struct anv_state kernel; uint32_t kernel_size; - struct anv_state constant_data; - uint32_t constant_data_size; - const struct brw_stage_prog_data *prog_data; uint32_t prog_data_size; @@ -3370,7 +3363,6 @@ anv_shader_bin_create(struct anv_device *device, gl_shader_stage stage, const void *key, uint32_t key_size, const void *kernel, uint32_t kernel_size, - const void *constant_data, uint32_t constant_data_size, const struct brw_stage_prog_data *prog_data, uint32_t prog_data_size, const struct brw_compile_stats *stats, uint32_t num_stats, diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index d65da902ce8..8bcb4f4affd 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -2512,10 +2512,11 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer, anv_cmd_buffer_alloc_surface_state(cmd_buffer); struct anv_address constant_data = { - .bo = cmd_buffer->device->dynamic_state_pool.block_pool.bo, - .offset = shader->constant_data.offset, + .bo = cmd_buffer->device->instruction_state_pool.block_pool.bo, + .offset = shader->kernel.offset + + shader->prog_data->const_data_offset, }; - unsigned constant_data_size = shader->constant_data_size; + unsigned constant_data_size = shader->prog_data->const_data_size; const enum isl_format format = anv_isl_format_for_descriptor_type(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER); -- 2.30.2