diff VSs.h @ 26:a60399b62614

Update.. in middle of changes..
author Sean Halle <seanhalle@yahoo.com>
date Thu, 18 Oct 2012 02:44:30 -0700
parents b2bc97318262
children 3b30da4643d1
line diff
     1.1 --- a/VSs.h	Mon Sep 03 03:26:12 2012 -0700
     1.2 +++ b/VSs.h	Thu Oct 18 02:44:30 2012 -0700
     1.3 @@ -11,24 +11,28 @@
     1.4  
     1.5  #include "Queue_impl/PrivateQueue.h"
     1.6  #include "Hash_impl/PrivateHash.h"
     1.7 -#include "VMS_impl/VMS.h"
     1.8 +#include "PR_impl/PR.h"
     1.9  #include "Measurement/dependency.h"
    1.10  
    1.11  
    1.12  //===========================================================================
    1.13 +   //uniquely identifies VSs -- should be a jenkins char-hash of "VSs" to int32
    1.14 +#define VSs_MAGIC_NUMBER 0000000001
    1.15 +
    1.16  #define NUM_STRUCS_IN_SEM_ENV 1000
    1.17  
    1.18     //This is hardware dependent -- it's the number of cycles of scheduling
    1.19     // overhead -- if a work unit is fewer than this, it is better being
    1.20     // combined sequentially with other work
    1.21 -   //This value depends on both VMS overhead and VSs's plugin.  At some point
    1.22 +   //This value depends on both PR overhead and VSs's plugin.  At some point
    1.23     // it will be derived by perf-counter measurements during init of VSs
    1.24  #define MIN_WORK_UNIT_CYCLES 20000
    1.25  
    1.26  //===========================================================================
    1.27  /*This header defines everything specific to the VSs semantic plug-in
    1.28   */
    1.29 -typedef struct _VSsSemReq   VSsSemReq;
    1.30 +typedef struct _VSsSemReq    VSsSemReq;
    1.31 +typedef struct _VSsTaskStub  VSsTaskStub;
    1.32  typedef void  (*VSsTaskFnPtr )   ( void *, SlaveVP *);
    1.33  typedef void  (*PtrToAtomicFn )  ( void * ); //executed atomically in master
    1.34  //===========================================================================
    1.35 @@ -45,6 +49,10 @@
    1.36  #define IS_ENDED    NULL
    1.37  #define SEED_SLV    NULL
    1.38  
    1.39 +#define NO_ID       NULL
    1.40 +#define ANY_CORE    -1
    1.41 +
    1.42 +//===========================================================================
    1.43  typedef struct
    1.44   {
    1.45     VSsTaskFnPtr fn;
    1.46 @@ -65,22 +73,24 @@
    1.47   }
    1.48  VSsPointerEntry;
    1.49  
    1.50 -typedef struct
    1.51 +/*This is placed into semData, used for dependencies and wait construct*/
    1.52 +struct _VSsTaskStub
    1.53   {
    1.54 -   void       **args; //ctld args must come first, as ptrs
    1.55 -   VSsTaskType *taskType;
    1.56 -   int32       *taskID;
    1.57 -   int32        numBlockingProp;
    1.58 -   SlaveVP     *slaveAssignedTo; //only valid before end task (thread)
    1.59 -   VSsPointerEntry  **ptrEntries;
    1.60 -   void*        parentTaskStub;
    1.61 +   int32             langMagicNumber; //magic num must be 1st field of langMetaTask
    1.62 +   PRMetaTask       *protoMetaTask;   //back-link must always be 2nd field
    1.63 +   void            **args;            //ctld args must be the first ones (as ptrs)
    1.64 +   VSsPointerEntry **ptrEntries;
    1.65 +   int32             numBlockingProp;
    1.66 +   
    1.67 +   VSsTaskType *taskType; //has VSs lang related info
    1.68 +   
    1.69 +   VSsTaskStub *parentTaskStub; //for liveness, for the wait construct
    1.70     int32        numLiveChildTasks;
    1.71     int32        numLiveChildThreads;
    1.72     bool32       isWaitingForChildTasksToEnd;
    1.73     bool32       isWaitingForChildThreadsToEnd;
    1.74     bool32       isEnded;
    1.75 - }
    1.76 -VSsTaskStub;
    1.77 + };
    1.78  
    1.79  
    1.80  typedef struct
    1.81 @@ -144,7 +154,7 @@
    1.82     SlaveVP           *callingSlv;
    1.83     VSsTaskType       *taskType;
    1.84     void              *args;
    1.85 -   VSsTaskStub       *taskStub;
    1.86 +//   VSsTaskStub       *taskStub;  //not needed -- get via PR accessor from slv
    1.87     
    1.88     SlaveVP           *senderSlv;
    1.89     SlaveVP           *receiverSlv;
    1.90 @@ -153,12 +163,13 @@
    1.91     int32              msgType;
    1.92     void              *msg;
    1.93     VSsSemReq         *nextReqInHashEntry;
    1.94 -   int32             *taskID;
    1.95 +//In PRReq:   int32             *taskID;
    1.96     
    1.97     TopLevelFnPtr      fnPtr;
    1.98     void              *initData;
    1.99     int32              coreToAssignOnto;
   1.100  
   1.101 +//These, below, should move to util language..
   1.102     int32              sizeToMalloc;
   1.103     void              *ptrToFree;
   1.104  
   1.105 @@ -174,15 +185,15 @@
   1.106  
   1.107  
   1.108  typedef struct
   1.109 - {
   1.110 + { PRSemEnv        *protoSemEnv;
   1.111     PrivQueueStruc  *slavesReadyToResumeQ; //Shared (slaves not pinned)
   1.112 -   PrivQueueStruc  *freeExtraTaskSlvQ;    //Shared
   1.113 +   PrivQueueStruc  *freeTaskSlvRecycleQ;    //Shared
   1.114     PrivQueueStruc  *taskReadyQ;           //Shared (tasks not pinned)
   1.115 -   SlaveVP         *slotTaskSlvs[NUM_CORES][NUM_ANIM_SLOTS];
   1.116 +//   SlaveVP         *slotTaskSlvs[NUM_CORES][NUM_ANIM_SLOTS];
   1.117     HashTable       *argPtrHashTbl;
   1.118     HashTable       *commHashTbl;
   1.119 -   int32            numLiveExtraTaskSlvs;
   1.120 -   int32            numLiveThreadSlvs;
   1.121 +//   int32            numLiveFreeTaskSlvs;
   1.122 +//   int32            numLiveThreadSlvs;
   1.123     int32            nextCoreToGetNewSlv;
   1.124     int32            primitiveStartTime;
   1.125  
   1.126 @@ -190,8 +201,11 @@
   1.127     VSsSingleton     fnSingletons[NUM_STRUCS_IN_SEM_ENV];
   1.128     VSsTrans         transactionStrucs[NUM_STRUCS_IN_SEM_ENV];
   1.129  
   1.130 -   bool32          *coreIsDone;
   1.131 -   int32            numCoresDone;
   1.132 +//   bool32          *coreIsDone;
   1.133 +//   int32            numCoresDone;
   1.134 +   
   1.135 +//   SlaveVP* idleSlv[NUM_CORES][NUM_ANIM_SLOTS];
   1.136 +//   int shutdownInitiated;
   1.137     
   1.138     #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC
   1.139     ListOfArrays* unitList;
   1.140 @@ -207,8 +221,6 @@
   1.141     #ifdef HOLISTIC__TURN_ON_PERF_COUNTERS
   1.142     ListOfArrays* counterList[NUM_CORES];
   1.143     #endif
   1.144 -   SlaveVP* idleSlv[NUM_CORES][NUM_ANIM_SLOTS];
   1.145 -   int shutdownInitiated;
   1.146   }
   1.147  VSsSemEnv;
   1.148  
   1.149 @@ -221,19 +233,20 @@
   1.150   };
   1.151  //TransListElem
   1.152   
   1.153 +/* PR now handles what this used to be used for
   1.154  enum VSsSlvType
   1.155 - { ExtraTaskSlv = 1,
   1.156 + { FreeTaskSlv = 1,
   1.157     SlotTaskSlv,
   1.158     ThreadSlv
   1.159   };
   1.160 +*/
   1.161   
   1.162  typedef struct
   1.163   {
   1.164 -   int32           highestTransEntered;
   1.165 -   TransListElem  *lastTransEntered;
   1.166 -   bool32          needsTaskAssigned;
   1.167 -   VSsTaskStub    *taskStub;
   1.168 -   enum VSsSlvType slaveType;
   1.169 +   int32            highestTransEntered;
   1.170 +   TransListElem   *lastTransEntered;
   1.171 +   int32            primitiveStartTime;
   1.172 +//   VSsTaskStub     *taskStub; //get from slave via PR accessor
   1.173   }
   1.174  VSsSemData;
   1.175   
   1.176 @@ -246,7 +259,7 @@
   1.177  VSs__giveMinWorkUnitCycles( float32 percentOverhead );
   1.178  
   1.179  void
   1.180 -VSs__start_primitive();
   1.181 +VSs__begin_primitive();
   1.182  
   1.183  int32
   1.184  VSs__end_primitive_and_give_cycles();
   1.185 @@ -260,7 +273,7 @@
   1.186  //=======================
   1.187  
   1.188  void
   1.189 -VSs__init();
   1.190 +VSs__start( SlaveVP *seedSlv );
   1.191  
   1.192  void
   1.193  VSs__cleanup_after_shutdown();
   1.194 @@ -276,9 +289,9 @@
   1.195  
   1.196  //=======================
   1.197  
   1.198 -#define VSs__malloc( numBytes, callingSlave ) VMS_App__malloc( numBytes, callingSlave)
   1.199 +#define VSs__malloc( numBytes, callingSlave ) PR_App__malloc( numBytes, callingSlave)
   1.200  
   1.201 -#define VSs__free(ptrToFree, callingSlave ) VMS_App__free( ptrToFree, callingSlave )
   1.202 +#define VSs__free(ptrToFree, callingSlave ) PR_App__free( ptrToFree, callingSlave )
   1.203  
   1.204  
   1.205  //=======================
   1.206 @@ -351,8 +364,8 @@
   1.207  VSs__create_slave_helper( TopLevelFnPtr fnPtr, void *initData,
   1.208                            VSsSemEnv *semEnv,    int32 coreToAssignOnto );
   1.209  
   1.210 -VSsTaskStub *
   1.211 -create_thread_task_stub( void *initData );
   1.212 +PRMetaTask *
   1.213 +PR_int__create_generic_slave_meta_task( void *initData );
   1.214  
   1.215  
   1.216  SlaveVP *
   1.217 @@ -363,9 +376,6 @@
   1.218  VSs__create_slave_with_affinity( TopLevelFnPtr fnPtr,    void *initData,
   1.219                              SlaveVP *creatingSlv, int32 coreToAssignOnto);
   1.220  
   1.221 -void 
   1.222 -idle_fn(void* data, SlaveVP *animatingSlv);
   1.223 -
   1.224  //=====================  Measurement of Lang Overheads  =====================
   1.225  #include "Measurement/VSs_Measurement.h"
   1.226