# HG changeset patch # User Me # Date 1289919563 -3600 # Node ID 96420af6b7e80e999ac1ad0123cb51812d03e9c2 # Parent b98f0f8da7d92f16cda16a83a4d8f23b426a8103 Nov15 vers for PLDI Fixed bug in create procr & added plugin time-meas diff -r b98f0f8da7d9 -r 96420af6b7e8 VCilk_PluginFns.c --- a/VCilk_PluginFns.c Thu Nov 11 04:58:05 2010 -0800 +++ b/VCilk_PluginFns.c Tue Nov 16 15:59:23 2010 +0100 @@ -90,6 +90,13 @@ VMSReqst *req; VCilkSemReq *semReq; + //============================= MEASUREMENT STUFF ======================== + #ifdef MEAS__TIME_PLUGIN + int32 startStamp, endStamp; + saveLowTimeStampCountInto( startStamp ); + #endif + //======================================================================== + semEnv = (VCilkSemEnv *)_semEnv; req = VMS__take_next_request_out_of( requestingPr ); @@ -120,6 +127,13 @@ req = VMS__take_next_request_out_of( requestingPr ); } //while( req != NULL ) + //============================= MEASUREMENT STUFF ======================== + #ifdef MEAS__TIME_PLUGIN + saveLowTimeStampCountInto( endStamp ); + addIntervalToHist( startStamp, endStamp, _VMSMasterEnv->pluginLowTimeHist ); + addIntervalToHist( startStamp, endStamp, _VMSMasterEnv->pluginHighTimeHist ); + #endif + //======================================================================== } void inline @@ -205,10 +219,10 @@ /*Re-use this in the entry-point fn */ inline VirtProcr * -VCilk__create_procr_helper( VirtProcrFnPtr fnPtr, void *initData, - VCilkSemEnv *semEnv, int32 coreToScheduleOnto ) +VCilk__create_procr_helper( VirtProcrFnPtr fnPtr, void *initData, + VirtProcr *requestingPr, VCilkSemEnv *semEnv, int32 coreToScheduleOnto ) { VirtProcr *newPr; - VCilkSemData semData; + VCilkSemData *semData; //This is running in master, so use internal version newPr = VMS__create_procr( fnPtr, initData ); @@ -216,7 +230,7 @@ semData = VMS__malloc( sizeof(VCilkSemData) ); semData->numLiveChildren = 0; - semData->parentPr = NULL; + semData->parentPr = requestingPr; semData->syncPending = FALSE; semData->highestTransEntered = -1; @@ -224,11 +238,10 @@ newPr->semanticData = semData; - /* add newly created to the list of live children of requester. - * In newly created, add pointer to VP requesting, as the parentVP + /* increase the number of live children of requester. */ - ((VCilkSemData *)(newPr->semanticData))->numLiveChildren +=1; - ((VCilkSemData *)(newPr->semanticData))->parentPr = newPr; + if( requestingPr != NULL ) //NULL when creating seed procr + ((VCilkSemData *)(requestingPr->semanticData))->numLiveChildren +=1; semEnv->numVirtPr += 1; @@ -264,8 +277,8 @@ semReq = VMS__take_sem_reqst_from( req ); - newPr = VCilk__create_procr_helper( semReq->fnPtr, semReq->initData, semEnv, - semReq->coreToSpawnOnto ); + newPr = VCilk__create_procr_helper( semReq->fnPtr, semReq->initData, + requestingPr, semEnv, semReq->coreToSpawnOnto ); //For VPThread, caller needs ptr to created processor returned to it requestingPr->dataRetFromReq = newPr; @@ -296,13 +309,13 @@ { ((VCilkSemData *)(parentPr->semanticData))->numLiveChildren -= 1; if( ((VCilkSemData *) - (parentPr->semanticData))->numLiveChildren <= 0 ) + (parentPr->semanticData))->numLiveChildren <= 0 ) { //this was last live child of parent if( ((VCilkSemData *) - (parentPr->semanticData))->syncPending == TRUE ) + (parentPr->semanticData))->syncPending == TRUE ) { //was waiting for last child to dissipate, so resume it ((VCilkSemData *) - (parentPr->semanticData))->syncPending = FALSE; + (parentPr->semanticData))->syncPending = FALSE; resume_procr( parentPr, semEnv ); } } diff -r b98f0f8da7d9 -r 96420af6b7e8 VCilk_lib.c --- a/VCilk_lib.c Thu Nov 11 04:58:05 2010 -0800 +++ b/VCilk_lib.c Tue Nov 16 15:59:23 2010 +0100 @@ -103,8 +103,8 @@ //VCilk starts with one processor, which is put into initial environ, // and which then calls create() to create more, thereby expanding work - seedPr = VCilk__create_procr_helper( fnPtr, initData, semEnv, -1 ); - resume_procr( seedPr ); + seedPr = VCilk__create_procr_helper( fnPtr, initData, NULL, semEnv, -1 ); + resume_procr( seedPr, semEnv ); #ifdef SEQUENTIAL VMS__start_the_work_then_wait_until_done_Seq(); //debug sequential exe @@ -211,7 +211,7 @@ for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ ) { - readyVPQs[ coreIdx ] = makePrivQ(); + readyVPQs[ coreIdx ] = makeVMSPrivQ(); } semanticEnv->readyVPQs = readyVPQs; @@ -226,7 +226,7 @@ for( i = 0; i < NUM_STRUCS_IN_SEM_ENV; i++ ) { semanticEnv->singletonHasBeenExecutedFlags[i] = FALSE; - semanticEnv->transactionStrucs[i].waitingVPQ = makePrivQ(); + semanticEnv->transactionStrucs[i].waitingVPQ = makeVMSPrivQ(); } } @@ -426,4 +426,4 @@ reqData.transID = transactionID; VMS__send_sem_request( &reqData, animPr ); - } \ No newline at end of file + }