@@ -430,6 +430,7 @@ static inline ucc_status_t ucc_tl_ucp_test_with_etasks(ucc_tl_ucp_task_t *task)
430430 ucc_status_t status_2 ;
431431 node_ucc_ee_executor_task_t * current_node ;
432432 node_ucc_ee_executor_task_t * prev_node ;
433+ node_ucc_ee_executor_task_t * to_be_removed ;
433434
434435 // ucc_info("in test_with_etasks");
435436
@@ -446,7 +447,6 @@ static inline ucc_status_t ucc_tl_ucp_test_with_etasks(ucc_tl_ucp_task_t *task)
446447 ucp_memcpy_device_complete (current_node -> etask -> completion , ucc_status_to_ucs_status (status ));
447448 current_node -> etask -> finished = 1 ;
448449 status_2 = ucc_ee_executor_task_finalize (current_node -> etask );
449- ucc_mpool_put (current_node );
450450 if (ucc_unlikely (status_2 < 0 )){
451451 tl_error (UCC_TASK_LIB (task ), "task finalize didnt work" );
452452 return status_2 ;
@@ -457,9 +457,14 @@ static inline ucc_status_t ucc_tl_ucp_test_with_etasks(ucc_tl_ucp_task_t *task)
457457 else { //i'm on first node
458458 task -> allgather_kn .etask_linked_list_head = current_node -> next ;
459459 }
460+ to_be_removed = current_node ;
461+ current_node = current_node -> next ;
462+ ucc_mpool_put (to_be_removed );
460463 }
461- prev_node = current_node ;
462- current_node = current_node -> next ; //to iterate to next node
464+ else {
465+ prev_node = current_node ;
466+ current_node = current_node -> next ; //to iterate to next node
467+ }
463468 }
464469 if (UCC_TL_UCP_TASK_P2P_COMPLETE (task ) && task -> allgather_kn .etask_linked_list_head == NULL ) {
465470 return UCC_OK ;
@@ -497,6 +502,7 @@ static inline ucc_status_t ucc_tl_ucp_test_recv_with_etasks(ucc_tl_ucp_task_t *t
497502 ucc_status_t status_2 ;
498503 node_ucc_ee_executor_task_t * current_node ;
499504 node_ucc_ee_executor_task_t * prev_node ;
505+ node_ucc_ee_executor_task_t * to_be_removed ;
500506
501507 // ucc_info("In recv_with_etasks");
502508
@@ -513,7 +519,6 @@ static inline ucc_status_t ucc_tl_ucp_test_recv_with_etasks(ucc_tl_ucp_task_t *t
513519 ucp_memcpy_device_complete (current_node -> etask -> completion , ucc_status_to_ucs_status (status ));
514520 current_node -> etask -> finished = 1 ;
515521 status_2 = ucc_ee_executor_task_finalize (current_node -> etask );
516- ucc_mpool_put (current_node );
517522 if (ucc_unlikely (status_2 < 0 )){
518523 tl_error (UCC_TASK_LIB (task ), "task finalize didnt work" );
519524 return status_2 ;
@@ -524,9 +529,14 @@ static inline ucc_status_t ucc_tl_ucp_test_recv_with_etasks(ucc_tl_ucp_task_t *t
524529 else { //i'm on first node
525530 task -> allgather_kn .etask_linked_list_head = current_node -> next ;
526531 }
532+ to_be_removed = current_node ;
533+ current_node = current_node -> next ;
534+ ucc_mpool_put (to_be_removed );
527535 }
528- prev_node = current_node ;
529- current_node = current_node -> next ; //to iterate to next node
536+ else {
537+ prev_node = current_node ;
538+ current_node = current_node -> next ; //to iterate to next node
539+ }
530540 }
531541 if (UCC_TL_UCP_TASK_RECV_COMPLETE (task ) && task -> allgather_kn .etask_linked_list_head == NULL ) {
532542 return UCC_OK ;
0 commit comments