From 4fc8cb1bf8ba372d978adcb770f53bdb23e22bd4 Mon Sep 17 00:00:00 2001 From: jjenista Date: Fri, 24 Sep 2010 19:48:00 +0000 Subject: [PATCH] there is definitely an uninitialized mem bug, temp fix is to zero allocated task records, however even with workaround pool allocation crashes SOR --- Robust/src/Benchmarks/oooJava/sor/makefile | 5 +- Robust/src/Benchmarks/oooJava/sor/runs | 2 + Robust/src/IR/Flat/BuildCode.java | 70 +++++++++------------ Robust/src/Runtime/memPool.h | 11 ++++ Robust/src/Runtime/mlp_runtime.h | 4 +- Robust/src/Tests/oooJava/poolalloc/makefile | 2 +- 6 files changed, 48 insertions(+), 46 deletions(-) create mode 100755 Robust/src/Benchmarks/oooJava/sor/runs diff --git a/Robust/src/Benchmarks/oooJava/sor/makefile b/Robust/src/Benchmarks/oooJava/sor/makefile index 6e5193b5..4f8d6da4 100644 --- a/Robust/src/Benchmarks/oooJava/sor/makefile +++ b/Robust/src/Benchmarks/oooJava/sor/makefile @@ -5,7 +5,10 @@ SOURCE_FILES=JGFSORBenchSizeD.java BUILDSCRIPT=../../../buildscript USEOOO= -ooojava 24 2 -ooodebug -BSFLAGS= -64bit -mainclass $(PROGRAM) -heapsize-mb 6*1024 -garbagestats -debug -joptimize -noloop -optimize #-coreprof -coreprof-eventwords 1024*1024*128 #-coreprof-checkoverflow + +BSFLAGS= -64bit -mainclass $(PROGRAM) -heapsize-mb 6*1024 -garbagestats -debug -joptimize -noloop -optimize -ooodebug-disable-task-mem-pool +#-coreprof -coreprof-eventwords 1024*1024*128 #-coreprof-checkoverflow + DISJOINT= -disjoint -disjoint-k 1 -enable-assertions #-disjoint-desire-determinism default: diff --git a/Robust/src/Benchmarks/oooJava/sor/runs b/Robust/src/Benchmarks/oooJava/sor/runs new file mode 100755 index 00000000..67fdaa14 --- /dev/null +++ b/Robust/src/Benchmarks/oooJava/sor/runs @@ -0,0 +1,2 @@ +#!/bin/sh +time ./JGFSORBenchSizeDs.bin diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index 9f94c886..884f9a1f 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -405,6 +405,7 @@ public class BuildCode { " ); }" ); } + outmethod.println(" runningSESE = NULL;"); outmethod.println(" workScheduleInit( "+state.MLP_NUMCORES+", invokeSESEmethod );"); @@ -3639,30 +3640,12 @@ public class BuildCode { if( state.COREPROF ) { output.println("CP_LOGEVENT( CP_EVENTID_TASKDISPATCH, CP_EVENTTYPE_BEGIN );"); } - - // set up the parent - if( (state.MLP && fsen == mlpa.getMainSESE()) || - (state.OOOJAVA && fsen == oooa.getMainSESE()) - ) { - output.println(" SESEcommon* parentCommon = NULL;"); - } else { - if( fsen.getParent() == null ) { - System.out.println( "in "+fm+", "+fsen+" has null parent" ); - } - assert fsen.getParent() != null; - if( !fsen.getParent().getIsCallerSESEplaceholder() ) { - output.println(" SESEcommon* parentCommon = &("+paramsprefix+"->common);"); - } else { - //output.println(" SESEcommon* parentCommon = (SESEcommon*) peekItem( seseCallStack );"); - output.println(" SESEcommon* parentCommon = runningSESE;"); - } - } // before doing anything, lock your own record and increment the running children if( (state.MLP && fsen != mlpa.getMainSESE()) || (state.OOOJAVA && fsen != oooa.getMainSESE()) ) { - output.println(" atomic_inc(&parentCommon->numRunningChildren);"); + output.println(" atomic_inc(&(runningSESE->numRunningChildren));"); } // allocate the space for this record @@ -3720,8 +3703,12 @@ public class BuildCode { output.println(" seseToIssue->common.doneExecuting = FALSE;"); output.println(" pthread_cond_init( &(seseToIssue->common.runningChildrenCond), NULL );"); output.println(" seseToIssue->common.numRunningChildren = 0;"); - output.println(" seseToIssue->common.parent = parentCommon;"); - output.println(" seseToIssue->common.refCount = 1;"); + output.println(" seseToIssue->common.parent = runningSESE;"); + // start with refCount = 2, one being the count that the child itself + // will decrement when it retires, to say it is done using its own + // record, and the other count is for the parent that will remember + // the static name of this new child below + output.println(" seseToIssue->common.refCount = 2;"); // all READY in-vars should be copied now and be done with it Iterator tempItr = fsen.getReadyInVarSet().iterator(); @@ -3865,19 +3852,26 @@ public class BuildCode { } output.println(" "+pairNewest+" = &(seseToIssue->common);"); } - // add a reference to whatever is the newest record after the shift - // and release a reference to whatever was the oldest BEFORE the shift - output.println(" ADD_REFERENCE_TO( "+pairNewest+" );"); + // no need to add a reference to whatever is the newest record, because + // we initialized seseToIssue->refCount to *2* + // but release a reference to whatever was the oldest BEFORE the shift output.println(" if( "+pairOldest+" != NULL ) {"); output.println(" RELEASE_REFERENCE_TO( "+pairOldest+" );"); output.println(" }"); + + //////////////// // count up memory conflict dependencies, // eom if(state.OOOJAVA){ + //output.println(" seseToIssue->common.numMemoryQueue=0;"); + //output.println(" seseToIssue->common.rentryIdx=0;"); + //output.println(" seseToIssue->common.unresolvedRentryIdx=0;"); + //output.println(" seseToIssue->common.memoryQueueArray=NULL;"); + FlatSESEEnterNode parent = fsen.getParent(); Analysis.OoOJava.ConflictGraph graph = oooa.getConflictGraph(parent); if (graph != null && graph.hasConflictEdge()) { @@ -3901,7 +3895,7 @@ public class BuildCode { seseWaitingQueue.getWaitingElementSet(queueID); int enqueueType=seseWaitingQueue.getType(queueID); if(enqueueType==SESEWaitingQueue.EXCEPTION){ - output.println(" INITIALIZEBUF(parentCommon->memoryQueueArray[" + output.println(" INITIALIZEBUF(runningSESE->memoryQueueArray[" + queueID+ "]);"); } for (Iterator iterator2 = waitingQueueSet.iterator(); iterator2.hasNext();) { @@ -3952,13 +3946,13 @@ public class BuildCode { + ");"); } } - output.println(" rentry->queue=parentCommon->memoryQueueArray[" + output.println(" rentry->queue=runningSESE->memoryQueueArray[" + waitingElement.getQueueID() + "];"); if(enqueueType==SESEWaitingQueue.NORMAL){ output.println(" seseToIssue->common.rentryArray[seseToIssue->common.rentryIdx++]=rentry;"); - output.println(" if(ADDRENTRY(parentCommon->memoryQueueArray[" + output.println(" if(ADDRENTRY(runningSESE->memoryQueueArray[" + waitingElement.getQueueID() + "],rentry)==NOTREADY){"); output.println(" ++(localCount);"); @@ -3988,13 +3982,13 @@ public class BuildCode { } }else{ output - .println(" ADDRENTRYTOBUF(parentCommon->memoryQueueArray[" + .println(" ADDRENTRYTOBUF(runningSESE->memoryQueueArray[" + waitingElement.getQueueID() + "],rentry);"); } } if(enqueueType!=SESEWaitingQueue.NORMAL){ - output.println(" localCount+=RESOLVEBUF(parentCommon->memoryQueueArray[" + output.println(" localCount+=RESOLVEBUF(runningSESE->memoryQueueArray[" + queueID+ "],&seseToIssue->common);"); } } @@ -4034,7 +4028,7 @@ public class BuildCode { Set waitingQueueSet = seseWaitingQueue.getWaitingElementSet(queueID); int enqueueType=seseWaitingQueue.getType(queueID); if(enqueueType==SESEWaitingQueue.EXCEPTION){ - output.println(" INITIALIZEBUF(parentCommon->memoryQueueArray[" + output.println(" INITIALIZEBUF(runningSESE->memoryQueueArray[" + queueID+ "]);"); } for (Iterator iterator2 = waitingQueueSet.iterator(); iterator2 @@ -4099,7 +4093,7 @@ public class BuildCode { } } output - .println(" rentry->queue=parentCommon->memoryQueueArray[" + .println(" rentry->queue=runningSESE->memoryQueueArray[" + waitingElement.getQueueID() + "];"); @@ -4107,20 +4101,20 @@ public class BuildCode { output .println(" seseToIssue->common.rentryArray[seseToIssue->common.rentryIdx++]=rentry;"); output - .println(" if(ADDRENTRY(parentCommon->memoryQueueArray[" + .println(" if(ADDRENTRY(runningSESE->memoryQueueArray[" + waitingElement.getQueueID() + "],rentry)==NOTREADY){"); output.println(" ++(localCount);"); output.println(" } "); }else{ output - .println(" ADDRENTRYTOBUF(parentCommon->memoryQueueArray[" + .println(" ADDRENTRYTOBUF(runningSESE->memoryQueueArray[" + waitingElement.getQueueID() + "],rentry);"); } } if(enqueueType!=SESEWaitingQueue.NORMAL){ - output.println(" localCount+=RESOLVEBUF(parentCommon->memoryQueueArray[" + output.println(" localCount+=RESOLVEBUF(runningSESE->memoryQueueArray[" + queueID+ "],&seseToIssue->common);"); } } @@ -4453,14 +4447,6 @@ public class BuildCode { private void generateFlatCall(FlatMethod fm, LocalityBinding lb, FlatCall fc, PrintWriter output) { - /* - if( (state.MLP && !nonSESEpass) || - (state.OOOJAVA && !nonSESEpass) - ) { - output.println(" runningSESE = (SESEcommon*)"+paramsprefix+";"); - } - */ - MethodDescriptor md=fc.getMethod(); ParamsObject objectparams=(ParamsObject)paramstable.get(lb!=null ? locality.getBinding(lb, fc) : md); ClassDescriptor cn=md.getClassDesc(); diff --git a/Robust/src/Runtime/memPool.h b/Robust/src/Runtime/memPool.h index 0bd4bad1..356e15e8 100644 --- a/Robust/src/Runtime/memPool.h +++ b/Robust/src/Runtime/memPool.h @@ -19,6 +19,10 @@ ////////////////////////////////////////////////////////// #include + +// just until uninitialized mem bug found +#include + #include "mlp_lock.h" @@ -109,10 +113,17 @@ static inline void* poolalloc( MemPool* p ) { if( headCurrent->next == NULL ) { // only one item, so don't take from pool + //return malloc( p->itemSize ); + + // just until uninitialized mem bug found return calloc( 1, p->itemSize ); } p->head = headCurrent->next; + + // just until uninitialized mem bug found + memset( headCurrent, 0, p->itemSize ); + return headCurrent; } diff --git a/Robust/src/Runtime/mlp_runtime.h b/Robust/src/Runtime/mlp_runtime.h index 4e351a50..21c86d96 100644 --- a/Robust/src/Runtime/mlp_runtime.h +++ b/Robust/src/Runtime/mlp_runtime.h @@ -87,8 +87,8 @@ typedef struct SESEcommon_t { struct SESEcommon_t* parent; - psemaphore parentStallSem; - pthread_cond_t stallDone; + //psemaphore parentStallSem; + //pthread_cond_t stallDone; int numMemoryQueue; int rentryIdx; diff --git a/Robust/src/Tests/oooJava/poolalloc/makefile b/Robust/src/Tests/oooJava/poolalloc/makefile index d9de9237..68d44644 100644 --- a/Robust/src/Tests/oooJava/poolalloc/makefile +++ b/Robust/src/Tests/oooJava/poolalloc/makefile @@ -5,7 +5,7 @@ SOURCE_FILES=test.java BUILDSCRIPT=../../../buildscript USEOOO= -ooojava 24 2 -ooodebug -BSFLAGS= -64bit -mainclass $(PROGRAM) -heapsize-mb 1024 -garbagestats -noloop -nooptimize -coreprof -coreprof-checkoverflow -coreprof -coreprof-eventwords 1024*1024*128 -debug -ooodebug-disable-task-mem-pool +BSFLAGS= -64bit -mainclass $(PROGRAM) -heapsize-mb 1024 -garbagestats -noloop -nooptimize -coreprof -coreprof-checkoverflow -coreprof -coreprof-eventwords 1024*1024*128 -debug #-ooodebug-disable-task-mem-pool DISJOINT= -disjoint -disjoint-k 1 -enable-assertions #-disjoint-desire-determinism all: ooo -- 2.34.1