Browse Source

fix sorting commute accesses: we want to have the commute accesses sorted too, actually, for properly handling the case when we take the same data several times

Samuel Thibault 10 years ago
parent
commit
75260ef5d5
1 changed files with 9 additions and 12 deletions
  1. 9 12
      src/datawizard/sort_data_handles.c

+ 9 - 12
src/datawizard/sort_data_handles.c

@@ -71,18 +71,6 @@ static int _starpu_compar_handles(const struct _starpu_data_descr *descrA,
 	struct _starpu_data_state *dataA = descrA->handle;
 	struct _starpu_data_state *dataA = descrA->handle;
 	struct _starpu_data_state *dataB = descrB->handle;
 	struct _starpu_data_state *dataB = descrB->handle;
 
 
-	// WIP_COMMUTE Begin
-	/* Put commute accesses last (without caring about the order) */
-	if(descrA->mode & STARPU_COMMUTE)
-	{
-		return 1;
-	}
-	if(descrB->mode & STARPU_COMMUTE)
-	{
-		return -1;
-	}
-	// WIP_COMMUTE End
-
 	/* Perhaps we have the same piece of data */
 	/* Perhaps we have the same piece of data */
 	if (dataA == dataB)
 	if (dataA == dataB)
 	{
 	{
@@ -105,6 +93,15 @@ static int _starpu_compar_handles(const struct _starpu_data_descr *descrA,
 			return 1;
 			return 1;
 	}
 	}
 
 
+	// WIP_COMMUTE Begin
+	/* Put commute accesses after non-commute */
+	if (descrA->mode & STARPU_COMMUTE && !(descrB->mode & STARPU_COMMUTE))
+		return 1;
+	if (descrB->mode & STARPU_COMMUTE && !(descrA->mode & STARPU_COMMUTE))
+		return -1;
+	/* If both are commute, we'll sort them by handle */
+	// WIP_COMMUTE End
+
 	/* In case we have data/subdata from different trees */
 	/* In case we have data/subdata from different trees */
 	if (dataA->root_handle != dataB->root_handle)
 	if (dataA->root_handle != dataB->root_handle)
 		return ((dataA->root_handle < dataB->root_handle)?-1:1);
 		return ((dataA->root_handle < dataB->root_handle)?-1:1);