Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > SSR_impls > SSR__MC_shared_impl
view SSR.h @ 78:0d04c3e608cc
Creating a new branch for development of the DKU Pattern
| author | Sean Halle <seanhalle@yahoo.com> |
|---|---|
| date | Sun, 26 Aug 2012 02:49:34 -0700 |
| parents | 8882e795016d |
| children | ee8510009267 |
line source
1 /*
2 * Copyright 2009 OpenSourceStewardshipFoundation.org
3 * Licensed under GNU General Public License version 2
4 *
5 * Author: seanhalle@yahoo.com
6 *
7 */
9 #ifndef _SSR_H
10 #define _SSR_H
12 #include "Queue_impl/PrivateQueue.h"
13 #include "Hash_impl/PrivateHash.h"
14 #include "VMS_impl/VMS.h"
15 #include "dependency.h"
18 //===========================================================================
19 #define NUM_STRUCS_IN_SEM_ENV 1000
21 //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
23 // combined sequentially with other work
24 //This value depends on both VMS overhead and SSR's plugin. At some point
25 // it will be derived by perf-counter measurements during init of SSR
26 #define MIN_WORK_UNIT_CYCLES 20000
28 //===========================================================================
29 /*This header defines everything specific to the SSR semantic plug-in
30 */
31 typedef struct _SSRSemReq SSRSemReq;
32 typedef void (*PtrToAtomicFn ) ( void * ); //executed atomically in master
33 //===========================================================================
35 /*Semantic layer-specific data sent inside a request from lib called in app
36 * to request handler called in AnimationMaster
37 */
39 typedef struct
40 {
41 SlaveVP *VPCurrentlyExecuting;
42 PrivQueueStruc *waitingVPQ;
43 }
44 SSRTrans;
46 /*WARNING: assembly hard-codes position of endInstrAddr as first field
47 */
48 typedef struct
49 {
50 void *endInstrAddr;
51 int32 hasBeenStarted;
52 int32 hasFinished;
53 PrivQueueStruc *waitQ;
54 }
55 SSRSingleton;
57 enum SSRReqType
58 {
59 send_type = 1,
60 send_from_to,
61 receive_any, //order and grouping matter -- send before receive
62 receive_type, // and receive_any first of the receives -- Handlers
63 receive_from_to,// rely upon this ordering of enum
64 transfer_to,
65 transfer_out,
66 malloc_req,
67 free_req,
68 singleton_fn_start,
69 singleton_fn_end,
70 singleton_data_start,
71 singleton_data_end,
72 atomic,
73 trans_start,
74 trans_end
75 };
77 struct _SSRSemReq
78 { enum SSRReqType reqType;
79 SlaveVP *sendPr;
80 SlaveVP *receivePr;
81 int32 msgType;
82 void *msg;
83 SSRSemReq *nextReqInHashEntry;
85 void *initData;
86 TopLevelFnPtr fnPtr;
87 int32 coreToAssignOnto;
89 int32 sizeToMalloc;
90 void *ptrToFree;
92 int32 singletonID;
93 SSRSingleton **singletonPtrAddr;
95 PtrToAtomicFn fnToExecInMaster;
96 void *dataForFn;
98 int32 transID;
99 }
100 /* SSRSemReq */;
103 typedef struct
104 {
105 PrivQueueStruc **readyVPQs;
106 HashTable *commHashTbl;
107 int32 numSlaveVP;
108 int32 nextCoreToGetNewPr;
109 int32 primitiveStartTime;
111 //fix limit on num with dynArray
112 SSRSingleton fnSingletons[NUM_STRUCS_IN_SEM_ENV];
113 SSRTrans transactionStrucs[NUM_STRUCS_IN_SEM_ENV];
115 #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC
116 ListOfArrays* unitList;
117 ListOfArrays* ctlDependenciesList;
118 ListOfArrays* commDependenciesList;
119 NtoN** ntonGroups;
120 PrivDynArrayInfo* ntonGroupsInfo;
121 ListOfArrays* dynDependenciesList;
122 Unit last_in_slot[NUM_CORES * NUM_ANIM_SLOTS];
123 ListOfArrays* hwArcs;
124 #endif
126 #ifdef HOLISTIC__TURN_ON_PERF_COUNTERS
127 ListOfArrays* counterList[NUM_CORES];
128 #endif
129 SlaveVP* idlePr[NUM_CORES][NUM_ANIM_SLOTS];
130 int shutdownInitiated;
131 }
132 SSRSemEnv;
135 typedef struct _DKUPiece DKUPiece;
137 typedef DKUPiece * (*DKUDividerFn ) ( DKUPiece * );
139 struct _DKUPiece
140 {
141 void *workData;
142 DKUPiece **subPieces;
143 void *infoForUndiv; //app creates own struct and casts
144 };
145 //DKUPiece
147 typedef struct _TransListElem TransListElem;
148 struct _TransListElem
149 {
150 int32 transID;
151 TransListElem *nextTrans;
152 };
153 //TransListElem
155 typedef struct
156 {
157 int32 highestTransEntered;
158 TransListElem *lastTransEntered;
159 }
160 SSRSemData;
162 //===========================================================================
164 void
165 SSR__create_seed_procr_and_do_work( TopLevelFnPtr fn, void *initData );
167 int32
168 SSR__giveMinWorkUnitCycles( float32 percentOverhead );
170 void
171 SSR__start_primitive();
173 int32
174 SSR__end_primitive_and_give_cycles();
176 int32
177 SSR__giveIdealNumWorkUnits();
179 int32
180 SSR__give_number_of_cores_to_schedule_onto();
182 //=======================
184 void
185 SSR__init();
187 void
188 SSR__cleanup_after_shutdown();
190 //=======================
192 SlaveVP *
193 SSR__create_procr_with( TopLevelFnPtr fnPtr, void *initData,
194 SlaveVP *creatingSlv );
196 SlaveVP *
197 SSR__create_procr_with_affinity( TopLevelFnPtr fnPtr, void *initData,
198 SlaveVP *creatingPr, int32 coreToAssignOnto);
200 void
201 SSR__dissipate_procr( SlaveVP *procrToDissipate );
203 //=======================
204 void *
205 SSR__malloc_to( int numBytes, SlaveVP *ownerSlv );
207 void
208 SSR__free( void *ptrToFree, SlaveVP *owningSlv );
210 void
211 SSR__transfer_ownership_of_from_to( void *data, SlaveVP *oldOwnerPr,
212 SlaveVP *newOwnerSlv );
214 void
215 SSR__add_ownership_by_to( SlaveVP *newOwnerPr, void *data );
217 void
218 SSR__remove_ownership_by_from( SlaveVP *loserPr, void *dataLosing );
220 void
221 SSR__transfer_ownership_to_outside( void *dataToTransferOwnershipOf );
225 //=======================
226 void
227 SSR__send_of_type_to( SlaveVP *sendPr, void *msg, const int type,
228 SlaveVP *receivePr);
230 void
231 SSR__send_from_to( void *msg, SlaveVP *sendPr, SlaveVP *receivePr);
233 void *
234 SSR__receive_type_to( const int type, SlaveVP *receiveSlv );
236 void *
237 SSR__receive_from_to( SlaveVP *sendPr, SlaveVP *receiveSlv );
241 //=========================== DKU ==============================
242 void
243 VMS_App__register_DKU_divider( DKUID ID, DKUDividerFn dividerFn,
244 SlaveVP *animSlv );
245 void
246 VMS_App__register_DKU_kernel( DKUID ID, DKUKernelFn kernelFn,
247 SlaveVP *animSlv );
249 void
250 VMS_App__register_DKU_undivider( DKUID ID, DKUUndividerFn undividerFn,
251 SlaveVP *animSlv );
255 //======================= Concurrency Stuff ======================
256 void
257 SSR__start_fn_singleton( int32 singletonID, SlaveVP *animSlv );
259 void
260 SSR__end_fn_singleton( int32 singletonID, SlaveVP *animSlv );
262 void
263 SSR__start_data_singleton( SSRSingleton **singeltonAddr, SlaveVP *animSlv );
265 void
266 SSR__end_data_singleton( SSRSingleton **singletonAddr, SlaveVP *animSlv );
268 void
269 SSR__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
270 void *data, SlaveVP *animSlv );
272 void
273 SSR__start_transaction( int32 transactionID, SlaveVP *animSlv );
275 void
276 SSR__end_transaction( int32 transactionID, SlaveVP *animSlv );
279 //========================= Internal use only =============================
280 void
281 SSR__Request_Handler( SlaveVP *requestingPr, void *_semEnv );
283 SlaveVP *
284 SSR__assign_slaveVP_to_slot( void *_semEnv, AnimSlot *slot );
286 SlaveVP*
287 SSR__create_procr_helper( TopLevelFnPtr fnPtr, void *initData,
288 SSRSemEnv *semEnv, int32 coreToAssignOnto );
290 //===================== Measurement of Lang Overheads =====================
291 #include "SSR_Measurement.h"
293 //===========================================================================
294 #endif /* _SSR_H */
