Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VCilk_impls > VCilk__MC_shared_impl
changeset 4:96420af6b7e8
Nov15 vers for PLDI Fixed bug in create procr & added plugin time-meas
| author | Me |
|---|---|
| date | Tue, 16 Nov 2010 15:59:23 +0100 |
| parents | b98f0f8da7d9 |
| children | 5494943ed3a4 |
| files | VCilk_PluginFns.c VCilk_lib.c |
| diffstat | 2 files changed, 31 insertions(+), 18 deletions(-) [+] |
line diff
1.1 --- a/VCilk_PluginFns.c Thu Nov 11 04:58:05 2010 -0800 1.2 +++ b/VCilk_PluginFns.c Tue Nov 16 15:59:23 2010 +0100 1.3 @@ -90,6 +90,13 @@ 1.4 VMSReqst *req; 1.5 VCilkSemReq *semReq; 1.6 1.7 + //============================= MEASUREMENT STUFF ======================== 1.8 + #ifdef MEAS__TIME_PLUGIN 1.9 + int32 startStamp, endStamp; 1.10 + saveLowTimeStampCountInto( startStamp ); 1.11 + #endif 1.12 + //======================================================================== 1.13 + 1.14 semEnv = (VCilkSemEnv *)_semEnv; 1.15 1.16 req = VMS__take_next_request_out_of( requestingPr ); 1.17 @@ -120,6 +127,13 @@ 1.18 req = VMS__take_next_request_out_of( requestingPr ); 1.19 } //while( req != NULL ) 1.20 1.21 + //============================= MEASUREMENT STUFF ======================== 1.22 + #ifdef MEAS__TIME_PLUGIN 1.23 + saveLowTimeStampCountInto( endStamp ); 1.24 + addIntervalToHist( startStamp, endStamp, _VMSMasterEnv->pluginLowTimeHist ); 1.25 + addIntervalToHist( startStamp, endStamp, _VMSMasterEnv->pluginHighTimeHist ); 1.26 + #endif 1.27 + //======================================================================== 1.28 } 1.29 1.30 void inline 1.31 @@ -205,10 +219,10 @@ 1.32 /*Re-use this in the entry-point fn 1.33 */ 1.34 inline VirtProcr * 1.35 -VCilk__create_procr_helper( VirtProcrFnPtr fnPtr, void *initData, 1.36 - VCilkSemEnv *semEnv, int32 coreToScheduleOnto ) 1.37 +VCilk__create_procr_helper( VirtProcrFnPtr fnPtr, void *initData, 1.38 + VirtProcr *requestingPr, VCilkSemEnv *semEnv, int32 coreToScheduleOnto ) 1.39 { VirtProcr *newPr; 1.40 - VCilkSemData semData; 1.41 + VCilkSemData *semData; 1.42 1.43 //This is running in master, so use internal version 1.44 newPr = VMS__create_procr( fnPtr, initData ); 1.45 @@ -216,7 +230,7 @@ 1.46 semData = VMS__malloc( sizeof(VCilkSemData) ); 1.47 1.48 semData->numLiveChildren = 0; 1.49 - semData->parentPr = NULL; 1.50 + semData->parentPr = requestingPr; 1.51 semData->syncPending = FALSE; 1.52 1.53 semData->highestTransEntered = -1; 1.54 @@ -224,11 +238,10 @@ 1.55 1.56 newPr->semanticData = semData; 1.57 1.58 - /* add newly created to the list of live children of requester. 1.59 - * In newly created, add pointer to VP requesting, as the parentVP 1.60 + /* increase the number of live children of requester. 1.61 */ 1.62 - ((VCilkSemData *)(newPr->semanticData))->numLiveChildren +=1; 1.63 - ((VCilkSemData *)(newPr->semanticData))->parentPr = newPr; 1.64 + if( requestingPr != NULL ) //NULL when creating seed procr 1.65 + ((VCilkSemData *)(requestingPr->semanticData))->numLiveChildren +=1; 1.66 1.67 semEnv->numVirtPr += 1; 1.68 1.69 @@ -264,8 +277,8 @@ 1.70 1.71 semReq = VMS__take_sem_reqst_from( req ); 1.72 1.73 - newPr = VCilk__create_procr_helper( semReq->fnPtr, semReq->initData, semEnv, 1.74 - semReq->coreToSpawnOnto ); 1.75 + newPr = VCilk__create_procr_helper( semReq->fnPtr, semReq->initData, 1.76 + requestingPr, semEnv, semReq->coreToSpawnOnto ); 1.77 1.78 //For VPThread, caller needs ptr to created processor returned to it 1.79 requestingPr->dataRetFromReq = newPr; 1.80 @@ -296,13 +309,13 @@ 1.81 { 1.82 ((VCilkSemData *)(parentPr->semanticData))->numLiveChildren -= 1; 1.83 if( ((VCilkSemData *) 1.84 - (parentPr->semanticData))->numLiveChildren <= 0 ) 1.85 + (parentPr->semanticData))->numLiveChildren <= 0 ) 1.86 { //this was last live child of parent 1.87 if( ((VCilkSemData *) 1.88 - (parentPr->semanticData))->syncPending == TRUE ) 1.89 + (parentPr->semanticData))->syncPending == TRUE ) 1.90 { //was waiting for last child to dissipate, so resume it 1.91 ((VCilkSemData *) 1.92 - (parentPr->semanticData))->syncPending = FALSE; 1.93 + (parentPr->semanticData))->syncPending = FALSE; 1.94 resume_procr( parentPr, semEnv ); 1.95 } 1.96 }
2.1 --- a/VCilk_lib.c Thu Nov 11 04:58:05 2010 -0800 2.2 +++ b/VCilk_lib.c Tue Nov 16 15:59:23 2010 +0100 2.3 @@ -103,8 +103,8 @@ 2.4 2.5 //VCilk starts with one processor, which is put into initial environ, 2.6 // and which then calls create() to create more, thereby expanding work 2.7 - seedPr = VCilk__create_procr_helper( fnPtr, initData, semEnv, -1 ); 2.8 - resume_procr( seedPr ); 2.9 + seedPr = VCilk__create_procr_helper( fnPtr, initData, NULL, semEnv, -1 ); 2.10 + resume_procr( seedPr, semEnv ); 2.11 2.12 #ifdef SEQUENTIAL 2.13 VMS__start_the_work_then_wait_until_done_Seq(); //debug sequential exe 2.14 @@ -211,7 +211,7 @@ 2.15 2.16 for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ ) 2.17 { 2.18 - readyVPQs[ coreIdx ] = makePrivQ(); 2.19 + readyVPQs[ coreIdx ] = makeVMSPrivQ(); 2.20 } 2.21 2.22 semanticEnv->readyVPQs = readyVPQs; 2.23 @@ -226,7 +226,7 @@ 2.24 for( i = 0; i < NUM_STRUCS_IN_SEM_ENV; i++ ) 2.25 { 2.26 semanticEnv->singletonHasBeenExecutedFlags[i] = FALSE; 2.27 - semanticEnv->transactionStrucs[i].waitingVPQ = makePrivQ(); 2.28 + semanticEnv->transactionStrucs[i].waitingVPQ = makeVMSPrivQ(); 2.29 } 2.30 2.31 } 2.32 @@ -426,4 +426,4 @@ 2.33 reqData.transID = transactionID; 2.34 2.35 VMS__send_sem_request( &reqData, animPr ); 2.36 - } 2.37 \ No newline at end of file 2.38 + }
