mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2025-11-11 10:36:54 +00:00
CUDA: avoid mul + bias fusion when doing fusion (#16935)
This commit is contained in:
@@ -2115,6 +2115,14 @@ static bool ggml_cuda_should_fuse_mul_mat_vec_f(const ggml_tensor * tensor) {
|
|||||||
const int cc = ggml_cuda_info().devices[ggml_cuda_get_device()].cc;
|
const int cc = ggml_cuda_info().devices[ggml_cuda_get_device()].cc;
|
||||||
use_mul_mat_vec_f = use_mul_mat_vec_f && ggml_cuda_should_use_mmvf(src0->type, cc, src0->ne, is_mul_mat_id ? src1->ne[2] : src1->ne[1]);
|
use_mul_mat_vec_f = use_mul_mat_vec_f && ggml_cuda_should_use_mmvf(src0->type, cc, src0->ne, is_mul_mat_id ? src1->ne[2] : src1->ne[1]);
|
||||||
|
|
||||||
|
const bool split = ggml_backend_buft_is_cuda_split(src0->buffer->buft) ||
|
||||||
|
ggml_backend_buft_is_cuda_split(src1->buffer->buft);
|
||||||
|
|
||||||
|
//TODO: add support for fusion for split buffers
|
||||||
|
if (split) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//we only support fusion for ncols_dst = 1
|
//we only support fusion for ncols_dst = 1
|
||||||
if (tensor->op == GGML_OP_MUL_MAT && dst->ne[1] != 1) {
|
if (tensor->op == GGML_OP_MUL_MAT && dst->ne[1] != 1) {
|
||||||
return false;
|
return false;
|
||||||
@@ -2154,6 +2162,15 @@ static bool ggml_cuda_should_fuse_mul_mat_vec_q(const ggml_tensor * tensor) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const bool split = ggml_backend_buft_is_cuda_split(src0->buffer->buft) ||
|
||||||
|
ggml_backend_buft_is_cuda_split(src1->buffer->buft);
|
||||||
|
|
||||||
|
//TODO: add support for fusion for split buffers
|
||||||
|
if (split) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return use_mul_mat_vec_q;
|
return use_mul_mat_vec_q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user