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

Assert that the application is not calling starpu_data_unregister_submit on a data handle with application-allocated home buffer

Samuel Thibault 5 éve
szülő
commit
63f24c5dfe
2 módosított fájl, 6 hozzáadás és 1 törlés
  1. 5 1
      include/starpu_data.h
  2. 1 0
      src/datawizard/interfaces/data_interface.c

+ 5 - 1
include/starpu_data.h

@@ -161,7 +161,11 @@ void starpu_data_unregister_no_coherency(starpu_data_handle_t handle);
 
 /**
    Destroy the data \p handle once it is no longer needed by any
-   submitted task. No coherency is assumed.
+   submitted task. No coherency is provided.
+
+   This is not safe to use on a handle coming from the registration of a
+   non-NULL application home buffer, since the moment when the unregistration
+   will happen is unknown to the application.
 */
 void starpu_data_unregister_submit(starpu_data_handle_t handle);
 

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

@@ -982,6 +982,7 @@ void starpu_data_unregister_submit(starpu_data_handle_t handle)
 {
 	STARPU_ASSERT_MSG(handle->magic == 42, "data %p is invalid (was it already registered?)", handle);
 	STARPU_ASSERT_MSG(!handle->lazy_unregister, "data %p can not be unregistered twice", handle);
+	STARPU_ASSERT_MSG(handle->home_node >= 0, "data %p with application-allocated home buffer can not be safely unregistered asynchronously", handle);
 
 	/* Wait for all task dependencies on this handle before putting it for free */
 	starpu_data_acquire_on_node_cb(handle, STARPU_ACQUIRE_NO_NODE_LOCK_ALL, handle->initialized?STARPU_RW:STARPU_W, _starpu_data_unregister_submit_cb, handle);