[Mesa-dev] [PATCH 09/10] radeonsi: automatically resize shader compiler thread queues when they are full

Marek Olšák maraeo at gmail.com
Mon Jul 10 21:21:44 UTC 2017


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

---
 src/gallium/drivers/radeonsi/si_pipe.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index e2ec377..4df60b6 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -954,35 +954,31 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws,
 	/* 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_threads = sysconf(_SC_NPROCESSORS_ONLN);
 	num_threads = MAX2(1, num_threads - 1);
 	num_compiler_threads = MIN2(num_threads, ARRAY_SIZE(sscreen->tm));
 	num_compiler_threads_lowprio =
 		MIN2(num_threads, ARRAY_SIZE(sscreen->tm_low_priority));
 
 	if (!util_queue_init(&sscreen->shader_compiler_queue, "si_shader",
-			     32, num_compiler_threads, 0)) {
+			     32, num_compiler_threads,
+			     UTIL_QUEUE_INIT_RESIZE_IF_FULL)) {
 		si_destroy_shader_cache(sscreen);
 		FREE(sscreen);
 		return NULL;
 	}
 
-	/* The queue must be large enough so that adding optimized shaders
-	 * doesn't stall draw calls when the queue is full. Especially varying
-	 * packing generates a very high volume of optimized shader compilation
-	 * jobs.
-	 */
 	if (!util_queue_init(&sscreen->shader_compiler_queue_low_priority,
 			     "si_shader_low",
-			     1024, num_compiler_threads,
-			     UTIL_QUEUE_INIT_USE_MINIMUM_PRIORITY)) {
+			     32, num_compiler_threads,
+			     UTIL_QUEUE_INIT_RESIZE_IF_FULL)) {
 	       si_destroy_shader_cache(sscreen);
 	       FREE(sscreen);
 	       return NULL;
 	}
 
 	si_handle_env_var_force_family(sscreen);
 
 	if (!debug_get_bool_option("RADEON_DISABLE_PERFCOUNTERS", false))
 		si_init_perfcounters(sscreen);
 
-- 
2.7.4



More information about the mesa-dev mailing list