Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > SSR_impls > SSR__MC_shared_impl
view SSR.h @ 67:b5b5323b4177
added debugging stuff
| author | Some Random Person <seanhalle@yahoo.com> |
|---|---|
| date | Fri, 16 Mar 2012 23:41:31 -0700 |
| parents | bd5ab695145c |
| children | 81a0f076b12e |
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_SCHED_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_SCHED_SLOTS];
130 }
131 SSRSemEnv;
134 typedef struct _TransListElem TransListElem;
135 struct _TransListElem
136 {
137 int32 transID;
138 TransListElem *nextTrans;
139 };
140 //TransListElem
142 typedef struct
143 {
144 int32 highestTransEntered;
145 TransListElem *lastTransEntered;
146 }
147 SSRSemData;
149 //===========================================================================
151 void
152 SSR__create_seed_procr_and_do_work( TopLevelFnPtr fn, void *initData );
154 int32
155 SSR__giveMinWorkUnitCycles( float32 percentOverhead );
157 void
158 SSR__start_primitive();
160 int32
161 SSR__end_primitive_and_give_cycles();
163 int32
164 SSR__giveIdealNumWorkUnits();
166 int32
167 SSR__give_number_of_cores_to_schedule_onto();
169 //=======================
171 void
172 SSR__init();
174 void
175 SSR__cleanup_after_shutdown();
177 //=======================
179 SlaveVP *
180 SSR__create_procr_with( TopLevelFnPtr fnPtr, void *initData,
181 SlaveVP *creatingSlv );
183 SlaveVP *
184 SSR__create_procr_with_affinity( TopLevelFnPtr fnPtr, void *initData,
185 SlaveVP *creatingPr, int32 coreToAssignOnto);
187 void
188 SSR__dissipate_procr( SlaveVP *procrToDissipate );
190 //=======================
191 void *
192 SSR__malloc_to( int numBytes, SlaveVP *ownerSlv );
194 void
195 SSR__free( void *ptrToFree, SlaveVP *owningSlv );
197 void
198 SSR__transfer_ownership_of_from_to( void *data, SlaveVP *oldOwnerPr,
199 SlaveVP *newOwnerSlv );
201 void
202 SSR__add_ownership_by_to( SlaveVP *newOwnerPr, void *data );
204 void
205 SSR__remove_ownership_by_from( SlaveVP *loserPr, void *dataLosing );
207 void
208 SSR__transfer_ownership_to_outside( void *dataToTransferOwnershipOf );
212 //=======================
213 void
214 SSR__send_of_type_to( SlaveVP *sendPr, void *msg, const int type,
215 SlaveVP *receivePr);
217 void
218 SSR__send_from_to( void *msg, SlaveVP *sendPr, SlaveVP *receivePr);
220 void *
221 SSR__receive_type_to( const int type, SlaveVP *receiveSlv );
223 void *
224 SSR__receive_from_to( SlaveVP *sendPr, SlaveVP *receiveSlv );
227 //======================= Concurrency Stuff ======================
228 void
229 SSR__start_fn_singleton( int32 singletonID, SlaveVP *animSlv );
231 void
232 SSR__end_fn_singleton( int32 singletonID, SlaveVP *animSlv );
234 void
235 SSR__start_data_singleton( SSRSingleton **singeltonAddr, SlaveVP *animSlv );
237 void
238 SSR__end_data_singleton( SSRSingleton **singletonAddr, SlaveVP *animSlv );
240 void
241 SSR__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
242 void *data, SlaveVP *animSlv );
244 void
245 SSR__start_transaction( int32 transactionID, SlaveVP *animSlv );
247 void
248 SSR__end_transaction( int32 transactionID, SlaveVP *animSlv );
251 //========================= Internal use only =============================
252 void
253 SSR__Request_Handler( SlaveVP *requestingPr, void *_semEnv );
255 SlaveVP *
256 SSR__assign_slaveVP_to_slot( void *_semEnv, AnimSlot *slot );
258 SlaveVP*
259 SSR__create_procr_helper( TopLevelFnPtr fnPtr, void *initData,
260 SSRSemEnv *semEnv, int32 coreToAssignOnto );
262 //===================== Measurement of Lang Overheads =====================
263 #include "SSR_Measurement.h"
265 //===========================================================================
266 #endif /* _SSR_H */
