Repository navigation
ggml-cuda: hip: add missing AMD GCN MMQ config - #27841
Conversation
|
Hi @thelittlefireman, thanks for your contribution! Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:
Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below. |
|
There seams to be code left over from perf testing in this pr. Please remove those changes. |
I left them cause I think they are missing for proper testing. |
15ac7df to
b79594d
Compare
|
@IMbackK Remove test, and rebase on master |
IMbackK
left a comment
There was a problem hiding this comment.
Lets just commit the the table in this pr and follow up with the other two changes in separate prs.
| } | ||
|
|
||
| template <ggml_type type, int J, bool fallback> | ||
| static void launch_mul_mat_q_adaptive(ggml_backend_cuda_context & ctx, const mmq_args & args, cudaStream_t stream) { |
There was a problem hiding this comment.
So avoiding the bounds check for cases other than args.nrows_x % 128 == 0 makes sense, but this changes behavior for all gpus not just GCN5, so i think it should be a seperate pr.
There was a problem hiding this comment.
agreed i will make another PR.
|
|
||
| // Wide GCN tiles are useful only if the local grid can | ||
| // provide at least one workgroup per CU. | ||
| if (GGML_CUDA_CC_IS_GCN(cc) && config.J > 64) { |
There was a problem hiding this comment.
we dont want this type of per arch tuning here instead something like this would have to be generically integrated in the mmq config tables, or by querying/adding info to the device struct for the size of the gpu.
There was a problem hiding this comment.
64 is also rather random since it being gcn tells you little about how many cus it has and small gcn5 solutions do exist.
There was a problem hiding this comment.
Agreed, i will rework on this.
b79594d to
4c56f8b
Compare
Done @IMbackK. Can you check again :) |
|
i presume its still perf positive without the other changes? |
|
In my testing: Performance
Keep the new header but revert all config changes vs. RDNA2 except for q4_0, q4_1, q8_0, q2_k, and q6_k. For q8_0, remove all configs with |
…rd815/mx-llama.cpp-Rocm10 Fork was based on b10917; brings in: - TurboQuant 2/3/4-bit KV cache types (PolarQuant + QJL), CPU quantize/dequantize (ggml-turbo-quant.c) + HIP/CUDA kernels (turbo-quant.cu), WHT rotation op GGML_OP_TURBO_WHT, turbo fattn template instances - New KV cache integration in llama-kv-cache / llama-graph / llama-context - gfx906 MMQ refactor: dedicated wave64 GCN table (mmq-config-gcn.cuh, ported from upstream PR ggml-org#27841), Q5_K J=64 I=64 override, gcn fallback replaces rdna2 Conflicts resolved (5 files): - ggml.h: turbo types renumbered to 44/45/46 (43 taken by NVFP4_E8M0) - CMakeLists.txt / dequantize.cuh / getrows.cu: additive union with our ROCmFPX/CT_INT4 additions - mmq-config-gfx906.cuh: kept our ROCmFPX/NVFP4 if-chains, took fork's Q5_K CASE values, switched fallback to ggml_cuda_mmq_get_config_gcn Co-Authored-By: Claude Code <[email protected]>
4c56f8b to
2df4b95
Compare
|
@JohannesGaessler Can you test again, I've made some tweaks. I removed J=72, 88, 104, 120 for Q8_0 as you request. Performance
|
PerformanceTable generated with
|
Overview
Per-arch MMQ config for AMD GCN arch to properly handle wave64(nthreads 512 (8 warps)) to avoid the fallback to RDNA2 MMQ config (wave32/nthreads 256))
Additional information
Additional changes:
They could be moved to another PR, for clarity.
Everything have been tested multiples times. My main goal was to be as good/fast as master branch for VGPR spill and kernel speeds.
test-backend-ops:
$.bin/test-backend-ops perf -b ROCm0 -o MUL_MAT -p "type_a=(q1_0|q2_0|q4_0|q4_1|q5_0|q5_1|q8_0|q2_K|q3_K|q4_K|q5_K|q6_K|iq1_s|iq2_xxs|iq2_xs|iq2_s|iq3_xxs|iq3_s|iq4_nl|iq4_xs|mxfp4|nvfp4),type_b=f32,m=(4096|4160|4097),n=(1|2|3|4|5|6|7|8|16|24|32|40|48|64|129|145|161|177|193|209|225|241|512),k=14336"Curent master MAT_MUL: https://pastebin.com/raw/3nEP6FJJ
PR MAT_MUL: https://pastebin.com/pL16aN4S
n=512gainm=4097m=4160The Q3_K
m=4160(−0.3%) and Q4_Kn=512(−0.5%) differences are within measurement variance. No MMQ test shows a regression greater than 1%.Small benchmark:
#23881
Requirements
YES : For testing, small code generation and help to understand. Every changes have been manually edited and tested on gfx906.