Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > SSR_impls > SSR__MC_shared_impl
view SSR.h @ 59:471c89d1d545
try 40 cores
| author | Nina Engelhardt <nengel@mailbox.tu-berlin.de> |
|---|---|
| date | Fri, 09 Mar 2012 19:01:21 +0100 |
| parents | 6b723b55b9a0 |
| children | 3c9ed64db705 |
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 "../../C_Libraries/Queue_impl/PrivateQueue.h"
13 #include "../../C_Libraries/Hash_impl/PrivateHash.h"
14 #include "../VMS_impl/VMS.h"
15 #include "dependency.h"
18 //===========================================================================
19 #define NUM_STRUCS_IN_SEM_ENV 1000
21 //===========================================================================
22 /*This header defines everything specific to the SSR semantic plug-in
23 */
24 typedef struct _SSRSemReq SSRSemReq;
25 typedef void (*PtrToAtomicFn ) ( void * ); //executed atomically in master
26 //===========================================================================
28 /*Semantic layer-specific data sent inside a request from lib called in app
29 * to request handler called in MasterLoop
30 */
32 typedef struct
33 {
34 VirtProcr *VPCurrentlyExecuting;
35 PrivQueueStruc *waitingVPQ;
36 }
37 SSRTrans;
39 /*WARNING: assembly hard-codes position of endInstrAddr as first field
40 */
41 typedef struct
42 {
43 void *endInstrAddr;
44 int32 hasBeenStarted;
45 int32 hasFinished;
46 PrivQueueStruc *waitQ;
47 }
48 SSRSingleton;
50 enum SSRReqType
51 {
52 send_type = 1,
53 send_from_to,
54 receive_any, //order and grouping matter -- send before receive
55 receive_type, // and receive_any first of the receives -- Handlers
56 receive_from_to,// rely upon this ordering of enum
57 transfer_to,
58 transfer_out,
59 malloc_req,
60 free_req,
61 singleton_fn_start,
62 singleton_fn_end,
63 singleton_data_start,
64 singleton_data_end,
65 atomic,
66 trans_start,
67 trans_end
68 };
70 struct _SSRSemReq
71 { enum SSRReqType reqType;
72 VirtProcr *sendPr;
73 VirtProcr *receivePr;
74 int32 msgType;
75 void *msg;
76 SSRSemReq *nextReqInHashEntry;
78 void *initData;
79 VirtProcrFnPtr fnPtr;
80 int32 coreToScheduleOnto;
82 int32 sizeToMalloc;
83 void *ptrToFree;
85 int32 singletonID;
86 SSRSingleton **singletonPtrAddr;
88 PtrToAtomicFn fnToExecInMaster;
89 void *dataForFn;
91 int32 transID;
92 }
93 /* SSRSemReq */;
96 typedef struct
97 {
98 PrivQueueStruc **readyVPQs;
99 HashTable *commHashTbl;
100 int32 numVirtPr;
101 int32 nextCoreToGetNewPr;
102 int32 primitiveStartTime;
104 //fix limit on num with dynArray
105 SSRSingleton fnSingletons[NUM_STRUCS_IN_SEM_ENV];
106 SSRTrans transactionStrucs[NUM_STRUCS_IN_SEM_ENV];
108 #ifdef OBSERVE_UCC
109 ListOfArrays* unitList;
110 ListOfArrays* ctlDependenciesList;
111 ListOfArrays* commDependenciesList;
112 NtoN** ntonGroups;
113 PrivDynArrayInfo* ntonGroupsInfo;
114 ListOfArrays* dynDependenciesList;
115 Unit last_in_slot[NUM_CORES * NUM_SCHED_SLOTS];
116 ListOfArrays* hwArcs;
117 #endif
119 #ifdef MEAS__PERF_COUNTERS
120 ListOfArrays* counterList[NUM_CORES];
121 #endif
122 VirtProcr* idlePr[NUM_CORES][NUM_SCHED_SLOTS];
123 }
124 SSRSemEnv;
127 typedef struct _TransListElem TransListElem;
128 struct _TransListElem
129 {
130 int32 transID;
131 TransListElem *nextTrans;
132 };
133 //TransListElem
135 typedef struct
136 {
137 int32 highestTransEntered;
138 TransListElem *lastTransEntered;
139 }
140 SSRSemData;
142 //===========================================================================
144 void
145 SSR__create_seed_procr_and_do_work( VirtProcrFnPtr fn, void *initData );
147 int32
148 SSR__giveMinWorkUnitCycles( float32 percentOverhead );
150 void
151 SSR__start_primitive();
153 int32
154 SSR__end_primitive_and_give_cycles();
156 int32
157 SSR__giveIdealNumWorkUnits();
159 int32
160 SSR__give_number_of_cores_to_schedule_onto();
162 //=======================
164 void
165 SSR__init();
167 void
168 SSR__cleanup_after_shutdown();
170 //=======================
172 VirtProcr *
173 SSR__create_procr_with( VirtProcrFnPtr fnPtr, void *initData,
174 VirtProcr *creatingPr );
176 VirtProcr *
177 SSR__create_procr_with_affinity( VirtProcrFnPtr fnPtr, void *initData,
178 VirtProcr *creatingPr, int32 coreToScheduleOnto);
180 void
181 SSR__dissipate_procr( VirtProcr *procrToDissipate );
183 //=======================
184 void *
185 SSR__malloc_to( int numBytes, VirtProcr *ownerPr );
187 void
188 SSR__free( void *ptrToFree, VirtProcr *owningPr );
190 void
191 SSR__transfer_ownership_of_from_to( void *data, VirtProcr *oldOwnerPr,
192 VirtProcr *newOwnerPr );
194 void
195 SSR__add_ownership_by_to( VirtProcr *newOwnerPr, void *data );
197 void
198 SSR__remove_ownership_by_from( VirtProcr *loserPr, void *dataLosing );
200 void
201 SSR__transfer_ownership_to_outside( void *dataToTransferOwnershipOf );
205 //=======================
206 void
207 SSR__send_of_type_to( VirtProcr *sendPr, void *msg, const int type,
208 VirtProcr *receivePr);
210 void
211 SSR__send_from_to( void *msg, VirtProcr *sendPr, VirtProcr *receivePr);
213 void *
214 SSR__receive_type_to( const int type, VirtProcr *receivePr );
216 void *
217 SSR__receive_from_to( VirtProcr *sendPr, VirtProcr *receivePr );
220 //======================= Concurrency Stuff ======================
221 void
222 SSR__start_fn_singleton( int32 singletonID, VirtProcr *animPr );
224 void
225 SSR__end_fn_singleton( int32 singletonID, VirtProcr *animPr );
227 void
228 SSR__start_data_singleton( SSRSingleton **singeltonAddr, VirtProcr *animPr );
230 void
231 SSR__end_data_singleton( SSRSingleton **singletonAddr, VirtProcr *animPr );
233 void
234 SSR__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
235 void *data, VirtProcr *animPr );
237 void
238 SSR__start_transaction( int32 transactionID, VirtProcr *animPr );
240 void
241 SSR__end_transaction( int32 transactionID, VirtProcr *animPr );
244 //========================= Internal use only =============================
245 void
246 SSR__Request_Handler( VirtProcr *requestingPr, void *_semEnv );
248 VirtProcr *
249 SSR__schedule_virt_procr( void *_semEnv, int coreNum, int slotNum );
251 VirtProcr*
252 SSR__create_procr_helper( VirtProcrFnPtr fnPtr, void *initData,
253 SSRSemEnv *semEnv, int32 coreToScheduleOnto );
255 #endif /* _SSR_H */
