Parcourir la source

Add STARPU_MATRIX_SET_NX/NY

to change a matrix tile size without reallocating the buffer.
Samuel Thibault il y a 6 ans
Parent
commit
bec950cc42

+ 2 - 0
ChangeLog

@@ -20,6 +20,8 @@ StarPU 1.4.0 (svn revision xxxx)
 ==============================================
 New features:
   * New schedulers modular-pheft, modular-prandom and modular-prandom-prio
+  * Add STARPU_MATRIX_SET_NX/NY to change a matrix tile size without
+    reallocating the buffer.
 
 StarPU 1.3.0 (svn revision xxxx)
 ==============================================

+ 14 - 0
doc/doxygen/chapters/310_data_management.doxy

@@ -150,6 +150,20 @@ TODO
 
 Tasks are actually allowed to change the size of data interfaces.
 
+The simplest case is just changing the amount of data actually used within the
+allocated buffer. This is for instance implemented for the matrix interface: one
+can set the new NX/NY values with STARPU_MATRIX_SET_NX() and STARPU_MATRIX_SET_NY()
+at the end of the task implementation. Data transfers achieved by StarPU will
+then use these values instead of the whole allocated size. The values of course
+need to be set within the original allocation. To reserve room for increasing
+the NX/NY values, one can use starpu_matrix_data_register_allocsize() instead of
+starpu_matrix_data_register(), to specify the allocation size to be used instead
+of the default NX*NY*ELEMSIZE. To support this, the data interface
+has to implement the starpu_data_interface_ops::alloc_footprint and
+starpu_data_interface_ops::alloc_compare methods, for proper StarPU allocation
+management.
+
+A more involved case is changing the amount of allocated data.
 The task implementation can just reallocate the buffer during its execution, and
 set the proper new values in the interface structure, e.g. nx, ny, ld, etc. so
 that the StarPU core knows the new data layout. The starpu_data_interface_ops

+ 5 - 1
examples/cpp/add_vectors_interface.cpp

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2012,2017                                Inria
  * Copyright (C) 2010-2014,2016,2017                      CNRS
- * Copyright (C) 2009-2011,2013-2015,2017,2018            Université de Bordeaux
+ * Copyright (C) 2009-2011,2013-2015,2017,2018-2019       Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -282,7 +282,9 @@ static struct starpu_data_interface_ops interface_vector_cpp_ops =
 	.pointer_is_inside = vector_cpp_pointer_is_inside,
 	.get_size = vector_cpp_interface_get_size,
 	.footprint = footprint_vector_cpp_interface_crc32,
+	.alloc_footprint = NULL,
 	.compare = vector_cpp_compare,
+	.alloc_compare = NULL,
 	.display = display_vector_cpp_interface,
 	.describe = vector_cpp_describe,
 	.interfaceid = STARPU_UNKNOWN_INTERFACE_ID,
@@ -305,7 +307,9 @@ static struct starpu_data_interface_ops interface_vector_cpp_ops =
 	vector_cpp_pointer_is_inside,
 	vector_cpp_interface_get_size,
 	footprint_vector_cpp_interface_crc32,
+	NULL,
 	vector_cpp_compare,
+	NULL,
 	display_vector_cpp_interface,
 	vector_cpp_describe,
 	STARPU_UNKNOWN_INTERFACE_ID,

+ 55 - 4
include/starpu_data_interfaces.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009-2018                                Université de Bordeaux
+ * Copyright (C) 2009-2019                                Université de Bordeaux
  * Copyright (C) 2011-2014,2016,2017                      Inria
  * Copyright (C) 2010-2015,2017,2019                           CNRS
  *
@@ -440,18 +440,35 @@ struct starpu_data_interface_ops
 	size_t 		 (*get_size)			(starpu_data_handle_t handle);
 
 	/**
-	   Return a 32bit footprint which characterizes the data size and layout (nx, ny, ld, elemsize, etc.)
+	  Return a 32bit footprint which characterizes the data size and layout (nx, ny, ld, elemsize, etc.), to be used for indexing performance models.
 	*/
 	uint32_t 	 (*footprint)			(starpu_data_handle_t handle);
 
 	/**
+	   Return a 32bit footprint which characterizes the data allocation, to be used
+	   for indexing allocation cache.
+	   If not specified, the starpu_data_interface_ops::footprint method is
+	   used instead.
+	*/
+	uint32_t 	 (*alloc_footprint)		(starpu_data_handle_t handle);
+
+	/**
 	   Compare the data size and layout of two interfaces (nx, ny, ld, elemsize,
-	   etc.). It should return 1 if the two interfaces size and layout match, and 0
-	   otherwise.
+	   etc.), to be used for indexing performance models.. It should return 1 if
+	   the two interfaces size and layout match, and 0 otherwise.
 	*/
 	int 		 (*compare)			(void *data_interface_a, void *data_interface_b);
 
 	/**
+	   Compare the data allocation of two interfaces etc.), to be used for indexing
+	   allocation cache. It should return
+	   1 if the two interfaces are allocation-compatible, and 0 otherwise.
+	   If not specified, the starpu_data_interface_ops::compare method is
+	   used instead.
+	*/
+	int 		 (*alloc_compare)		(void *data_interface_a, void *data_interface_b);
+
+	/**
 	   Dump the sizes of a handle to a file.
 	*/
 	void 		 (*display)			(starpu_data_handle_t handle, FILE *f);
@@ -696,6 +713,7 @@ struct starpu_matrix_interface
 					       when there is no padding.
 					  */
 	size_t elemsize;                  /**< size of the elements of the matrix */
+	size_t allocsize;		  /**< size actually currently allocated */
 };
 
 /**
@@ -715,6 +733,12 @@ struct starpu_matrix_interface
 void starpu_matrix_data_register(starpu_data_handle_t *handle, int home_node, uintptr_t ptr, uint32_t ld, uint32_t nx, uint32_t ny, size_t elemsize);
 
 /**
+   Similar to starpu_matrix_data_register, but additionally specifies which
+   allocation size should be used instead of the initial nx*ny*elemsize.
+*/
+void starpu_matrix_data_register_allocsize(starpu_data_handle_t *handle, int home_node, uintptr_t ptr, uint32_t ld, uint32_t nx, uint32_t ny, size_t elemsize, size_t allocsize);
+
+/**
    Register into the \p handle that to store data on node \p node it should use the
    buffer located at \p ptr, or device handle \p dev_handle and offset \p offset
    (for OpenCL, notably), with \p ld elements between rows.
@@ -750,6 +774,11 @@ uintptr_t starpu_matrix_get_local_ptr(starpu_data_handle_t handle);
 */
 size_t starpu_matrix_get_elemsize(starpu_data_handle_t handle);
 
+/**
+   Return the allocated size of the matrix designated by \p handle.
+*/
+size_t starpu_matrix_get_allocsize(starpu_data_handle_t handle);
+
 #if defined(STARPU_HAVE_STATEMENT_EXPRESSIONS) && defined(STARPU_DEBUG)
 #define STARPU_MATRIX_CHECK(interface)          STARPU_ASSERT_MSG((((struct starpu_matrix_interface *)(interface))->id) == STARPU_MATRIX_INTERFACE_ID, "Error. The given data is not a matrix.")
 #define STARPU_MATRIX_GET_PTR(interface)	({ STARPU_MATRIX_CHECK(interface); (((struct starpu_matrix_interface *)(interface))->ptr) ; })
@@ -759,6 +788,7 @@ size_t starpu_matrix_get_elemsize(starpu_data_handle_t handle);
 #define STARPU_MATRIX_GET_NY(interface)	        ({ STARPU_MATRIX_CHECK(interface); (((struct starpu_matrix_interface *)(interface))->ny) ; })
 #define STARPU_MATRIX_GET_LD(interface)	        ({ STARPU_MATRIX_CHECK(interface); (((struct starpu_matrix_interface *)(interface))->ld) ; })
 #define STARPU_MATRIX_GET_ELEMSIZE(interface)	({ STARPU_MATRIX_CHECK(interface); (((struct starpu_matrix_interface *)(interface))->elemsize) ; })
+#define STARPU_MATRIX_GET_ALLOCSIZE(interface)	({ STARPU_MATRIX_CHECK(interface); (((struct starpu_matrix_interface *)(interface))->allocsize) ; })
 #else
 /**
    Return a pointer to the matrix designated by \p interface, valid
@@ -798,8 +828,27 @@ size_t starpu_matrix_get_elemsize(starpu_data_handle_t handle);
    designated by \p interface.
 */
 #define STARPU_MATRIX_GET_ELEMSIZE(interface)	(((struct starpu_matrix_interface *)(interface))->elemsize)
+/**
+   Return the allocated size of the matrix designated by \p interface.
+*/
+#define STARPU_MATRIX_GET_ALLOCSIZE(interface)	(((struct starpu_matrix_interface *)(interface))->allocsize)
 #endif
 
+/**
+   Set the number of elements on the x-axis of the matrix
+   designated by \p interface.
+*/
+#define STARPU_MATRIX_SET_NX(interface, newnx)	        do { \
+	(((struct starpu_matrix_interface *)(interface))->nx) = (newnx); \
+} while (0)
+/**
+   Set the number of elements on the y-axis of the matrix
+   designated by \p interface.
+*/
+#define STARPU_MATRIX_SET_NY(interface, newny)	        do { \
+	(((struct starpu_matrix_interface *)(interface))->ny) = (newny); \
+} while(0)
+
 /** @} */
 
 /** @name Accessing COO Data Interfaces
@@ -898,6 +947,7 @@ void starpu_coo_data_register(starpu_data_handle_t *handleptr, int home_node, ui
 extern struct starpu_data_interface_ops starpu_interface_block_ops;
 
 /* TODO: rename to 3dmatrix? */
+/* TODO: add allocsize support */
 /** Block interface for 3D dense blocks */
 struct starpu_block_interface
 {
@@ -1049,6 +1099,7 @@ extern struct starpu_data_interface_ops starpu_interface_vector_ops;
 
 /**
  */
+/* TODO: add allocsize support */
 struct starpu_vector_interface
 {
 	enum starpu_data_interface_id id; /**< Identifier of the interface */

+ 14 - 1
src/datawizard/footprint.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2012,2014                                Inria
- * Copyright (C) 2008-2011,2013,2014                      Université de Bordeaux
+ * Copyright (C) 2008-2011,2013,2014,2019                 Université de Bordeaux
  * Copyright (C) 2010-2015,2017                           CNRS
  * Copyright (C) 2013                                     Thibaut Lambert
  *
@@ -98,6 +98,19 @@ uint32_t _starpu_compute_data_footprint(starpu_data_handle_t handle)
 	return starpu_hash_crc32c_be(handle_footprint, interfaceid);
 }
 
+uint32_t _starpu_compute_data_alloc_footprint(starpu_data_handle_t handle)
+{
+	uint32_t interfaceid = (uint32_t)starpu_data_get_interface_id(handle);
+
+	uint32_t handle_footprint;
+	if (handle->ops->alloc_footprint)
+		handle_footprint = handle->ops->alloc_footprint(handle);
+	else
+		handle_footprint = handle->ops->footprint(handle);
+
+	return starpu_hash_crc32c_be(handle_footprint, interfaceid);
+}
+
 uint32_t starpu_task_footprint(struct starpu_perfmodel *model, struct starpu_task *task, struct starpu_perfmodel_arch* arch, unsigned nimpl)
 {
 	struct _starpu_job *j = _starpu_get_job_associated_to_task(task);

+ 4 - 1
src/datawizard/footprint.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2008-2011,2014                           Université de Bordeaux
+ * Copyright (C) 2008-2011,2014,2019                      Université de Bordeaux
  * Copyright (C) 2010,2011,2013,2015,2017                 CNRS
  * Copyright (C) 2013                                     Thibaut Lambert
  *
@@ -30,4 +30,7 @@ uint32_t _starpu_compute_buffers_footprint(struct starpu_perfmodel *model, struc
 /* Compute the footprint that characterizes the layout of the data handle. */
 uint32_t _starpu_compute_data_footprint(starpu_data_handle_t handle);
 
+/* Compute the footprint that characterizes the allocation of the data handle. */
+uint32_t _starpu_compute_data_alloc_footprint(starpu_data_handle_t handle);
+
 #endif // __FOOTPRINT_H__

+ 9 - 1
src/datawizard/interfaces/matrix_filters.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2008-2014,2016                           Université de Bordeaux
+ * Copyright (C) 2008-2014,2016,2019                      Université de Bordeaux
  * Copyright (C) 2012                                     Inria
  * Copyright (C) 2010                                     Mehdi Juhoor
  * Copyright (C) 2010,2011,2013,2015,2017                 CNRS
@@ -48,6 +48,8 @@ void starpu_matrix_filter_block(void *father_interface, void *child_interface, S
 	matrix_child->nx = child_nx;
 	matrix_child->ny = ny;
 	matrix_child->elemsize = elemsize;
+	STARPU_ASSERT_MSG(matrix_father->allocsize == matrix_father->nx * matrix_father->ny * matrix_father->elemsize, "partitioning matrix with non-trivial allocsize not supported yet, patch welcome");
+	matrix_child->allocsize = matrix_child->nx * matrix_child->ny * elemsize;
 
 	/* is the information on this node valid ? */
 	if (matrix_father->dev_handle)
@@ -92,6 +94,8 @@ void starpu_matrix_filter_block_shadow(void *father_interface, void *child_inter
 	matrix_child->nx = child_nx;
 	matrix_child->ny = ny;
 	matrix_child->elemsize = elemsize;
+	STARPU_ASSERT_MSG(matrix_father->allocsize == matrix_father->nx * matrix_father->ny * matrix_father->elemsize, "partitioning matrix with non-trivial allocsize not supported yet, patch welcome");
+	matrix_child->allocsize = matrix_child->nx * matrix_child->ny * elemsize;
 
 	/* is the information on this node valid ? */
 	if (matrix_father->dev_handle)
@@ -127,6 +131,8 @@ void starpu_matrix_filter_vertical_block(void *father_interface, void *child_int
 	matrix_child->nx = nx;
 	matrix_child->ny = child_ny;
 	matrix_child->elemsize = elemsize;
+	STARPU_ASSERT_MSG(matrix_father->allocsize == matrix_father->nx * matrix_father->ny * matrix_father->elemsize, "partitioning matrix with non-trivial allocsize not supported yet, patch welcome");
+	matrix_child->allocsize = matrix_child->nx * matrix_child->ny * elemsize;
 
 	/* is the information on this node valid ? */
 	if (matrix_father->dev_handle)
@@ -166,6 +172,8 @@ void starpu_matrix_filter_vertical_block_shadow(void *father_interface, void *ch
 	matrix_child->nx = nx;
 	matrix_child->ny = child_ny;
 	matrix_child->elemsize = elemsize;
+	STARPU_ASSERT_MSG(matrix_father->allocsize == matrix_father->nx * matrix_father->ny * matrix_father->elemsize, "partitioning matrix with non-trivial allocsize not supported yet, patch welcome");
+	matrix_child->allocsize = matrix_child->nx * matrix_child->ny * elemsize;
 
 	/* is the information on this node valid ? */
 	if (matrix_father->dev_handle)

+ 47 - 20
src/datawizard/interfaces/matrix_interface.c

@@ -92,7 +92,9 @@ static starpu_ssize_t allocate_matrix_buffer_on_node(void *data_interface_, unsi
 static void free_matrix_buffer_on_node(void *data_interface, unsigned node);
 static size_t matrix_interface_get_size(starpu_data_handle_t handle);
 static uint32_t footprint_matrix_interface_crc32(starpu_data_handle_t handle);
+static uint32_t alloc_footprint_matrix_interface_crc32(starpu_data_handle_t handle);
 static int matrix_compare(void *data_interface_a, void *data_interface_b);
+static int matrix_alloc_compare(void *data_interface_a, void *data_interface_b);
 static void display_matrix_interface(starpu_data_handle_t handle, FILE *f);
 static int pack_matrix_handle(starpu_data_handle_t handle, unsigned node, void **ptr, starpu_ssize_t *count);
 static int unpack_matrix_handle(starpu_data_handle_t handle, unsigned node, void *ptr, size_t count);
@@ -108,7 +110,9 @@ struct starpu_data_interface_ops starpu_interface_matrix_ops =
 	.copy_methods = &matrix_copy_data_methods_s,
 	.get_size = matrix_interface_get_size,
 	.footprint = footprint_matrix_interface_crc32,
+	.alloc_footprint = alloc_footprint_matrix_interface_crc32,
 	.compare = matrix_compare,
+	.alloc_compare = matrix_alloc_compare,
 	.interfaceid = STARPU_MATRIX_INTERFACE_ID,
 	.interface_size = sizeof(struct starpu_matrix_interface),
 	.display = display_matrix_interface,
@@ -147,6 +151,7 @@ static void register_matrix_handle(starpu_data_handle_t handle, unsigned home_no
 		local_interface->nx = matrix_interface->nx;
 		local_interface->ny = matrix_interface->ny;
 		local_interface->elemsize = matrix_interface->elemsize;
+		local_interface->allocsize  = matrix_interface->allocsize;
 	}
 }
 
@@ -169,9 +174,9 @@ static int matrix_pointer_is_inside(void *data_interface, unsigned node, void *p
 
 
 /* declare a new data with the matrix interface */
-void starpu_matrix_data_register(starpu_data_handle_t *handleptr, int home_node,
+void starpu_matrix_data_register_allocsize(starpu_data_handle_t *handleptr, int home_node,
 			uintptr_t ptr, uint32_t ld, uint32_t nx,
-			uint32_t ny, size_t elemsize)
+			uint32_t ny, size_t elemsize, size_t allocsize)
 {
 	struct starpu_matrix_interface matrix_interface =
 	{
@@ -182,7 +187,8 @@ void starpu_matrix_data_register(starpu_data_handle_t *handleptr, int home_node,
 		.ny = ny,
 		.elemsize = elemsize,
                 .dev_handle = ptr,
-                .offset = 0
+                .offset = 0,
+		.allocsize = allocsize,
 	};
 #ifndef STARPU_SIMGRID
 	if (home_node >= 0 && starpu_node_get_kind(home_node) == STARPU_CPU_RAM)
@@ -200,6 +206,13 @@ void starpu_matrix_data_register(starpu_data_handle_t *handleptr, int home_node,
 	starpu_data_register(handleptr, home_node, &matrix_interface, &starpu_interface_matrix_ops);
 }
 
+void starpu_matrix_data_register(starpu_data_handle_t *handleptr, int home_node,
+			uintptr_t ptr, uint32_t ld, uint32_t nx,
+			uint32_t ny, size_t elemsize)
+{
+	starpu_matrix_data_register_allocsize(handleptr, home_node, ptr, ld, nx, ny, elemsize, nx * ny * elemsize);
+}
+
 void starpu_matrix_ptr_register(starpu_data_handle_t handle, unsigned node,
 			uintptr_t ptr, uintptr_t dev_handle, size_t offset, uint32_t ld)
 {
@@ -216,6 +229,11 @@ static uint32_t footprint_matrix_interface_crc32(starpu_data_handle_t handle)
 	return starpu_hash_crc32c_be(starpu_matrix_get_nx(handle), starpu_matrix_get_ny(handle));
 }
 
+static uint32_t alloc_footprint_matrix_interface_crc32(starpu_data_handle_t handle)
+{
+	return starpu_hash_crc32c_be(starpu_matrix_get_allocsize(handle), 0);
+}
+
 static int matrix_compare(void *data_interface_a, void *data_interface_b)
 {
 	struct starpu_matrix_interface *matrix_a = (struct starpu_matrix_interface *) data_interface_a;
@@ -227,6 +245,15 @@ static int matrix_compare(void *data_interface_a, void *data_interface_b)
 		&& (matrix_a->elemsize == matrix_b->elemsize);
 }
 
+static int matrix_alloc_compare(void *data_interface_a, void *data_interface_b)
+{
+	struct starpu_matrix_interface *matrix_a = (struct starpu_matrix_interface *) data_interface_a;
+	struct starpu_matrix_interface *matrix_b = (struct starpu_matrix_interface *) data_interface_b;
+
+	/* Two matricess are considered compatible if they have the same size */
+	return (matrix_a->allocsize == matrix_b->allocsize);
+}
+
 static void display_matrix_interface(starpu_data_handle_t handle, FILE *f)
 {
 	struct starpu_matrix_interface *matrix_interface = (struct starpu_matrix_interface *)
@@ -294,10 +321,7 @@ static size_t matrix_interface_get_size(starpu_data_handle_t handle)
 	STARPU_ASSERT_MSG(matrix_interface->id == STARPU_MATRIX_INTERFACE_ID, "Error. The given data is not a matrix.");
 #endif
 
-	size_t size;
-	size = (size_t)matrix_interface->nx*matrix_interface->ny*matrix_interface->elemsize;
-
-	return size;
+	return matrix_interface->allocsize;
 }
 
 /* offer an access to the data parameters */
@@ -371,6 +395,18 @@ size_t starpu_matrix_get_elemsize(starpu_data_handle_t handle)
 	return matrix_interface->elemsize;
 }
 
+size_t starpu_matrix_get_allocsize(starpu_data_handle_t handle)
+{
+	struct starpu_matrix_interface *matrix_interface = (struct starpu_matrix_interface *)
+		starpu_data_get_interface_on_node(handle, STARPU_MAIN_RAM);
+
+#ifdef STARPU_DEBUG
+	STARPU_ASSERT_MSG(matrix_interface->id == STARPU_MATRIX_INTERFACE_ID, "Error. The given data is not a matrix.");
+#endif
+
+	return matrix_interface->allocsize;
+}
+
 /* memory allocation/deallocation primitives for the matrix interface */
 
 /* returns the size of the allocated area */
@@ -380,14 +416,10 @@ static starpu_ssize_t allocate_matrix_buffer_on_node(void *data_interface_, unsi
 
 	struct starpu_matrix_interface *matrix_interface = (struct starpu_matrix_interface *) data_interface_;
 
-	uint32_t nx = matrix_interface->nx;
-	uint32_t ny = matrix_interface->ny;
-	uint32_t ld = nx; // by default
-	size_t elemsize = matrix_interface->elemsize;
-
-	starpu_ssize_t allocated_memory;
+	uint32_t ld = matrix_interface->nx; // by default
 
-	handle = starpu_malloc_on_node(dst_node, nx*ny*elemsize);
+	starpu_ssize_t allocated_memory = matrix_interface->allocsize;
+	handle = starpu_malloc_on_node(dst_node, allocated_memory);
 
 	if (!handle)
 		return -ENOMEM;
@@ -395,8 +427,6 @@ static starpu_ssize_t allocate_matrix_buffer_on_node(void *data_interface_, unsi
 	if (starpu_node_get_kind(dst_node) != STARPU_OPENCL_RAM)
 		addr = handle;
 
-	allocated_memory = (size_t)nx*ny*elemsize;
-
 	/* update the data properly in consequence */
 	matrix_interface->ptr = addr;
 	matrix_interface->dev_handle = handle;
@@ -409,11 +439,8 @@ static starpu_ssize_t allocate_matrix_buffer_on_node(void *data_interface_, unsi
 static void free_matrix_buffer_on_node(void *data_interface, unsigned node)
 {
 	struct starpu_matrix_interface *matrix_interface = (struct starpu_matrix_interface *) data_interface;
-	uint32_t nx = matrix_interface->nx;
-	uint32_t ny = matrix_interface->ny;
-	size_t elemsize = matrix_interface->elemsize;
 
-	starpu_free_on_node(node, matrix_interface->dev_handle, nx*ny*elemsize);
+	starpu_free_on_node(node, matrix_interface->dev_handle, matrix_interface->allocsize);
 }
 
 #ifdef STARPU_USE_CUDA

+ 5 - 1
src/datawizard/memalloc.c

@@ -657,7 +657,11 @@ static int _starpu_data_interface_compare(void *data_interface_a, struct starpu_
 	if (ops_a->interfaceid != ops_b->interfaceid)
 		return -1;
 
-	int ret = ops_a->compare(data_interface_a, data_interface_b);
+	int ret;
+	if (ops_a->alloc_compare)
+		ret = ops_a->alloc_compare(data_interface_a, data_interface_b);
+	else
+		ret = ops_a->compare(data_interface_a, data_interface_b);
 
 	return ret;
 }

+ 4 - 2
tests/datawizard/variable_size.c

@@ -52,14 +52,16 @@ int main(int argc, char **argv)
 }
 #else
 
+/* Sample Data interface with variable size */
 struct variable_size_interface
 {
 	enum starpu_data_interface_id id;
 
+	/* Just a buffer of a given size */
 	uintptr_t ptr;
 	size_t size;
 
-	/* Coordinates of the represented object, to model growth */
+	/* Coordinates of the represented object, just for modeling growth */
 	unsigned x, y;
 };
 
@@ -76,9 +78,9 @@ static void register_variable_size(starpu_data_handle_t handle, unsigned home_no
 
 		if (node == home_node)
 			local_interface->ptr = variable_size_interface->ptr;
+		local_interface->size = variable_size_interface->size;
 
 		local_interface->id = variable_size_interface->id;
-		local_interface->size = variable_size_interface->size;
 		local_interface->x = variable_size_interface->x;
 		local_interface->y = variable_size_interface->y;
 	}