@@ -107,7 +107,7 @@ int parsec_select_best_device( parsec_task_t* this_task ) {
107107
108108 /* Run the evaluates for the incarnation types to determine if they can
109109 * execute this task */
110- for (chore_id = 0 ; PARSEC_DEV_NONE != tc -> incarnations [chore_id ].type ; chore_id ++ ) {
110+ for (chore_id = 0 ; PARSEC_DEV_NONE != ( tc -> incarnations [chore_id ].type & PARSEC_DEV_ANY_TYPE ) ; chore_id ++ ) {
111111 if ( 0 == (this_task -> chore_mask & (1 <<chore_id )) ) continue ;
112112 if ( NULL == tc -> incarnations [chore_id ].hook ) continue ; /* dyld hook not found during initialization */
113113
@@ -116,15 +116,15 @@ int parsec_select_best_device( parsec_task_t* this_task ) {
116116 if ( PARSEC_HOOK_RETURN_DONE != rc ) {
117117 if ( PARSEC_HOOK_RETURN_NEXT != rc ) {
118118 PARSEC_DEBUG_VERBOSE (5 , parsec_device_output , "Failed to evaluate %s[%d] chore %d" ,
119- tmp , tc -> incarnations [chore_id ].type ,
119+ tmp , tc -> incarnations [chore_id ].type & PARSEC_DEV_ANY_TYPE ,
120120 chore_id );
121121 }
122122 /* Mark this chore as tested */
123123 this_task -> chore_mask &= ~( 1 <<chore_id );
124124 continue ;
125125 }
126126 }
127- valid_types |= tc -> incarnations [chore_id ].type ; /* the eval accepted the type, but no device specified yet */
127+ valid_types |= ( tc -> incarnations [chore_id ].type & PARSEC_DEV_ANY_TYPE ) ; /* the eval accepted the type, but no device specified yet */
128128 /* Evaluate may have picked a device, abide by it */
129129 if ( NULL != this_task -> selected_device ) {
130130 assert ( this_task -> selected_device -> type & valid_types );
@@ -140,7 +140,7 @@ int parsec_select_best_device( parsec_task_t* this_task ) {
140140 if (PARSEC_DEV_CPU == valid_types ) { /* shortcut for CPU only tasks */
141141 this_task -> selected_device = dev = parsec_mca_device_get (0 );
142142 this_task -> load = 0 ;
143- for (chore_id = 0 ; tc -> incarnations [chore_id ].type != PARSEC_DEV_CPU ; chore_id ++ );
143+ for (chore_id = 0 ; !( tc -> incarnations [chore_id ].type & PARSEC_DEV_CPU ) ; chore_id ++ );
144144 this_task -> selected_chore = chore_id ;
145145 PARSEC_DEBUG_VERBOSE (80 , parsec_device_output , "%s: Task %s cpu-only task set selected_device %d:%s" ,
146146 __func__ , tmp , dev -> device_index , dev -> name );
@@ -226,7 +226,7 @@ int parsec_select_best_device( parsec_task_t* this_task ) {
226226 /* Skip the device if no incarnations for its type */
227227 if (!(dev -> type & valid_types )) continue ;
228228 /* Skip recursive devices: time estimates are computed on the associated CPU device */
229- if (dev -> type == PARSEC_DEV_RECURSIVE ) continue ;
229+ if (dev -> type & PARSEC_DEV_RECURSIVE ) continue ;
230230
231231 eta = dev -> device_load + time_estimate (this_task , dev );
232232 if ( best_eta > eta ) {
@@ -244,14 +244,14 @@ int parsec_select_best_device( parsec_task_t* this_task ) {
244244 goto no_valid_device ;
245245
246246 this_task -> selected_device = parsec_mca_device_get (best_index );
247- assert ( this_task -> selected_device -> type != PARSEC_DEV_RECURSIVE );
247+ assert ( !( this_task -> selected_device -> type & PARSEC_DEV_RECURSIVE ) );
248248 }
249249
250250device_selected :
251251 dev = this_task -> selected_device ;
252252 assert ( NULL != dev );
253253 assert ( tp -> devices_index_mask & (1 << dev -> device_index ) );
254- for (chore_id = 0 ; tc -> incarnations [chore_id ].type != dev -> type ; chore_id ++ )
254+ for (chore_id = 0 ; !( tc -> incarnations [chore_id ].type & dev -> type ) ; chore_id ++ )
255255 assert (PARSEC_DEV_NONE != tc -> incarnations [chore_id ].type /* we have selected this device, so there *must* be an incarnation that matches */ );
256256 this_task -> selected_chore = chore_id ;
257257 this_task -> load = time_estimate (this_task , dev );
@@ -748,8 +748,8 @@ int parsec_mca_device_registration_complete(parsec_context_t* context)
748748 for ( uint32_t i = 0 ; i < parsec_nb_devices ; i ++ ) {
749749 parsec_device_module_t * device = parsec_devices [i ];
750750 if ( NULL == device ) continue ;
751- if ( PARSEC_DEV_RECURSIVE == device -> type ) continue ;
752- if ( PARSEC_DEV_CPU == device -> type ) {
751+ if ( PARSEC_DEV_RECURSIVE & device -> type ) continue ;
752+ if ( PARSEC_DEV_CPU & device -> type ) {
753753 c = 0 ;
754754 for (int p = 0 ; p < context -> nb_vp ; p ++ )
755755 c += context -> virtual_processes [p ]-> nb_cores ;
@@ -768,7 +768,7 @@ int parsec_mca_device_registration_complete(parsec_context_t* context)
768768 for ( uint32_t i = 0 ; i < parsec_nb_devices ; i ++ ) {
769769 parsec_device_module_t * device = parsec_devices [i ];
770770 if ( NULL == device ) continue ;
771- if ( PARSEC_DEV_RECURSIVE == device -> type ) continue ;
771+ if ( PARSEC_DEV_RECURSIVE & device -> type ) continue ;
772772 device -> time_estimate_default = total_gflops_fp64 /(double )device -> gflops_fp64 ;
773773 parsec_debug_verbose (6 , parsec_device_output , " Dev[%d] default-time-estimate %-4" PRId64 " <- double %-8" PRId64 " single %-8" PRId64 " tensor %-8" PRId64 " half %-8" PRId64 " %s" ,
774774 i , device -> time_estimate_default , device -> gflops_fp64 , device -> gflops_fp32 , device -> gflops_tf32 , device -> gflops_fp16 , device -> gflops_guess ? "GUESSED" : "" );
@@ -933,7 +933,7 @@ device_taskpool_register_static(parsec_device_module_t* device, parsec_taskpool_
933933 continue ;
934934 __parsec_chore_t * chores = (__parsec_chore_t * )tc -> incarnations ;
935935 for ( j = 0 ; NULL != chores [j ].hook ; j ++ ) {
936- if ( chores [j ].type != device -> type )
936+ if ( !( chores [j ].type & device -> type ) )
937937 continue ;
938938 if ( NULL != chores [j ].dyld_fn ) {
939939 continue ; /* the function has been set for another device of the same type */
0 commit comments