Skip to content

Commit 7d65657

Browse files
CUDA: fix should_use_mmvf for ne11 == 1
1 parent 7c23f3f commit 7d65657

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ggml/src/ggml-cuda/mmvf.cu

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,12 +720,18 @@ bool ggml_cuda_should_use_mmvf(enum ggml_type type, int cc, const int64_t * src0
720720
if (src0_ne[0] % 2 != 0) {
721721
return false;
722722
}
723+
724+
// Pointers not aligned to the size of half2/nv_bfloat162/float2 would result in a crash:
723725
const size_t ts = ggml_type_size(type);
724726
for (size_t i = 0; i < GGML_MAX_DIMS; ++i) {
725727
if (src0_nb[i] % (2*ts) != 0) {
726728
return false;
727729
}
730+
if (ne11 == 1) {
731+
break; // For a single column we only care about dimension 0.
732+
}
728733
}
734+
729735
switch (type) {
730736
case GGML_TYPE_F32:
731737
if (GGML_CUDA_CC_IS_NVIDIA(cc)) {

0 commit comments

Comments
 (0)