Repository navigation
CUDA: use MMVF for thin f16/bf16 mul_mat at small batch size - #29633
Conversation
|
can you measure on more devices? Preferably ampere and ada too |
JohannesGaessler
left a comment
There was a problem hiding this comment.
Modify the logic in ggml_cuda_should_use_mmvf instead of adding a second check in ggml_cuda_mul_mat. You can dynamically adjust the threshold for ne11 based on the return value of ggml_cuda_should_use_mmf.
Performance RTX-4090
Performance RTX-3090
|
|
it says thin F16 and BF16, have we measured the F16 path? because that would I think have a different performance profile. |
yup need to collect that, let me change the outtype to fp16 and collect perf sweep for that. |
Performance RTX-PRO-6000-BLACKWELLSeeing similar gains with FP16
|
Signed-off-by: ynankani <ynankani@nvidia.com>
e56cd33 to
bbbb1d0
Compare
| // MMF needs full row tiles, for other row counts MMVF still beats cuBLAS at small batch size | ||
| if (src0_small && !ggml_cuda_should_use_mmf(type, cc, warp_size, src0_ne, src0_nb, ne11, /*mul_mat_id =*/ false)) { | ||
| return ne11 <= MMVF_MAX_BATCH_SIZE; | ||
| } |
There was a problem hiding this comment.
My intuition is that the correct logic is to put this in front of the switch statement for the type. I'll check the AMD performance.
|
Note: these numbers are with a patch on top that force-disables MMF. It seems that only for RDNA a speedup can be achieved vs. hipBLAS by using MMVF more often:
I did not touch the NVIDIA-specific logic. |
44dab7b to
ebae262
Compare
|
Hi @am17an, Could i please get a 2nd review and approval for this? |
matcher Upstream ggml-org#29633 added a warp_size parameter; the fused Q4_K gate/up SwiGLU matcher still used the old signature and failed to compile.
Overview
Use MMVF for thin f16/bf16 mul_mat at small batch size instead of slow cublass path. Credits to @am17an for this suggestion #29187 (comment)
Additional information
Performance RTX-6000 PRO-BLACKWELL
Collected with -p 256 -n 0 -ub 1,2,3,4,5,6,7,8 -r 5 <style> </style>Requirements