Mesa (master): radv: do not dump meta shader stats

Samuel Pitoiset hakzsam at kemper.freedesktop.org
Wed Jan 31 13:10:44 UTC 2018


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

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Wed Jan 31 11:40:24 2018 +0100

radv: do not dump meta shader stats

That's quite useless and that pollutes the output.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

---

 src/amd/vulkan/radv_pipeline.c | 30 +++++++++---------------------
 src/amd/vulkan/radv_shader.h   |  9 +++++++++
 2 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 785c216b4a..6547637338 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -110,18 +110,6 @@ void radv_DestroyPipeline(
 	radv_pipeline_destroy(device, pipeline, pAllocator);
 }
 
-static void radv_dump_pipeline_stats(struct radv_device *device, struct radv_pipeline *pipeline)
-{
-	int i;
-
-	for (i = 0; i < MESA_SHADER_STAGES; i++) {
-		if (!pipeline->shaders[i])
-			continue;
-
-		radv_shader_dump_stats(device, pipeline->shaders[i], i, stderr);
-	}
-}
-
 static uint32_t get_hash_flags(struct radv_device *device)
 {
 	uint32_t hash_flags = 0;
@@ -1861,8 +1849,15 @@ void radv_create_shaders(struct radv_pipeline *pipeline,
 
 	for (int i = 0; i < MESA_SHADER_STAGES; ++i) {
 		free(codes[i]);
-		if (modules[i] && !pipeline->device->keep_shader_info)
-			ralloc_free(nir[i]);
+		if (modules[i]) {
+			if (!pipeline->device->keep_shader_info)
+				ralloc_free(nir[i]);
+
+			if (radv_can_dump_shader_stats(device, modules[i]))
+				radv_shader_dump_stats(device,
+						       pipeline->shaders[i],
+						       i, stderr);
+		}
 	}
 
 	if (fs_m.nir)
@@ -3233,10 +3228,6 @@ radv_pipeline_init(struct radv_pipeline *pipeline,
 			pipeline->graphics.vtx_emit_num = 2;
 	}
 
-	if (device->instance->debug_flags & RADV_DEBUG_DUMP_SHADER_STATS) {
-		radv_dump_pipeline_stats(device, pipeline);
-	}
-
 	result = radv_pipeline_scratch_init(device, pipeline);
 	radv_pipeline_generate_pm4(pipeline, pCreateInfo, extra, &blend, &tess, &gs, prim, gs_out);
 
@@ -3400,9 +3391,6 @@ static VkResult radv_compute_pipeline_create(
 
 	*pPipeline = radv_pipeline_to_handle(pipeline);
 
-	if (device->instance->debug_flags & RADV_DEBUG_DUMP_SHADER_STATS) {
-		radv_dump_pipeline_stats(device, pipeline);
-	}
 	return VK_SUCCESS;
 }
 
diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h
index f6486863f8..b07f8a89e7 100644
--- a/src/amd/vulkan/radv_shader.h
+++ b/src/amd/vulkan/radv_shader.h
@@ -122,4 +122,13 @@ radv_can_dump_shader(struct radv_device *device,
 	       module && !module->nir;
 }
 
+static inline bool
+radv_can_dump_shader_stats(struct radv_device *device,
+			   struct radv_shader_module *module)
+{
+	/* Only dump non-meta shader stats. */
+	return device->instance->debug_flags & RADV_DEBUG_DUMP_SHADER_STATS &&
+	       module && !module->nir;
+}
+
 #endif




More information about the mesa-commit mailing list