|
@@ -474,7 +474,7 @@ struct _starpu_data_request *_starpu_create_request_to_fetch_data(starpu_data_ha
|
|
|
_starpu_spin_checklocked(&handle->header_lock);
|
|
|
|
|
|
unsigned requesting_node = dst_replicate->memory_node;
|
|
|
- unsigned nwait = 0;
|
|
|
+ unsigned nwait = 0, nwaitself = 0;
|
|
|
|
|
|
if (mode & STARPU_W)
|
|
|
{
|
|
@@ -487,8 +487,13 @@ struct _starpu_data_request *_starpu_create_request_to_fetch_data(starpu_data_ha
|
|
|
unsigned nnodes = starpu_memory_nodes_get_count();
|
|
|
for (i = 0; i < nnodes; i++)
|
|
|
for (j = 0; j < nnodes; j++)
|
|
|
- if (j != requesting_node && handle->per_node[i].request[j])
|
|
|
- nwait++;
|
|
|
+ if (handle->per_node[i].request[j])
|
|
|
+ {
|
|
|
+ if (j != requesting_node)
|
|
|
+ nwait++;
|
|
|
+ else
|
|
|
+ nwaitself++;
|
|
|
+ }
|
|
|
/* If the request is not detached (i.e. the caller really wants
|
|
|
* proper ownership), no new requests will appear because a
|
|
|
* reference will be kept on the dst replicate, which will
|
|
@@ -647,13 +652,14 @@ struct _starpu_data_request *_starpu_create_request_to_fetch_data(starpu_data_ha
|
|
|
|
|
|
if (write_invalidation)
|
|
|
{
|
|
|
+ nwait += nwaitself;
|
|
|
/* Some requests were still pending, we have to add yet another
|
|
|
* request, depending on them, which will invalidate their
|
|
|
* result.
|
|
|
*/
|
|
|
struct _starpu_data_request *r = _starpu_create_data_request(handle, dst_replicate,
|
|
|
dst_replicate, requesting_node,
|
|
|
- STARPU_W, nwait, is_prefetch, 1);
|
|
|
+ mode, nwait, is_prefetch, 1);
|
|
|
|
|
|
/* and perform the callback after termination */
|
|
|
_starpu_data_request_append_callback(r, callback_func, callback_arg);
|