@@ -5800,11 +5800,6 @@ static void ggml_vk_mul_mat_q_f16(ggml_backend_vk_context * ctx, vk_context& sub
5800
5800
ggml_vk_sync_buffers(ctx, subctx);
5801
5801
}
5802
5802
}
5803
- if (y_non_contig || quantize_y) {
5804
- if (ctx->prealloc_y_need_sync) {
5805
- ggml_vk_sync_buffers(ctx, subctx);
5806
- }
5807
- }
5808
5803
5809
5804
if (x_non_contig) {
5810
5805
ggml_vk_cpy_to_contiguous(ctx, subctx, to_fp16_vk_0, src0, { d_Qx, qx_buf_offset, VK_WHOLE_SIZE }, { d_X, 0, VK_WHOLE_SIZE });
@@ -5816,6 +5811,9 @@ static void ggml_vk_mul_mat_q_f16(ggml_backend_vk_context * ctx, vk_context& sub
5816
5811
if (y_non_contig) {
5817
5812
if (ctx->prealloc_y_last_pipeline_used != to_fp16_vk_1.get() ||
5818
5813
ctx->prealloc_y_last_tensor_used != src1) {
5814
+ if (ctx->prealloc_y_need_sync) {
5815
+ ggml_vk_sync_buffers(ctx, subctx);
5816
+ }
5819
5817
ggml_vk_cpy_to_contiguous(ctx, subctx, to_fp16_vk_1, src1, { d_Qy, qy_buf_offset, VK_WHOLE_SIZE }, { d_Y, 0, VK_WHOLE_SIZE });
5820
5818
ctx->prealloc_y_last_pipeline_used = to_fp16_vk_1.get();
5821
5819
ctx->prealloc_y_last_tensor_used = src1;
@@ -5824,6 +5822,9 @@ static void ggml_vk_mul_mat_q_f16(ggml_backend_vk_context * ctx, vk_context& sub
5824
5822
if (quantize_y) {
5825
5823
if (ctx->prealloc_y_last_pipeline_used != to_q8_1.get() ||
5826
5824
ctx->prealloc_y_last_tensor_used != src1) {
5825
+ if (ctx->prealloc_y_need_sync) {
5826
+ ggml_vk_sync_buffers(ctx, subctx);
5827
+ }
5827
5828
ggml_vk_quantize_q8_1(ctx, subctx, { d_Qy, qy_buf_offset, VK_WHOLE_SIZE }, { d_Y, 0, VK_WHOLE_SIZE }, y_ne * ne12 * ne13);
5828
5829
ctx->prealloc_y_last_pipeline_used = to_q8_1.get();
5829
5830
ctx->prealloc_y_last_tensor_used = src1;
@@ -6008,11 +6009,6 @@ static void ggml_vk_mul_mat_vec_q_f16(ggml_backend_vk_context * ctx, vk_context&
6008
6009
ggml_vk_sync_buffers(ctx, subctx);
6009
6010
}
6010
6011
}
6011
- if (y_non_contig) {
6012
- if (ctx->prealloc_y_need_sync) {
6013
- ggml_vk_sync_buffers(ctx, subctx);
6014
- }
6015
- }
6016
6012
6017
6013
if (x_non_contig) {
6018
6014
GGML_ASSERT(x_sz == ggml_vk_align_size(ggml_type_size(src0->type) * x_ne, ctx->device->properties.limits.minStorageBufferOffsetAlignment));
@@ -6022,6 +6018,9 @@ static void ggml_vk_mul_mat_vec_q_f16(ggml_backend_vk_context * ctx, vk_context&
6022
6018
GGML_ASSERT(y_sz == ggml_type_size(src1->type) * y_ne);
6023
6019
if (ctx->prealloc_y_last_pipeline_used != to_fp16_vk_1.get() ||
6024
6020
ctx->prealloc_y_last_tensor_used != src1) {
6021
+ if (ctx->prealloc_y_need_sync) {
6022
+ ggml_vk_sync_buffers(ctx, subctx);
6023
+ }
6025
6024
ggml_vk_cpy_to_contiguous(ctx, subctx, to_fp16_vk_1, src1, { d_Qy, qy_buf_offset, VK_WHOLE_SIZE }, { d_Y, 0, VK_WHOLE_SIZE });
6026
6025
ctx->prealloc_y_last_pipeline_used = to_fp16_vk_1.get();
6027
6026
ctx->prealloc_y_last_tensor_used = src1;
@@ -6454,11 +6453,6 @@ static void ggml_vk_mul_mat_id_q_f16(ggml_backend_vk_context * ctx, vk_context&
6454
6453
ggml_vk_sync_buffers(ctx, subctx);
6455
6454
}
6456
6455
}
6457
- if (y_non_contig) {
6458
- if (ctx->prealloc_y_need_sync) {
6459
- ggml_vk_sync_buffers(ctx, subctx);
6460
- }
6461
- }
6462
6456
6463
6457
if (x_non_contig) {
6464
6458
ggml_vk_cpy_to_contiguous(ctx, subctx, to_fp16_vk_0, src0, { d_Qx, qx_buf_offset, VK_WHOLE_SIZE }, { d_X, 0, VK_WHOLE_SIZE });
@@ -6471,6 +6465,9 @@ static void ggml_vk_mul_mat_id_q_f16(ggml_backend_vk_context * ctx, vk_context&
6471
6465
if (y_non_contig) {
6472
6466
if (ctx->prealloc_y_last_pipeline_used != to_fp16_vk_1.get() ||
6473
6467
ctx->prealloc_y_last_tensor_used != src1) {
6468
+ if (ctx->prealloc_y_need_sync) {
6469
+ ggml_vk_sync_buffers(ctx, subctx);
6470
+ }
6474
6471
ggml_vk_cpy_to_contiguous(ctx, subctx, to_fp16_vk_1, src1, { d_Qy, qy_buf_offset, VK_WHOLE_SIZE }, { d_Y, 0, VK_WHOLE_SIZE });
6475
6472
ctx->prealloc_y_last_pipeline_used = to_fp16_vk_1.get();
6476
6473
ctx->prealloc_y_last_tensor_used = src1;
@@ -6668,11 +6665,6 @@ static void ggml_vk_mul_mat_vec_id_q_f16(ggml_backend_vk_context * ctx, vk_conte
6668
6665
ggml_vk_sync_buffers(ctx, subctx);
6669
6666
}
6670
6667
}
6671
- if (y_non_contig) {
6672
- if (ctx->prealloc_y_need_sync) {
6673
- ggml_vk_sync_buffers(ctx, subctx);
6674
- }
6675
- }
6676
6668
6677
6669
if (x_non_contig) {
6678
6670
GGML_ASSERT(x_sz == ggml_vk_align_size(ggml_type_size(src0->type) * x_ne, ctx->device->properties.limits.minStorageBufferOffsetAlignment));
@@ -6682,6 +6674,9 @@ static void ggml_vk_mul_mat_vec_id_q_f16(ggml_backend_vk_context * ctx, vk_conte
6682
6674
GGML_ASSERT(y_sz == ggml_type_size(src1->type) * y_ne);
6683
6675
if (ctx->prealloc_y_last_pipeline_used != to_fp16_vk_1.get() ||
6684
6676
ctx->prealloc_y_last_tensor_used != src1) {
6677
+ if (ctx->prealloc_y_need_sync) {
6678
+ ggml_vk_sync_buffers(ctx, subctx);
6679
+ }
6685
6680
ggml_vk_cpy_to_contiguous(ctx, subctx, to_fp16_vk_1, src1, { d_Qy, qy_buf_offset, VK_WHOLE_SIZE }, { d_Y, 0, VK_WHOLE_SIZE });
6686
6681
ctx->prealloc_y_last_pipeline_used = to_fp16_vk_1.get();
6687
6682
ctx->prealloc_y_last_tensor_used = src1;
0 commit comments