Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VSs_impls > VSs__MC_shared_impl
view VSs.h @ 1:5ed4d833506e
Started putting in some VSs impl -- still mostly SSR copy
| author | Some Random Person <seanhalle@yahoo.com> |
|---|---|
| date | Thu, 24 May 2012 07:34:21 -0700 |
| parents | 67a3a05a39c0 |
| children | f2ed1c379fe7 |
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 (*VSsTaskFnPtr ) ( void * ); //executed atomically in master
33 //===========================================================================
35 #define IN 1;
36 #define OUT 2;
37 #define INOUT 3;
39 typedef struct
40 {
41 VSsTaskFnPtr fn;
42 int32 numArgs;
43 int32 *argTypes;
44 int32 *argSizes;
45 }
46 VSsTaskType;
50 /*Semantic layer-specific data sent inside a request from lib called in app
51 * to request handler called in AnimationMaster
52 */
54 typedef struct
55 {
56 SlaveVP *VPCurrentlyExecuting;
57 PrivQueueStruc *waitingVPQ;
58 }
59 VOMPTrans;
61 /*WARNING: assembly hard-codes position of endInstrAddr as first field
62 */
63 typedef struct
64 {
65 void *endInstrAddr;
66 int32 hasBeenStarted;
67 int32 hasFinished;
68 PrivQueueStruc *waitQ;
69 }
70 VOMPSingleton;
72 enum VOMPReqType
73 {
74 send_type = 1,
75 send_from_to,
76 receive_any, //order and grouping matter -- send before receive
77 receive_type, // and receive_any first of the receives -- Handlers
78 receive_from_to,// rely upon this ordering of enum
79 transfer_to,
80 transfer_out,
81 malloc_req,
82 free_req,
83 singleton_fn_start,
84 singleton_fn_end,
85 singleton_data_start,
86 singleton_data_end,
87 atomic,
88 trans_start,
89 trans_end
90 };
92 struct _VOMPSemReq
93 { enum VOMPReqType reqType;
94 SlaveVP *sendPr;
95 SlaveVP *receivePr;
96 int32 msgType;
97 void *msg;
98 VOMPSemReq *nextReqInHashEntry;
100 void *initData;
101 TopLevelFnPtr fnPtr;
102 int32 coreToAssignOnto;
104 int32 sizeToMalloc;
105 void *ptrToFree;
107 int32 singletonID;
108 VOMPSingleton **singletonPtrAddr;
110 PtrToAtomicFn fnToExecInMaster;
111 void *dataForFn;
113 int32 transID;
114 }
115 /* VOMPSemReq */;
118 typedef struct
119 {
120 PrivQueueStruc **readyVPQs;
121 HashTable *commHashTbl;
122 int32 numSlaveVP;
123 int32 nextCoreToGetNewPr;
124 int32 primitiveStartTime;
126 //fix limit on num with dynArray
127 VOMPSingleton fnSingletons[NUM_STRUCS_IN_SEM_ENV];
128 VOMPTrans transactionStrucs[NUM_STRUCS_IN_SEM_ENV];
130 #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC
131 ListOfArrays* unitList;
132 ListOfArrays* ctlDependenciesList;
133 ListOfArrays* commDependenciesList;
134 NtoN** ntonGroups;
135 PrivDynArrayInfo* ntonGroupsInfo;
136 ListOfArrays* dynDependenciesList;
137 Unit last_in_slot[NUM_CORES * NUM_ANIM_SLOTS];
138 ListOfArrays* hwArcs;
139 #endif
141 #ifdef HOLISTIC__TURN_ON_PERF_COUNTERS
142 ListOfArrays* counterList[NUM_CORES];
143 #endif
144 SlaveVP* idlePr[NUM_CORES][NUM_ANIM_SLOTS];
145 int shutdownInitiated;
146 }
147 VOMPSemEnv;
150 typedef struct _TransListElem TransListElem;
151 struct _TransListElem
152 {
153 int32 transID;
154 TransListElem *nextTrans;
155 };
156 //TransListElem
158 typedef struct
159 {
160 int32 highestTransEntered;
161 TransListElem *lastTransEntered;
162 }
163 VOMPSemData;
165 //===========================================================================
167 void
168 VOMP__create_seed_procr_and_do_work( TopLevelFnPtr fn, void *initData );
170 int32
171 VOMP__giveMinWorkUnitCycles( float32 percentOverhead );
173 void
174 VOMP__start_primitive();
176 int32
177 VOMP__end_primitive_and_give_cycles();
179 int32
180 VOMP__giveIdealNumWorkUnits();
182 int32
183 VOMP__give_number_of_cores_to_schedule_onto();
185 //=======================
187 void
188 VOMP__init();
190 void
191 VOMP__cleanup_after_shutdown();
193 //=======================
195 SlaveVP *
196 VOMP__create_procr_with( TopLevelFnPtr fnPtr, void *initData,
197 SlaveVP *creatingSlv );
199 SlaveVP *
200 VOMP__create_procr_with_affinity( TopLevelFnPtr fnPtr, void *initData,
201 SlaveVP *creatingPr, int32 coreToAssignOnto);
203 void
204 VOMP__dissipate_procr( SlaveVP *procrToDissipate );
206 //=======================
207 void *
208 VOMP__malloc_to( int numBytes, SlaveVP *ownerSlv );
210 void
211 VOMP__free( void *ptrToFree, SlaveVP *owningSlv );
213 void
214 VOMP__transfer_ownership_of_from_to( void *data, SlaveVP *oldOwnerPr,
215 SlaveVP *newOwnerSlv );
217 void
218 VOMP__add_ownership_by_to( SlaveVP *newOwnerPr, void *data );
220 void
221 VOMP__remove_ownership_by_from( SlaveVP *loserPr, void *dataLosing );
223 void
224 VOMP__transfer_ownership_to_outside( void *dataToTransferOwnershipOf );
228 //=======================
229 void
230 VOMP__send_of_type_to( SlaveVP *sendPr, void *msg, const int type,
231 SlaveVP *receivePr);
233 void
234 VOMP__send_from_to( void *msg, SlaveVP *sendPr, SlaveVP *receivePr);
236 void *
237 VOMP__receive_type_to( const int type, SlaveVP *receiveSlv );
239 void *
240 VOMP__receive_from_to( SlaveVP *sendPr, SlaveVP *receiveSlv );
243 //======================= Concurrency Stuff ======================
244 void
245 VOMP__start_fn_singleton( int32 singletonID, SlaveVP *animSlv );
247 void
248 VOMP__end_fn_singleton( int32 singletonID, SlaveVP *animSlv );
250 void
251 VOMP__start_data_singleton( VOMPSingleton **singeltonAddr, SlaveVP *animSlv );
253 void
254 VOMP__end_data_singleton( VOMPSingleton **singletonAddr, SlaveVP *animSlv );
256 void
257 VOMP__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
258 void *data, SlaveVP *animSlv );
260 void
261 VOMP__start_transaction( int32 transactionID, SlaveVP *animSlv );
263 void
264 VOMP__end_transaction( int32 transactionID, SlaveVP *animSlv );
267 //========================= Internal use only =============================
268 void
269 VOMP__Request_Handler( SlaveVP *requestingPr, void *_semEnv );
271 SlaveVP *
272 VOMP__assign_slaveVP_to_slot( void *_semEnv, AnimSlot *slot );
274 SlaveVP*
275 VOMP__create_procr_helper( TopLevelFnPtr fnPtr, void *initData,
276 VOMPSemEnv *semEnv, int32 coreToAssignOnto );
278 //===================== Measurement of Lang Overheads =====================
279 #include "VOMP_Measurement.h"
281 //===========================================================================
282 #endif /* _VOMP_H */
