Repository navigation
ggml-cuda: fix a mountain of VGPR spills on Q2_K - #29910
thelittlefireman wants to merge 4 commits into
Conversation
PerformanceTable generated with
The results I get are mixed and quite different and don't match what you're reporting. I am using the q2_K_S model which has all tensors as q2_K rather than the "q2_K" model which contains some q3_K tensors. However, for the q2_K model I'm observing the same pattern:
|
|
what also dosent make sense here is that the hip quality check should have picked up on these spills. Edit: it did the spills are real i just missed the kernel in the list. |
Thanks for the tests. That's strange. I Will try to reproduce and fix.
|
|
@JohannesGaessler I can't reproduce. Can you give me your rocm version that you use to compare ? Thanks a lot
|
|
I see very strange and inconsistent (but consistent run to run) results too. rocm 7.2.4 AMD clang version 23.0.0
|
I'm on rocm 7.14, could you try with it to see if it's a toolchain issue ? |
|
On my MI50 machine I am using: ┌─[johannesg@johannes-x10sra] - [~] - [10450]
└─[$] hipcc --version [20:31:27]
HIP version: 7.2.53211-9999
AMD clang version 22.0.0git (/srcdest/rocm-llvm f58b06dce1f9c15707c5f808fd002e18c2accf7e)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /opt/rocm/lib/llvm/bin |
|
I try to compile on your arch with 7.14 and 7.12. to see if there is difference. There is some VGPR/Spill count changes between two but i can't explain the stranges bench/numbers that you get. I need help to understand, sorry.
|
|
Sorry, but I don't understand it either. |
3ab8634 to
f2179ef
Compare
|
I think I can explain. Depending on the clang version used, the ROCm compiler generates different bytecode :) See this thread: gufo-org/gufo#255 So, the spill depends what version you compile the code with. |
|
I agree. There seems to be a regression between rocm 7.2.1 and rocm 7.14 on shcheduling or vgpr selection. On Q2_K vgpr spill are muliply by 10 on master. |
|
Quite frankly, I have concerns about maintainability if we try to accommodate multiple different ROCm versions at the same time. I think the only viable paths for is to either
|
|
@JohannesGaessler @pwilkin For this PR I will rollback the 3 |
|
Conclusion useless ==> Close
|
Overview
Q2_K mmq spill massively at least on AMD. Fix it by changing to more gentle unroll and removing a not needed temporary loop.
Additional information
AMD gfx906 / MI50 GCN5 - Q2_K DP4A
Meta-Llama-3-8B-Instruct-Q2_K.gguf, pp2048, -b 2048, -r 10.
AMD gfx1152 RDNA 3.5 - Q2_K MMA
Meta-Llama-3-8B-Instruct-Q2_K.gguf, pp2048, -b 2048, -r 10
On both i try different unroll 1,2,4 and mesure spill.
unroll 1was the best for RDNA3.5/MMA and on GCN5unroll 2was the best on D4PA.test-backend-ops
I run a separate github actions to mesure spill on sm61 and sm70 and it seems to remove all the spill too.
Could someone with Nvidia Pascal/Volta could confirms that ? Otherwise i will add a
#if GGML_USE_HIParound the bothunroll 2.Requirements