comparison VOMP.h @ 1:21cf36019f0d

Partially converted SSR to VOMP -- start of changes
author Some Random Person <seanhalle@yahoo.com>
date Thu, 24 May 2012 08:57:24 -0700
parents b311282ec174
children
comparison
equal deleted inserted replaced
0:8164594dbff5 1:db3a655b351a
4 * 4 *
5 * Author: seanhalle@yahoo.com 5 * Author: seanhalle@yahoo.com
6 * 6 *
7 */ 7 */
8 8
9 #ifndef _SSR_H 9 #ifndef _VOMP_H
10 #define _SSR_H 10 #define _VOMP_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 "dependency.h"
19 #define NUM_STRUCS_IN_SEM_ENV 1000 19 #define NUM_STRUCS_IN_SEM_ENV 1000
20 20
21 //This is hardware dependent -- it's the number of cycles of scheduling 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 22 // overhead -- if a work unit is fewer than this, it is better being
23 // combined sequentially with other work 23 // combined sequentially with other work
24 //This value depends on both VMS overhead and SSR's plugin. At some point 24 //This value depends on both VMS overhead and VOMP's plugin. At some point
25 // it will be derived by perf-counter measurements during init of SSR 25 // it will be derived by perf-counter measurements during init of VOMP
26 #define MIN_WORK_UNIT_CYCLES 20000 26 #define MIN_WORK_UNIT_CYCLES 20000
27 27
28 //=========================================================================== 28 //===========================================================================
29 /*This header defines everything specific to the SSR semantic plug-in 29 /*This header defines everything specific to the VOMP semantic plug-in
30 */ 30 */
31 typedef struct _SSRSemReq SSRSemReq; 31 typedef struct _VOMPSemReq VOMPSemReq;
32 typedef void (*PtrToAtomicFn ) ( void * ); //executed atomically in master 32 typedef void (*PtrToAtomicFn ) ( void * ); //executed atomically in master
33 //=========================================================================== 33 //===========================================================================
34 34
35 /*Semantic layer-specific data sent inside a request from lib called in app 35 /*Semantic layer-specific data sent inside a request from lib called in app
36 * to request handler called in AnimationMaster 36 * to request handler called in AnimationMaster
39 typedef struct 39 typedef struct
40 { 40 {
41 SlaveVP *VPCurrentlyExecuting; 41 SlaveVP *VPCurrentlyExecuting;
42 PrivQueueStruc *waitingVPQ; 42 PrivQueueStruc *waitingVPQ;
43 } 43 }
44 SSRTrans; 44 VOMPTrans;
45 45
46 /*WARNING: assembly hard-codes position of endInstrAddr as first field 46 /*WARNING: assembly hard-codes position of endInstrAddr as first field
47 */ 47 */
48 typedef struct 48 typedef struct
49 { 49 {
50 void *endInstrAddr; 50 void *endInstrAddr;
51 int32 hasBeenStarted; 51 int32 hasBeenStarted;
52 int32 hasFinished; 52 int32 hasFinished;
53 PrivQueueStruc *waitQ; 53 PrivQueueStruc *waitQ;
54 } 54 }
55 SSRSingleton; 55 VOMPSingleton;
56 56
57 enum SSRReqType 57 enum VOMPReqType
58 { 58 {
59 send_type = 1, 59 send_type = 1,
60 send_from_to, 60 send_from_to,
61 receive_any, //order and grouping matter -- send before receive 61 receive_any, //order and grouping matter -- send before receive
62 receive_type, // and receive_any first of the receives -- Handlers 62 receive_type, // and receive_any first of the receives -- Handlers
72 atomic, 72 atomic,
73 trans_start, 73 trans_start,
74 trans_end 74 trans_end
75 }; 75 };
76 76
77 struct _SSRSemReq 77 struct _VOMPSemReq
78 { enum SSRReqType reqType; 78 { enum VOMPReqType reqType;
79 SlaveVP *sendPr; 79 SlaveVP *sendPr;
80 SlaveVP *receivePr; 80 SlaveVP *receivePr;
81 int32 msgType; 81 int32 msgType;
82 void *msg; 82 void *msg;
83 SSRSemReq *nextReqInHashEntry; 83 VOMPSemReq *nextReqInHashEntry;
84 84
85 void *initData; 85 void *initData;
86 TopLevelFnPtr fnPtr; 86 TopLevelFnPtr fnPtr;
87 int32 coreToAssignOnto; 87 int32 coreToAssignOnto;
88 88
89 int32 sizeToMalloc; 89 int32 sizeToMalloc;
90 void *ptrToFree; 90 void *ptrToFree;
91 91
92 int32 singletonID; 92 int32 singletonID;
93 SSRSingleton **singletonPtrAddr; 93 VOMPSingleton **singletonPtrAddr;
94 94
95 PtrToAtomicFn fnToExecInMaster; 95 PtrToAtomicFn fnToExecInMaster;
96 void *dataForFn; 96 void *dataForFn;
97 97
98 int32 transID; 98 int32 transID;
99 } 99 }
100 /* SSRSemReq */; 100 /* VOMPSemReq */;
101 101
102 102
103 typedef struct 103 typedef struct
104 { 104 {
105 PrivQueueStruc **readyVPQs; 105 PrivQueueStruc **readyVPQs;
107 int32 numSlaveVP; 107 int32 numSlaveVP;
108 int32 nextCoreToGetNewPr; 108 int32 nextCoreToGetNewPr;
109 int32 primitiveStartTime; 109 int32 primitiveStartTime;
110 110
111 //fix limit on num with dynArray 111 //fix limit on num with dynArray
112 SSRSingleton fnSingletons[NUM_STRUCS_IN_SEM_ENV]; 112 VOMPSingleton fnSingletons[NUM_STRUCS_IN_SEM_ENV];
113 SSRTrans transactionStrucs[NUM_STRUCS_IN_SEM_ENV]; 113 VOMPTrans transactionStrucs[NUM_STRUCS_IN_SEM_ENV];
114 114
115 #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC 115 #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC
116 ListOfArrays* unitList; 116 ListOfArrays* unitList;
117 ListOfArrays* ctlDependenciesList; 117 ListOfArrays* ctlDependenciesList;
118 ListOfArrays* commDependenciesList; 118 ListOfArrays* commDependenciesList;
127 ListOfArrays* counterList[NUM_CORES]; 127 ListOfArrays* counterList[NUM_CORES];
128 #endif 128 #endif
129 SlaveVP* idlePr[NUM_CORES][NUM_ANIM_SLOTS]; 129 SlaveVP* idlePr[NUM_CORES][NUM_ANIM_SLOTS];
130 int shutdownInitiated; 130 int shutdownInitiated;
131 } 131 }
132 SSRSemEnv; 132 VOMPSemEnv;
133 133
134 134
135 typedef struct _TransListElem TransListElem; 135 typedef struct _TransListElem TransListElem;
136 struct _TransListElem 136 struct _TransListElem
137 { 137 {
143 typedef struct 143 typedef struct
144 { 144 {
145 int32 highestTransEntered; 145 int32 highestTransEntered;
146 TransListElem *lastTransEntered; 146 TransListElem *lastTransEntered;
147 } 147 }
148 SSRSemData; 148 VOMPSemData;
149 149
150 //=========================================================================== 150 //===========================================================================
151 151
152 void 152 void
153 SSR__create_seed_procr_and_do_work( TopLevelFnPtr fn, void *initData ); 153 VOMP__create_seed_procr_and_do_work( TopLevelFnPtr fn, void *initData );
154 154
155 int32 155 int32
156 SSR__giveMinWorkUnitCycles( float32 percentOverhead ); 156 VOMP__giveMinWorkUnitCycles( float32 percentOverhead );
157 157
158 void 158 void
159 SSR__start_primitive(); 159 VOMP__start_primitive();
160 160
161 int32 161 int32
162 SSR__end_primitive_and_give_cycles(); 162 VOMP__end_primitive_and_give_cycles();
163 163
164 int32 164 int32
165 SSR__giveIdealNumWorkUnits(); 165 VOMP__giveIdealNumWorkUnits();
166 166
167 int32 167 int32
168 SSR__give_number_of_cores_to_schedule_onto(); 168 VOMP__give_number_of_cores_to_schedule_onto();
169 169
170 //======================= 170 //=======================
171 171
172 void 172 void
173 SSR__init(); 173 VOMP__init();
174 174
175 void 175 void
176 SSR__cleanup_after_shutdown(); 176 VOMP__cleanup_after_shutdown();
177 177
178 //======================= 178 //=======================
179 179
180 SlaveVP * 180 SlaveVP *
181 SSR__create_procr_with( TopLevelFnPtr fnPtr, void *initData, 181 VOMP__create_procr_with( TopLevelFnPtr fnPtr, void *initData,
182 SlaveVP *creatingSlv ); 182 SlaveVP *creatingSlv );
183 183
184 SlaveVP * 184 SlaveVP *
185 SSR__create_procr_with_affinity( TopLevelFnPtr fnPtr, void *initData, 185 VOMP__create_procr_with_affinity( TopLevelFnPtr fnPtr, void *initData,
186 SlaveVP *creatingPr, int32 coreToAssignOnto); 186 SlaveVP *creatingPr, int32 coreToAssignOnto);
187 187
188 void 188 void
189 SSR__dissipate_procr( SlaveVP *procrToDissipate ); 189 VOMP__dissipate_procr( SlaveVP *procrToDissipate );
190 190
191 //======================= 191 //=======================
192 void * 192 void *
193 SSR__malloc_to( int numBytes, SlaveVP *ownerSlv ); 193 VOMP__malloc_to( int numBytes, SlaveVP *ownerSlv );
194 194
195 void 195 void
196 SSR__free( void *ptrToFree, SlaveVP *owningSlv ); 196 VOMP__free( void *ptrToFree, SlaveVP *owningSlv );
197 197
198 void 198 void
199 SSR__transfer_ownership_of_from_to( void *data, SlaveVP *oldOwnerPr, 199 VOMP__transfer_ownership_of_from_to( void *data, SlaveVP *oldOwnerPr,
200 SlaveVP *newOwnerSlv ); 200 SlaveVP *newOwnerSlv );
201 201
202 void 202 void
203 SSR__add_ownership_by_to( SlaveVP *newOwnerPr, void *data ); 203 VOMP__add_ownership_by_to( SlaveVP *newOwnerPr, void *data );
204 204
205 void 205 void
206 SSR__remove_ownership_by_from( SlaveVP *loserPr, void *dataLosing ); 206 VOMP__remove_ownership_by_from( SlaveVP *loserPr, void *dataLosing );
207 207
208 void 208 void
209 SSR__transfer_ownership_to_outside( void *dataToTransferOwnershipOf ); 209 VOMP__transfer_ownership_to_outside( void *dataToTransferOwnershipOf );
210 210
211 211
212 212
213 //======================= 213 //=======================
214 void 214 void
215 SSR__send_of_type_to( SlaveVP *sendPr, void *msg, const int type, 215 VOMP__send_of_type_to( SlaveVP *sendPr, void *msg, const int type,
216 SlaveVP *receivePr); 216 SlaveVP *receivePr);
217 217
218 void 218 void
219 SSR__send_from_to( void *msg, SlaveVP *sendPr, SlaveVP *receivePr); 219 VOMP__send_from_to( void *msg, SlaveVP *sendPr, SlaveVP *receivePr);
220 220
221 void * 221 void *
222 SSR__receive_type_to( const int type, SlaveVP *receiveSlv ); 222 VOMP__receive_type_to( const int type, SlaveVP *receiveSlv );
223 223
224 void * 224 void *
225 SSR__receive_from_to( SlaveVP *sendPr, SlaveVP *receiveSlv ); 225 VOMP__receive_from_to( SlaveVP *sendPr, SlaveVP *receiveSlv );
226 226
227 227
228 //======================= Concurrency Stuff ====================== 228 //======================= Concurrency Stuff ======================
229 void 229 void
230 SSR__start_fn_singleton( int32 singletonID, SlaveVP *animSlv ); 230 VOMP__start_fn_singleton( int32 singletonID, SlaveVP *animSlv );
231 231
232 void 232 void
233 SSR__end_fn_singleton( int32 singletonID, SlaveVP *animSlv ); 233 VOMP__end_fn_singleton( int32 singletonID, SlaveVP *animSlv );
234 234
235 void 235 void
236 SSR__start_data_singleton( SSRSingleton **singeltonAddr, SlaveVP *animSlv ); 236 VOMP__start_data_singleton( VOMPSingleton **singeltonAddr, SlaveVP *animSlv );
237 237
238 void 238 void
239 SSR__end_data_singleton( SSRSingleton **singletonAddr, SlaveVP *animSlv ); 239 VOMP__end_data_singleton( VOMPSingleton **singletonAddr, SlaveVP *animSlv );
240 240
241 void 241 void
242 SSR__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster, 242 VOMP__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
243 void *data, SlaveVP *animSlv ); 243 void *data, SlaveVP *animSlv );
244 244
245 void 245 void
246 SSR__start_transaction( int32 transactionID, SlaveVP *animSlv ); 246 VOMP__start_transaction( int32 transactionID, SlaveVP *animSlv );
247 247
248 void 248 void
249 SSR__end_transaction( int32 transactionID, SlaveVP *animSlv ); 249 VOMP__end_transaction( int32 transactionID, SlaveVP *animSlv );
250 250
251 251
252 //========================= Internal use only ============================= 252 //========================= Internal use only =============================
253 void 253 void
254 SSR__Request_Handler( SlaveVP *requestingPr, void *_semEnv ); 254 VOMP__Request_Handler( SlaveVP *requestingPr, void *_semEnv );
255 255
256 SlaveVP * 256 SlaveVP *
257 SSR__assign_slaveVP_to_slot( void *_semEnv, AnimSlot *slot ); 257 VOMP__assign_slaveVP_to_slot( void *_semEnv, AnimSlot *slot );
258 258
259 SlaveVP* 259 SlaveVP*
260 SSR__create_procr_helper( TopLevelFnPtr fnPtr, void *initData, 260 VOMP__create_procr_helper( TopLevelFnPtr fnPtr, void *initData,
261 SSRSemEnv *semEnv, int32 coreToAssignOnto ); 261 VOMPSemEnv *semEnv, int32 coreToAssignOnto );
262 262
263 //===================== Measurement of Lang Overheads ===================== 263 //===================== Measurement of Lang Overheads =====================
264 #include "SSR_Measurement.h" 264 #include "VOMP_Measurement.h"
265 265
266 //=========================================================================== 266 //===========================================================================
267 #endif /* _SSR_H */ 267 #endif /* _VOMP_H */
268 268