Explorar o código

Fix handle initialized flag when reading an uninitialized data

When running data_acquire(R), _starpu_data_check_initialized explicitly
creates a task that writes the data. But when submitting a task that reads
the data, it is the task which will call the cl_init function, so it is the
implicit dependency duty to note that the handle will be initialized.
Samuel Thibault %!s(int64=4) %!d(string=hai) anos
pai
achega
5109603b5e
Modificáronse 1 ficheiros con 5 adicións e 2 borrados
  1. 5 2
      src/core/dependencies/implicit_data_deps.c

+ 5 - 2
src/core/dependencies/implicit_data_deps.c

@@ -225,8 +225,11 @@ struct starpu_task *_starpu_detect_implicit_data_deps_with_handle(struct starpu_
 		struct _starpu_job *pre_sync_job = _starpu_get_job_associated_to_task(pre_sync_task);
 		struct _starpu_job *post_sync_job = _starpu_get_job_associated_to_task(post_sync_task);
 
-		if (mode & STARPU_R)
-			STARPU_ASSERT_MSG(handle->initialized || handle->init_cl, "Handle %p is not initialized, it cannot be read", handle);
+		if (mode & STARPU_R && !handle->initialized) {
+			STARPU_ASSERT_MSG(handle->init_cl, "Handle %p is not initialized, it cannot be read", handle);
+			/* The task will initialize it with init_cl */
+			handle->initialized = 1;
+		}
 
 		if (mode & STARPU_W || mode == STARPU_REDUX)
 		{