Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > SSR_impls > SSR__MC_shared_impl
view SSR.h @ 72:d20b105981b7
make idle VPs optional
| author | Nina Engelhardt <nengel@mailbox.tu-berlin.de> |
|---|---|
| date | Wed, 28 Mar 2012 18:02:38 +0200 |
| parents | 8882e795016d |
| children | f20b4d9d3086 |
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 //#define IDLE_SLAVES
23 //This is hardware dependent -- it's the number of cycles of scheduling
24 // overhead -- if a work unit is fewer than this, it is better being
25 // combined sequentially with other work
26 //This value depends on both VMS overhead and SSR's plugin. At some point
27 // it will be derived by perf-counter measurements during init of SSR
28 #define MIN_WORK_UNIT_CYCLES 20000
30 //===========================================================================
31 /*This header defines everything specific to the SSR semantic plug-in
32 */
33 typedef struct _SSRSemReq SSRSemReq;
34 typedef void (*PtrToAtomicFn ) ( void * ); //executed atomically in master
35 //===========================================================================
37 /*Semantic layer-specific data sent inside a request from lib called in app
38 * to request handler called in AnimationMaster
39 */
41 typedef struct
42 {
43 SlaveVP *VPCurrentlyExecuting;
44 PrivQueueStruc *waitingVPQ;
45 }
46 SSRTrans;
48 /*WARNING: assembly hard-codes position of endInstrAddr as first field
49 */
50 typedef struct
51 {
52 void *endInstrAddr;
53 int32 hasBeenStarted;
54 int32 hasFinished;
55 PrivQueueStruc *waitQ;
56 }
57 SSRSingleton;
59 enum SSRReqType
60 {
61 send_type = 1,
62 send_from_to,
63 receive_any, //order and grouping matter -- send before receive
64 receive_type, // and receive_any first of the receives -- Handlers
65 receive_from_to,// rely upon this ordering of enum
66 transfer_to,
67 transfer_out,
68 malloc_req,
69 free_req,
70 singleton_fn_start,
71 singleton_fn_end,
72 singleton_data_start,
73 singleton_data_end,
74 atomic,
75 trans_start,
76 trans_end
77 };
79 struct _SSRSemReq
80 { enum SSRReqType reqType;
81 SlaveVP *sendPr;
82 SlaveVP *receivePr;
83 int32 msgType;
84 void *msg;
85 SSRSemReq *nextReqInHashEntry;
87 void *initData;
88 TopLevelFnPtr fnPtr;
89 int32 coreToAssignOnto;
91 int32 sizeToMalloc;
92 void *ptrToFree;
94 int32 singletonID;
95 SSRSingleton **singletonPtrAddr;
97 PtrToAtomicFn fnToExecInMaster;
98 void *dataForFn;
100 int32 transID;
101 }
102 /* SSRSemReq */;
105 typedef struct
106 {
107 PrivQueueStruc **readyVPQs;
108 HashTable *commHashTbl;
109 int32 numSlaveVP;
110 int32 nextCoreToGetNewPr;
111 int32 primitiveStartTime;
113 //fix limit on num with dynArray
114 SSRSingleton fnSingletons[NUM_STRUCS_IN_SEM_ENV];
115 SSRTrans transactionStrucs[NUM_STRUCS_IN_SEM_ENV];
117 #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC
118 ListOfArrays* unitList;
119 ListOfArrays* ctlDependenciesList;
120 ListOfArrays* commDependenciesList;
121 NtoN** ntonGroups;
122 PrivDynArrayInfo* ntonGroupsInfo;
123 ListOfArrays* dynDependenciesList;
124 Unit last_in_slot[NUM_CORES * NUM_ANIM_SLOTS];
125 ListOfArrays* hwArcs;
126 #endif
128 #ifdef HOLISTIC__TURN_ON_PERF_COUNTERS
129 ListOfArrays* counterList[NUM_CORES];
130 #endif
131 #ifdef IDLE_SLAVES
132 SlaveVP* idlePr[NUM_CORES][NUM_ANIM_SLOTS];
133 int shutdownInitiated;
134 #endif
135 }
136 SSRSemEnv;
139 typedef struct _TransListElem TransListElem;
140 struct _TransListElem
141 {
142 int32 transID;
143 TransListElem *nextTrans;
144 };
145 //TransListElem
147 typedef struct
148 {
149 int32 highestTransEntered;
150 TransListElem *lastTransEntered;
151 }
152 SSRSemData;
154 //===========================================================================
156 void
157 SSR__create_seed_procr_and_do_work( TopLevelFnPtr fn, void *initData );
159 int32
160 SSR__giveMinWorkUnitCycles( float32 percentOverhead );
162 void
163 SSR__start_primitive();
165 int32
166 SSR__end_primitive_and_give_cycles();
168 int32
169 SSR__giveIdealNumWorkUnits();
171 int32
172 SSR__give_number_of_cores_to_schedule_onto();
174 //=======================
176 void
177 SSR__init();
179 void
180 SSR__cleanup_after_shutdown();
182 //=======================
184 SlaveVP *
185 SSR__create_procr_with( TopLevelFnPtr fnPtr, void *initData,
186 SlaveVP *creatingSlv );
188 SlaveVP *
189 SSR__create_procr_with_affinity( TopLevelFnPtr fnPtr, void *initData,
190 SlaveVP *creatingPr, int32 coreToAssignOnto);
192 void
193 SSR__dissipate_procr( SlaveVP *procrToDissipate );
195 //=======================
196 void *
197 SSR__malloc_to( int numBytes, SlaveVP *ownerSlv );
199 void
200 SSR__free( void *ptrToFree, SlaveVP *owningSlv );
202 void
203 SSR__transfer_ownership_of_from_to( void *data, SlaveVP *oldOwnerPr,
204 SlaveVP *newOwnerSlv );
206 void
207 SSR__add_ownership_by_to( SlaveVP *newOwnerPr, void *data );
209 void
210 SSR__remove_ownership_by_from( SlaveVP *loserPr, void *dataLosing );
212 void
213 SSR__transfer_ownership_to_outside( void *dataToTransferOwnershipOf );
217 //=======================
218 void
219 SSR__send_of_type_to( SlaveVP *sendPr, void *msg, const int type,
220 SlaveVP *receivePr);
222 void
223 SSR__send_from_to( void *msg, SlaveVP *sendPr, SlaveVP *receivePr);
225 void *
226 SSR__receive_type_to( const int type, SlaveVP *receiveSlv );
228 void *
229 SSR__receive_from_to( SlaveVP *sendPr, SlaveVP *receiveSlv );
232 //======================= Concurrency Stuff ======================
233 void
234 SSR__start_fn_singleton( int32 singletonID, SlaveVP *animSlv );
236 void
237 SSR__end_fn_singleton( int32 singletonID, SlaveVP *animSlv );
239 void
240 SSR__start_data_singleton( SSRSingleton **singeltonAddr, SlaveVP *animSlv );
242 void
243 SSR__end_data_singleton( SSRSingleton **singletonAddr, SlaveVP *animSlv );
245 void
246 SSR__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
247 void *data, SlaveVP *animSlv );
249 void
250 SSR__start_transaction( int32 transactionID, SlaveVP *animSlv );
252 void
253 SSR__end_transaction( int32 transactionID, SlaveVP *animSlv );
256 //========================= Internal use only =============================
257 void
258 SSR__Request_Handler( SlaveVP *requestingPr, void *_semEnv );
260 SlaveVP *
261 SSR__assign_slaveVP_to_slot( void *_semEnv, AnimSlot *slot );
263 SlaveVP*
264 SSR__create_procr_helper( TopLevelFnPtr fnPtr, void *initData,
265 SSRSemEnv *semEnv, int32 coreToAssignOnto );
267 //===================== Measurement of Lang Overheads =====================
268 #include "SSR_Measurement.h"
270 //===========================================================================
271 #endif /* _SSR_H */
