Repository navigation
Mali: the GPU-progress waiter thread on by default - #466
Conversation
Reading the timeline's value on ARM's Mali driver blocks in the kernel until the GPU has caught up with everything submitted, the same stall Turnip over KGSL had (exec.c's comment there, 2026-11-13): without the waiter thread, every read of vk_completed_seq (vk_collect_dead, the ring, the caches - once a submission or more) stopped the render thread until the GPU finished. On a Helio G95's Mali-G76 (Redmi Note 9 Pro, 8 GB) that was half the render thread's time in the world (simpleperf --trace-offcpu, 2026-11-15). With the waiter thread and its per-submission fences on: the render thread and the GPU work at the same time, and nothing else reads the timeline, so it isn't signalled either (LARECOMP_SEQ_NO_TIMELINE). The default only gains Mali (device.c vk_driver_is_mali: driverID VK_DRIVER_ID_ARM_PROPRIETARY, or the 0x13B5 vendor id - Xclipse reports Mesa's driverID, so the vendor id is what catches it); Turnip and low RAM as before. LARECOMP_SEQ_THREAD=0 restores the stock behavior.
|
Thanks! Only the default changes, and Mali phones with 4 GB or less already run this path, so I'm fine with it. Could you add the |
|
Right you are, it's PanVK not Xclipse: the vendor id is ARM's, and Xclipse reports AMD's (0x1002, RADV's driverID), so the vendor-id catch was never about it. The PR text claimed it was; that sentence and the comment in |
|
Thanks for fixing the note. The code is fine; I'll merge it once the |
|
Thank you. The PR text and the |
mamcjr
left a comment
There was a problem hiding this comment.
Thanks! This merges cleanly as text but doesn't compile: main already has bool vk_driver_is_mali(void) (device.c, declared in vk.h), and this PR adds a second definition, so the merged device.c fails with a redefinition. Could you drop the device.c part and keep only the one line in exec.c (seq_thread_on)? Main's version is also the safer one: it only takes vendor 0x13B5 when driverID == 0, so PanVK isn't caught, and the PanVK comment can go.
Still missing from my last comment: the [vk] GPU progress: line from the G76 and the power numbers (LARECOMP_LOG_POWER=1). On Turnip nothing changes, since vk_driver_is_turnip() is already true there.
main's own (8bb3c02) is kept: ARM's driver, or Mali's vendor id only when the driver id is unset - so PanVK isn't counted as Mali. The waiter thread's default (exec.c seq_thread_on) uses it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
What
Reading the timeline's value on ARM's Mali driver blocks in the kernel until the GPU has caught up with everything submitted - the same stall Turnip over KGSL had (the comment over
seq_waiter, 2026-11-13): without the waiter thread, every read ofvk_completed_seq(vk_collect_dead, the ring, the caches - once a submission or more) stopped the render thread until the GPU finished, so the render thread and the GPU never worked at the same time.This turns the existing waiter thread on for Mali (
device.c vk_driver_is_mali:VK_DRIVER_ID_ARM_PROPRIETARY, or the 0x13B5 vendor id - Xclipse reports Mesa's driverID, so the vendor id is what catches it). Nothing else: the per-submission fences, the "don't signal the timeline" path (LARECOMP_SEQ_NO_TIMELINE) and the low-RAM / Turnip defaults are exactly what main has.Measurements
On the device this was tuned on - Helio G95, Mali-G76:
vkGetSemaphoreCounterValueon the timeline -simpleperf --trace-offcpu, 2026-11-15. The world (BotW's overworld around the Great Plateau) ran at 14-15 fps.exec.c.LARECOMP_SEQ_THREAD=0restores the stock behaviour; the log line ([vk] GPU progress: ...) says which one ran, so a report from any Mali phone says whether it applied.Where it touches
runtime/nvn/vulkan/device.c-vk_driver_is_mali(), same shape as the Turnip/RADV ones beside it.runtime/nvn/vulkan/exec.c- the default inseq_thread_ongainsvk_driver_is_mali(); the comment block above it says what the Mali stall is and where the numbers come from.Redone on current main as asked (PR #417's version was on the 0.4.1 fork: it rewrote that whole spot; main has since moved it to Turnip + per-submission fences, and Mali slots into that).