소스 검색

Catch at submission time applications trying to read from an uninitialized handle

Samuel Thibault 5 년 전
부모
커밋
d3107c1dbd
2개의 변경된 파일8개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      src/core/dependencies/implicit_data_deps.c
  2. 4 0
      src/datawizard/interfaces/data_interface.c

+ 4 - 1
src/core/dependencies/implicit_data_deps.c

@@ -225,10 +225,13 @@ 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_W || mode == STARPU_REDUX)
 		{
 
-			STARPU_ASSERT_MSG(!handle->readonly, "Read-only handles can not be written to");
+			STARPU_ASSERT_MSG(!handle->readonly, "Read-only handle %p can not be written to", handle);
 
 			handle->initialized = 1;
 			/* We will change our value, disconnect from our readonly duplicates */

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

@@ -836,6 +836,10 @@ static void _starpu_data_unregister(starpu_data_handle_t handle, unsigned cohere
 	int sequential_consistency = handle->sequential_consistency;
 	if (sequential_consistency && !nowait)
 	{
+		/* We will acquire it in write mode to catch all dependencies,
+		 * but possibly it's not actually initialized. Fake it to avoid
+		 getting caught doing it */
+		handle->initialized = 1;
 		STARPU_ASSERT_MSG(_starpu_worker_may_perform_blocking_calls(), "starpu_data_unregister must not be called from a task or callback, perhaps you can use starpu_data_unregister_submit instead");
 
 		/* If sequential consistency is enabled, wait until data is available */