소스 검색

Fix off-by-one access

Samuel Thibault 12 년 전
부모
커밋
4f35720e8e
2개의 변경된 파일7개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      src/drivers/mic/driver_mic_source.c
  2. 3 0
      src/drivers/mp_common/sink_common.c

+ 4 - 2
src/drivers/mic/driver_mic_source.c

@@ -678,8 +678,10 @@ void *_starpu_mic_src_worker(void *arg)
 		for (micworkerid = 0 ; (micworkerid < args->nworkers) && (task == NULL); micworkerid++)
 		    task = _starpu_pop_task (&args->workers[micworkerid]);
 
-		if (task != NULL)
-		    goto task_found;
+		if (task != NULL) {
+			micworkerid--;
+			goto task_found;
+		}
 
 #if 0 // XXX: synchronous execution for now
 		/* No task to submit, so we can poll the MIC device for

+ 3 - 0
src/drivers/mp_common/sink_common.c

@@ -105,15 +105,18 @@ void _starpu_sink_common_execute(const struct _starpu_mp_node *node,
 	else
 		cl_arg = NULL;
 
+	//_STARPU_DEBUG("telling host that we have submitted the task %p.\n", kernel);
 	/* XXX: in the future, we will not have to directly execute the kernel
 	 * but submit it to the correct local worker. */
 	_starpu_mp_common_send_command(node, STARPU_EXECUTION_SUBMITTED,
 				       NULL, 0);
 
+	//_STARPU_DEBUG("executing the task %p\n", kernel);
 	/* XXX: we keep the synchronous execution model on the sink side for
 	 * now. */
 	kernel(interfaces, cl_arg);
 
+	//_STARPU_DEBUG("telling host that we have finished the task %p.\n", kernel);
 	_starpu_mp_common_send_command(node, STARPU_EXECUTION_COMPLETED,
 				       &coreid, sizeof(coreid));
 }