Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
changeset 234:0ee1a3c8972d Common_Ancestor
Merged Nina's fix of assembly with Sean's comments and cleanup
| author | Some Random Person <seanhalle@yahoo.com> |
|---|---|
| date | Fri, 16 Mar 2012 10:43:15 -0700 |
| parents | a0ac58d8201c 5bb234f93cf6 |
| children | ecbf6992dab4 |
| files | Hardware_Dependent/VMS__HW_measurement.h Hardware_Dependent/VMS__primitives_asm.s Services_Offered_by_VMS/Measurement_and_Stats/MEAS__macros.h VMS.h VMS__int.c VMS__startup_and_shutdown.c |
| diffstat | 8 files changed, 86 insertions(+), 7 deletions(-) [+] |
line diff
1.1 --- a/Defines/VMS_defs__HW_constants.h Fri Mar 16 09:39:53 2012 -0700 1.2 +++ b/Defines/VMS_defs__HW_constants.h Fri Mar 16 10:43:15 2012 -0700 1.3 @@ -18,7 +18,7 @@ 1.4 1.5 // tradeoff amortizing master fixed overhead vs imbalance potential 1.6 // when work-stealing, can make bigger, at risk of losing cache affinity 1.7 -#define NUM_SCHED_SLOTS 3 1.8 +#define NUM_SCHED_SLOTS 1 1.9 1.10 //These are for backoff inside core-loop, which reduces lock contention 1.11 #define NUM_REPS_W_NO_WORK_BEFORE_YIELD 10
2.1 --- a/Defines/VMS_defs__turn_on_and_off.h Fri Mar 16 09:39:53 2012 -0700 2.2 +++ b/Defines/VMS_defs__turn_on_and_off.h Fri Mar 16 10:43:15 2012 -0700 2.3 @@ -21,7 +21,7 @@ 2.4 /*turns on the probe-instrumentation in the application -- when not 2.5 * defined, the calls to the probe functions turn into comments 2.6 */ 2.7 -#define DEBUG__TURN_ON_DEBUG_PRINT 2.8 +//#define DEBUG__TURN_ON_DEBUG_PRINT 2.9 2.10 /*These defines turn types of bug messages on and off 2.11 */ 2.12 @@ -60,6 +60,9 @@ 2.13 /*turn on/off subtraction of create measurements from plugin meas*/ 2.14 //#define MEAS__TURN_ON_EXCLUDE_CREATION_TIME 2.15 2.16 +#define HOLISTIC__TURN_ON_PERF_COUNTERS 2.17 +#define HOLISTIC__TURN_ON_OBSERVE_UCC 2.18 +#define DETECT_LOOP_GRAPH 2.19 2.20 //=================== Turn on or off system options ======================= 2.21 //
3.1 --- a/Hardware_Dependent/VMS__HW_measurement.h Fri Mar 16 09:39:53 2012 -0700 3.2 +++ b/Hardware_Dependent/VMS__HW_measurement.h Fri Mar 16 10:43:15 2012 -0700 3.3 @@ -57,6 +57,6 @@ 3.4 // different cores. 3.5 //#define NUM_TSC_ROUND_TRIPS 10 3.6 3.7 - 3.8 +void setup_perf_counters(); 3.9 #endif /* */ 3.10
4.1 --- a/Hardware_Dependent/VMS__primitives_asm.s Fri Mar 16 09:39:53 2012 -0700 4.2 +++ b/Hardware_Dependent/VMS__primitives_asm.s Fri Mar 16 10:43:15 2012 -0700 4.3 @@ -100,7 +100,7 @@ 4.4 movq $_VMSMasterEnv, %rcx 4.5 movq (%rcx), %rcx #_VMSMasterEnv is pointer to struct 4.6 movq 0x00(%rcx), %rax #get CoreCtlr return pt 4.7 - movl $0x0 , 0x08(%rcx) #release lock 4.8 + movl $0x0 , 0x100(%rcx) #release lock 4.9 jmp *%rax #jmp to CoreCtlr 4.10 MasterReturn: 4.11 ret
5.1 --- a/Services_Offered_by_VMS/Measurement_and_Stats/MEAS__macros.h Fri Mar 16 09:39:53 2012 -0700 5.2 +++ b/Services_Offered_by_VMS/Measurement_and_Stats/MEAS__macros.h Fri Mar 16 10:43:15 2012 -0700 5.3 @@ -292,12 +292,57 @@ 5.4 #define MEAS__Print_Hists_for_System_Meas 5.5 #endif 5.6 5.7 + #ifdef HOLISTIC__TURN_ON_PERF_COUNTERS 5.8 + 5.9 +#define MEAS__Insert_Counter_Handler \ 5.10 + typedef void (*CounterHandler) (int,int,int,SlaveVP*,uint64,uint64); 5.11 + 5.12 + enum eventType { 5.13 + DebugEvt = 0, 5.14 + AppResponderInvocation_start, 5.15 + AppResponder_start, 5.16 + AppResponder_end, 5.17 + AssignerInvocation_start, 5.18 + NextAssigner_start, 5.19 + Assigner_start, 5.20 + Assigner_end, 5.21 + Work_start, 5.22 + Work_end, 5.23 + HwResponderInvocation_start, 5.24 + Timestamp_start, 5.25 + Timestamp_end 5.26 + }; 5.27 + 5.28 + 5.29 + #define MEAS__Insert_Counter_Meas_Fields_into_MasterEnv \ 5.30 + int cycles_counter_fd[NUM_CORES]; \ 5.31 + int instrs_counter_fd[NUM_CORES]; \ 5.32 + uint64 start_master_lock[NUM_CORES][2]; \ 5.33 + CounterHandler counterHandler; 5.34 + 5.35 + #define HOLISTIC__Setup_Perf_Counters void setup_perf_counters(); 5.36 + 5.37 + #define HOLISTIC__Start_Perf_Counters prctl(PR_TASK_PERF_EVENTS_ENABLE); 5.38 + 5.39 + #define HOLISTIC__Record_HwResponderInvocation_start \ 5.40 + uint64 cycles,instrs; \ 5.41 + saveCyclesAndInstrs(animatingPr->coreAnimatedBy,cycles, instrs); \ 5.42 + (*(_VMSMasterEnv->counterHandler))(HwResponderInvocation_start,animatingPr->procrID,animatingPr->numTimesScheduled,animatingPr,cycles,instrs); 5.43 + 5.44 + 5.45 + 5.46 +#else 5.47 + #define MEAS__Insert_Counter_Handler 5.48 + #define MEAS__Insert_Counter_Meas_Fields_into_MasterEnv 5.49 + #define HOLISTIC__Setup_Perf_Counters 5.50 + #define HOLISTIC__Start_Perf_Counters 5.51 +#endif 5.52 5.53 //Experiment in two-step macros -- if doesn't work, insert each separately 5.54 #define MEAS__Insert_Meas_Fields_into_Slave \ 5.55 MEAS__Insert_Susp_Meas_Fields_into_Slave \ 5.56 MEAS__Insert_Master_Meas_Fields_into_Slave \ 5.57 - MEAS__Insert_System_Meas_Fields_into_Slave 5.58 + MEAS__Insert_System_Meas_Fields_into_Slave 5.59 5.60 5.61 //====================== Histogram Macros -- Create ========================
6.1 --- a/VMS.h Fri Mar 16 09:39:53 2012 -0700 6.2 +++ b/VMS.h Fri Mar 16 10:43:15 2012 -0700 6.3 @@ -43,6 +43,9 @@ 6.4 typedef void (*TopLevelFnPtr) ( void *, SlaveVP * ); //initData, animSlv 6.5 typedef void TopLevelFn ( void *, SlaveVP * ); //initData, animSlv 6.6 typedef void (*ResumeSlvFnPtr) ( SlaveVP *, void * ); 6.7 + //=========== MEASUREMENT STUFF ========== 6.8 + MEAS__Insert_Counter_Handler 6.9 + //======================================== 6.10 6.11 //============================ HW Dependent Fns ================================ 6.12 6.13 @@ -105,6 +108,12 @@ 6.14 }; 6.15 //SchedSlot 6.16 6.17 + enum VPtype { 6.18 + Slave = 1, //default 6.19 + Master, 6.20 + Shutdown 6.21 + }; 6.22 + 6.23 /*This structure embodies the state of a slaveVP. It is reused for masterVP 6.24 * and shutdownVPs. 6.25 */ 6.26 @@ -133,7 +142,10 @@ 6.27 MEAS__Insert_Meas_Fields_into_Slave; 6.28 //======================================== 6.29 6.30 - float64 createPtInSecs; //have space but don't use on some configs 6.31 + enum VPtype type; 6.32 + int numTimesAssigned; 6.33 + 6.34 + float64 createPtInSecs; //have space but don't use on some configs 6.35 }; 6.36 //SlaveVP 6.37 6.38 @@ -181,6 +193,7 @@ 6.39 MEAS__Insert_Malloc_Meas_Fields_into_MasterEnv; 6.40 MEAS__Insert_Plugin_Meas_Fields_into_MasterEnv; 6.41 MEAS__Insert_System_Meas_Fields_into_MasterEnv; 6.42 + MEAS__Insert_Counter_Meas_Fields_into_MasterEnv; 6.43 //========================================== 6.44 } 6.45 MasterEnv; 6.46 @@ -246,6 +259,9 @@ 6.47 void 6.48 VMS_SS__start_the_work_then_wait_until_done(); 6.49 6.50 +SlaveVP* 6.51 +VMS_SS__create_shutdown_slave(); 6.52 + 6.53 void 6.54 VMS_SS__shutdown(); 6.55
7.1 --- a/VMS__int.c Fri Mar 16 09:39:53 2012 -0700 7.2 +++ b/VMS__int.c Fri Mar 16 10:43:15 2012 -0700 7.3 @@ -175,6 +175,8 @@ 7.4 newSlv->slaveID = _VMSMasterEnv->numSlavesCreated++; 7.5 newSlv->requests = NULL; 7.6 newSlv->schedSlotAssignedTo = NULL; 7.7 + newSlv->type = Slave; 7.8 + newSlv->numTimesAssigned = 0; 7.9 7.10 VMS_int__point_slaveVP_to_Fn( newSlv, fnPtr, dataParam ); 7.11
8.1 --- a/VMS__startup_and_shutdown.c Fri Mar 16 09:39:53 2012 -0700 8.2 +++ b/VMS__startup_and_shutdown.c Fri Mar 16 10:43:15 2012 -0700 8.3 @@ -82,6 +82,7 @@ 8.4 printf( "\n\n Running in SEQUENTIAL mode \n\n" ); 8.5 #else 8.6 create_masterEnv(); 8.7 + printf("Offset of lock in masterEnv:%d\n",offsetof(MasterEnv,masterLock)); 8.8 create_the_coreCtlr_OS_threads(); 8.9 #endif 8.10 } 8.11 @@ -305,6 +306,7 @@ 8.12 //Q: should give masterVP core-specific info as its init data? 8.13 masterVPs[ coreIdx ] = VMS_int__create_slaveVP( (TopLevelFnPtr)&animationMaster, (void*)masterEnv ); 8.14 masterVPs[ coreIdx ]->coreAnimatedBy = coreIdx; 8.15 + masterVPs[ coreIdx ]->type = Master; 8.16 allSchedSlots[ coreIdx ] = create_sched_slots(); //makes for one core 8.17 } 8.18 _VMSMasterEnv->masterVPs = masterVPs; 8.19 @@ -323,6 +325,8 @@ 8.20 8.21 PROBES__Create_Probe_Bookkeeping_Vars; 8.22 8.23 + HOLISTIC__Setup_Perf_Counters; 8.24 + 8.25 //======================================================================== 8.26 } 8.27 8.28 @@ -448,6 +452,15 @@ 8.29 } 8.30 8.31 8.32 +SlaveVP* VMS_SS__create_shutdown_slave(){ 8.33 + SlaveVP* shutdownVP; 8.34 + 8.35 + shutdownVP = VMS_int__create_slaveVP( &endOSThreadFn, NULL ); 8.36 + shutdownVP->type = Shutdown; 8.37 + 8.38 + return shutdownVP; 8.39 +} 8.40 + 8.41 //TODO: look at architecting cleanest separation between request handler 8.42 // and animation master, for dissipate, create, shutdown, and other non-semantic 8.43 // requests. Issue is chain: one removes requests from AppSlv, one dispatches 8.44 @@ -489,7 +502,7 @@ 8.45 // directly into the Q -- each core will die when gets one 8.46 for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ ) 8.47 { //Note, this is running in the master 8.48 - shutDownSlv = VMS_int__create_slaveVP( &endOSThreadFn, NULL ); 8.49 + shutDownSlv = VMS_SS__create_shutdown_slave(); 8.50 //last slave has dissipated, so no more in slots, so write 8.51 // shut down slave into first schedulng slot. 8.52 schedSlots = _VMSMasterEnv->allSchedSlots[ coreIdx ];
