You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Eval bug: Vulkan: count_experts.comp zero_skipped_rows() loops over every id in every thread #31163
In count_experts.comp, the zero_skipped_rows() loop (from #26631) runs over every expert id in every thread instead of each thread checking the ids specific to itself. Swapping the two loops speeds up prompt processing 5%-35% depending on the model . Generation isn't affected significantly since it's only one token.
changed the title [-]Vulkan: count_experts.comp zero_skipped_rows() loops over every id in every thread[/-][+]Eval bug: Vulkan: count_experts.comp zero_skipped_rows() loops over every id in every thread[/+]on Oct 25, 2026
@SG-Amadeus I tested your PR and it has the same speedup effect, maybe a tiny bit faster even. Sadly not quite as dramatic as your results :) Wow + 76%.
It's a linear problem. Each block repeats the loops over the experts so Vulkan had a progressively worse problem the more blocks a prompt needed.
Vulkan is faster than HIP on my system :)
Tested on RX 7800 XT, RADV (Mesa 25.2.8 and Mesa 26.2.5), Linux 6.8, base 2280f0f. test-backend-ops -o MUL_MAT_ID: 1109/1109 pass. pp2048, -ngl 99 -fa 1 -ub 2048, two interleaved rounds:
Thanks for testing! The large speedup mainly recovers the regression from #26631. Your fix gives essentially the same normal PP performance. I'm concerned that one thread has to zero the whole row. That might be slow when there are many skipped rows or each row is large.
Activity
[-]Vulkan: count_experts.comp zero_skipped_rows() loops over every id in every thread[/-][+]Eval bug: Vulkan: count_experts.comp zero_skipped_rows() loops over every id in every thread[/+]SG-Amadeus commentedon Oct 27, 2026
I've opened a draft PR with a potential fix on #31266. @andrewd207 Could you test it on your setup ?
andrewd207 commentedon Oct 27, 2026
@SG-Amadeus I tested your PR and it has the same speedup effect, maybe a tiny bit faster even. Sadly not quite as dramatic as your results :) Wow + 76%.
It's a linear problem. Each block repeats the loops over the experts so Vulkan had a progressively worse problem the more blocks a prompt needed.
Vulkan is faster than HIP on my system :)
Tested on RX 7800 XT, RADV (Mesa 25.2.8 and Mesa 26.2.5), Linux 6.8, base 2280f0f. test-backend-ops -o MUL_MAT_ID: 1109/1109 pass.
pp2048, -ngl 99 -fa 1 -ub 2048, two interleaved rounds:RX 7800 XT, RADV (Mesa 25.2.8), Linux 6.8, master 2280f0f, pp2048
RX 7800 XT, RADV (Mesa 26.2.5), Linux 6.8, master 2280f0f, pp2048
HIP: ROCm 7.0.3, gfx1101, same commit.
llama-bench -ngl 99 -fa 1 -ub 2048 -p 512,2048 -n 128 -r 3, mean of 2 interleaved rounds.SG-Amadeus commentedon Oct 28, 2026
Thanks for testing! The large speedup mainly recovers the regression from #26631. Your fix gives essentially the same normal PP performance. I'm concerned that one thread has to zero the whole row. That might be slow when there are many skipped rows or each row is large.