Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > SSR_impls > SSR__MC_shared_impl
view SSR.h @ 47:23bcca1c3687
added units to plugin ucc recording
| author | Nina Engelhardt <nengel@mailbox.tu-berlin.de> |
|---|---|
| date | Tue, 20 Dec 2011 14:42:56 +0100 |
| parents | bde026832af7 |
| children | 593fe0543a22 |
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 "VMS/Queue_impl/PrivateQueue.h"
13 #include "VMS/Hash_impl/PrivateHash.h"
14 #include "VMS/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 structure?
113 #endif
115 }
116 SSRSemEnv;
119 typedef struct _TransListElem TransListElem;
120 struct _TransListElem
121 {
122 int32 transID;
123 TransListElem *nextTrans;
124 };
125 //TransListElem
127 typedef struct
128 {
129 int32 highestTransEntered;
130 TransListElem *lastTransEntered;
131 }
132 SSRSemData;
134 //===========================================================================
136 void
137 SSR__create_seed_procr_and_do_work( VirtProcrFnPtr fn, void *initData );
139 int32
140 SSR__giveMinWorkUnitCycles( float32 percentOverhead );
142 void
143 SSR__start_primitive();
145 int32
146 SSR__end_primitive_and_give_cycles();
148 int32
149 SSR__giveIdealNumWorkUnits();
151 int32
152 SSR__give_number_of_cores_to_schedule_onto();
154 //=======================
156 void
157 SSR__init();
159 void
160 SSR__cleanup_after_shutdown();
162 //=======================
164 VirtProcr *
165 SSR__create_procr_with( VirtProcrFnPtr fnPtr, void *initData,
166 VirtProcr *creatingPr );
168 VirtProcr *
169 SSR__create_procr_with_affinity( VirtProcrFnPtr fnPtr, void *initData,
170 VirtProcr *creatingPr, int32 coreToScheduleOnto);
172 void
173 SSR__dissipate_procr( VirtProcr *procrToDissipate );
175 //=======================
176 void *
177 SSR__malloc_to( int numBytes, VirtProcr *ownerPr );
179 void
180 SSR__free( void *ptrToFree, VirtProcr *owningPr );
182 void
183 SSR__transfer_ownership_of_from_to( void *data, VirtProcr *oldOwnerPr,
184 VirtProcr *newOwnerPr );
186 void
187 SSR__add_ownership_by_to( VirtProcr *newOwnerPr, void *data );
189 void
190 SSR__remove_ownership_by_from( VirtProcr *loserPr, void *dataLosing );
192 void
193 SSR__transfer_ownership_to_outside( void *dataToTransferOwnershipOf );
197 //=======================
198 void
199 SSR__send_of_type_to( VirtProcr *sendPr, void *msg, const int type,
200 VirtProcr *receivePr);
202 void
203 SSR__send_from_to( void *msg, VirtProcr *sendPr, VirtProcr *receivePr);
205 void *
206 SSR__receive_type_to( const int type, VirtProcr *receivePr );
208 void *
209 SSR__receive_from_to( VirtProcr *sendPr, VirtProcr *receivePr );
212 //======================= Concurrency Stuff ======================
213 void
214 SSR__start_fn_singleton( int32 singletonID, VirtProcr *animPr );
216 void
217 SSR__end_fn_singleton( int32 singletonID, VirtProcr *animPr );
219 void
220 SSR__start_data_singleton( SSRSingleton **singeltonAddr, VirtProcr *animPr );
222 void
223 SSR__end_data_singleton( SSRSingleton **singletonAddr, VirtProcr *animPr );
225 void
226 SSR__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
227 void *data, VirtProcr *animPr );
229 void
230 SSR__start_transaction( int32 transactionID, VirtProcr *animPr );
232 void
233 SSR__end_transaction( int32 transactionID, VirtProcr *animPr );
236 //========================= Internal use only =============================
237 void
238 SSR__Request_Handler( VirtProcr *requestingPr, void *_semEnv );
240 VirtProcr *
241 SSR__schedule_virt_procr( void *_semEnv, int coreNum );
243 VirtProcr*
244 SSR__create_procr_helper( VirtProcrFnPtr fnPtr, void *initData,
245 SSRSemEnv *semEnv, int32 coreToScheduleOnto );
247 #endif /* _SSR_H */
