Skip to content

Commit 266b851

Browse files
authored
sycl : Reroute permuted mul_mats through oneMKL (#10408)
This PR fixes the failing MUL_MAT tests for the sycl backend.
1 parent 938f608 commit 266b851

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

ggml/src/ggml-sycl/ggml-sycl.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3447,8 +3447,15 @@ static void ggml_sycl_mul_mat(ggml_backend_sycl_context & ctx, const ggml_tensor
34473447
use_dequantize_mul_mat_vec = use_dequantize_mul_mat_vec && !use_mul_mat_vec_q;
34483448

34493449
if (!split && src0->type == GGML_TYPE_F16 && ggml_is_permuted(src0) && ggml_is_permuted(src1) && src1->ne[1] == 1) {
3450-
// KQ single-batch
3451-
ggml_sycl_mul_mat_vec_p021(ctx, src0, src1, dst);
3450+
// TODO: Refactor and cleanup of mul mat dispatching.
3451+
if (src0->ne[3] == 1 && src1->ne[3] == 1) {
3452+
// KQ single-batch
3453+
// mmv p021 was specific for these dimensions
3454+
ggml_sycl_mul_mat_vec_p021(ctx, src0, src1, dst);
3455+
} else {
3456+
// The kernel from the if path is faster for that specific case, but does not support all mul mats.
3457+
ggml_sycl_mul_mat_batched_sycl(ctx, src0, src1, dst);
3458+
}
34523459
} else if (!split && src0->type == GGML_TYPE_F16 && !ggml_is_contiguous(src0) && !ggml_is_transposed(src1) && src1->ne[1] == 1) {
34533460
// KQV single-batch
34543461
ggml_sycl_mul_mat_vec_nc(ctx, src0, src1, dst);

0 commit comments

Comments
 (0)