|
@@ -763,7 +763,7 @@ restart:
|
|
* Try to find a buffer currently in use on the memory node which has the given
|
|
* Try to find a buffer currently in use on the memory node which has the given
|
|
* footprint.
|
|
* footprint.
|
|
*/
|
|
*/
|
|
-static int try_to_reuse_potentially_in_use_mc(unsigned node, starpu_data_handle_t handle, struct _starpu_data_replicate *replicate, uint32_t footprint)
|
|
+static int try_to_reuse_potentially_in_use_mc(unsigned node, starpu_data_handle_t handle, struct _starpu_data_replicate *replicate, uint32_t footprint, int is_prefetch)
|
|
{
|
|
{
|
|
struct _starpu_mem_chunk *mc, *next_mc, *orig_next_mc;
|
|
struct _starpu_mem_chunk *mc, *next_mc, *orig_next_mc;
|
|
int success = 0;
|
|
int success = 0;
|
|
@@ -790,6 +790,9 @@ restart:
|
|
if (mc->remove_notify)
|
|
if (mc->remove_notify)
|
|
|
|
|
|
continue;
|
|
continue;
|
|
|
|
+ if (is_prefetch > 1 && !mc->wontuse)
|
|
|
|
+
|
|
|
|
+ continue;
|
|
if (mc->footprint != footprint || _starpu_data_interface_compare(handle->per_node[node].data_interface, handle->ops, mc->data->per_node[node].data_interface, mc->ops) != 1)
|
|
if (mc->footprint != footprint || _starpu_data_interface_compare(handle->per_node[node].data_interface, handle->ops, mc->data->per_node[node].data_interface, mc->ops) != 1)
|
|
|
|
|
|
continue;
|
|
continue;
|
|
@@ -1206,6 +1209,7 @@ static struct _starpu_mem_chunk *_starpu_memchunk_init(struct _starpu_data_repli
|
|
mc->size_interface = interface_size;
|
|
mc->size_interface = interface_size;
|
|
mc->remove_notify = NULL;
|
|
mc->remove_notify = NULL;
|
|
mc->diduse = 0;
|
|
mc->diduse = 0;
|
|
|
|
+ mc->wontuse = 0;
|
|
|
|
|
|
return mc;
|
|
return mc;
|
|
}
|
|
}
|
|
@@ -1391,20 +1395,20 @@ static starpu_ssize_t _starpu_allocate_interface(starpu_data_handle_t handle, st
|
|
continue;
|
|
continue;
|
|
reclaim -= freed;
|
|
reclaim -= freed;
|
|
|
|
|
|
- if (is_prefetch)
|
|
|
|
-
|
|
|
|
- continue;
|
|
|
|
-
|
|
|
|
|
|
|
|
if (_starpu_has_not_important_data && try_to_reuse_not_important_mc(dst_node, handle, replicate, footprint))
|
|
if (_starpu_has_not_important_data && try_to_reuse_not_important_mc(dst_node, handle, replicate, footprint))
|
|
break;
|
|
break;
|
|
- if (try_to_reuse_potentially_in_use_mc(dst_node, handle, replicate, footprint))
|
|
+ if (try_to_reuse_potentially_in_use_mc(dst_node, handle, replicate, footprint, is_prefetch))
|
|
{
|
|
{
|
|
reused = 1;
|
|
reused = 1;
|
|
allocated_memory = data_size;
|
|
allocated_memory = data_size;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (is_prefetch)
|
|
|
|
+
|
|
|
|
+ continue;
|
|
|
|
+
|
|
if (!told_reclaiming)
|
|
if (!told_reclaiming)
|
|
{
|
|
{
|
|
|
|
|
|
@@ -1524,6 +1528,7 @@ void _starpu_memchunk_recently_used(struct _starpu_mem_chunk *mc, unsigned node)
|
|
return;
|
|
return;
|
|
_starpu_spin_lock(&mc_lock[node]);
|
|
_starpu_spin_lock(&mc_lock[node]);
|
|
MC_LIST_ERASE(node, mc);
|
|
MC_LIST_ERASE(node, mc);
|
|
|
|
+ mc->wontuse = 0;
|
|
MC_LIST_PUSH_BACK(node, mc);
|
|
MC_LIST_PUSH_BACK(node, mc);
|
|
_starpu_spin_unlock(&mc_lock[node]);
|
|
_starpu_spin_unlock(&mc_lock[node]);
|
|
}
|
|
}
|
|
@@ -1538,6 +1543,7 @@ void _starpu_memchunk_wont_use(struct _starpu_mem_chunk *mc, unsigned node)
|
|
_starpu_spin_lock(&mc_lock[node]);
|
|
_starpu_spin_lock(&mc_lock[node]);
|
|
|
|
|
|
mc->diduse = 1;
|
|
mc->diduse = 1;
|
|
|
|
+ mc->wontuse = 1;
|
|
MC_LIST_ERASE(node, mc);
|
|
MC_LIST_ERASE(node, mc);
|
|
|
|
|
|
mc->clean = 1;
|
|
mc->clean = 1;
|