[Mesa-dev] [PATCH 03/11] radeonsi: decrease the number of compiler threads to num CPUs - 1

Marek Olšák maraeo at gmail.com
Thu Jun 1 18:18:21 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

Reserve one core for other things (like draw calls).
---
 src/gallium/drivers/radeonsi/si_pipe.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index de4e5da..4704304 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -874,22 +874,25 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws)
 
 	si_init_screen_state_functions(sscreen);
 
 	if (!r600_common_screen_init(&sscreen->b, ws) ||
 	    !si_init_gs_info(sscreen) ||
 	    !si_init_shader_cache(sscreen)) {
 		FREE(sscreen);
 		return NULL;
 	}
 
-	/* Only enable as many threads as we have target machines and CPUs. */
+	/* Only enable as many threads as we have target machines, but at most
+	 * the number of CPUs - 1 if there is more than one.
+	 */
 	num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
+	num_cpus = MAX2(1, num_cpus - 1);
 	num_compiler_threads = MIN2(num_cpus, ARRAY_SIZE(sscreen->tm));
 
 	if (!util_queue_init(&sscreen->shader_compiler_queue, "si_shader",
 			     32, num_compiler_threads)) {
 		si_destroy_shader_cache(sscreen);
 		FREE(sscreen);
 		return NULL;
 	}
 
 	si_handle_env_var_force_family(sscreen);
-- 
2.7.4



More information about the mesa-dev mailing list