venus: further reduce idle timeout from 5ms to 1ms

Similar to the rationale for the 50ms -> 5ms adjustment before. When
there's enough cpu cycles, doing so would only help reduce cpu
utilization. When cpu is mostly drained, less host side unnecessary
polling is favored by the scheduler. Also in the latter case, it'd be
the non-primary ring, so it doesn't hurt to idle out faster.

Besides the theory, there's no regression in popular benchmarks, but
only power wins. Making the idle timeout too small will lead to overhead
built up. e.g. From the initial notify to ring being waken up, it's
about 200us. The notify op is more expensive than ring thread doing a
few more polls. However, we normally would save many more polls by idle
out earlier. From my local testing, reducing down to 500us won't incur
and real perf regressions either.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28287>
This commit is contained in:
Yiwei Zhang 2024-03-16 20:15:47 -07:00 committed by Marge Bot
parent 30d7b3bdec
commit d05eb97408

View file

@ -11,7 +11,7 @@
#include "vn_instance.h"
#include "vn_renderer.h"
#define VN_RING_IDLE_TIMEOUT_NS (5ull * 1000 * 1000)
#define VN_RING_IDLE_TIMEOUT_NS (1ull * 1000 * 1000)
static_assert(ATOMIC_INT_LOCK_FREE == 2 && sizeof(atomic_uint) == 4,
"vn_ring_shared requires lock-free 32-bit atomic_uint");