Forráskód Böngészése

data_request: Fix adding reference when the request will actually be already complete

Samuel Thibault 4 éve
szülő
commit
402d74b121
2 módosított fájl, 6 hozzáadás és 6 törlés
  1. 0 6
      src/datawizard/copy_driver.c
  2. 6 0
      src/datawizard/data_request.c

+ 0 - 6
src/datawizard/copy_driver.c

@@ -211,12 +211,6 @@ int STARPU_ATTRIBUTE_WARN_UNUSED_RESULT _starpu_driver_copy_data_1_to_1(starpu_d
 		STARPU_ASSERT(src_replicate->refcnt);
 	}
 
-	/* For prefetches, we take a reference on the destination only now that
-	 * we will really try to fetch the data (instead of in
-	 * _starpu_create_data_request) */
-	if (req->prefetch > STARPU_FETCH)
-		dst_replicate->refcnt++;
-
 	unsigned src_node = src_replicate->memory_node;
 	unsigned dst_node = dst_replicate->memory_node;
 

+ 6 - 0
src/datawizard/data_request.c

@@ -531,6 +531,12 @@ static int starpu_handle_data_request(struct _starpu_data_request *r, unsigned m
 	STARPU_ASSERT(!(r_mode & STARPU_R) || src_replicate->allocated);
 	STARPU_ASSERT(!(r_mode & STARPU_R) || src_replicate->refcnt);
 
+	/* For prefetches, we take a reference on the destination only now that
+	 * we will really try to fetch the data (instead of in
+	 * _starpu_create_data_request) */
+	if (r->prefetch > STARPU_FETCH)
+		dst_replicate->refcnt++;
+
 	_starpu_spin_unlock(&r->lock);
 
 	/* FIXME: the request may get upgraded from here to freeing it... */