@@ -513,8 +513,8 @@ static size_t vk_skip_checks;
513
513
static size_t vk_output_tensor;
514
514
515
515
static void ggml_vk_print_tensor (ggml_backend * ctx, const ggml_tensor * tensor, const char * name);
516
- static void ggml_vk_check_results_0 (ggml_backend_vk_context * ctx, ggml_tensor * tensor);
517
- static void ggml_vk_check_results_1 (ggml_backend_vk_context * ctx, ggml_tensor * tensor);
516
+ static void ggml_vk_check_results_0 (ggml_backend_vk_context * ctx, ggml_compute_params * params, ggml_tensor * tensor);
517
+ static void ggml_vk_check_results_1 (ggml_backend_vk_context * ctx, ggml_compute_params * params, ggml_tensor * tensor);
518
518
#endif
519
519
520
520
typedef void (*ggml_vk_func_t )(ggml_backend_vk_context * ctx, vk_context * subctx, const ggml_tensor * src0, const ggml_tensor * src1, ggml_tensor * dst);
@@ -5644,7 +5644,7 @@ static void ggml_vk_build_graph(ggml_backend_vk_context * ctx, ggml_tensor * nod
5644
5644
}
5645
5645
}
5646
5646
5647
- static bool ggml_vk_compute_forward (ggml_backend_vk_context * ctx, ggml_tensor * tensor){
5647
+ static bool ggml_vk_compute_forward (ggml_backend_vk_context * ctx, ggml_compute_params * params, ggml_tensor * tensor){
5648
5648
ggml_tensor_extra_gpu * extra = nullptr ;
5649
5649
5650
5650
switch (tensor->op ) {
@@ -5697,10 +5697,17 @@ static bool ggml_vk_compute_forward(ggml_backend_vk_context * ctx, ggml_tensor *
5697
5697
return false ;
5698
5698
}
5699
5699
5700
+ if (params->ith != 0 ) {
5701
+ return true ;
5702
+ }
5703
+ if (params->type == GGML_TASK_TYPE_INIT || params->type == GGML_TASK_TYPE_FINALIZE) {
5704
+ return true ;
5705
+ }
5706
+
5700
5707
VK_LOG_DEBUG (" ggml_vk_compute_forward(" << tensor << " , name=" << tensor->name << " , op=" << ggml_op_name (tensor->op ) << " , type=" << tensor->type << " , ne0=" << tensor->ne [0 ] << " , ne1=" << tensor->ne [1 ] << " , ne2=" << tensor->ne [2 ] << " , ne3=" << tensor->ne [3 ] << " , nb0=" << tensor->nb [0 ] << " , nb1=" << tensor->nb [1 ] << " , nb2=" << tensor->nb [2 ] << " , nb3=" << tensor->nb [3 ] << " , view_src=" << tensor->view_src << " , view_offs=" << tensor->view_offs << " )" );
5701
5708
5702
5709
#ifdef GGML_VULKAN_CHECK_RESULTS
5703
- ggml_vk_check_results_0 (ctx, tensor);
5710
+ ggml_vk_check_results_0 (ctx, params, tensor);
5704
5711
#endif
5705
5712
5706
5713
vk_context& subctx = ctx->gc .contexts [extra->ctx_idx ];
@@ -6207,20 +6214,23 @@ GGML_CALL static ggml_status ggml_backend_vk_graph_compute(ggml_backend_t backen
6207
6214
ggml_vk_build_graph (ctx,cgraph->nodes [i], i == last_node);
6208
6215
}
6209
6216
6217
+ ggml_compute_params params = {};
6218
+ params.type = GGML_TASK_TYPE_COMPUTE;
6219
+ params.ith = 0 ;
6210
6220
for (int i = 0 ; i < cgraph->n_nodes ; i++) {
6211
6221
ggml_tensor * node = cgraph->nodes [i];
6212
6222
6213
6223
if (ggml_vk_is_empty (node)) {
6214
6224
continue ;
6215
6225
}
6216
6226
6217
- bool ok = ggml_vk_compute_forward (ctx, node);
6227
+ bool ok = ggml_vk_compute_forward (ctx, ¶ms, node);
6218
6228
if (!ok) {
6219
6229
fprintf (stderr, " %s: error: op not supported %s (%s)\n " , __func__, node->name , ggml_op_name (node->op ));
6220
6230
}
6221
6231
#ifdef GGML_VULKAN_CHECK_RESULTS
6222
6232
else {
6223
- ggml_vk_check_results_1 (ctx, node);
6233
+ ggml_vk_check_results_1 (ctx, ¶ms, node);
6224
6234
}
6225
6235
#endif
6226
6236
GGML_ASSERT (ok);
@@ -6590,8 +6600,11 @@ void * comp_result;
6590
6600
size_t comp_size;
6591
6601
size_t comp_nb[GGML_MAX_DIMS];
6592
6602
size_t check_counter = 0 ;
6593
- static void ggml_vk_check_results_0 (ggml_backend_vk_context * ctx, ggml_tensor * tensor) {
6594
- if (tensor->op == GGML_OP_TRANSPOSE) {
6603
+ static void ggml_vk_check_results_0 (ggml_backend_vk_context * ctx, ggml_compute_params * params, ggml_tensor * tensor) {
6604
+ if (params->ith != 0 ) {
6605
+ return ;
6606
+ }
6607
+ if (params->type == GGML_TASK_TYPE_INIT || params->type == GGML_TASK_TYPE_FINALIZE || tensor->op == GGML_OP_TRANSPOSE) {
6595
6608
return ;
6596
6609
}
6597
6610
@@ -6895,8 +6908,11 @@ static void ggml_vk_check_results_0(ggml_backend_vk_context * ctx, ggml_tensor *
6895
6908
ggml_free (ggml_ctx);
6896
6909
}
6897
6910
6898
- static void ggml_vk_check_results_1 (ggml_backend_vk_context * ctx, ggml_tensor * tensor) {
6899
- if (tensor->op == GGML_OP_TRANSPOSE) {
6911
+ static void ggml_vk_check_results_1 (ggml_backend_vk_context * ctx, ggml_compute_params * params, ggml_tensor * tensor) {
6912
+ if (params->ith != 0 ) {
6913
+ return ;
6914
+ }
6915
+ if (params->type == GGML_TASK_TYPE_INIT || params->type == GGML_TASK_TYPE_FINALIZE || tensor->op == GGML_OP_TRANSPOSE) {
6900
6916
return ;
6901
6917
}
6902
6918
if (!(vk_output_tensor > 0 && vk_output_tensor == check_counter) && check_counter <= vk_skip_checks) {
0 commit comments