|
@@ -7414,6 +7414,8 @@ static void ggml_cuda_mul_mat(const ggml_tensor * src0, const ggml_tensor * src1
|
|
|
(src1->backend == GGML_BACKEND_GPU) &&
|
|
(src1->backend == GGML_BACKEND_GPU) &&
|
|
|
( dst->backend == GGML_BACKEND_GPU);
|
|
( dst->backend == GGML_BACKEND_GPU);
|
|
|
|
|
|
|
|
|
|
+ const bool split = src0->backend == GGML_BACKEND_GPU_SPLIT;
|
|
|
|
|
+
|
|
|
int64_t min_compute_capability = INT_MAX;
|
|
int64_t min_compute_capability = INT_MAX;
|
|
|
for (int64_t id = 0; id < g_device_count; ++id) {
|
|
for (int64_t id = 0; id < g_device_count; ++id) {
|
|
|
if (min_compute_capability > g_compute_capabilities[id] && g_tensor_split[id] < (id + 1 < g_device_count ? g_tensor_split[id + 1] : 1.0f)) {
|
|
if (min_compute_capability > g_compute_capabilities[id] && g_tensor_split[id] < (id + 1 < g_device_count ? g_tensor_split[id + 1] : 1.0f)) {
|
|
@@ -7435,13 +7437,13 @@ static void ggml_cuda_mul_mat(const ggml_tensor * src0, const ggml_tensor * src1
|
|
|
//printf("src0 is contiguous %d, transposed %d, type = %s, name = %s\n", ggml_is_contiguous(src0), ggml_is_transposed(src0), ggml_type_name(src0->type), src0->name);
|
|
//printf("src0 is contiguous %d, transposed %d, type = %s, name = %s\n", ggml_is_contiguous(src0), ggml_is_transposed(src0), ggml_type_name(src0->type), src0->name);
|
|
|
//printf("src1 is contiguous %d, transposed %d, type = %s, name = %s\n", ggml_is_contiguous(src1), ggml_is_transposed(src1), ggml_type_name(src1->type), src1->name);
|
|
//printf("src1 is contiguous %d, transposed %d, type = %s, name = %s\n", ggml_is_contiguous(src1), ggml_is_transposed(src1), ggml_type_name(src1->type), src1->name);
|
|
|
|
|
|
|
|
- if (all_on_device && !use_tensor_cores && src0->type == GGML_TYPE_F16 && ggml_is_permuted(src0) && ggml_is_permuted(src1) && src1->ne[1] == 1) {
|
|
|
|
|
|
|
+ if (!split && all_on_device && !use_tensor_cores && src0->type == GGML_TYPE_F16 && ggml_is_permuted(src0) && ggml_is_permuted(src1) && src1->ne[1] == 1) {
|
|
|
// KQ single-batch
|
|
// KQ single-batch
|
|
|
ggml_cuda_mul_mat_vec_p021(src0, src1, dst);
|
|
ggml_cuda_mul_mat_vec_p021(src0, src1, dst);
|
|
|
- } else if (all_on_device && !use_tensor_cores && src0->type == GGML_TYPE_F16 && !ggml_is_contiguous(src0) && !ggml_is_transposed(src1) && src1->ne[1] == 1) {
|
|
|
|
|
|
|
+ } else if (!split && all_on_device && !use_tensor_cores && src0->type == GGML_TYPE_F16 && !ggml_is_contiguous(src0) && !ggml_is_transposed(src1) && src1->ne[1] == 1) {
|
|
|
// KQV single-batch
|
|
// KQV single-batch
|
|
|
ggml_cuda_mul_mat_vec_nc(src0, src1, dst);
|
|
ggml_cuda_mul_mat_vec_nc(src0, src1, dst);
|
|
|
- } else if (all_on_device && use_tensor_cores && src0->type == GGML_TYPE_F16 && src1->type == GGML_TYPE_F32 && !ggml_is_transposed(src0) && !ggml_is_transposed(src1)) {
|
|
|
|
|
|
|
+ } else if (!split && all_on_device && use_tensor_cores && src0->type == GGML_TYPE_F16 && src1->type == GGML_TYPE_F32 && !ggml_is_transposed(src0) && !ggml_is_transposed(src1)) {
|
|
|
// KQ + KQV multi-batch
|
|
// KQ + KQV multi-batch
|
|
|
ggml_cuda_mul_mat_mat_batched_cublas(src0, src1, dst);
|
|
ggml_cuda_mul_mat_mat_batched_cublas(src0, src1, dst);
|
|
|
} else if (src0->type == GGML_TYPE_F32) {
|
|
} else if (src0->type == GGML_TYPE_F32) {
|