From: bdemsky Date: Tue, 9 Nov 2010 06:20:41 +0000 (+0000) Subject: changes X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=cfc850e2efb85c1861ece35c0cfca29f41cf9612;p=IRC.git changes --- diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index 158d7b78..156dc737 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -3115,7 +3115,7 @@ public class BuildCode { output.println(" // when you call RELEASE_REFERENCE_TO on a stall record."); output.println(" // so the parent field must be initialized."); output.println(" SESEstall * stallrecord=(SESEstall *) poolalloc(runningSESE->taskRecordMemPool);"); - output.println(" stallrecord->common.parent=runningSESE;"); + output.println(" stallrecord->common.parent=runningSESE;"); output.println(" stallrecord->common.unresolvedDependencies=10000;"); output.println(" stallrecord->common.rcrstatus=1;"); output.println(" stallrecord->common.offsetToParamRecords=(INTPTR) & (((SESEstall *)0)->rcrRecords);"); @@ -3141,8 +3141,12 @@ public class BuildCode { output.println(" rentry->queue=runningSESE->memoryQueueArray[" + waitingElement.getQueueID() + "];"); output.println(" if(ADDRENTRY(runningSESE->memoryQueueArray[" - + waitingElement.getQueueID() + "],rentry)==NOTREADY) "); + + waitingElement.getQueueID() + "],rentry)==NOTREADY) {"); output.println(" localCount--;"); + output.println(" }"); + output.println("#if defined(RCR)&&!defined(OOO_DISABLE_TASKMEMPOOL)"); + output.println(" else poolfreeinto(runningSESE->memoryQueueArray["+waitingElement.getQueueID()+"]->rentrypool, rentry);"); + output.println("#endif"); if (stalltd==null) { stalltd=waitingElement.getTempDesc(); } else if (stalltd!=waitingElement.getTempDesc()) { @@ -4576,6 +4580,7 @@ public class BuildCode { assert(waitingElement.getStatus()>=ConflictNode.COARSE); long mask=queuetovar.get(queueID); output.println(" rentry=mlpCreateREntry(runningSESE->memoryQueueArray["+ waitingElement.getQueueID()+ "]," + waitingElement.getStatus() + ", &(seseToIssue->common), "+mask+"LL);"); + output.println(" rentry->count=2;"); output.println(" seseToIssue->common.rentryArray[seseToIssue->common.rentryIdx++]=rentry;"); output.println(" rentry->queue=runningSESE->memoryQueueArray[" + waitingElement.getQueueID()+"];"); @@ -4716,13 +4721,15 @@ public class BuildCode { output.println(" SESEcommon* consumer = (SESEcommon*) getItem( &runningSESE->forwardList );"); - output.println(" if(consumer->rentryIdx>0){"); - output.println(" // resolved null pointer"); - output.println(" int idx;"); - output.println(" for(idx=0;idxrentryIdx;idx++){"); - output.println(" resolvePointer(consumer->rentryArray[idx]);"); - output.println(" }"); - output.println(" }"); + if (!state.RCR) { + output.println(" if(consumer->rentryIdx>0){"); + output.println(" // resolved null pointer"); + output.println(" int idx;"); + output.println(" for(idx=0;idxrentryIdx;idx++){"); + output.println(" resolvePointer(consumer->rentryArray[idx]);"); + output.println(" }"); + output.println(" }"); + } output.println(" if( atomic_sub_and_test( 1, &(consumer->unresolvedDependencies) ) ){"); output.println(" workScheduleSubmit( (void*)consumer );"); diff --git a/Robust/src/Runtime/garbage.c b/Robust/src/Runtime/garbage.c index 262b82bd..9094dd64 100644 --- a/Robust/src/Runtime/garbage.c +++ b/Robust/src/Runtime/garbage.c @@ -723,17 +723,6 @@ void collect(struct garbagelist * stackptr) { fixtags(); #endif -#ifdef MLP - { - //rehash memory queues of current running SESEs - struct listitem *listptr=list; - while(listptr!=NULL){ - rehashMemoryQueue((SESEcommon*)(listptr->seseCommon)); - listptr=listptr->next; - } - } -#endif - #if defined(THREADS)||defined(DSTM)||defined(STM)||defined(MLP) needtocollect=0; pthread_mutex_unlock(&gclistlock); diff --git a/Robust/src/Runtime/mlp_runtime.c b/Robust/src/Runtime/mlp_runtime.c index 5dcf2b97..ad1542b5 100644 --- a/Robust/src/Runtime/mlp_runtime.c +++ b/Robust/src/Runtime/mlp_runtime.c @@ -497,15 +497,15 @@ void TAILWRITECASE(Hashtable *T, REntry *r, BinItem *val, BinItem *bintail, int int ADDVECTOR(MemoryQueue *Q, REntry *r) { if(!isVector(Q->tail)) { //Fast Case - if (isParentCoarse(r) && Q->tail->total==0 && Q->tail==Q->head) { + if (isParentCoarse(r) && Q->tail->total==0 && Q->tail==Q->head) { return READY; } //added vector Vector* V=createVector(); - Q->tail->next=(MemoryQueueItem*)V; + Q->tail->next=(MemoryQueueItem*)V; //************NEED memory barrier here to ensure compiler does not cache Q.tail.status****** - if (BARRIER() && Q->tail->status==READY&&Q->tail->total==0) { + if (BARRIER() && Q->tail->status==READY&&Q->tail->total==0) { //previous Q item is finished V->item.status=READY; } @@ -541,7 +541,7 @@ int ADDVECTOR(MemoryQueue *Q, REntry *r) { r->qitem=(MemoryQueueItem *)V; if (BARRIER() && V->item.status==READY) { void* flag=NULL; - flag=(void*)LOCKXCHG((unsigned INTPTR*)&(V->array[index]), (unsigned INTPTR)flag); + flag=(void*)LOCKXCHG((unsigned INTPTR*)&(V->array[index]), (unsigned INTPTR)flag); if (flag!=NULL) { if (isParentCoarse(r)) { //parent's retire immediately atomic_dec(&V->item.total); @@ -597,7 +597,10 @@ void RETIRERENTRY(MemoryQueue* Q, REntry * r) { RETIRESCC(Q, r); } #ifndef OOO_DISABLE_TASKMEMPOOL - poolfreeinto(Q->rentrypool, r); +#ifdef RCR + if(atomic_sub_and_test(1, &r->count)) +#endif + poolfreeinto(Q->rentrypool, r); #endif } @@ -788,8 +791,15 @@ void RESOLVEVECTOR(MemoryQueue *q, Vector *V) { if (val!=NULL) { resolveDependencies(val); if (isParent(val)) { - atomic_dec(&tmp->item.total); - } + atomic_dec(&tmp->item.total); +#ifdef RCR + poolfreeinto(q->rentrypool,val); +#endif + } +#if defined(RCR)&&defined(OOO_DISABLE_TASKMEMPOOL) + else if (atomic_sub_and_test(1, &((REntry *)val)->count)) + poolfreeinto(q->rentrypool,val); +#endif } } if (tmp->item.next!=NULL&&isVector(tmp->item.next)) { @@ -806,6 +816,10 @@ void RESOLVESCC(SCC *S) { flag=(void*)LOCKXCHG((unsigned INTPTR*)&(S->val), (unsigned INTPTR)flag); if (flag!=NULL) { resolveDependencies(flag); +#if defined(RCR)&&defined(OOO_DISABLE_TASKMEMPOOL) + if (atomic_sub_and_test(1, &((REntry *)flag)->count)) + poolfreeinto(q->rentrypool, flag); +#endif } } @@ -905,6 +919,7 @@ int RESOLVEBUFFORHASHTABLE(MemoryQueue * q, Hashtable* table, SESEcommon *seseCo } } +#ifndef RCR int RESOLVEBUF(MemoryQueue * q, SESEcommon *seseCommon){ int localCount=0; int i; @@ -1044,6 +1059,4 @@ void resolvePointer(REntry* rentry){ table->unresolvedQueue=val;//released lock; } } - -void rehashMemoryQueue(SESEcommon* seseParent){ -} +#endif diff --git a/Robust/src/Runtime/mlp_runtime.h b/Robust/src/Runtime/mlp_runtime.h index 2d51ac97..3e1610e0 100644 --- a/Robust/src/Runtime/mlp_runtime.h +++ b/Robust/src/Runtime/mlp_runtime.h @@ -148,7 +148,11 @@ typedef struct REntry_t{ // fine read:0, fine write:1, parent read:2, // parent write:3 coarse: 4, parent coarse:5, scc: 6 int type; +#ifdef RCR + int count; +#else int isBufMode; +#endif struct MemoryQueueItem_t *qitem; struct BinItem_t* binitem; struct MemoryQueue_t* queue; @@ -280,6 +284,10 @@ void RESOLVEVECTOR(MemoryQueue *q, Vector *V); void RESOLVESCC(SCC *S); void resolveDependencies(REntry* rentry); +#ifndef RCR +int RESOLVEBUF(MemoryQueue * q, SESEcommon *seseCommon); +void resolvePointer(REntry* rentry); +#endif static inline void ADD_REFERENCE_TO( SESEcommon* seseRec ) { atomic_inc( &(seseRec->refCount) );