summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2020-03-27 08:20:51 -0400
committerMarek Olšák <marek.olsak@amd.com>2020-03-30 23:57:52 -0400
commit6e672074dd1f3c105396a9d7a9bc35ea785569c9 (patch)
tree13745159d19527a82ff2c864742bf069ff37e999
parent4df3c7a2079bc6d11149fa42ff0ca27ea70a7942 (diff)
st/mesa: add environment variable pin_app_thread for faster glthread on AMD Zen
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4369> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4369>
-rw-r--r--src/gallium/auxiliary/util/u_helpers.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_helpers.c b/src/gallium/auxiliary/util/u_helpers.c
index 5e5eeedbf45..31b7d533952 100644
--- a/src/gallium/auxiliary/util/u_helpers.c
+++ b/src/gallium/auxiliary/util/u_helpers.c
@@ -192,6 +192,16 @@ util_pin_driver_threads_to_random_L3(struct pipe_context *ctx,
/* Do the same for the upper level thread if there is any (e.g. glthread) */
if (upper_thread)
util_pin_thread_to_L3(*upper_thread, cache, util_cpu_caps.cores_per_L3);
+
+ /* Optionally pin the application thread to the same L3 to get maximum
+ * performance with glthread on AMD Zen. (this function is only called
+ * with glthread) This is used to estimate and remove the overhead of
+ * Infinity Fabric between L3 caches.
+ */
+#if defined(HAVE_PTHREAD)
+ if (debug_get_bool_option("pin_app_thread", false))
+ util_pin_thread_to_L3(pthread_self(), cache, util_cpu_caps.cores_per_L3);
+#endif
}
/* This is a helper for hardware bring-up. Don't remove. */