Browse Source

prefetch: fix case of a prefetch being evicted

Samuel Thibault 5 years ago
parent
commit
6110fac0c2
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/datawizard/coherency.c

+ 4 - 2
src/datawizard/coherency.c

@@ -1259,8 +1259,10 @@ void _starpu_fetch_task_input_tail(struct starpu_task *task, struct _starpu_job
 				/* Allocations or transfer prefetchs should have been done by now and marked
 				 * this mc as needed for us.
 				 * Now that we added a reference for the task, we can relieve that.  */
-				STARPU_ASSERT(local_replicate->mc->nb_tasks_prefetch > 0);
-				local_replicate->mc->nb_tasks_prefetch--;
+				/* Note: the replicate might have been evicted in between, thus not 100% sure
+				 * that our prefetch request is still recorded here.  */
+				if (local_replicate->mc->nb_tasks_prefetch > 0)
+					local_replicate->mc->nb_tasks_prefetch--;
 			}
 		}
 		_starpu_spin_unlock(&handle->header_lock);