From 5dadbabb47c317f58a3b939d08e8e50745d92990 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Thu, 29 Aug 2019 17:15:46 +0200 Subject: radv/radeonsi: Don't count read-only data when reporting code size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We usually use these counts as a simple way to figure out if a change reduces the number of instructions or shrinks an instruction. However, since .rodata sections aren't executed, we shouldn't be counting their size for this analysis. Make the linker return the total executable size, and use it to report the more useful size in both drivers. Reviewed-by: Marek Olšák --- src/amd/vulkan/radv_pipeline.c | 2 +- src/amd/vulkan/radv_shader.c | 6 ++++-- src/amd/vulkan/radv_shader.h | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src/amd/vulkan') diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index 0897b2d153e..d387e56c60b 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -5025,7 +5025,7 @@ VkResult radv_GetPipelineExecutableStatisticsKHR( desc_copy(s->name, "Code size"); desc_copy(s->description, "Code size in bytes"); s->format = VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_UINT64_KHR; - s->value.u64 = shader->code_size; + s->value.u64 = shader->exec_size; } ++s; diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index e907c04863a..b6de97deb24 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -941,10 +941,12 @@ radv_shader_variant_create(struct radv_device *device, } variant->code_size = rtld_binary.rx_size; + variant->exec_size = rtld_binary.exec_size; } else { assert(binary->type == RADV_BINARY_TYPE_LEGACY); config = ((struct radv_shader_binary_legacy *)binary)->config; - variant->code_size = radv_get_shader_binary_size(((struct radv_shader_binary_legacy *)binary)->code_size); + variant->code_size = radv_get_shader_binary_size(((struct radv_shader_binary_legacy *)binary)->code_size); + variant->exec_size = variant->code_size; } variant->info = binary->variant_info; @@ -1299,7 +1301,7 @@ generate_shader_stats(struct radv_device *device, "********************\n\n\n", conf->num_sgprs, conf->num_vgprs, conf->spilled_sgprs, conf->spilled_vgprs, - variant->info.private_mem_vgprs, variant->code_size, + variant->info.private_mem_vgprs, variant->exec_size, conf->lds_size, conf->scratch_bytes_per_wave, max_simd_waves); } diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h index 67c45a0f0bd..9d18d4410c1 100644 --- a/src/amd/vulkan/radv_shader.h +++ b/src/amd/vulkan/radv_shader.h @@ -350,6 +350,7 @@ struct radv_shader_variant { uint64_t bo_offset; struct ac_shader_config config; uint32_t code_size; + uint32_t exec_size; struct radv_shader_variant_info info; /* debug only */ -- cgit v1.2.3