diff options
| author | Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> | 2022-05-02 09:27:59 +0200 |
|---|---|---|
| committer | Marge Bot <emma+marge@anholt.net> | 2022-05-13 14:40:56 +0000 |
| commit | e549b6fe42c45efa6e2625cef7c328cb6a6a4319 (patch) | |
| tree | aa633ec6b9d7e85874172ba4b5b9dbdb7bfddd8d | |
| parent | b75b9d5cb4945af7d0205685fa84bc4dd12ecc62 (diff) | |
radeonsi: scale the number of shader compiler threads
Instead of spawning all the threads on startup.
This speeds up short lived programs (eg: piglit runs duration is reduced by ±25%),
avoid wasting resources and still make use of multi-threaded capabilities.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16273>
| -rw-r--r-- | src/gallium/drivers/radeonsi/si_pipe.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index 7eb7d364f80..48d7844732c 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -1192,18 +1192,27 @@ static struct pipe_screen *radeonsi_screen_create_impl(struct radeon_winsys *ws, /* Take a reference on the glsl types for the compiler threads. */ glsl_type_singleton_init_or_ref(); - if (!util_queue_init( - &sscreen->shader_compiler_queue, "sh", 64, num_comp_hi_threads, - UTIL_QUEUE_INIT_RESIZE_IF_FULL | UTIL_QUEUE_INIT_SET_FULL_THREAD_AFFINITY, NULL)) { + /* Start with a single thread and a single slot. + * Each time we'll hit the "all slots are in use" case, the number of threads and + * slots will be increased. + */ + int num_slots = num_comp_hi_threads == 1 ? 64 : 1; + if (!util_queue_init(&sscreen->shader_compiler_queue, "sh", num_slots, + num_comp_hi_threads, + UTIL_QUEUE_INIT_RESIZE_IF_FULL | + UTIL_QUEUE_INIT_SCALE_THREADS | + UTIL_QUEUE_INIT_SET_FULL_THREAD_AFFINITY, NULL)) { si_destroy_shader_cache(sscreen); FREE(sscreen); glsl_type_singleton_decref(); return NULL; } - if (!util_queue_init(&sscreen->shader_compiler_queue_low_priority, "shlo", 64, + if (!util_queue_init(&sscreen->shader_compiler_queue_low_priority, "shlo", num_slots, num_comp_lo_threads, - UTIL_QUEUE_INIT_RESIZE_IF_FULL | UTIL_QUEUE_INIT_SET_FULL_THREAD_AFFINITY | + UTIL_QUEUE_INIT_RESIZE_IF_FULL | + UTIL_QUEUE_INIT_SCALE_THREADS | + UTIL_QUEUE_INIT_SET_FULL_THREAD_AFFINITY | UTIL_QUEUE_INIT_USE_MINIMUM_PRIORITY, NULL)) { si_destroy_shader_cache(sscreen); FREE(sscreen); |
