Skip to content

Commit b009236

Browse files
airMengAlcpz
authored andcommitted
[SYCL] fallback mmvq (ggml-org#9088)
* fallback mmvq to mul_mat * mmvq in cuda path * Update ggml/src/ggml-sycl.cpp Co-authored-by: Alberto Cabrera Pérez <[email protected]> --------- Co-authored-by: Alberto Cabrera Pérez <[email protected]>
1 parent 3def9ba commit b009236

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

ggml/src/ggml-sycl.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3353,7 +3353,8 @@ static void ggml_sycl_mul_mat(ggml_backend_sycl_context & ctx, const ggml_tensor
33533353

33543354
bool use_mul_mat_vec_q = ggml_is_quantized(src0->type)
33553355
&& src1->type == GGML_TYPE_F32 && dst->type == GGML_TYPE_F32
3356-
&& src1->ne[1] <= MMVQ_MAX_BATCH_SIZE;
3356+
&& src1->ne[1] <= MMVQ_MAX_BATCH_SIZE
3357+
&& (ctx.stream()->get_backend() == sycl::backend::ext_oneapi_cuda || src1->ne[1] > MMVQ_MIN_BATCH_SIZE);
33573358

33583359
bool use_mul_mat_q = ggml_sycl_supports_mmq(src0->type)
33593360
&& src1->type == GGML_TYPE_F32 && dst->type == GGML_TYPE_F32;

ggml/src/ggml-sycl/common.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ typedef sycl::float2 dfloat2;
129129
#endif // GGML_SYCL_F16
130130

131131
#define MMVQ_MAX_BATCH_SIZE 8
132+
#define MMVQ_MIN_BATCH_SIZE 4
132133

133134
static const int8_t kvalues_iq4nl[16]={-127, -104, -83, -65, -49, -35, -22, -10, 1, 13, 25, 38, 53, 69, 89, 113};
134135

0 commit comments

Comments
 (0)