From baf17853b729abe76a2bc132c2092567a9f39731 Mon Sep 17 00:00:00 2001
From: Mathieu Faverge <mathieu.faverge@inria.fr>
Date: Tue, 15 Feb 2022 12:36:35 +0100
Subject: [PATCH] Backport assert and unregistration fix from recursive branch

---
 runtime/starpu/control/runtime_descriptor.c    | 2 +-
 runtime/starpu/interface/cham_tile_interface.c | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/runtime/starpu/control/runtime_descriptor.c b/runtime/starpu/control/runtime_descriptor.c
index f3f3ecd30..fef8c75aa 100644
--- a/runtime/starpu/control/runtime_descriptor.c
+++ b/runtime/starpu/control/runtime_descriptor.c
@@ -240,7 +240,7 @@ void RUNTIME_desc_destroy( CHAM_desc_t *desc )
             for (m = 0; m < lmt; m++)
             {
                 if ( *handle != NULL ) {
-                    starpu_data_unregister_submit(*handle);
+                    starpu_data_unregister(*handle);
                     *handle = NULL;
                 }
                 handle++;
diff --git a/runtime/starpu/interface/cham_tile_interface.c b/runtime/starpu/interface/cham_tile_interface.c
index 493c9eade..a237d2cfe 100644
--- a/runtime/starpu/interface/cham_tile_interface.c
+++ b/runtime/starpu/interface/cham_tile_interface.c
@@ -299,7 +299,7 @@ cti_alloc_compare(void *data_interface_a, void *data_interface_b)
     starpu_cham_tile_interface_t *cham_tile_b = (starpu_cham_tile_interface_t *) data_interface_b;
 
     /* Two matrices are considered compatible if they have the same allocated size */
-    return ( cham_tile_a->allocsize   == cham_tile_b->allocsize   );
+    return ( cham_tile_a->allocsize == cham_tile_b->allocsize );
 }
 
 static void
@@ -585,6 +585,9 @@ static int cti_copy_any_to_any( void *src_interface, unsigned src_node,
     assert( ld_src >= m );
     assert( ld_dst >= m );
 
+    assert( m == cham_tile_dst->tile.m );
+    assert( n == cham_tile_dst->tile.n );
+
 #if defined(CHAMELEON_KERNELS_TRACE)
     fprintf( stderr,
              "[ANY->ANY] src(%s, type:%s, m=%d, n=%d, ld=%d, ptr:%p) dest(%s, type:%s, m=%d, n=%d, ld=%d, ptr:%p)\n",
-- 
GitLab