comparison VSs.h @ 27:3b30da4643d1

Update2.. in middle of changes.. made request handler ptr be sent w/req struct
author Sean Halle <seanhalle@yahoo.com>
date Sat, 12 Jan 2013 11:31:51 -0800
parents a60399b62614
children 91caa8a9d591
comparison
equal deleted inserted replaced
22:677c841ff4fb 23:55e613de717a
1 /* 1 /*
2 * Copyright 2009 OpenSourceStewardshipFoundation.org 2 * Copyright 2009 OpenSourceResearchInstitute.org
3 * Licensed under GNU General Public License version 2 3 * Licensed under GNU General Public License version 2
4 * 4 *
5 * Author: seanhalle@yahoo.com 5 * Author: seanhalle@yahoo.com
6 * 6 *
7 */ 7 */
17 17
18 //=========================================================================== 18 //===========================================================================
19 //uniquely identifies VSs -- should be a jenkins char-hash of "VSs" to int32 19 //uniquely identifies VSs -- should be a jenkins char-hash of "VSs" to int32
20 #define VSs_MAGIC_NUMBER 0000000001 20 #define VSs_MAGIC_NUMBER 0000000001
21 21
22 #define NUM_STRUCS_IN_SEM_ENV 1000 22 #define NUM_STRUCS_IN_LANG_ENV 1000
23 23
24 //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
25 // 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
26 // combined sequentially with other work 26 // combined sequentially with other work
27 //This value depends on both PR overhead and VSs's plugin. At some point 27 //This value depends on both PR overhead and VSs's plugin. At some point
29 #define MIN_WORK_UNIT_CYCLES 20000 29 #define MIN_WORK_UNIT_CYCLES 20000
30 30
31 //=========================================================================== 31 //===========================================================================
32 /*This header defines everything specific to the VSs semantic plug-in 32 /*This header defines everything specific to the VSs semantic plug-in
33 */ 33 */
34 typedef struct _VSsSemReq VSsSemReq; 34 typedef struct _VSsLangReq VSsLangReq;
35 typedef struct _VSsTaskStub VSsTaskStub; 35 typedef struct _VSsTaskStub VSsTaskStub;
36 typedef void (*VSsTaskFnPtr ) ( void *, SlaveVP *); 36 typedef void (*VSsTaskFnPtr ) ( void *, SlaveVP *);
37 typedef void (*PtrToAtomicFn ) ( void * ); //executed atomically in master 37 typedef void (*PtrToAtomicFn ) ( void * ); //executed atomically in master
38 //=========================================================================== 38 //===========================================================================
39 39
71 int32 numEnabledNonDoneReaders; 71 int32 numEnabledNonDoneReaders;
72 PrivQueueStruc *waitersQ; 72 PrivQueueStruc *waitersQ;
73 } 73 }
74 VSsPointerEntry; 74 VSsPointerEntry;
75 75
76 /*This is placed into semData, used for dependencies and wait construct*/ 76 /*This is placed into langData, used for dependencies and wait construct*/
77 struct _VSsTaskStub 77 struct _VSsTaskStub
78 { 78 {
79 //====== The first fields must match PRLangMetaTask fields ======
79 int32 langMagicNumber; //magic num must be 1st field of langMetaTask 80 int32 langMagicNumber; //magic num must be 1st field of langMetaTask
80 PRMetaTask *protoMetaTask; //back-link must always be 2nd field 81 PRMetaTask *protoMetaTask; //back-link must always be 2nd field
82 //====== end PRLangMetaTask fields =========
81 void **args; //ctld args must be the first ones (as ptrs) 83 void **args; //ctld args must be the first ones (as ptrs)
82 VSsPointerEntry **ptrEntries; 84 VSsPointerEntry **ptrEntries;
83 int32 numBlockingProp; 85 int32 numBlockingProp;
84 86
85 VSsTaskType *taskType; //has VSs lang related info 87 VSsTaskType *taskType; //has VSs lang related info
147 atomic, 149 atomic,
148 trans_start, 150 trans_start,
149 trans_end 151 trans_end
150 }; 152 };
151 153
152 struct _VSsSemReq 154 struct _VSsLangReq
153 { enum VSsReqType reqType; 155 { enum VSsReqType reqType;
154 SlaveVP *callingSlv; 156 SlaveVP *callingSlv;
155 VSsTaskType *taskType; 157 VSsTaskType *taskType;
156 void *args; 158 void *args;
157 // VSsTaskStub *taskStub; //not needed -- get via PR accessor from slv 159 // VSsTaskStub *taskStub; //not needed -- get via PR accessor from slv
160 SlaveVP *receiverSlv; 162 SlaveVP *receiverSlv;
161 int32 *senderID; 163 int32 *senderID;
162 int32 *receiverID; 164 int32 *receiverID;
163 int32 msgType; 165 int32 msgType;
164 void *msg; 166 void *msg;
165 VSsSemReq *nextReqInHashEntry; 167 VSsLangReq *nextReqInHashEntry;
166 //In PRReq: int32 *taskID; 168 //In PRReq: int32 *taskID;
167 169
168 TopLevelFnPtr fnPtr; 170 TopLevelFnPtr fnPtr;
169 void *initData; 171 void *initData;
170 int32 coreToAssignOnto; 172 int32 coreToAssignOnto;
179 PtrToAtomicFn fnToExecInMaster; 181 PtrToAtomicFn fnToExecInMaster;
180 void *dataForFn; 182 void *dataForFn;
181 183
182 int32 transID; 184 int32 transID;
183 } 185 }
184 /* VSsSemReq */; 186 /* VSsLangReq */;
185 187
186 188
187 typedef struct 189 typedef struct
188 { PRSemEnv *protoSemEnv; 190 {
189 PrivQueueStruc *slavesReadyToResumeQ; //Shared (slaves not pinned) 191 PrivQueueStruc *slavesReadyToResumeQ; //Shared (slaves not pinned)
190 PrivQueueStruc *freeTaskSlvRecycleQ; //Shared
191 PrivQueueStruc *taskReadyQ; //Shared (tasks not pinned) 192 PrivQueueStruc *taskReadyQ; //Shared (tasks not pinned)
192 // SlaveVP *slotTaskSlvs[NUM_CORES][NUM_ANIM_SLOTS]; 193
193 HashTable *argPtrHashTbl; 194 HashTable *argPtrHashTbl;
194 HashTable *commHashTbl; 195 HashTable *commHashTbl;
195 // int32 numLiveFreeTaskSlvs;
196 // int32 numLiveThreadSlvs;
197 int32 nextCoreToGetNewSlv; 196 int32 nextCoreToGetNewSlv;
198 int32 primitiveStartTime; 197 int32 primitiveStartTime;
199 198
200 //fix limit on num with dynArray 199 //fix limit on num with dynArray
201 VSsSingleton fnSingletons[NUM_STRUCS_IN_SEM_ENV]; 200 VSsSingleton fnSingletons[NUM_STRUCS_IN_LANG_ENV];
202 VSsTrans transactionStrucs[NUM_STRUCS_IN_SEM_ENV]; 201 VSsTrans transactionStrucs[NUM_STRUCS_IN_LANG_ENV];
203
204 // bool32 *coreIsDone;
205 // int32 numCoresDone;
206
207 // SlaveVP* idleSlv[NUM_CORES][NUM_ANIM_SLOTS];
208 // int shutdownInitiated;
209 202
210 #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC 203 #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC
211 ListOfArrays* unitList; 204 ListOfArrays* unitList;
212 ListOfArrays* ctlDependenciesList; 205 ListOfArrays* ctlDependenciesList;
213 ListOfArrays* commDependenciesList; 206 ListOfArrays* commDependenciesList;
220 213
221 #ifdef HOLISTIC__TURN_ON_PERF_COUNTERS 214 #ifdef HOLISTIC__TURN_ON_PERF_COUNTERS
222 ListOfArrays* counterList[NUM_CORES]; 215 ListOfArrays* counterList[NUM_CORES];
223 #endif 216 #endif
224 } 217 }
225 VSsSemEnv; 218 VSsLangEnv;
226 219
227 220
228 typedef struct _TransListElem TransListElem; 221 typedef struct _TransListElem TransListElem;
229 struct _TransListElem 222 struct _TransListElem
230 { 223 {
246 int32 highestTransEntered; 239 int32 highestTransEntered;
247 TransListElem *lastTransEntered; 240 TransListElem *lastTransEntered;
248 int32 primitiveStartTime; 241 int32 primitiveStartTime;
249 // VSsTaskStub *taskStub; //get from slave via PR accessor 242 // VSsTaskStub *taskStub; //get from slave via PR accessor
250 } 243 }
251 VSsSemData; 244 VSsLangData;
252 245
253 //=========================================================================== 246 //===========================================================================
254 247
255 void 248 void
256 VSs__create_seed_slave_and_do_work( TopLevelFnPtr fn, void *initData ); 249 VSs__create_seed_slave_and_do_work( TopLevelFnPtr fn, void *initData );
353 VSs__end_transaction( int32 transactionID, SlaveVP *animSlv ); 346 VSs__end_transaction( int32 transactionID, SlaveVP *animSlv );
354 347
355 348
356 //========================= Internal use only ============================= 349 //========================= Internal use only =============================
357 void 350 void
358 VSs__Request_Handler( SlaveVP *requestingSlv, void *_semEnv ); 351 VSs__Request_Handler( SlaveVP *requestingSlv, void *_langEnv );
359 352
360 SlaveVP * 353 SlaveVP *
361 VSs__assign_slaveVP_to_slot( void *_semEnv, AnimSlot *slot ); 354 VSs__assign_work_to_slot( void *_langEnv, AnimSlot *slot );
362 355
363 SlaveVP* 356 SlaveVP*
364 VSs__create_slave_helper( TopLevelFnPtr fnPtr, void *initData, 357 VSs__create_slave_helper( TopLevelFnPtr fnPtr, void *initData,
365 VSsSemEnv *semEnv, int32 coreToAssignOnto ); 358 VSsLangEnv *langEnv, int32 coreToAssignOnto );
366
367 PRMetaTask *
368 PR_int__create_generic_slave_meta_task( void *initData );
369
370 359
371 SlaveVP * 360 SlaveVP *
372 VSs__create_slave_with( TopLevelFnPtr fnPtr, void *initData, 361 VSs__create_slave_with( TopLevelFnPtr fnPtr, void *initData,
373 SlaveVP *creatingSlv ); 362 SlaveVP *creatingSlv );
374 363
375 SlaveVP * 364 SlaveVP *
376 VSs__create_slave_with_affinity( TopLevelFnPtr fnPtr, void *initData, 365 VSs__create_slave_with_affinity( TopLevelFnPtr fnPtr, void *initData,
377 SlaveVP *creatingSlv, int32 coreToAssignOnto); 366 SlaveVP *creatingSlv, int32 coreToAssignOnto);
378 367
368 //===================== =====================
369 inline
370 void *
371 handleSubmitTask( VSsLangReq *langReq, VSsLangEnv *langEnv );
372 inline
373 void
374 handleEndTask( VSsLangReq *langReq, SlaveVP *requestingSlv, VSsLangEnv *langEnv );
375
376
379 //===================== Measurement of Lang Overheads ===================== 377 //===================== Measurement of Lang Overheads =====================
380 #include "Measurement/VSs_Measurement.h" 378 #include "Measurement/VSs_Measurement.h"
381 379
382 //=========================================================================== 380 //===========================================================================
383 #endif /* _VSs_H */ 381 #endif /* _VSs_H */