Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > SSR_impls > SSR__MC_shared_impl
view SSR.h @ 56:772bb0384074
fix coreloop recording bug and eliminate race condition on measurement-collecting list
| author | Nina Engelhardt <nengel@mailbox.tu-berlin.de> |
|---|---|
| date | Thu, 09 Feb 2012 15:40:23 +0100 |
| parents | 5c59bfe62d92 |
| children | 6b723b55b9a0 |
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** 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 }
123 SSRSemEnv;
126 typedef struct _TransListElem TransListElem;
127 struct _TransListElem
128 {
129 int32 transID;
130 TransListElem *nextTrans;
131 };
132 //TransListElem
134 typedef struct
135 {
136 int32 highestTransEntered;
137 TransListElem *lastTransEntered;
138 }
139 SSRSemData;
141 //===========================================================================
143 void
144 SSR__create_seed_procr_and_do_work( VirtProcrFnPtr fn, void *initData );
146 int32
147 SSR__giveMinWorkUnitCycles( float32 percentOverhead );
149 void
150 SSR__start_primitive();
152 int32
153 SSR__end_primitive_and_give_cycles();
155 int32
156 SSR__giveIdealNumWorkUnits();
158 int32
159 SSR__give_number_of_cores_to_schedule_onto();
161 //=======================
163 void
164 SSR__init();
166 void
167 SSR__cleanup_after_shutdown();
169 //=======================
171 VirtProcr *
172 SSR__create_procr_with( VirtProcrFnPtr fnPtr, void *initData,
173 VirtProcr *creatingPr );
175 VirtProcr *
176 SSR__create_procr_with_affinity( VirtProcrFnPtr fnPtr, void *initData,
177 VirtProcr *creatingPr, int32 coreToScheduleOnto);
179 void
180 SSR__dissipate_procr( VirtProcr *procrToDissipate );
182 //=======================
183 void *
184 SSR__malloc_to( int numBytes, VirtProcr *ownerPr );
186 void
187 SSR__free( void *ptrToFree, VirtProcr *owningPr );
189 void
190 SSR__transfer_ownership_of_from_to( void *data, VirtProcr *oldOwnerPr,
191 VirtProcr *newOwnerPr );
193 void
194 SSR__add_ownership_by_to( VirtProcr *newOwnerPr, void *data );
196 void
197 SSR__remove_ownership_by_from( VirtProcr *loserPr, void *dataLosing );
199 void
200 SSR__transfer_ownership_to_outside( void *dataToTransferOwnershipOf );
204 //=======================
205 void
206 SSR__send_of_type_to( VirtProcr *sendPr, void *msg, const int type,
207 VirtProcr *receivePr);
209 void
210 SSR__send_from_to( void *msg, VirtProcr *sendPr, VirtProcr *receivePr);
212 void *
213 SSR__receive_type_to( const int type, VirtProcr *receivePr );
215 void *
216 SSR__receive_from_to( VirtProcr *sendPr, VirtProcr *receivePr );
219 //======================= Concurrency Stuff ======================
220 void
221 SSR__start_fn_singleton( int32 singletonID, VirtProcr *animPr );
223 void
224 SSR__end_fn_singleton( int32 singletonID, VirtProcr *animPr );
226 void
227 SSR__start_data_singleton( SSRSingleton **singeltonAddr, VirtProcr *animPr );
229 void
230 SSR__end_data_singleton( SSRSingleton **singletonAddr, VirtProcr *animPr );
232 void
233 SSR__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
234 void *data, VirtProcr *animPr );
236 void
237 SSR__start_transaction( int32 transactionID, VirtProcr *animPr );
239 void
240 SSR__end_transaction( int32 transactionID, VirtProcr *animPr );
243 //========================= Internal use only =============================
244 void
245 SSR__Request_Handler( VirtProcr *requestingPr, void *_semEnv );
247 VirtProcr *
248 SSR__schedule_virt_procr( void *_semEnv, int coreNum, int slotNum );
250 VirtProcr*
251 SSR__create_procr_helper( VirtProcrFnPtr fnPtr, void *initData,
252 SSRSemEnv *semEnv, int32 coreToScheduleOnto );
254 #endif /* _SSR_H */
