comparison VSs.h @ 3:468b8638ff92

Works -- first working version, includes slave pruning and shutdown detection
author Sean Halle <seanhalle@yahoo.com>
date Wed, 06 Jun 2012 17:55:36 -0700
parents f2ed1c379fe7
children 13af59ed7ea5
comparison
equal deleted inserted replaced
2:1d89844b03b2 3:a2f449a56e91
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 "VMS_impl/VMS.h"
15 #include "dependency.h" 15 #include "Measurement/dependency.h"
16 16
17 17
18 //=========================================================================== 18 //===========================================================================
19 #define NUM_STRUCS_IN_SEM_ENV 1000 19 #define NUM_STRUCS_IN_SEM_ENV 1000
20 20
27 27
28 //=========================================================================== 28 //===========================================================================
29 /*This header defines everything specific to the VSs semantic plug-in 29 /*This header defines everything specific to the VSs semantic plug-in
30 */ 30 */
31 typedef struct _VSsSemReq VSsSemReq; 31 typedef struct _VSsSemReq VSsSemReq;
32 typedef void (*VSsTaskFnPtr ) ( void * ); //executed atomically in master 32 typedef void (*VSsTaskFnPtr ) ( void *, SlaveVP *);
33 typedef void (*PtrToAtomicFn ) ( void * ); //executed atomically in master 33 typedef void (*PtrToAtomicFn ) ( void * ); //executed atomically in master
34 //=========================================================================== 34 //===========================================================================
35 35
36 #define IN 1 36 #define IN 1
37 #define OUT 2 37 #define OUT 2
38 #define INOUT 3 38 #define INOUT 2
39 39
40 #define READER 1 40 #define READER 1
41 #define WRITER 2 41 #define WRITER 2
42 42
43 typedef struct 43 typedef struct
52 VSsTaskType; 52 VSsTaskType;
53 53
54 54
55 typedef struct 55 typedef struct
56 { 56 {
57 bool32 hasEnabledNonFinishedWriter;
58 int32 numEnabledNonDoneReaders;
59 PrivQueueStruc *waitersQ;
60 }
61 VSsPointerEntry;
62
63 typedef struct
64 {
57 void **args; //ctld args must come first, as ptrs 65 void **args; //ctld args must come first, as ptrs
58 VSsTaskType *taskType; 66 VSsTaskType *taskType;
59 int32 numBlockingProp; 67 int32 numBlockingProp;
60 SlaveVP *slaveAssignedTo; 68 SlaveVP *slaveAssignedTo;
69 VSsPointerEntry **ptrEntries;
61 } 70 }
62 VSsTaskStub; 71 VSsTaskStub;
63 72
64 typedef struct 73 typedef struct
65 { 74 {
66 VSsTaskStub *taskStub; 75 VSsTaskStub *taskStub;
67 int32 argNum; 76 int32 argNum;
68 int32 isReader; 77 int32 isReader;
69 } 78 }
70 VSsTaskStubCarrier; 79 VSsTaskStubCarrier;
71
72 typedef struct
73 {
74 bool32 hasEnabledNonFinishedWriter;
75 int32 numEnabledNonDoneReaders;
76 PrivQStruct *waitersQ;
77 }
78 VSsPointerEntry;
79 80
80 81
81 typedef struct 82 typedef struct
82 { 83 {
83 int32 type; 84 int32 type;
155 { 156 {
156 PrivQueueStruc **readyVPQs; 157 PrivQueueStruc **readyVPQs;
157 PrivQueueStruc *taskReadyQ; //Q: shared or local? 158 PrivQueueStruc *taskReadyQ; //Q: shared or local?
158 HashTable *argPtrHashTbl; 159 HashTable *argPtrHashTbl;
159 int32 numSlaveVP; 160 int32 numSlaveVP;
160 int32 nextCoreToGetNewPr; 161 int32 nextCoreToGetNewSlv;
161 int32 primitiveStartTime; 162 int32 primitiveStartTime;
162 163
163 //fix limit on num with dynArray 164 //fix limit on num with dynArray
164 VSsSingleton fnSingletons[NUM_STRUCS_IN_SEM_ENV]; 165 VSsSingleton fnSingletons[NUM_STRUCS_IN_SEM_ENV];
165 VSsTrans transactionStrucs[NUM_STRUCS_IN_SEM_ENV]; 166 VSsTrans transactionStrucs[NUM_STRUCS_IN_SEM_ENV];
167
168 bool32 *coreIsDone;
169 int32 numCoresDone;
166 170
167 #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC 171 #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC
168 ListOfArrays* unitList; 172 ListOfArrays* unitList;
169 ListOfArrays* ctlDependenciesList; 173 ListOfArrays* ctlDependenciesList;
170 ListOfArrays* commDependenciesList; 174 ListOfArrays* commDependenciesList;
176 #endif 180 #endif
177 181
178 #ifdef HOLISTIC__TURN_ON_PERF_COUNTERS 182 #ifdef HOLISTIC__TURN_ON_PERF_COUNTERS
179 ListOfArrays* counterList[NUM_CORES]; 183 ListOfArrays* counterList[NUM_CORES];
180 #endif 184 #endif
181 SlaveVP* idlePr[NUM_CORES][NUM_ANIM_SLOTS]; 185 SlaveVP* idleSlv[NUM_CORES][NUM_ANIM_SLOTS];
182 int shutdownInitiated; 186 int shutdownInitiated;
183 } 187 }
184 VSsSemEnv; 188 VSsSemEnv;
185 189
186 190
235 VSs__create_slave_with( TopLevelFnPtr fnPtr, void *initData, 239 VSs__create_slave_with( TopLevelFnPtr fnPtr, void *initData,
236 SlaveVP *creatingSlv ); 240 SlaveVP *creatingSlv );
237 241
238 SlaveVP * 242 SlaveVP *
239 VSs__create_slave_with_affinity( TopLevelFnPtr fnPtr, void *initData, 243 VSs__create_slave_with_affinity( TopLevelFnPtr fnPtr, void *initData,
240 SlaveVP *creatingPr, int32 coreToAssignOnto); 244 SlaveVP *creatingSlv, int32 coreToAssignOnto);
241 245
242 void 246 void
243 VSs__dissipate_slave( SlaveVP *slaveToDissipate ); 247 VSs__dissipate_slave( SlaveVP *slaveToDissipate );
244 248
245 //======================= 249 //=======================
249 #define VSs__free(ptrToFree, callingSlave ) VMS_App__free( ptrToFree, callingSlave ) 253 #define VSs__free(ptrToFree, callingSlave ) VMS_App__free( ptrToFree, callingSlave )
250 254
251 255
252 //======================= 256 //=======================
253 int32 257 int32
254 VSs__submit_task( VSsTaskType *taskType, void **args, SlaveVP *animSlv); 258 VSs__submit_task( VSsTaskType *taskType, void *args, SlaveVP *animSlv);
255 259
256 260
257 void 261 void
258 VSs__end_task( SlaveVP *animSlv ); 262 VSs__end_task( SlaveVP *animSlv );
259 263
282 VSs__end_transaction( int32 transactionID, SlaveVP *animSlv ); 286 VSs__end_transaction( int32 transactionID, SlaveVP *animSlv );
283 287
284 288
285 //========================= Internal use only ============================= 289 //========================= Internal use only =============================
286 void 290 void
287 VSs__Request_Handler( SlaveVP *requestingPr, void *_semEnv ); 291 VSs__Request_Handler( SlaveVP *requestingSlv, void *_semEnv );
288 292
289 SlaveVP * 293 SlaveVP *
290 VSs__assign_slaveVP_to_slot( void *_semEnv, AnimSlot *slot ); 294 VSs__assign_slaveVP_to_slot( void *_semEnv, AnimSlot *slot );
291 295
292 SlaveVP* 296 SlaveVP*
293 VSs__create_slave_helper( TopLevelFnPtr fnPtr, void *initData, 297 VSs__create_slave_helper( TopLevelFnPtr fnPtr, void *initData,
294 VSsSemEnv *semEnv, int32 coreToAssignOnto ); 298 VSsSemEnv *semEnv, int32 coreToAssignOnto );
295 299
296 //===================== Measurement of Lang Overheads ===================== 300 //===================== Measurement of Lang Overheads =====================
297 #include "VSs_Measurement.h" 301 #include "Measurement/VSs_Measurement.h"
298 302
299 //=========================================================================== 303 //===========================================================================
300 #endif /* _VSs_H */ 304 #endif /* _VSs_H */
301 305