Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > SSR_impls > SSR__MC_shared_impl
view SSR.h @ 76:6647aea90477
commented out uses of SemEnv->lastReqType .. wasn't compiling..
author | Sean Halle <seanhalle@yahoo.com> |
---|---|
date | Sun, 15 Jul 2012 02:03:43 -0700 |
parents | f20b4d9d3086 |
children | ee8510009267 |
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 int executingVp;
57 int executingTask;
58 }
59 SSRSingleton;
61 enum SSRReqType
62 {
63 send_type = 1,
64 send_from_to,
65 receive_any, //order and grouping matter -- send before receive
66 receive_type, // and receive_any first of the receives -- Handlers
67 receive_from_to,// rely upon this ordering of enum
68 transfer_to,
69 transfer_out,
70 malloc_req,
71 free_req,
72 singleton_fn_start,
73 singleton_fn_end,
74 singleton_data_start,
75 singleton_data_end,
76 atomic,
77 trans_start,
78 trans_end
79 };
81 struct _SSRSemReq
82 { enum SSRReqType reqType;
83 SlaveVP *sendPr;
84 SlaveVP *receivePr;
85 int32 msgType;
86 void *msg;
87 SSRSemReq *nextReqInHashEntry;
89 void *initData;
90 TopLevelFnPtr fnPtr;
91 int32 coreToAssignOnto;
93 int32 sizeToMalloc;
94 void *ptrToFree;
96 int32 singletonID;
97 SSRSingleton **singletonPtrAddr;
99 PtrToAtomicFn fnToExecInMaster;
100 void *dataForFn;
102 int32 transID;
103 }
104 /* SSRSemReq */;
107 typedef struct
108 {
109 PrivQueueStruc **readyVPQs;
110 HashTable *commHashTbl;
111 int32 numSlaveVP;
112 int32 nextCoreToGetNewPr;
113 int32 primitiveStartTime;
115 //fix limit on num with dynArray
116 SSRSingleton fnSingletons[NUM_STRUCS_IN_SEM_ENV];
117 SSRTrans transactionStrucs[NUM_STRUCS_IN_SEM_ENV];
119 #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC
120 ListOfArrays* unitList;
121 ListOfArrays* ctlDependenciesList;
122 ListOfArrays* commDependenciesList;
123 NtoN** ntonGroups;
124 PrivDynArrayInfo* ntonGroupsInfo;
125 ListOfArrays* dynDependenciesList;
126 ListOfArrays* singletonDependenciesList;
127 Unit last_in_slot[NUM_CORES * NUM_ANIM_SLOTS];
128 ListOfArrays* hwArcs;
129 int lastReqType;
130 #endif
132 #ifdef HOLISTIC__TURN_ON_PERF_COUNTERS
133 ListOfArrays* counterList[NUM_CORES];
134 #endif
135 #ifdef IDLE_SLAVES
136 SlaveVP* idlePr[NUM_CORES][NUM_ANIM_SLOTS];
137 int shutdownInitiated;
138 #endif
139 }
140 SSRSemEnv;
143 typedef struct _TransListElem TransListElem;
144 struct _TransListElem
145 {
146 int32 transID;
147 TransListElem *nextTrans;
148 };
149 //TransListElem
151 typedef struct
152 {
153 int32 highestTransEntered;
154 TransListElem *lastTransEntered;
155 }
156 SSRSemData;
158 //===========================================================================
160 void
161 SSR__create_seed_procr_and_do_work( TopLevelFnPtr fn, void *initData );
163 int32
164 SSR__giveMinWorkUnitCycles( float32 percentOverhead );
166 void
167 SSR__start_primitive();
169 int32
170 SSR__end_primitive_and_give_cycles();
172 int32
173 SSR__giveIdealNumWorkUnits();
175 int32
176 SSR__give_number_of_cores_to_schedule_onto();
178 //=======================
180 void
181 SSR__init();
183 void
184 SSR__cleanup_after_shutdown();
186 //=======================
188 SlaveVP *
189 SSR__create_procr_with( TopLevelFnPtr fnPtr, void *initData,
190 SlaveVP *creatingSlv );
192 SlaveVP *
193 SSR__create_procr_with_affinity( TopLevelFnPtr fnPtr, void *initData,
194 SlaveVP *creatingPr, int32 coreToAssignOnto);
196 void
197 SSR__dissipate_procr( SlaveVP *procrToDissipate );
199 //=======================
200 void *
201 SSR__malloc_to( int numBytes, SlaveVP *ownerSlv );
203 void
204 SSR__free( void *ptrToFree, SlaveVP *owningSlv );
206 void
207 SSR__transfer_ownership_of_from_to( void *data, SlaveVP *oldOwnerPr,
208 SlaveVP *newOwnerSlv );
210 void
211 SSR__add_ownership_by_to( SlaveVP *newOwnerPr, void *data );
213 void
214 SSR__remove_ownership_by_from( SlaveVP *loserPr, void *dataLosing );
216 void
217 SSR__transfer_ownership_to_outside( void *dataToTransferOwnershipOf );
221 //=======================
222 void
223 SSR__send_of_type_to( SlaveVP *sendPr, void *msg, const int type,
224 SlaveVP *receivePr);
226 void
227 SSR__send_from_to( void *msg, SlaveVP *sendPr, SlaveVP *receivePr);
229 void *
230 SSR__receive_type_to( const int type, SlaveVP *receiveSlv );
232 void *
233 SSR__receive_from_to( SlaveVP *sendPr, SlaveVP *receiveSlv );
236 //======================= Concurrency Stuff ======================
237 void
238 SSR__start_fn_singleton( int32 singletonID, SlaveVP *animSlv );
240 void
241 SSR__end_fn_singleton( int32 singletonID, SlaveVP *animSlv );
243 void
244 SSR__start_data_singleton( SSRSingleton **singeltonAddr, SlaveVP *animSlv );
246 void
247 SSR__end_data_singleton( SSRSingleton **singletonAddr, SlaveVP *animSlv );
249 void
250 SSR__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
251 void *data, SlaveVP *animSlv );
253 void
254 SSR__start_transaction( int32 transactionID, SlaveVP *animSlv );
256 void
257 SSR__end_transaction( int32 transactionID, SlaveVP *animSlv );
260 //========================= Internal use only =============================
261 void
262 SSR__Request_Handler( SlaveVP *requestingPr, void *_semEnv );
264 SlaveVP *
265 SSR__assign_slaveVP_to_slot( void *_semEnv, AnimSlot *slot );
267 SlaveVP*
268 SSR__create_procr_helper( TopLevelFnPtr fnPtr, void *initData,
269 SSRSemEnv *semEnv, int32 coreToAssignOnto );
271 //===================== Measurement of Lang Overheads =====================
272 #include "SSR_Measurement.h"
274 //===========================================================================
275 #endif /* _SSR_H */