Skip to content

Commit a1ded76

Browse files
committed
chore: resolve MSVC warnings in ggml extensions
1 parent 8cc5ad8 commit a1ded76

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

‎src/core/ggml_extend.cpp‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,13 @@ ggml_tensor* ggml_ext_linear(ggml_context* ctx,
223223
x = ggml_reshape_2d(ctx, x, x->ne[0], x->ne[1] * x->ne[2] * x->ne[3]);
224224
x = ggml_mul_mat(ctx, w, x);
225225
if (force_prec_f32) {
226-
ggml_mul_mat_set_prec(x, GGML_PREC_F32);
226+
ggml_prec_set_acc(x, GGML_PREC_F32);
227227
}
228228
x = ggml_reshape_4d(ctx, x, x->ne[0], x->ne[1] / ne2 / ne3, ne2, ne3);
229229
} else {
230230
x = ggml_mul_mat(ctx, w, x);
231231
if (force_prec_f32) {
232-
ggml_mul_mat_set_prec(x, GGML_PREC_F32);
232+
ggml_prec_set_acc(x, GGML_PREC_F32);
233233
}
234234
}
235235
if (scale != 1.f) {
@@ -488,7 +488,7 @@ ggml_tensor* ggml_ext_conv_3d(ggml_context* ctx,
488488
x = ggml_mul_mat(ctx,
489489
ggml_reshape_2d(ctx, im2col, im2col->ne[0], im2col->ne[3] * im2col->ne[2] * im2col->ne[1]),
490490
ggml_reshape_2d(ctx, w, w->ne[0] * w->ne[1] * w->ne[2] * IC, OC));
491-
ggml_mul_mat_set_prec(x, GGML_PREC_F32);
491+
ggml_prec_set_acc(x, GGML_PREC_F32);
492492

493493
int64_t OD = im2col->ne[3] / N;
494494
x = ggml_reshape_4d(ctx, x, im2col->ne[1] * im2col->ne[2], OD, N, OC);
@@ -683,8 +683,8 @@ ggml_tensor* ggml_ext_attention_ext(ggml_context* ctx,
683683
v_in->type == GGML_TYPE_F32 && sd_backend_supports_cuda_mma(backend);
684684
if (pad_head) {
685685
// CUDA FA MMA starts at 64 channels; keep the original head's attention scale.
686-
q_in = ggml_pad(ctx, q_in, 64 - d_head, 0, 0, 0);
687-
k_in = ggml_pad(ctx, k_in, 64 - d_head, 0, 0, 0);
686+
q_in = ggml_pad(ctx, q_in, static_cast<int>(64 - d_head), 0, 0, 0);
687+
k_in = ggml_pad(ctx, k_in, static_cast<int>(64 - d_head), 0, 0, 0);
688688
}
689689
if (kv_scale != 1.0f) {
690690
k_in = ggml_ext_scale(ctx, k_in, kv_scale);
@@ -694,7 +694,7 @@ ggml_tensor* ggml_ext_attention_ext(ggml_context* ctx,
694694
v_in = ggml_ext_cont(ctx, ggml_permute(ctx, v_in, 0, 2, 1, 3));
695695
v_in = ggml_reshape_3d(ctx, v_in, d_head, L_k, n_kv_head * N);
696696
if (pad_head) {
697-
v_in = ggml_pad(ctx, v_in, 64 - d_head, 0, 0, 0);
697+
v_in = ggml_pad(ctx, v_in, static_cast<int>(64 - d_head), 0, 0, 0);
698698
}
699699
if (kv_scale != 1.0f) {
700700
v_in = ggml_ext_scale(ctx, v_in, kv_scale);
@@ -721,7 +721,7 @@ ggml_tensor* ggml_ext_attention_ext(ggml_context* ctx,
721721
if (!ggml_backend_supports_op(backend, out)) {
722722
return nullptr;
723723
}
724-
ggml_flash_attn_ext_set_prec(out, GGML_PREC_F32);
724+
ggml_prec_set_acc(out, GGML_PREC_F32);
725725
if (kv_scale != 1.0f) {
726726
out = ggml_ext_scale(ctx, out, 1.0f / kv_scale);
727727
}
@@ -742,9 +742,9 @@ ggml_tensor* ggml_ext_attention_ext(ggml_context* ctx,
742742
}
743743
if (padded_head != d_head) {
744744
// Keep the original head's softmax scale when padding for the CUDA kernel.
745-
q_in = ggml_pad(ctx, q_in, padded_head - d_head, 0, 0, 0);
746-
k_in = ggml_pad(ctx, k_in, padded_head - d_head, 0, 0, 0);
747-
v_in = ggml_pad(ctx, v_in, padded_head - d_head, 0, 0, 0);
745+
q_in = ggml_pad(ctx, q_in, static_cast<int>(padded_head - d_head), 0, 0, 0);
746+
k_in = ggml_pad(ctx, k_in, static_cast<int>(padded_head - d_head), 0, 0, 0);
747+
v_in = ggml_pad(ctx, v_in, static_cast<int>(padded_head - d_head), 0, 0, 0);
748748
}
749749
if (kv_scale != 1.0f) {
750750
k_in = ggml_ext_scale(ctx, k_in, kv_scale);
@@ -797,7 +797,7 @@ ggml_tensor* ggml_ext_attention_ext(ggml_context* ctx,
797797
v = ggml_reshape_3d(ctx, v, L_k, d_head, n_kv_head * N); // [N * n_kv_head, d_head, L_k]
798798

799799
auto kq = ggml_mul_mat(ctx, k, q); // [N * n_head, L_q, L_k]
800-
ggml_mul_mat_set_prec(kq, GGML_PREC_F32);
800+
ggml_prec_set_acc(kq, GGML_PREC_F32);
801801
kq = ggml_scale_inplace(ctx, kq, scale);
802802
if (mask) {
803803
kq = ggml_add_inplace(ctx, kq, mask);

0 commit comments

Comments
 (0)