Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VSs_impls > VSs__MC_shared_impl
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 14:f8103dc9423a | 22:677c841ff4fb |
|---|---|
| 9 #ifndef _VSs_H | 9 #ifndef _VSs_H |
| 10 #define _VSs_H | 10 #define _VSs_H |
| 11 | 11 |
| 12 #include "Queue_impl/PrivateQueue.h" | 12 #include "Queue_impl/PrivateQueue.h" |
| 13 #include "Hash_impl/PrivateHash.h" | 13 #include "Hash_impl/PrivateHash.h" |
| 14 #include "VMS_impl/VMS.h" | 14 #include "PR_impl/PR.h" |
| 15 #include "Measurement/dependency.h" | 15 #include "Measurement/dependency.h" |
| 16 | 16 |
| 17 | 17 |
| 18 //=========================================================================== | 18 //=========================================================================== |
| 19 //uniquely identifies VSs -- should be a jenkins char-hash of "VSs" to int32 | |
| 20 #define VSs_MAGIC_NUMBER 0000000001 | |
| 21 | |
| 19 #define NUM_STRUCS_IN_SEM_ENV 1000 | 22 #define NUM_STRUCS_IN_SEM_ENV 1000 |
| 20 | 23 |
| 21 //This is hardware dependent -- it's the number of cycles of scheduling | 24 //This is hardware dependent -- it's the number of cycles of scheduling |
| 22 // overhead -- if a work unit is fewer than this, it is better being | 25 // overhead -- if a work unit is fewer than this, it is better being |
| 23 // combined sequentially with other work | 26 // combined sequentially with other work |
| 24 //This value depends on both VMS overhead and VSs's plugin. At some point | 27 //This value depends on both PR overhead and VSs's plugin. At some point |
| 25 // it will be derived by perf-counter measurements during init of VSs | 28 // it will be derived by perf-counter measurements during init of VSs |
| 26 #define MIN_WORK_UNIT_CYCLES 20000 | 29 #define MIN_WORK_UNIT_CYCLES 20000 |
| 27 | 30 |
| 28 //=========================================================================== | 31 //=========================================================================== |
| 29 /*This header defines everything specific to the VSs semantic plug-in | 32 /*This header defines everything specific to the VSs semantic plug-in |
| 30 */ | 33 */ |
| 31 typedef struct _VSsSemReq VSsSemReq; | 34 typedef struct _VSsSemReq VSsSemReq; |
| 35 typedef struct _VSsTaskStub VSsTaskStub; | |
| 32 typedef void (*VSsTaskFnPtr ) ( void *, SlaveVP *); | 36 typedef void (*VSsTaskFnPtr ) ( void *, SlaveVP *); |
| 33 typedef void (*PtrToAtomicFn ) ( void * ); //executed atomically in master | 37 typedef void (*PtrToAtomicFn ) ( void * ); //executed atomically in master |
| 34 //=========================================================================== | 38 //=========================================================================== |
| 35 | 39 |
| 36 #define NONCTLD 0 | 40 #define NONCTLD 0 |
| 43 | 47 |
| 44 #define IS_A_THREAD NULL | 48 #define IS_A_THREAD NULL |
| 45 #define IS_ENDED NULL | 49 #define IS_ENDED NULL |
| 46 #define SEED_SLV NULL | 50 #define SEED_SLV NULL |
| 47 | 51 |
| 52 #define NO_ID NULL | |
| 53 #define ANY_CORE -1 | |
| 54 | |
| 55 //=========================================================================== | |
| 48 typedef struct | 56 typedef struct |
| 49 { | 57 { |
| 50 VSsTaskFnPtr fn; | 58 VSsTaskFnPtr fn; |
| 51 int32 numTotalArgs;//the number of inputs to function | 59 int32 numTotalArgs;//the number of inputs to function |
| 52 int32 numCtldArgs;//how many of args have dependencies | 60 int32 numCtldArgs;//how many of args have dependencies |
| 63 int32 numEnabledNonDoneReaders; | 71 int32 numEnabledNonDoneReaders; |
| 64 PrivQueueStruc *waitersQ; | 72 PrivQueueStruc *waitersQ; |
| 65 } | 73 } |
| 66 VSsPointerEntry; | 74 VSsPointerEntry; |
| 67 | 75 |
| 68 typedef struct | 76 /*This is placed into semData, used for dependencies and wait construct*/ |
| 69 { | 77 struct _VSsTaskStub |
| 70 void **args; //ctld args must come first, as ptrs | 78 { |
| 71 VSsTaskType *taskType; | 79 int32 langMagicNumber; //magic num must be 1st field of langMetaTask |
| 72 int32 *taskID; | 80 PRMetaTask *protoMetaTask; //back-link must always be 2nd field |
| 73 int32 numBlockingProp; | 81 void **args; //ctld args must be the first ones (as ptrs) |
| 74 SlaveVP *slaveAssignedTo; //only valid before end task (thread) | 82 VSsPointerEntry **ptrEntries; |
| 75 VSsPointerEntry **ptrEntries; | 83 int32 numBlockingProp; |
| 76 void* parentTaskStub; | 84 |
| 85 VSsTaskType *taskType; //has VSs lang related info | |
| 86 | |
| 87 VSsTaskStub *parentTaskStub; //for liveness, for the wait construct | |
| 77 int32 numLiveChildTasks; | 88 int32 numLiveChildTasks; |
| 78 int32 numLiveChildThreads; | 89 int32 numLiveChildThreads; |
| 79 bool32 isWaitingForChildTasksToEnd; | 90 bool32 isWaitingForChildTasksToEnd; |
| 80 bool32 isWaitingForChildThreadsToEnd; | 91 bool32 isWaitingForChildThreadsToEnd; |
| 81 bool32 isEnded; | 92 bool32 isEnded; |
| 82 } | 93 }; |
| 83 VSsTaskStub; | |
| 84 | 94 |
| 85 | 95 |
| 86 typedef struct | 96 typedef struct |
| 87 { | 97 { |
| 88 VSsTaskStub *taskStub; | 98 VSsTaskStub *taskStub; |
| 142 struct _VSsSemReq | 152 struct _VSsSemReq |
| 143 { enum VSsReqType reqType; | 153 { enum VSsReqType reqType; |
| 144 SlaveVP *callingSlv; | 154 SlaveVP *callingSlv; |
| 145 VSsTaskType *taskType; | 155 VSsTaskType *taskType; |
| 146 void *args; | 156 void *args; |
| 147 VSsTaskStub *taskStub; | 157 // VSsTaskStub *taskStub; //not needed -- get via PR accessor from slv |
| 148 | 158 |
| 149 SlaveVP *senderSlv; | 159 SlaveVP *senderSlv; |
| 150 SlaveVP *receiverSlv; | 160 SlaveVP *receiverSlv; |
| 151 int32 *senderID; | 161 int32 *senderID; |
| 152 int32 *receiverID; | 162 int32 *receiverID; |
| 153 int32 msgType; | 163 int32 msgType; |
| 154 void *msg; | 164 void *msg; |
| 155 VSsSemReq *nextReqInHashEntry; | 165 VSsSemReq *nextReqInHashEntry; |
| 156 int32 *taskID; | 166 //In PRReq: int32 *taskID; |
| 157 | 167 |
| 158 TopLevelFnPtr fnPtr; | 168 TopLevelFnPtr fnPtr; |
| 159 void *initData; | 169 void *initData; |
| 160 int32 coreToAssignOnto; | 170 int32 coreToAssignOnto; |
| 161 | 171 |
| 172 //These, below, should move to util language.. | |
| 162 int32 sizeToMalloc; | 173 int32 sizeToMalloc; |
| 163 void *ptrToFree; | 174 void *ptrToFree; |
| 164 | 175 |
| 165 int32 singletonID; | 176 int32 singletonID; |
| 166 VSsSingleton **singletonPtrAddr; | 177 VSsSingleton **singletonPtrAddr; |
| 172 } | 183 } |
| 173 /* VSsSemReq */; | 184 /* VSsSemReq */; |
| 174 | 185 |
| 175 | 186 |
| 176 typedef struct | 187 typedef struct |
| 177 { | 188 { PRSemEnv *protoSemEnv; |
| 178 PrivQueueStruc *slavesReadyToResumeQ; //Shared (slaves not pinned) | 189 PrivQueueStruc *slavesReadyToResumeQ; //Shared (slaves not pinned) |
| 179 PrivQueueStruc *freeExtraTaskSlvQ; //Shared | 190 PrivQueueStruc *freeTaskSlvRecycleQ; //Shared |
| 180 PrivQueueStruc *taskReadyQ; //Shared (tasks not pinned) | 191 PrivQueueStruc *taskReadyQ; //Shared (tasks not pinned) |
| 181 SlaveVP *slotTaskSlvs[NUM_CORES][NUM_ANIM_SLOTS]; | 192 // SlaveVP *slotTaskSlvs[NUM_CORES][NUM_ANIM_SLOTS]; |
| 182 HashTable *argPtrHashTbl; | 193 HashTable *argPtrHashTbl; |
| 183 HashTable *commHashTbl; | 194 HashTable *commHashTbl; |
| 184 int32 numLiveExtraTaskSlvs; | 195 // int32 numLiveFreeTaskSlvs; |
| 185 int32 numLiveThreadSlvs; | 196 // int32 numLiveThreadSlvs; |
| 186 int32 nextCoreToGetNewSlv; | 197 int32 nextCoreToGetNewSlv; |
| 187 int32 primitiveStartTime; | 198 int32 primitiveStartTime; |
| 188 | 199 |
| 189 //fix limit on num with dynArray | 200 //fix limit on num with dynArray |
| 190 VSsSingleton fnSingletons[NUM_STRUCS_IN_SEM_ENV]; | 201 VSsSingleton fnSingletons[NUM_STRUCS_IN_SEM_ENV]; |
| 191 VSsTrans transactionStrucs[NUM_STRUCS_IN_SEM_ENV]; | 202 VSsTrans transactionStrucs[NUM_STRUCS_IN_SEM_ENV]; |
| 192 | 203 |
| 193 bool32 *coreIsDone; | 204 // bool32 *coreIsDone; |
| 194 int32 numCoresDone; | 205 // int32 numCoresDone; |
| 206 | |
| 207 // SlaveVP* idleSlv[NUM_CORES][NUM_ANIM_SLOTS]; | |
| 208 // int shutdownInitiated; | |
| 195 | 209 |
| 196 #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC | 210 #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC |
| 197 ListOfArrays* unitList; | 211 ListOfArrays* unitList; |
| 198 ListOfArrays* ctlDependenciesList; | 212 ListOfArrays* ctlDependenciesList; |
| 199 ListOfArrays* commDependenciesList; | 213 ListOfArrays* commDependenciesList; |
| 205 #endif | 219 #endif |
| 206 | 220 |
| 207 #ifdef HOLISTIC__TURN_ON_PERF_COUNTERS | 221 #ifdef HOLISTIC__TURN_ON_PERF_COUNTERS |
| 208 ListOfArrays* counterList[NUM_CORES]; | 222 ListOfArrays* counterList[NUM_CORES]; |
| 209 #endif | 223 #endif |
| 210 SlaveVP* idleSlv[NUM_CORES][NUM_ANIM_SLOTS]; | |
| 211 int shutdownInitiated; | |
| 212 } | 224 } |
| 213 VSsSemEnv; | 225 VSsSemEnv; |
| 214 | 226 |
| 215 | 227 |
| 216 typedef struct _TransListElem TransListElem; | 228 typedef struct _TransListElem TransListElem; |
| 219 int32 transID; | 231 int32 transID; |
| 220 TransListElem *nextTrans; | 232 TransListElem *nextTrans; |
| 221 }; | 233 }; |
| 222 //TransListElem | 234 //TransListElem |
| 223 | 235 |
| 236 /* PR now handles what this used to be used for | |
| 224 enum VSsSlvType | 237 enum VSsSlvType |
| 225 { ExtraTaskSlv = 1, | 238 { FreeTaskSlv = 1, |
| 226 SlotTaskSlv, | 239 SlotTaskSlv, |
| 227 ThreadSlv | 240 ThreadSlv |
| 228 }; | 241 }; |
| 242 */ | |
| 229 | 243 |
| 230 typedef struct | 244 typedef struct |
| 231 { | 245 { |
| 232 int32 highestTransEntered; | 246 int32 highestTransEntered; |
| 233 TransListElem *lastTransEntered; | 247 TransListElem *lastTransEntered; |
| 234 bool32 needsTaskAssigned; | 248 int32 primitiveStartTime; |
| 235 VSsTaskStub *taskStub; | 249 // VSsTaskStub *taskStub; //get from slave via PR accessor |
| 236 enum VSsSlvType slaveType; | |
| 237 } | 250 } |
| 238 VSsSemData; | 251 VSsSemData; |
| 239 | 252 |
| 240 //=========================================================================== | 253 //=========================================================================== |
| 241 | 254 |
| 244 | 257 |
| 245 int32 | 258 int32 |
| 246 VSs__giveMinWorkUnitCycles( float32 percentOverhead ); | 259 VSs__giveMinWorkUnitCycles( float32 percentOverhead ); |
| 247 | 260 |
| 248 void | 261 void |
| 249 VSs__start_primitive(); | 262 VSs__begin_primitive(); |
| 250 | 263 |
| 251 int32 | 264 int32 |
| 252 VSs__end_primitive_and_give_cycles(); | 265 VSs__end_primitive_and_give_cycles(); |
| 253 | 266 |
| 254 int32 | 267 int32 |
| 258 VSs__give_number_of_cores_to_schedule_onto(); | 271 VSs__give_number_of_cores_to_schedule_onto(); |
| 259 | 272 |
| 260 //======================= | 273 //======================= |
| 261 | 274 |
| 262 void | 275 void |
| 263 VSs__init(); | 276 VSs__start( SlaveVP *seedSlv ); |
| 264 | 277 |
| 265 void | 278 void |
| 266 VSs__cleanup_after_shutdown(); | 279 VSs__cleanup_after_shutdown(); |
| 267 | 280 |
| 268 //======================= | 281 //======================= |
| 274 void | 287 void |
| 275 VSs__end_thread( SlaveVP *thdToEnd ); | 288 VSs__end_thread( SlaveVP *thdToEnd ); |
| 276 | 289 |
| 277 //======================= | 290 //======================= |
| 278 | 291 |
| 279 #define VSs__malloc( numBytes, callingSlave ) VMS_App__malloc( numBytes, callingSlave) | 292 #define VSs__malloc( numBytes, callingSlave ) PR_App__malloc( numBytes, callingSlave) |
| 280 | 293 |
| 281 #define VSs__free(ptrToFree, callingSlave ) VMS_App__free( ptrToFree, callingSlave ) | 294 #define VSs__free(ptrToFree, callingSlave ) PR_App__free( ptrToFree, callingSlave ) |
| 282 | 295 |
| 283 | 296 |
| 284 //======================= | 297 //======================= |
| 285 void | 298 void |
| 286 VSs__submit_task( VSsTaskType *taskType, void *args, SlaveVP *animSlv); | 299 VSs__submit_task( VSsTaskType *taskType, void *args, SlaveVP *animSlv); |
| 349 | 362 |
| 350 SlaveVP* | 363 SlaveVP* |
| 351 VSs__create_slave_helper( TopLevelFnPtr fnPtr, void *initData, | 364 VSs__create_slave_helper( TopLevelFnPtr fnPtr, void *initData, |
| 352 VSsSemEnv *semEnv, int32 coreToAssignOnto ); | 365 VSsSemEnv *semEnv, int32 coreToAssignOnto ); |
| 353 | 366 |
| 354 VSsTaskStub * | 367 PRMetaTask * |
| 355 create_thread_task_stub( void *initData ); | 368 PR_int__create_generic_slave_meta_task( void *initData ); |
| 356 | 369 |
| 357 | 370 |
| 358 SlaveVP * | 371 SlaveVP * |
| 359 VSs__create_slave_with( TopLevelFnPtr fnPtr, void *initData, | 372 VSs__create_slave_with( TopLevelFnPtr fnPtr, void *initData, |
| 360 SlaveVP *creatingSlv ); | 373 SlaveVP *creatingSlv ); |
| 361 | 374 |
| 362 SlaveVP * | 375 SlaveVP * |
| 363 VSs__create_slave_with_affinity( TopLevelFnPtr fnPtr, void *initData, | 376 VSs__create_slave_with_affinity( TopLevelFnPtr fnPtr, void *initData, |
| 364 SlaveVP *creatingSlv, int32 coreToAssignOnto); | 377 SlaveVP *creatingSlv, int32 coreToAssignOnto); |
| 365 | 378 |
| 366 void | |
| 367 idle_fn(void* data, SlaveVP *animatingSlv); | |
| 368 | |
| 369 //===================== Measurement of Lang Overheads ===================== | 379 //===================== Measurement of Lang Overheads ===================== |
| 370 #include "Measurement/VSs_Measurement.h" | 380 #include "Measurement/VSs_Measurement.h" |
| 371 | 381 |
| 372 //=========================================================================== | 382 //=========================================================================== |
| 373 #endif /* _VSs_H */ | 383 #endif /* _VSs_H */ |
