소스 검색

heteroprio: Avoid hardcoding the list of architectures

Samuel Thibault 4 년 전
부모
커밋
1b8fb28567

+ 10 - 10
doc/doxygen/chapters/320_scheduling.doxy

@@ -404,31 +404,31 @@ starpu_init(&conf);
 
 void init_heteroprio(unsigned sched_ctx) {
   // CPU uses 5 buckets and visits them in the natural order
-  starpu_heteroprio_set_nb_prios(ctx, STARPU_CPU_IDX, 5);
+  starpu_heteroprio_set_nb_prios(ctx, STARPU_CPU_WORKER, 5);
   // It uses direct mapping idx => idx
   for(unsigned idx = 0; idx < 5; ++idx){
-    starpu_heteroprio_set_mapping(ctx, STARPU_CPU_IDX, idx, idx);
+    starpu_heteroprio_set_mapping(ctx, STARPU_CPU_WORKER, idx, idx);
     // If there is no CUDA worker we must tell that CPU is faster
-    starpu_heteroprio_set_faster_arch(ctx, STARPU_CPU_IDX, idx);
+    starpu_heteroprio_set_faster_arch(ctx, STARPU_CPU_WORKER, idx);
   }
   
   if(starpu_cuda_worker_get_count()){
     // CUDA is enabled and uses 2 buckets
-    starpu_heteroprio_set_nb_prios(ctx, STARPU_CUDA_IDX, 2);
+    starpu_heteroprio_set_nb_prios(ctx, STARPU_CUDA_WORKER, 2);
     // CUDA will first look at bucket 1
-    starpu_heteroprio_set_mapping(ctx, STARPU_CUDA_IDX, 0, 1);
+    starpu_heteroprio_set_mapping(ctx, STARPU_CUDA_WORKER, 0, 1);
     // CUDA will then look at bucket 2
-    starpu_heteroprio_set_mapping(ctx, STARPU_CUDA_IDX, 1, 2);
+    starpu_heteroprio_set_mapping(ctx, STARPU_CUDA_WORKER, 1, 2);
 
     // For bucket 1 CUDA is the fastest
-    starpu_heteroprio_set_faster_arch(ctx, STARPU_CUDA_IDX, 1);
+    starpu_heteroprio_set_faster_arch(ctx, STARPU_CUDA_WORKER, 1);
     // And CPU is 30 times slower
-    starpu_heteroprio_set_arch_slow_factor(ctx, STARPU_CPU_IDX, 1, 30.0f);
+    starpu_heteroprio_set_arch_slow_factor(ctx, STARPU_CPU_WORKER, 1, 30.0f);
     
     // For bucket 0 CUDA is the fastest
-    starpu_heteroprio_set_faster_arch(ctx, STARPU_CUDA_IDX, 0);
+    starpu_heteroprio_set_faster_arch(ctx, STARPU_CUDA_WORKER, 0);
     // And CPU is 20 times slower
-    starpu_heteroprio_set_arch_slow_factor(ctx, STARPU_CPU_IDX, 0, 20.0f);
+    starpu_heteroprio_set_arch_slow_factor(ctx, STARPU_CPU_WORKER, 0, 20.0f);
   }
 }
 \endcode

+ 9 - 9
examples/scheduler/heteroprio_test.c

@@ -30,33 +30,33 @@ void initSchedulerCallback(unsigned sched_ctx)
 #ifdef STARPU_USE_CPU
 	if (starpu_cpu_worker_get_count())
 	{
-		starpu_heteroprio_set_nb_prios(0, STARPU_CPU_IDX, 3);
+		starpu_heteroprio_set_nb_prios(0, STARPU_CPU_WORKER, 3);
 		// It uses direct mapping idx => idx
 		unsigned idx;
 		for(idx = 0; idx < 3; ++idx)
 		{
-			starpu_heteroprio_set_mapping(sched_ctx, STARPU_CPU_IDX, idx, idx);
-			starpu_heteroprio_set_faster_arch(sched_ctx, STARPU_CPU_IDX, idx);
+			starpu_heteroprio_set_mapping(sched_ctx, STARPU_CPU_WORKER, idx, idx);
+			starpu_heteroprio_set_faster_arch(sched_ctx, STARPU_CPU_WORKER, idx);
 		}
 	}
 #endif
 #ifdef STARPU_USE_OPENCL
 	// OpenCL is enabled and uses 2 buckets
-	starpu_heteroprio_set_nb_prios(sched_ctx, STARPU_OPENCL_IDX, 2);
+	starpu_heteroprio_set_nb_prios(sched_ctx, STARPU_OPENCL_WORKER, 2);
 	// OpenCL will first look to priority 2
 	int prio2 = starpu_cpu_worker_get_count() ? 2 : 1;
-	starpu_heteroprio_set_mapping(sched_ctx, STARPU_OPENCL_IDX, 0, prio2);
+	starpu_heteroprio_set_mapping(sched_ctx, STARPU_OPENCL_WORKER, 0, prio2);
 	// For this bucket OpenCL is the fastest
-	starpu_heteroprio_set_faster_arch(sched_ctx, STARPU_OPENCL_IDX, prio2);
+	starpu_heteroprio_set_faster_arch(sched_ctx, STARPU_OPENCL_WORKER, prio2);
 	// And CPU is 4 times slower
 #ifdef STARPU_USE_CPU
-	starpu_heteroprio_set_arch_slow_factor(sched_ctx, STARPU_CPU_IDX, 2, 4.0f);
+	starpu_heteroprio_set_arch_slow_factor(sched_ctx, STARPU_CPU_WORKER, 2, 4.0f);
 #endif
 
 	int prio1 = starpu_cpu_worker_get_count() ? 1 : 0;
-	starpu_heteroprio_set_mapping(sched_ctx, STARPU_OPENCL_IDX, 1, prio1);
+	starpu_heteroprio_set_mapping(sched_ctx, STARPU_OPENCL_WORKER, 1, prio1);
 	// We let the CPU as the fastest and tell that OpenCL is 1.7 times slower
-	starpu_heteroprio_set_arch_slow_factor(sched_ctx, STARPU_OPENCL_IDX, prio1, 1.7f);
+	starpu_heteroprio_set_arch_slow_factor(sched_ctx, STARPU_OPENCL_WORKER, prio1, 1.7f);
 #endif
 }
 

+ 4 - 30
include/schedulers/starpu_heteroprio.h

@@ -25,49 +25,23 @@ extern "C"
 #endif
 
 #define STARPU_HETEROPRIO_MAX_PRIO 100
-/* #define STARPU_NB_TYPES 3 */
-/* #define STARPU_CPU_IDX 0 */
-/* #define STARPU_CUDA_IDX 1 */
-/* #define STARPU_OPENCL_IDX 2 */
 
 #define STARPU_HETEROPRIO_MAX_PREFETCH 2
 #if STARPU_HETEROPRIO_MAX_PREFETCH <= 0
 #error STARPU_HETEROPRIO_MAX_PREFETCH == 1 means no prefetch so STARPU_HETEROPRIO_MAX_PREFETCH must >= 1
 #endif
 
-enum starpu_heteroprio_types
-{
-// First will be zero
-	STARPU_CPU_IDX, // = 0
-	STARPU_CUDA_IDX,
-	STARPU_OPENCL_IDX,
-	STARPU_MIC_IDX,
-	STARPU_MPI_MS_IDX,
-// This will be the number of archs
-	STARPU_NB_TYPES
-};
-
-static const unsigned starpu_heteroprio_types_to_arch[STARPU_NB_TYPES+1] =
-{
-	STARPU_CPU,
-	STARPU_CUDA,
-	STARPU_OPENCL,
-	STARPU_MIC,
-        STARPU_MPI_MS,
-	0
-};
-
 /** Tell how many prio there are for a given arch */
-void starpu_heteroprio_set_nb_prios(unsigned sched_ctx_id, enum starpu_heteroprio_types arch, unsigned max_prio);
+void starpu_heteroprio_set_nb_prios(unsigned sched_ctx_id, enum starpu_worker_archtype arch, unsigned max_prio);
 
 /** Set the mapping for a given arch prio=>bucket */
-void starpu_heteroprio_set_mapping(unsigned sched_ctx_id, enum starpu_heteroprio_types arch, unsigned source_prio, unsigned dest_bucket_id);
+void starpu_heteroprio_set_mapping(unsigned sched_ctx_id, enum starpu_worker_archtype arch, unsigned source_prio, unsigned dest_bucket_id);
 
 /** Tell which arch is the faster for the tasks of a bucket (optional) */
-void starpu_heteroprio_set_faster_arch(unsigned sched_ctx_id, enum starpu_heteroprio_types arch, unsigned bucket_id);
+void starpu_heteroprio_set_faster_arch(unsigned sched_ctx_id, enum starpu_worker_archtype arch, unsigned bucket_id);
 
 /** Tell how slow is a arch for the tasks of a bucket (optional) */ 
-void starpu_heteroprio_set_arch_slow_factor(unsigned sched_ctx_id, enum starpu_heteroprio_types arch, unsigned bucket_id, float slow_factor);
+void starpu_heteroprio_set_arch_slow_factor(unsigned sched_ctx_id, enum starpu_worker_archtype arch, unsigned bucket_id, float slow_factor);
 
 #ifdef __cplusplus
 }

+ 9 - 5
include/starpu_task.h

@@ -48,39 +48,43 @@ extern "C"
 #define STARPU_NOWHERE	((1ULL)<<0)
 
 /**
+  Convert from enum starpu_worker_archtype to worker type mask for use in "where" fields
+  */
+#define STARPU_WORKER_TO_MASK(worker_archtype) (1ULL << (worker_archtype + 1))
+/**
    To be used when setting the field starpu_codelet::where (or
    starpu_task::where) to specify the codelet (or the task) may be
    executed on a CPU processing unit.
 */
-#define STARPU_CPU	((1ULL)<<1)
+#define STARPU_CPU	STARPU_WORKER_TO_MASK(STARPU_CPU_WORKER)
 
 /**
    To be used when setting the field starpu_codelet::where (or
    starpu_task::where) to specify the codelet (or the task) may be
    executed on a CUDA processing unit.
 */
-#define STARPU_CUDA	((1ULL)<<3)
+#define STARPU_CUDA	STARPU_WORKER_TO_MASK(STARPU_CUDA_WORKER)
 
 /**
    To be used when setting the field starpu_codelet::where (or
    starpu_task::where) to specify the codelet (or the task) may be
    executed on a OpenCL processing unit.
 */
-#define STARPU_OPENCL	((1ULL)<<6)
+#define STARPU_OPENCL	STARPU_WORKER_TO_MASK(STARPU_OPENCL_WORKER)
 
 /**
    To be used when setting the field starpu_codelet::where (or
    starpu_task::where) to specify the codelet (or the task) may be
    executed on a MIC processing unit.
 */
-#define STARPU_MIC	((1ULL)<<7)
+#define STARPU_MIC	STARPU_WORKER_TO_MASK(STARPU_MIC_WORKER)
 
 /**
    To be used when setting the field starpu_codelet::where (or
    starpu_task::where) to specify the codelet (or the task) may be
    executed on a MPI Slave processing unit.
 */
-#define STARPU_MPI_MS	((1ULL)<<9)
+#define STARPU_MPI_MS	STARPU_WORKER_TO_MASK(STARPU_MPI_MS_WORKER)
 
 /**
    Value to be set in starpu_codelet::flags to execute the codelet

+ 7 - 1
include/starpu_worker.h

@@ -66,7 +66,8 @@ enum starpu_worker_archtype
 	STARPU_OPENCL_WORKER=2,     /**< OpenCL device */
 	STARPU_MIC_WORKER=3,        /**< Intel MIC device */
 	STARPU_MPI_MS_WORKER=5,     /**< MPI Slave device */
-	STARPU_ANY_WORKER=6         /**< any worker, used in the hypervisor */
+	STARPU_MAX_WORKER=5,        /**< maximum value of STARPU_*_WORKER */
+	STARPU_ANY_WORKER=255       /**< any worker, used in the hypervisor */
 };
 
 /**
@@ -375,6 +376,11 @@ int starpu_memory_nodes_numa_devid_to_id(unsigned id);
 enum starpu_node_kind starpu_node_get_kind(unsigned node);
 
 /**
+   Return the type of worker which operates on memory node kind \p node_kind
+  */
+enum starpu_worker_archtype starpu_memory_node_get_worker_archtype(enum starpu_node_kind node_kind);
+
+/**
    @name Scheduling operations
    @{
 */

+ 13 - 0
src/datawizard/memory_nodes.c

@@ -179,3 +179,16 @@ int starpu_memory_node_get_devid(unsigned node)
 {
 	return _starpu_descr.devid[node];
 }
+
+enum starpu_worker_archtype starpu_memory_node_get_worker_archtype(enum starpu_node_kind node_kind) {
+	switch (node_kind) {
+		// case STARPU_UNUSED:
+		case STARPU_CPU_RAM: return STARPU_CPU_WORKER;
+		case STARPU_CUDA_RAM: return STARPU_CUDA_WORKER;
+		case STARPU_OPENCL_RAM: return STARPU_OPENCL_WORKER;
+		// case STARPU_DISK_RAM:
+		case STARPU_MIC_RAM: return STARPU_MIC_WORKER;
+		case STARPU_MPI_MS_RAM: return STARPU_MPI_MS_WORKER;
+		default: STARPU_ASSERT_MSG(0, "ambiguous memory node kind %d", node_kind);
+	}
+}

+ 34 - 76
src/sched_policies/heteroprio.c

@@ -37,6 +37,8 @@
 #define DBL_MAX __DBL_MAX__
 #endif
 
+#define STARPU_NB_TYPES (STARPU_MAX_WORKER+1)
+
 /* A bucket corresponds to a Pair of priorities
  * When a task is pushed with a priority X, it will be stored
  * into the bucket X.
@@ -107,8 +109,16 @@ struct _starpu_heteroprio_data
 	unsigned nb_workers_per_arch_index[STARPU_NB_TYPES];
 };
 
+
+static int starpu_heteroprio_types_to_arch(enum starpu_worker_archtype arch)
+{
+	if (arch > STARPU_MAX_WORKER)
+		return 0;
+	return STARPU_WORKER_TO_MASK(arch);
+}
+
 /** Tell how many prio there are for a given arch */
-void starpu_heteroprio_set_nb_prios(unsigned sched_ctx_id, enum starpu_heteroprio_types arch, unsigned max_prio)
+void starpu_heteroprio_set_nb_prios(unsigned sched_ctx_id, enum starpu_worker_archtype arch, unsigned max_prio)
 {
 	struct _starpu_heteroprio_data *hp = (struct _starpu_heteroprio_data*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
 
@@ -118,7 +128,7 @@ void starpu_heteroprio_set_nb_prios(unsigned sched_ctx_id, enum starpu_heteropri
 }
 
 /** Set the mapping for a given arch prio=>bucket */
-inline void starpu_heteroprio_set_mapping(unsigned sched_ctx_id, enum starpu_heteroprio_types arch, unsigned source_prio, unsigned dest_bucket_id)
+inline void starpu_heteroprio_set_mapping(unsigned sched_ctx_id, enum starpu_worker_archtype arch, unsigned source_prio, unsigned dest_bucket_id)
 {
 	STARPU_ASSERT(dest_bucket_id < STARPU_HETEROPRIO_MAX_PRIO);
 
@@ -126,12 +136,12 @@ inline void starpu_heteroprio_set_mapping(unsigned sched_ctx_id, enum starpu_het
 
 	hp->prio_mapping_per_arch_index[arch][source_prio] = dest_bucket_id;
 
-	hp->buckets[dest_bucket_id].valid_archs |= starpu_heteroprio_types_to_arch[arch];
+	hp->buckets[dest_bucket_id].valid_archs |= starpu_heteroprio_types_to_arch(arch);
 	_STARPU_DEBUG("Adding arch %d to bucket %u\n", arch, dest_bucket_id);
 }
 
 /** Tell which arch is the faster for the tasks of a bucket (optional) */
-inline void starpu_heteroprio_set_faster_arch(unsigned sched_ctx_id, enum starpu_heteroprio_types arch, unsigned bucket_id)
+inline void starpu_heteroprio_set_faster_arch(unsigned sched_ctx_id, enum starpu_worker_archtype arch, unsigned bucket_id)
 {
 	STARPU_ASSERT(bucket_id < STARPU_HETEROPRIO_MAX_PRIO);
 
@@ -143,7 +153,7 @@ inline void starpu_heteroprio_set_faster_arch(unsigned sched_ctx_id, enum starpu
 }
 
 /** Tell how slow is a arch for the tasks of a bucket (optional) */
-inline void starpu_heteroprio_set_arch_slow_factor(unsigned sched_ctx_id, enum starpu_heteroprio_types arch, unsigned bucket_id, float slow_factor)
+inline void starpu_heteroprio_set_arch_slow_factor(unsigned sched_ctx_id, enum starpu_worker_archtype arch, unsigned bucket_id, float slow_factor)
 {
 	STARPU_ASSERT(bucket_id < STARPU_HETEROPRIO_MAX_PRIO);
 
@@ -160,52 +170,22 @@ static inline void default_init_sched(unsigned sched_ctx_id)
 	int max_prio = starpu_sched_ctx_get_max_priority(sched_ctx_id);
 	STARPU_ASSERT(min_prio >= 0);
 	STARPU_ASSERT(max_prio >= 0);
+
+	enum starpu_worker_archtype type;
+
 	// By default each type of devices uses 1 bucket and no slow factor
-#ifdef STARPU_USE_CPU
-	if (starpu_cpu_worker_get_count() > 0)
-		starpu_heteroprio_set_nb_prios(sched_ctx_id, STARPU_CPU_IDX, max_prio-min_prio+1);
-#endif
-#ifdef STARPU_USE_CUDA
-	if (starpu_cuda_worker_get_count() > 0)
-		starpu_heteroprio_set_nb_prios(sched_ctx_id, STARPU_CUDA_IDX, max_prio-min_prio+1);
-#endif
-#ifdef STARPU_USE_OPENCL
-	if (starpu_opencl_worker_get_count() > 0)
-		starpu_heteroprio_set_nb_prios(sched_ctx_id, STARPU_OPENCL_IDX, max_prio-min_prio+1);
-#endif
-#ifdef STARPU_USE_MIC
-	if (starpu_mic_worker_get_count() > 0)
-		starpu_heteroprio_set_nb_prios(sched_ctx_id, STARPU_MIC_IDX, max_prio-min_prio+1);
-#endif
-#ifdef STARPU_USE_MPI_MASTER_SLAVE
-	if (starpu_mpi_ms_worker_get_count() > 0)
-		starpu_heteroprio_set_nb_prios(sched_ctx_id, STARPU_MPI_MS_IDX, max_prio-min_prio+1);
-#endif
+	for (type = 0; type <= STARPU_MAX_WORKER; type++)
+		if (starpu_worker_get_count_by_type(type) > 0)
+			starpu_heteroprio_set_nb_prios(sched_ctx_id, type, max_prio-min_prio+1);
 
 	// Direct mapping
 	int prio;
 	for(prio=min_prio ; prio<=max_prio ; prio++)
 	{
-#ifdef STARPU_USE_CPU
-		if (starpu_cpu_worker_get_count() > 0)
-			starpu_heteroprio_set_mapping(sched_ctx_id, STARPU_CPU_IDX, prio, prio);
-#endif
-#ifdef STARPU_USE_CUDA
-		if (starpu_cuda_worker_get_count() > 0)
-			starpu_heteroprio_set_mapping(sched_ctx_id, STARPU_CUDA_IDX, prio, prio);
-#endif
-#ifdef STARPU_USE_OPENCL
-		if (starpu_opencl_worker_get_count() > 0)
-			starpu_heteroprio_set_mapping(sched_ctx_id, STARPU_OPENCL_IDX, prio, prio);
-#endif
-#ifdef STARPU_USE_MIC
-		if (starpu_mic_worker_get_count() > 0)
-			starpu_heteroprio_set_mapping(sched_ctx_id, STARPU_MIC_IDX, prio, prio);
-#endif
-#ifdef STARPU_USE_MPI_MASTER_SLAVE
-		if (starpu_mpi_ms_worker_get_count() > 0)
-			starpu_heteroprio_set_mapping(sched_ctx_id, STARPU_MPI_MS_IDX, prio, prio);
-#endif
+		// By default each type of devices uses 1 bucket and no slow factor
+		for (type = 0; type <= STARPU_MAX_WORKER; type++)
+			if (starpu_worker_get_count_by_type(type) > 0)
+				starpu_heteroprio_set_mapping(sched_ctx_id, type, prio, prio);
 	}
 }
 
@@ -249,7 +229,7 @@ static void initialize_heteroprio_policy(unsigned sched_ctx_id)
 			const unsigned mapped_prio = hp->prio_mapping_per_arch_index[arch_index][idx_prio];
 			STARPU_ASSERT(mapped_prio <= STARPU_HETEROPRIO_MAX_PRIO);
 			STARPU_ASSERT(hp->buckets[mapped_prio].slow_factors_per_index[arch_index] >= 0.0);
-			STARPU_ASSERT(hp->buckets[mapped_prio].valid_archs & starpu_heteroprio_types_to_arch[arch_index]);
+			STARPU_ASSERT(hp->buckets[mapped_prio].valid_archs & starpu_heteroprio_types_to_arch(arch_index));
 			check_archs[mapped_prio]      = 1;
 			check_all_archs[mapped_prio] += 1;
 		}
@@ -257,7 +237,7 @@ static void initialize_heteroprio_policy(unsigned sched_ctx_id)
 		{
 			/* Ensure the current arch use a bucket or someone else can use it */
 			STARPU_ASSERT(check_archs[idx_prio] == 1 || hp->buckets[idx_prio].valid_archs == 0
-				      || (hp->buckets[idx_prio].valid_archs & ~starpu_heteroprio_types_to_arch[arch_index]) != 0);
+				      || (hp->buckets[idx_prio].valid_archs & ~starpu_heteroprio_types_to_arch(arch_index)) != 0);
 		}
 	}
 	/* Ensure that if a valid_archs = (STARPU_CPU|STARPU_CUDA) then check_all_archs[] = 2 for example */
@@ -267,7 +247,7 @@ static void initialize_heteroprio_policy(unsigned sched_ctx_id)
 		unsigned nb_arch_on_bucket = 0;
 		for(arch_index = 0; arch_index < STARPU_NB_TYPES; ++arch_index)
 		{
-			if(hp->buckets[idx_prio].valid_archs & starpu_heteroprio_types_to_arch[arch_index])
+			if(hp->buckets[idx_prio].valid_archs & starpu_heteroprio_types_to_arch(arch_index))
 			{
 				nb_arch_on_bucket += 1;
 			}
@@ -310,32 +290,10 @@ static void add_workers_heteroprio_policy(unsigned sched_ctx_id, int *workerids,
 		memset(&hp->workers_heteroprio[workerid], 0, sizeof(hp->workers_heteroprio[workerid]));
 		/* if the worker has already belonged to this context
 		   the queue and the synchronization variables have been already initialized */
-			_starpu_prio_deque_init(&hp->workers_heteroprio[workerid].tasks_queue);
-			switch(starpu_worker_get_type(workerid))
-			{
-			case STARPU_CPU_WORKER:
-				hp->workers_heteroprio[workerid].arch_type = STARPU_CPU;
-				hp->workers_heteroprio[workerid].arch_index = STARPU_CPU_IDX;
-				break;
-			case STARPU_CUDA_WORKER:
-				hp->workers_heteroprio[workerid].arch_type = STARPU_CUDA;
-				hp->workers_heteroprio[workerid].arch_index = STARPU_CUDA_IDX;
-				break;
-			case STARPU_OPENCL_WORKER:
-				hp->workers_heteroprio[workerid].arch_type = STARPU_OPENCL;
-				hp->workers_heteroprio[workerid].arch_index = STARPU_OPENCL_IDX;
-				break;
-			case STARPU_MIC_WORKER:
-				hp->workers_heteroprio[workerid].arch_type = STARPU_MIC;
-				hp->workers_heteroprio[workerid].arch_index = STARPU_MIC_IDX;
-				break;
-			case STARPU_MPI_MS_WORKER:
-				hp->workers_heteroprio[workerid].arch_type = STARPU_MPI_MS;
-				hp->workers_heteroprio[workerid].arch_index = STARPU_MPI_MS_IDX;
-				break;
-			default:
-				STARPU_ASSERT(0);
-			}
+		enum starpu_worker_archtype arch_index = starpu_worker_get_type(workerid);
+		_starpu_prio_deque_init(&hp->workers_heteroprio[workerid].tasks_queue);
+		hp->workers_heteroprio[workerid].arch_index = arch_index;
+		hp->workers_heteroprio[workerid].arch_type = starpu_heteroprio_types_to_arch(arch_index);
 		hp->nb_workers_per_arch_index[hp->workers_heteroprio[workerid].arch_index]++;
 
 	}
@@ -379,7 +337,7 @@ static int push_task_heteroprio_policy(struct starpu_task *task)
 	for(arch_index = 0; arch_index < STARPU_NB_TYPES; ++arch_index)
 	{
 		/* We test the archs on the bucket and not on task->where since it is restrictive */
-		if(bucket->valid_archs & starpu_heteroprio_types_to_arch[arch_index])
+		if(bucket->valid_archs & starpu_heteroprio_types_to_arch(arch_index))
 			hp->nb_remaining_tasks_per_arch_index[arch_index] += 1;
 	}
 
@@ -512,7 +470,7 @@ static struct starpu_task *pop_task_heteroprio_policy(unsigned sched_ctx_id)
 				for(arch_index = 0; arch_index < STARPU_NB_TYPES; ++arch_index)
 				{
 					/* We test the archs on the bucket and not on task->where since it is restrictive */
-					if(bucket->valid_archs & starpu_heteroprio_types_to_arch[arch_index])
+					if(bucket->valid_archs & starpu_heteroprio_types_to_arch(arch_index))
 					{
 						hp->nb_remaining_tasks_per_arch_index[arch_index] -= 1;
 					}