changeset 72:d20b105981b7 Holistic_Model

make idle VPs optional
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Wed, 28 Mar 2012 18:02:38 +0200
parents 69a1875af605
children f20b4d9d3086
files SSR.c SSR.h SSR_PluginFns.c dependency.c dependency.h
diffstat 5 files changed, 27 insertions(+), 5 deletions(-) [+]
line diff
     1.1 --- a/SSR.c	Wed Mar 21 11:12:08 2012 +0100
     1.2 +++ b/SSR.c	Wed Mar 28 18:02:38 2012 +0200
     1.3 @@ -199,14 +199,16 @@
     1.4     #ifdef HOLISTIC__TURN_ON_PERF_COUNTERS
     1.5     SSR__init_counter_data_structs();
     1.6     #endif
     1.7 +   #ifdef IDLE_SLAVES
     1.8     semanticEnv->shutdownInitiated = FALSE;
     1.9     for(i=0;i<NUM_CORES;++i){
    1.10         for(j=0;j<NUM_ANIM_SLOTS;++j){
    1.11             semanticEnv->idlePr[i][j] = VMS_int__create_slaveVP(&idle_fn,NULL);
    1.12             semanticEnv->idlePr[i][j]->coreAnimatedBy = i;
    1.13 +           semanticEnv->idlePr[i][j]->typeOfVP = Idle;
    1.14         }
    1.15     }
    1.16 -
    1.17 +   #endif
    1.18     #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC
    1.19     semanticEnv->unitList = makeListOfArrays(sizeof(Unit),128);
    1.20     semanticEnv->ctlDependenciesList = makeListOfArrays(sizeof(Dependency),128);
     2.1 --- a/SSR.h	Wed Mar 21 11:12:08 2012 +0100
     2.2 +++ b/SSR.h	Wed Mar 28 18:02:38 2012 +0200
     2.3 @@ -18,6 +18,8 @@
     2.4  //===========================================================================
     2.5  #define NUM_STRUCS_IN_SEM_ENV 1000
     2.6  
     2.7 +//#define IDLE_SLAVES
     2.8 +
     2.9     //This is hardware dependent -- it's the number of cycles of scheduling
    2.10     // overhead -- if a work unit is fewer than this, it is better being
    2.11     // combined sequentially with other work
    2.12 @@ -126,8 +128,10 @@
    2.13     #ifdef HOLISTIC__TURN_ON_PERF_COUNTERS
    2.14     ListOfArrays* counterList[NUM_CORES];
    2.15     #endif
    2.16 +   #ifdef IDLE_SLAVES
    2.17     SlaveVP* idlePr[NUM_CORES][NUM_ANIM_SLOTS];
    2.18     int shutdownInitiated;
    2.19 +   #endif
    2.20   }
    2.21  SSRSemEnv;
    2.22  
     3.1 --- a/SSR_PluginFns.c	Wed Mar 21 11:12:08 2012 +0100
     3.2 +++ b/SSR_PluginFns.c	Wed Mar 28 18:02:38 2012 +0200
     3.3 @@ -46,7 +46,8 @@
     3.4  
     3.5     assignPr = readPrivQ( semEnv->readyVPQs[coreNum] );
     3.6        //Note, using a non-blocking queue -- it returns NULL if queue empty
     3.7 -  if(!assignPr){
     3.8 +   #ifdef IDLE_SLAVES
     3.9 +   if(!assignPr){
    3.10         assignPr = semEnv->idlePr[coreNum][slotNum];
    3.11        
    3.12        if(semEnv->shutdownInitiated) {
    3.13 @@ -72,8 +73,9 @@
    3.14        }
    3.15        #endif
    3.16     }
    3.17 +   #endif
    3.18     #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC
    3.19 -   if (assignPr && assignPr->typeOfVP == Slave) {
    3.20 +   if (assignPr && (assignPr->typeOfVP == Slave || assignPr->typeOfVP == Idle)) {
    3.21          //assignPr->numTimesAssigned++;
    3.22          Unit prev_in_slot = semEnv->last_in_slot[coreNum * NUM_ANIM_SLOTS + slotNum];
    3.23          if(prev_in_slot.vp != 0){
    3.24 @@ -194,8 +196,11 @@
    3.25     semEnv->numSlaveVP -= 1;
    3.26     if( semEnv->numSlaveVP == 0 )
    3.27      {    //no more work, so shutdown
    3.28 +       #ifdef IDLE_SLAVES
    3.29         semEnv->shutdownInitiated = TRUE;
    3.30 -      //VMS_SS__shutdown();
    3.31 +        #else
    3.32 +      VMS_SS__shutdown();
    3.33 +        #endif
    3.34      }
    3.35   }
    3.36  
    3.37 @@ -289,6 +294,16 @@
    3.38     Unit newu;
    3.39     newu.vp = procr->slaveID;
    3.40     newu.task = procr->assignCount;
    3.41 +   if(procr->assignCount <= 1){
    3.42 +       newu.ret_ptr = procr->resumeInstrPtr;  
    3.43 +   } else {
    3.44 +        void* frame_ptr0 = procr->framePtr;                               
    3.45 +        void* frame_ptr1 = *((void**)frame_ptr0);                          
    3.46 +        void* frame_ptr2 = *((void**)frame_ptr1);                          
    3.47 +        void* frame_ptr3 = *((void**)frame_ptr2);                          
    3.48 +        void* ret_addr = *((void**)frame_ptr3 + 1);                        
    3.49 +        newu.ret_ptr = ret_addr; 
    3.50 +   }
    3.51     addToListOfArrays(Unit,newu,semEnv->unitList);
    3.52     
    3.53     if (procr->assignCount > 1){
     4.1 --- a/dependency.c	Wed Mar 21 11:12:08 2012 +0100
     4.2 +++ b/dependency.c	Wed Mar 28 18:02:38 2012 +0200
     4.3 @@ -57,7 +57,7 @@
     4.4  void print_unit_to_file(void* _unit){
     4.5      Unit* unit = (Unit*) _unit;
     4.6      if(!unit) return;
     4.7 -    fprintf(dependency_file,"unit,%d,%d\n",unit->vp,unit->task);
     4.8 +    fprintf(dependency_file,"unit,%d,%d,%p\n",unit->vp,unit->task,unit->ret_ptr);
     4.9  }
    4.10  
    4.11  void print_nton_set_helper(void* _u){
     5.1 --- a/dependency.h	Wed Mar 21 11:12:08 2012 +0100
     5.2 +++ b/dependency.h	Wed Mar 28 18:02:38 2012 +0200
     5.3 @@ -15,6 +15,7 @@
     5.4  typedef struct {
     5.5      int vp;
     5.6      int task;
     5.7 +    void* ret_ptr;
     5.8  } Unit;
     5.9  
    5.10  typedef struct {