|
|
@@ -295,11 +295,15 @@ void _starpu_submit_job_enforce_commute_deps(struct _starpu_job *j, unsigned buf
|
|
|
|
|
|
for (idx_buf_commute = nb_non_commute_buff; idx_buf_commute < nbuffers; idx_buf_commute++)
|
|
|
{
|
|
|
- if (idx_buf_commute && (_STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(j, idx_buf_commute-1)==_STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(j, idx_buf_commute)))
|
|
|
- continue;
|
|
|
- /* we post all commute */
|
|
|
starpu_data_handle_t handle = _STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(j, idx_buf_commute);
|
|
|
enum starpu_data_access_mode mode = _STARPU_JOB_GET_ORDERED_BUFFER_MODE(j, idx_buf_commute);
|
|
|
+
|
|
|
+ if (idx_buf_commute && (_STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(j, idx_buf_commute-1)==handle))
|
|
|
+ /* We have already requested this data, skip it. This
|
|
|
+ * depends on ordering putting writes before reads, see
|
|
|
+ * _starpu_compar_handles. */
|
|
|
+ continue;
|
|
|
+ /* we post all commute */
|
|
|
STARPU_ASSERT(mode & STARPU_COMMUTE);
|
|
|
|
|
|
_starpu_spin_lock(&handle->header_lock);
|
|
|
@@ -324,10 +328,11 @@ void _starpu_submit_job_enforce_commute_deps(struct _starpu_job *j, unsigned buf
|
|
|
unsigned idx_buf_cancel;
|
|
|
for (idx_buf_cancel = nb_non_commute_buff; idx_buf_cancel < idx_buf_commute ; idx_buf_cancel++)
|
|
|
{
|
|
|
- if (idx_buf_cancel && (_STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(j, idx_buf_cancel-1)==_STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(j, idx_buf_cancel)))
|
|
|
+ starpu_data_handle_t cancel_handle = _STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(j, idx_buf_cancel);
|
|
|
+
|
|
|
+ if (idx_buf_cancel && (_STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(j, idx_buf_cancel-1)==cancel_handle))
|
|
|
continue;
|
|
|
|
|
|
- starpu_data_handle_t cancel_handle = _STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(j, idx_buf_cancel);
|
|
|
_starpu_spin_lock(&cancel_handle->header_lock);
|
|
|
/* reset the counter because finally we do not take the data */
|
|
|
STARPU_ASSERT(cancel_handle->refcnt == 1);
|
|
|
@@ -415,7 +420,11 @@ void _starpu_notify_commute_dependencies(starpu_data_handle_t handle)
|
|
|
/* find the position of commute buffers */
|
|
|
for (nb_non_commute_buff = 0; nb_non_commute_buff < nbuffers; nb_non_commute_buff++)
|
|
|
{
|
|
|
- if (nb_non_commute_buff && (_STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(j, nb_non_commute_buff-1) == _STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(j, nb_non_commute_buff)))
|
|
|
+ starpu_data_handle_t handle_commute = _STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(j, nb_non_commute_buff);
|
|
|
+ if (nb_non_commute_buff && (_STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(j, nb_non_commute_buff-1) == handle_commute))
|
|
|
+ /* We have already requested this data, skip it. This
|
|
|
+ * depends on ordering putting writes before reads, see
|
|
|
+ * _starpu_compar_handles. */
|
|
|
continue;
|
|
|
enum starpu_data_access_mode mode = _STARPU_JOB_GET_ORDERED_BUFFER_MODE(j, nb_non_commute_buff);
|
|
|
if(mode & STARPU_COMMUTE)
|
|
|
@@ -429,10 +438,13 @@ void _starpu_notify_commute_dependencies(starpu_data_handle_t handle)
|
|
|
|
|
|
for (idx_buf_commute = nb_non_commute_buff; idx_buf_commute < nbuffers; idx_buf_commute++)
|
|
|
{
|
|
|
- if (idx_buf_commute && (_STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(j, idx_buf_commute-1)==_STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(j, idx_buf_commute)))
|
|
|
+ starpu_data_handle_t handle_commute = _STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(j, idx_buf_commute);
|
|
|
+ if (idx_buf_commute && (_STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(j, idx_buf_commute-1)==handle_commute))
|
|
|
+ /* We have already requested this data, skip it. This
|
|
|
+ * depends on ordering putting writes before reads, see
|
|
|
+ * _starpu_compar_handles. */
|
|
|
continue;
|
|
|
/* we post all commute */
|
|
|
- starpu_data_handle_t handle_commute = _STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(j, idx_buf_commute);
|
|
|
enum starpu_data_access_mode mode = _STARPU_JOB_GET_ORDERED_BUFFER_MODE(j, idx_buf_commute);
|
|
|
STARPU_ASSERT(mode & STARPU_COMMUTE);
|
|
|
|
|
|
@@ -454,10 +466,10 @@ void _starpu_notify_commute_dependencies(starpu_data_handle_t handle)
|
|
|
{
|
|
|
for (idx_buf_commute = nb_non_commute_buff; idx_buf_commute < nbuffers; idx_buf_commute++)
|
|
|
{
|
|
|
- if (idx_buf_commute && (_STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(j, idx_buf_commute-1)==_STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(j, idx_buf_commute)))
|
|
|
+ starpu_data_handle_t handle_commute = _STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(j, idx_buf_commute);
|
|
|
+ if (idx_buf_commute && (_STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(j, idx_buf_commute-1)==handle_commute))
|
|
|
continue;
|
|
|
/* we post all commute */
|
|
|
- starpu_data_handle_t handle_commute = _STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(j, idx_buf_commute);
|
|
|
enum starpu_data_access_mode mode = _STARPU_JOB_GET_ORDERED_BUFFER_MODE(j, idx_buf_commute);
|
|
|
STARPU_ASSERT(mode & STARPU_COMMUTE);
|
|
|
|