ソースを参照

Fix abusive assertion failure while reducing value of a handle

Samuel Thibault 8 年 前
コミット
e491b4a92f
共有2 個のファイルを変更した5 個の追加4 個の削除を含む
  1. 1 1
      src/core/task.c
  2. 4 3
      src/datawizard/interfaces/data_interface.c

+ 1 - 1
src/core/task.c

@@ -572,7 +572,7 @@ static int _starpu_task_submit_head(struct starpu_task *task)
 		{
 			starpu_data_handle_t handle = STARPU_TASK_GET_HANDLE(task, i);
 			/* Make sure handles are valid */
-			STARPU_ASSERT_MSG(handle->magic == 42, "data %p is invalid (was it already registered?)", handle);
+			STARPU_ASSERT_MSG(handle->magic == 42, "data %p is invalid (was it already unregistered?)", handle);
 			/* Make sure handles are not partitioned */
 			STARPU_ASSERT_MSG(handle->nchildren == 0, "only unpartitioned data (or the pieces of a partitioned data) can be used in a task");
 			/* Provide the home interface for now if any,

+ 4 - 3
src/datawizard/interfaces/data_interface.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009-2016  Université de Bordeaux
+ * Copyright (C) 2009-2017  Université de Bordeaux
  * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016  CNRS
  * Copyright (C) 2014, 2016  Inria
  *
@@ -687,8 +687,6 @@ static void _starpu_data_unregister_fetch_data_callback(void *_arg)
 static void _starpu_data_unregister(starpu_data_handle_t handle, unsigned coherent, unsigned nowait)
 {
 	STARPU_ASSERT(handle);
-	/* Prevent any further unregistration */
-	handle->magic = 0;
 	STARPU_ASSERT_MSG(handle->nchildren == 0, "data %p needs to be unpartitioned before unregistration", handle);
 	STARPU_ASSERT_MSG(handle->nplans == 0, "data %p needs its partition plans to be cleaned before unregistration", handle);
 	STARPU_ASSERT_MSG(handle->partitioned == 0, "data %p needs its partitioned plans to be unpartitioned before unregistration", handle);
@@ -798,6 +796,9 @@ static void _starpu_data_unregister(starpu_data_handle_t handle, unsigned cohere
 		}
 	}
 
+	/* Prevent any further unregistration */
+	handle->magic = 0;
+
 	_starpu_spin_lock(&handle->header_lock);
 	if (!coherent)
 	{