Quellcode durchsuchen

Add some likeliness

Samuel Thibault vor 5 Jahren
Ursprung
Commit
d3ffaa6170
5 geänderte Dateien mit 12 neuen und 12 gelöschten Zeilen
  1. 1 1
      mpi/src/starpu_mpi.c
  2. 6 6
      src/core/task.c
  3. 2 2
      src/core/workers.h
  4. 1 1
      src/datawizard/user_interactions.c
  5. 2 2
      src/profiling/bound.c

+ 1 - 1
mpi/src/starpu_mpi.c

@@ -46,7 +46,7 @@ static void _starpu_mpi_isend_irecv_common(struct _starpu_mpi_req *req, enum sta
 
 static struct _starpu_mpi_req *_starpu_mpi_isend_common(starpu_data_handle_t data_handle, int dest, starpu_mpi_tag_t data_tag, MPI_Comm comm, unsigned detached, unsigned sync, int prio, void (*callback)(void *), void *arg, int sequential_consistency)
 {
-	if (_starpu_mpi_fake_world_size != -1)
+	if (STARPU_UNLIKELY(_starpu_mpi_fake_world_size != -1))
 	{
 		/* Don't actually do the communication */
 		return NULL;

+ 6 - 6
src/core/task.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2011-2019                                Inria
- * Copyright (C) 2009-2019                                Université de Bordeaux
+ * Copyright (C) 2009-2020                                Université de Bordeaux
  * Copyright (C) 2017                                     Erwan Leria
  * Copyright (C) 2010-2019                                CNRS
  * Copyright (C) 2013                                     Thibaut Lambert
@@ -772,7 +772,7 @@ static int _starpu_task_submit_head(struct starpu_task *task)
 					  "Codelet %p has too many buffers (%d vs max %d). Either use --enable-maxbuffers configure option to increase the max, or use dyn_handles instead of handles.",
 					  task->cl, STARPU_TASK_GET_NBUFFERS(task), STARPU_NMAXBUFS);
 
-		if (task->dyn_handles)
+		if (STARPU_UNLIKELY(task->dyn_handles))
 		{
 			_STARPU_MALLOC(task->dyn_interfaces, nbuffers * sizeof(void *));
 		}
@@ -805,7 +805,7 @@ static int _starpu_task_submit_head(struct starpu_task *task)
 		}
 
 		/* Check the type of worker(s) required by the task exist */
-		if (!_starpu_worker_exists(task))
+		if (STARPU_UNLIKELY(!_starpu_worker_exists(task)))
 		{
 			_STARPU_LOG_OUT_TAG("ENODEV");
 			return -ENODEV;
@@ -814,7 +814,7 @@ static int _starpu_task_submit_head(struct starpu_task *task)
 		/* In case we require that a task should be explicitely
 		 * executed on a specific worker, we make sure that the worker
 		 * is able to execute this task.  */
-		if (task->execute_on_a_specific_worker && !starpu_combined_worker_can_execute_task(task->workerid, task, 0))
+		if (STARPU_UNLIKELY(task->execute_on_a_specific_worker && !starpu_combined_worker_can_execute_task(task->workerid, task, 0)))
 		{
 			_STARPU_LOG_OUT_TAG("ENODEV");
 			return -ENODEV;
@@ -916,7 +916,7 @@ int _starpu_task_submit(struct starpu_task *task, int nodeps)
 			_starpu_detect_implicit_data_deps(task);
 	}
 
-	if (bundle)
+	if (STARPU_UNLIKELY(bundle))
 	{
 		/* We need to make sure that models for other tasks of the
 		 * bundle are also loaded, so the scheduler can estimate the
@@ -951,7 +951,7 @@ int _starpu_task_submit(struct starpu_task *task, int nodeps)
 	 * dependency. */
 	task->status = STARPU_TASK_BLOCKED;
 
-	if (profiling)
+	if (STARPU_UNLIKELY(profiling))
 		_starpu_clock_gettime(&info->submit_time);
 
 	ret = _starpu_submit_job(j, nodeps);

+ 2 - 2
src/core/workers.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2011-2017,2019                           Inria
- * Copyright (C) 2008-2019                                Université de Bordeaux
+ * Copyright (C) 2008-2020                                Université de Bordeaux
  * Copyright (C) 2010-2019                                CNRS
  * Copyright (C) 2013                                     Thibaut Lambert
  * Copyright (C) 2016                                     Uppsala University
@@ -1187,7 +1187,7 @@ int _starpu_get_catch_signals(void);
 static inline int _starpu_perf_counter_paused(void) 
 {
 	STARPU_RMB();
-	return _starpu_config.perf_counter_pause_depth > 0;
+	return STARPU_UNLIKELY(_starpu_config.perf_counter_pause_depth > 0);
 }
 
 /* @}*/

+ 1 - 1
src/datawizard/user_interactions.c

@@ -240,7 +240,7 @@ int starpu_data_acquire_on_node_cb_sequential_consistency_sync_jobids(starpu_dat
 		new_task = _starpu_detect_implicit_data_deps_with_handle(wrapper->pre_sync_task, wrapper->post_sync_task, &_starpu_get_job_associated_to_task(wrapper->post_sync_task)->implicit_dep_slot, handle, mode, sequential_consistency);
 		STARPU_PTHREAD_MUTEX_UNLOCK(&handle->sequential_consistency_mutex);
 
-		if (new_task)
+		if (STARPU_UNLIKELY(new_task))
 		{
 			int ret = _starpu_task_submit_internally(new_task);
 			STARPU_ASSERT(!ret);

+ 2 - 2
src/profiling/bound.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2011,2012,2014                           Inria
- * Copyright (C) 2010-2017,2019                           Université de Bordeaux
+ * Copyright (C) 2010-2017,2019-2020                      Université de Bordeaux
  * Copyright (C) 2010-2017,2019                           CNRS
  * Copyright (C) 2013                                     Thibaut Lambert
  * Copyright (C) 2011                                     Télécom-SudParis
@@ -257,7 +257,7 @@ static void new_task(struct _starpu_job *j)
 /* A new task was submitted, record it */
 void _starpu_bound_record(struct _starpu_job *j)
 {
-	if (!_starpu_bound_recording)
+	if (STARPU_LIKELY(!_starpu_bound_recording))
 		return;
 
 	if (!good_job(j))