VMS/VMS_Implementations/VOMP_impls/VOMP__MC_shared_impl

view 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
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 _VOMP_H
10 #define _VOMP_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 VOMP's plugin. At some point
25 // it will be derived by perf-counter measurements during init of VOMP
26 #define MIN_WORK_UNIT_CYCLES 20000
28 //===========================================================================
29 /*This header defines everything specific to the VOMP semantic plug-in
30 */
31 typedef struct _VOMPSemReq VOMPSemReq;
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 VOMPTrans;
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 VOMPSingleton;
57 enum VOMPReqType
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 _VOMPSemReq
78 { enum VOMPReqType reqType;
79 SlaveVP *sendPr;
80 SlaveVP *receivePr;
81 int32 msgType;
82 void *msg;
83 VOMPSemReq *nextReqInHashEntry;
85 void *initData;
86 TopLevelFnPtr fnPtr;
87 int32 coreToAssignOnto;
89 int32 sizeToMalloc;
90 void *ptrToFree;
92 int32 singletonID;
93 VOMPSingleton **singletonPtrAddr;
95 PtrToAtomicFn fnToExecInMaster;
96 void *dataForFn;
98 int32 transID;
99 }
100 /* VOMPSemReq */;
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 VOMPSingleton fnSingletons[NUM_STRUCS_IN_SEM_ENV];
113 VOMPTrans 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 VOMPSemEnv;
135 typedef struct _TransListElem TransListElem;
136 struct _TransListElem
137 {
138 int32 transID;
139 TransListElem *nextTrans;
140 };
141 //TransListElem
143 typedef struct
144 {
145 int32 highestTransEntered;
146 TransListElem *lastTransEntered;
147 }
148 VOMPSemData;
150 //===========================================================================
152 void
153 VOMP__create_seed_procr_and_do_work( TopLevelFnPtr fn, void *initData );
155 int32
156 VOMP__giveMinWorkUnitCycles( float32 percentOverhead );
158 void
159 VOMP__start_primitive();
161 int32
162 VOMP__end_primitive_and_give_cycles();
164 int32
165 VOMP__giveIdealNumWorkUnits();
167 int32
168 VOMP__give_number_of_cores_to_schedule_onto();
170 //=======================
172 void
173 VOMP__init();
175 void
176 VOMP__cleanup_after_shutdown();
178 //=======================
180 SlaveVP *
181 VOMP__create_procr_with( TopLevelFnPtr fnPtr, void *initData,
182 SlaveVP *creatingSlv );
184 SlaveVP *
185 VOMP__create_procr_with_affinity( TopLevelFnPtr fnPtr, void *initData,
186 SlaveVP *creatingPr, int32 coreToAssignOnto);
188 void
189 VOMP__dissipate_procr( SlaveVP *procrToDissipate );
191 //=======================
192 void *
193 VOMP__malloc_to( int numBytes, SlaveVP *ownerSlv );
195 void
196 VOMP__free( void *ptrToFree, SlaveVP *owningSlv );
198 void
199 VOMP__transfer_ownership_of_from_to( void *data, SlaveVP *oldOwnerPr,
200 SlaveVP *newOwnerSlv );
202 void
203 VOMP__add_ownership_by_to( SlaveVP *newOwnerPr, void *data );
205 void
206 VOMP__remove_ownership_by_from( SlaveVP *loserPr, void *dataLosing );
208 void
209 VOMP__transfer_ownership_to_outside( void *dataToTransferOwnershipOf );
213 //=======================
214 void
215 VOMP__send_of_type_to( SlaveVP *sendPr, void *msg, const int type,
216 SlaveVP *receivePr);
218 void
219 VOMP__send_from_to( void *msg, SlaveVP *sendPr, SlaveVP *receivePr);
221 void *
222 VOMP__receive_type_to( const int type, SlaveVP *receiveSlv );
224 void *
225 VOMP__receive_from_to( SlaveVP *sendPr, SlaveVP *receiveSlv );
228 //======================= Concurrency Stuff ======================
229 void
230 VOMP__start_fn_singleton( int32 singletonID, SlaveVP *animSlv );
232 void
233 VOMP__end_fn_singleton( int32 singletonID, SlaveVP *animSlv );
235 void
236 VOMP__start_data_singleton( VOMPSingleton **singeltonAddr, SlaveVP *animSlv );
238 void
239 VOMP__end_data_singleton( VOMPSingleton **singletonAddr, SlaveVP *animSlv );
241 void
242 VOMP__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
243 void *data, SlaveVP *animSlv );
245 void
246 VOMP__start_transaction( int32 transactionID, SlaveVP *animSlv );
248 void
249 VOMP__end_transaction( int32 transactionID, SlaveVP *animSlv );
252 //========================= Internal use only =============================
253 void
254 VOMP__Request_Handler( SlaveVP *requestingPr, void *_semEnv );
256 SlaveVP *
257 VOMP__assign_slaveVP_to_slot( void *_semEnv, AnimSlot *slot );
259 SlaveVP*
260 VOMP__create_procr_helper( TopLevelFnPtr fnPtr, void *initData,
261 VOMPSemEnv *semEnv, int32 coreToAssignOnto );
263 //===================== Measurement of Lang Overheads =====================
264 #include "VOMP_Measurement.h"
266 //===========================================================================
267 #endif /* _VOMP_H */