venus: TLS ring

This change adds a new venus feature: TLS ring
- co-owned by TLS and VkInstance
- initialized in TLS upon requested
- teardown happens upon thread exit or instance destroy
- teardown is split into 2 stages:
  1. one owner locks and destroys the ring and mark destroyed
  2. the other owner locks and frees up the tls ring storage

TLS ring supercedes the prior secondary ring and enables multi-thread
shader compilation and reduces the loading time of ROTTR from ~110s to
~21s (native is ~19s).

TLS ring is in fact a synchronous ring by design, and can be used to
redirect all exisiting synchronous submissions trivially. e.g. upon any
vn_call_*, request a TLS ring, wait for deps and then submit.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26838>
This commit is contained in:
Yiwei Zhang
2023-12-27 16:57:25 -08:00
committed by Marge Bot
parent 30316246d0
commit 945165acad
5 changed files with 144 additions and 27 deletions
+6
View File
@@ -118,6 +118,10 @@ vn_instance_fini_ring(struct vn_instance *instance)
vn_watchdog_fini(&instance->ring.watchdog);
list_for_each_entry_safe(struct vn_tls_ring, tls_ring,
&instance->ring.tls_rings, vk_head)
vn_tls_destroy_ring(tls_ring);
vn_ring_destroy(instance->ring.ring);
}
@@ -133,6 +137,8 @@ vn_instance_init_ring(struct vn_instance *instance)
if (!instance->ring.ring)
return VK_ERROR_OUT_OF_HOST_MEMORY;
list_inithead(&instance->ring.tls_rings);
vn_watchdog_init(&instance->ring.watchdog);
mtx_init(&instance->ring.roundtrip_mutex, mtx_plain);