comparison VMS.h @ 224:efcc6331a2a2

fixed stack handling in fn that points the slave to a top-level function
author Some Random Person <seanhalle@yahoo.com>
date Wed, 14 Mar 2012 23:21:01 -0700
parents c88ce1db91ef
children 309559064073
comparison
equal deleted inserted replaced
105:8b9169868d80 106:6a929cd504f9
13 #include "VMS_primitive_data_types.h" 13 #include "VMS_primitive_data_types.h"
14 #include "DynArray/DynArray.h" 14 #include "DynArray/DynArray.h"
15 #include "Hash_impl/PrivateHash.h" 15 #include "Hash_impl/PrivateHash.h"
16 #include "Histogram/Histogram.h" 16 #include "Histogram/Histogram.h"
17 #include "Queue_impl/PrivateQueue.h" 17 #include "Queue_impl/PrivateQueue.h"
18 #include "vmalloc.h" 18 #include "Services_Offered_by_VMS/Memory_Handling/vmalloc.h"
19 19
20 #include <pthread.h> 20 #include <pthread.h>
21 #include <sys/time.h> 21 #include <sys/time.h>
22 22
23 //================= Defines: included from separate files ================= 23 //================= Defines: included from separate files =================
24 // 24 //
25 // Note: ALL defines are in other files, none are in here 25 // Note: ALL defines are in other files, none are in here
26 // 26 //
27 #include "Defines/VMS_defs__main.h" 27 #include "Defines/VMS_defs.h"
28 28
29 29
30 //================================ Typedefs ================================= 30 //================================ Typedefs =================================
31 // 31 //
32 typedef unsigned long long TSCount; 32 typedef unsigned long long TSCount;
42 typedef struct _MasterVP MasterVP; 42 typedef struct _MasterVP MasterVP;
43 typedef struct _IntervalProbe IntervalProbe; 43 typedef struct _IntervalProbe IntervalProbe;
44 typedef struct _GateStruc GateStruc; 44 typedef struct _GateStruc GateStruc;
45 45
46 46
47 typedef SlaveVP * (*Sched_Assigner) ( void *, int ); //semEnv, coreIdx 47 typedef SlaveVP *(*SlaveAssigner) ( void *, int, SchedSlot *); //semEnv, coreIdx, slot for HW info
48 typedef void (*RequestHandler) ( SlaveVP *, void * ); //prWReqst, semEnv 48 typedef void (*RequestHandler) ( SlaveVP *, void * ); //prWReqst, semEnv
49 typedef void (*TopLevelFnPtr) ( void *, SlaveVP * ); //initData, animSlv 49 typedef void (*TopLevelFnPtr) ( void *, SlaveVP * ); //initData, animSlv
50 typedef void TopLevelFn ( void *, SlaveVP * ); //initData, animSlv 50 typedef void TopLevelFn ( void *, SlaveVP * ); //initData, animSlv
51 typedef void (*ResumeSlvFnPtr) ( SlaveVP *, void * ); 51 typedef void (*ResumeSlvFnPtr) ( SlaveVP *, void * );
52 52
53 //============================ HW Dependent Fns ================================ 53 //============================ HW Dependent Fns ================================
54 54
55 #include "Hardware_Dependent/VMS__HW_measurement.h" 55 #include "Hardware_Dependent/VMS__HW_measurement.h"
56 #include "Hardware_Dependent/VMS__primitives.h" 56 #include "Hardware_Dependent/VMS__primitives.h"
96 96
97 //==================== Core data structures =================== 97 //==================== Core data structures ===================
98 98
99 struct _SchedSlot 99 struct _SchedSlot
100 { 100 {
101 int slotIdx; //needed by Holistic Model's data gathering
101 int workIsDone; 102 int workIsDone;
102 int needsSlaveAssigned; 103 int needsSlaveAssigned;
103 SlaveVP *slaveAssignedToSlot; 104 SlaveVP *slaveAssignedToSlot;
104 }; 105 };
105 //SchedSlot 106 //SchedSlot
106 107
107 /*WARNING: re-arranging this data structure could cause Slv switching 108 /*WARNING: re-arranging this data structure could cause Slv switching
108 * assembly code to fail -- hard-codes offsets of fields 109 * assembly code to fail -- hard-codes offsets of fields
138 * assembly code to fail -- hard-codes offsets of fields 139 * assembly code to fail -- hard-codes offsets of fields
139 * (because -O3 messes with things otherwise) 140 * (because -O3 messes with things otherwise)
140 */ 141 */
141 typedef struct 142 typedef struct
142 { 143 {
143 Sched_Assigner slaveAssigner; 144 SlaveAssigner slaveAssigner;
144 RequestHandler requestHandler; 145 RequestHandler requestHandler;
145 146
146 SchedSlot ***allSchedSlots; 147 SchedSlot ***allSchedSlots;
147 VMSQueueStruc **readyToAnimateQs; 148 VMSQueueStruc **readyToAnimateQs;
148 SlaveVP **masterVPs; 149 SlaveVP **masterVPs;
149 150
150 void *semanticEnv; 151 void *semanticEnv;
151 void *OSEventStruc; //for future, when add I/O to BLIS 152 void *OSEventStruc; //for future, when add I/O to BLIS
152 MallocArrays *freeLists; 153 MallocArrays *freeLists;
153 int32 amtOfOutstandingMem; //total currently allocated 154 int32 amtOfOutstandingMem; //total currently allocated
154 155
155 void *coreCtlrReturnPt;//addr to jump to to re-enter coreCtlr 156 void *coreCtlrReturnPt;//addr to jump to to re-enter coreCtlr
156 157
157 int32 setupComplete; 158 int32 setupComplete;
158 int32 numMasterInARow[NUM_CORES];//detect back-to-back masterVP
159 int32 masterLock __align_to_cacheline__; 159 int32 masterLock __align_to_cacheline__;
160 GateStruc *workStealingGates[ NUM_CORES ]; //concurrent work-steal 160 GateStruc *workStealingGates[ NUM_CORES ]; //concurrent work-steal
161 int32 workStealingLock; 161 int32 workStealingLock;
162 162
163 int32 numSlavesCreated; //gives ordering to processor creation 163 int32 numSlavesCreated; //gives ordering to processor creation
233 233
234 //========== Setup and shutdown ========== 234 //========== Setup and shutdown ==========
235 void 235 void
236 VMS_SS__init(); 236 VMS_SS__init();
237 237
238 //Fix;
239 /*seed-slaveVP creation -- put box around language, have lang register stuff
240 with VMS.
241 have main program explicitly INIT Lang! -- makes more sense to
242 C programmers -- makes it clear that there's a transition.
243 (might need to have the pthreads remain waiting for
244 cond until work is scheduled)
245 Have main do call to tell language to perform work -- like did with DKU
246
247 Ex: "HWSim__run_a_simulation(netlist, paramBag);"
248 "processID = SSR__run_program(seed_fn, seedData); "
249 "SSR__Wait_for_program_to_end(processID);"
250 "SSR__run_program_and_wait_till_it_ends(seed_fn, seedData);"
251
252 allows multiple languages to be started, and programs run in several,
253 overlapped, or one program to be run that uses multiple langs..?
254 So, each program is in separate directory:
255 "HWSim_ArchDef__PingPong" "SSR_Program__Blocked_Matrix_Mult"
256
257 Those programs can talk to each other, via VMS, by handles they each
258 return
259 "processIDs[0] = SSR__run_program(seed_fn1, seedData1);"
260 "processIDs[1] = SSR__run_program(seed_fn2, seedData2);"
261 "SSR__link_programs(processIDs, 2);"
262 or even
263 "processIDs[0] = Vthread__run_program(seed_fn1, seedData1);"
264 "processIDs[1] = SSR__run_program(seed_fn2, seedData2);"
265 "VMS__link_programs(processIDs, 2);"
266 Then, the programs just know they sync with other prog, but use own
267 lang's sync constructs -- VMS uses message system to establish tie-pt,
268 each lang defines what a tie-point means to it.. (work with the
269 diff semantics?)
270 */
271 void 238 void
272 VMS_SS__start_the_work_then_wait_until_done(); 239 VMS_SS__start_the_work_then_wait_until_done();
273 240
274 void 241 void
275 VMS_SS__shutdown(); 242 VMS_SS__shutdown();
358 inline char * 325 inline char *
359 VMS_int__strDup( char *str ); 326 VMS_int__strDup( char *str );
360 327
361 328
362 //========================= Probes ======================= 329 //========================= Probes =======================
363 #include "Probes/probes.h" 330 #include "Services_Offered_by_VMS/Measurement_and_Stats/probes.h"
364 331
365 //================================================ 332 //================================================
366 #endif /* _VMS_H */ 333 #endif /* _VMS_H */
367 334