From: jjenista Date: Tue, 12 Oct 2010 22:22:30 +0000 (+0000) Subject: ok, this is a wacky commit, purposefully leaving a half-implemented forward Q change... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b0555fc26840dce0fa95a4f521e390956c0c0197;p=IRC.git ok, this is a wacky commit, purposefully leaving a half-implemented forward Q change in, but benign, because pool allocation by itslef might have fixed ray tracer up very nicely, but gotta check it out first --- diff --git a/Robust/src/Benchmarks/oooJava/master-makefile b/Robust/src/Benchmarks/oooJava/master-makefile index 56ae7f05..edb433a7 100644 --- a/Robust/src/Benchmarks/oooJava/master-makefile +++ b/Robust/src/Benchmarks/oooJava/master-makefile @@ -14,11 +14,11 @@ BUILDSCRIPT=../../../buildscript COREPROFOVERFLOW= #-coreprof-checkoverflow USECOREPROF= #-coreprof $(COREPROFOVERFLOW) \ - -coreprof-eventwords 1024*1024*128 \ - -coreprof-enable cpe_main \ - -coreprof-enable cpe_taskdispatch +# -coreprof-eventwords 1024*1024*128 \ +# -coreprof-enable cpe_main \ +# -coreprof-enable cpe_taskdispatch \ +# -coreprof-enable cpe_runmalloc # -coreprof-enable cpe_taskexecute \ -# -coreprof-enable cpe_runmalloc \ # -coreprof-enable cpe_runfree \ # -coreprof-enable cpe_count_poolalloc \ # -coreprof-enable cpe_count_poolreuse \ @@ -28,7 +28,7 @@ USECOREPROF= #-coreprof $(COREPROFOVERFLOW) \ # -coreprof-enable cpe_taskstallmem -USEOOO= -ooojava 24 2 -ooodebug -ooodebug-disable-task-mem-pool +USEOOO= -ooojava 24 2 -ooodebug-disable-task-mem-pool -ooodebug BSFLAGS= -64bit -mainclass $(PROGRAM) -heapsize-mb 1024 -garbagestats -joptimize -noloop -optimize #-debug DRELEASEMODE=-disjoint-release-mode -disjoint-dvisit-stack-callees-on-top -disjoint-alias-file aliases.txt tabbed diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index aca3697b..60080861 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -3734,6 +3734,9 @@ public class BuildCode { output.println(" psem_init( &(seseToIssue->common.stallSem) );"); output.println(" seseToIssue->common.forwardList = createQueue();"); + //output.println(" seseToIssue->common.forwardList.numItems = 0;"); + //output.println(" seseToIssue->common.forwardList.nextElement = NULL;"); + output.println(" seseToIssue->common.unresolvedDependencies = 10000;"); output.println(" pthread_cond_init( &(seseToIssue->common.doneCond), NULL );"); output.println(" seseToIssue->common.doneExecuting = FALSE;"); @@ -3787,24 +3790,27 @@ public class BuildCode { SESEandAgePair srcPair = staticSrcsItr.next(); output.println(" {"); output.println(" SESEcommon* src = (SESEcommon*)"+srcPair+";"); - //eomgc + + if(GENERATEPRECISEGC){ - output.println(" stopforgc((struct garbagelist *)&___locals___);"); + output.println(" stopforgc((struct garbagelist *)&___locals___);"); } + output.println(" pthread_mutex_lock( &(src->lock) );"); - if(GENERATEPRECISEGC){ - output.println(" restartaftergc();"); + + if(GENERATEPRECISEGC){ + output.println(" restartaftergc();"); } - output.println(" if( !isEmpty( src->forwardList ) &&"); - output.println(" seseToIssue == peekItem( src->forwardList ) ) {"); - output.println(" printf( \"This shouldnt already be here\\n\");"); - output.println(" exit( -1 );"); - output.println(" }"); + + // FORWARD TODO output.println(" if( !src->doneExecuting ) {"); - output.println(" addNewItem( src->forwardList, seseToIssue );"); + output.println(" addNewItem( src->forwardList, seseToIssue );"); + //output.println(" ADD_FORWARD_ITEM( src->forwardList, seseToIssue );"); output.println(" ++(localCount);"); output.println(" }"); + output.println("#ifndef OOO_DISABLE_TASKMEMPOOL" ); output.println(" ADD_REFERENCE_TO( src );"); + output.println("#endif" ); output.println(" pthread_mutex_unlock( &(src->lock) );"); output.println(" }"); @@ -3835,6 +3841,9 @@ public class BuildCode { if(GENERATEPRECISEGC){ output.println(" restartaftergc();"); } + + // FORWARD TODO + output.println(" if( isEmpty( src->forwardList ) ||"); output.println(" seseToIssue != peekItem( src->forwardList ) ) {"); output.println(" if( !src->doneExecuting ) {"); @@ -3842,7 +3851,9 @@ public class BuildCode { output.println(" ++(localCount);"); output.println(" }"); output.println(" }"); + output.println("#ifndef OOO_DISABLE_TASKMEMPOOL" ); output.println(" ADD_REFERENCE_TO( src );"); + output.println("#endif" ); output.println(" pthread_mutex_unlock( &(src->lock) );"); output.println(" seseToIssue->"+dynInVar+"_srcOffset = "+dynInVar+"_srcOffset;"); output.println(" } else {"); @@ -4299,6 +4310,8 @@ public class BuildCode { output.println(" pthread_mutex_unlock( &("+com+".lock) );"); // decrement dependency count for all SESE's on your forwarding list + + // FORWARD TODO output.println(" while( !isEmpty( "+com+".forwardList ) ) {"); output.println(" SESEcommon* consumer = (SESEcommon*) getItem( "+com+".forwardList );"); diff --git a/Robust/src/Runtime/mlp_runtime.h b/Robust/src/Runtime/mlp_runtime.h index 21c86d96..6a2972ea 100644 --- a/Robust/src/Runtime/mlp_runtime.h +++ b/Robust/src/Runtime/mlp_runtime.h @@ -50,11 +50,29 @@ #endif +// these are useful for interpreting an INTPTR to an +// Object at runtime to retrieve the object's type +// or object id (OID), 64-bit safe #define OBJPTRPTR_2_OBJTYPE( opp ) ((int*)(*(opp)))[0] #define OBJPTRPTR_2_OBJOID( opp ) ((int*)(*(opp)))[1] +// forwarding list elements is a linked +// structure of arrays, should help task +// dispatch because the first element is +// an embedded member of the task record, +// only have to do memory allocation if +// a lot of items are on the list +#define FLIST_ITEMS_PER_ELEMENT 30 +typedef struct ForwardingListElement_t { + int numItems; + struct ForwardingListElement_t* nextElement; + INTPTR items[FLIST_ITEMS_PER_ELEMENT]; +} ForwardingListElement; + + + // these fields are common to any SESE, and casting the // generated SESE record to this can be used, because // the common structure is always the first item in a @@ -76,7 +94,12 @@ typedef struct SESEcommon_t { // use to coordinate with one another pthread_mutex_t lock; - struct Queue* forwardList; + // NOTE: first element is embedded in the task + // record, so don't free it! + //ForwardingListElement forwardList; + struct Queue* forwardList; + + volatile int unresolvedDependencies; pthread_cond_t doneCond; @@ -115,7 +138,9 @@ extern __thread SESEcommon* runningSESE; typedef struct REntry_t{ - int type; // fine read:0, fine write:1, parent read:2, parent write:3 coarse: 4, parent coarse:5, scc: 6 + // fine read:0, fine write:1, parent read:2, + // parent write:3 coarse: 4, parent coarse:5, scc: 6 + int type; struct Hashtable_t* hashtable; struct BinItem_t* binitem; struct Vector_t* vector; @@ -187,6 +212,15 @@ void RETIRERENTRY(MemoryQueue* Q, REntry * r); + +static inline void ADD_FORWARD_ITEM( ForwardingListElement* e, + SESEcommon* s ) { + //atomic_inc( &(s->refCount) ); +} + + + + // simple mechanical allocation and // deallocation of SESE records void* mlpAllocSESErecord( int size ); @@ -200,17 +234,13 @@ void rehashMemoryQueue(SESEcommon* seseParent); static inline void ADD_REFERENCE_TO( SESEcommon* seseRec ) { -#ifndef OOO_DISABLE_TASKMEMPOOL atomic_inc( &(seseRec->refCount) ); -#endif } static inline void RELEASE_REFERENCE_TO( SESEcommon* seseRec ) { -#ifndef OOO_DISABLE_TASKMEMPOOL if( atomic_sub_and_test( 1, &(seseRec->refCount) ) ) { poolfreeinto( seseRec->parent->taskRecordMemPool, seseRec ); } -#endif } diff --git a/Robust/src/Tests/disjoint/tiny/makefile b/Robust/src/Tests/disjoint/tiny/makefile index 5f210cab..855ef133 100644 --- a/Robust/src/Tests/disjoint/tiny/makefile +++ b/Robust/src/Tests/disjoint/tiny/makefile @@ -3,7 +3,7 @@ PROGRAM=test SOURCE_FILES=$(PROGRAM).java BUILDSCRIPT=~/research/Robust/src/buildscript -BSFLAGS= -mainclass Test -disjoint -disjoint-k 1 -disjoint-alias-file aliases.txt normal -enable-assertions -justanalyze #-joptimize #-disjoint-write-dots final +BSFLAGS= -mainclass Test #-disjoint -disjoint-k 1 -disjoint-alias-file aliases.txt normal -enable-assertions -justanalyze -flatirusermethods #-joptimize #-disjoint-write-dots final all: $(PROGRAM).bin