From f073bf8b7c0ded1893408feeb94075cd8a88b92f Mon Sep 17 00:00:00 2001 From: jjenista Date: Thu, 30 Jul 2009 22:21:11 +0000 Subject: [PATCH] stall mechanism working, but data passing between SESE's incorrect --- Robust/src/IR/Flat/BuildCode.java | 19 +++++++------ Robust/src/Runtime/mlp_runtime.c | 45 +++---------------------------- Robust/src/Runtime/mlp_runtime.h | 15 +++++------ Robust/src/Runtime/workschedule.c | 2 +- 4 files changed, 19 insertions(+), 62 deletions(-) diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index 0fd4ac1f..b25311c6 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -513,6 +513,7 @@ public class BuildCode { outstructs.println("#endif"); outstructs.println("#endif"); if( state.MLP ) { + outstructs.println("#include \"mlp_runtime.h\""); outstructs.println("#include \"psemaphore.h\""); } @@ -1753,12 +1754,10 @@ public class BuildCode { // generate the SESE record structure outputStructs.println(fsen.getSESErecordName()+" {"); - // SESE's static class ID - outputStructs.println(" int classID;"); - - // child is issued with this locked, and it - // unlocks it when it completes - outputStructs.println(" psemaphore stallSem;"); + // data common to any SESE, and it must be placed first so + // a module that doesn't know what kind of SESE record this + // is can cast the pointer to a common struct + outputStructs.println(" SESEcommon common;"); // then garbage list stuff outputStructs.println(" INTPTR size;"); @@ -2226,7 +2225,7 @@ public class BuildCode { while( pItr.hasNext() ) { SESEandAgePair p = pItr.next(); output.println(" {"); - output.println(" SESErecord* child = (SESErecord*) "+p+";"); + output.println(" SESEcommon* child = (SESEcommon*) "+p+";"); output.println(" psem_take( &(child->stallSem) );"); output.println(" }"); } @@ -2694,8 +2693,8 @@ public class BuildCode { output.println(" "+fsen.getSESErecordName()+"* seseToIssue = ("+ fsen.getSESErecordName()+"*) mlpAllocSESErecord( sizeof( "+ fsen.getSESErecordName()+" ) );"); - output.println(" seseToIssue->classID = "+fsen.getIdentifier()+";"); - output.println(" psem_init( &(seseToIssue->stallSem) );"); + output.println(" seseToIssue->common.classID = "+fsen.getIdentifier()+";"); + output.println(" psem_init( &(seseToIssue->common.stallSem) );"); // give pointers to in-set variables, when this SESE is ready to // execute it should copy values from the pointers because they @@ -2734,7 +2733,7 @@ public class BuildCode { if( fsexn.getFlatEnter() != mlpa.getRootSESE() ) { output.println(" {"); - output.println(" psem_give( &("+paramsprefix+"->stallSem) );"); + output.println(" psem_give( &("+paramsprefix+"->common.stallSem) );"); output.println(" }"); } } diff --git a/Robust/src/Runtime/mlp_runtime.c b/Robust/src/Runtime/mlp_runtime.c index 25f5b9f8..1070c2c9 100644 --- a/Robust/src/Runtime/mlp_runtime.c +++ b/Robust/src/Runtime/mlp_runtime.c @@ -16,64 +16,25 @@ void* mlpAllocSESErecord( int size ) { - - void* newrec = RUNMALLOC( size ); - - /* - SESErecord* commonView = (SESErecord*) newrec; - commonView->classID = classID; - pthread_mutex_init( &(newrec->lock), NULL ); - newrec->forwardList = createQueue(); - newrec->doneExecuting = FALSE; - */ - + void* newrec = RUNMALLOC( size ); return newrec; } void mlpFreeSESErecord( void* seseRecord ) { - - /* - SESErecord* commonView = (SESErecord*) seseRecord; - pthread_mutex_destroy( &(commonView->lock) ); - freeQueue( commonView->forwardList ); - */ - RUNFREE( seseRecord ); } -/* -struct rootSESEinSetObjs { char** argv; }; -struct rootSESEinSetPrims { int argc; }; -*/ - void mlpInit( int numProcessors, void(*workFunc)(void*), int argc, char** argv, int maxSESEage ) { - //SESErecord* rootSESE; - - //struct rootSESEinSetObjs* inObjs = RUNMALLOC( sizeof( struct rootSESEinSetObjs ) ); - //struct rootSESEinSetPrims* inPrims = RUNMALLOC( sizeof( struct rootSESEinSetPrims ) ); - // first initialize the work scheduler - workScheduleInit( numProcessors, workFunc ); - - // the prepare the root SESE - //inObjs->argv = argv; - //inPrims->argc = argc; - //rootSESE = mlpCreateSESErecord( 0, inObjs, NULL, inPrims, NULL ); - - // skip the issue step because the root SESE will - // never have outstanding dependencies - //workScheduleSubmit( (void*) rootSESE ); + //workScheduleInit( numProcessors, workFunc ); - // now the work scheduler is initialized and work is - // in the hopper, so begin processing. This call - // will not return - workScheduleBegin(); + //workScheduleBegin(); } diff --git a/Robust/src/Runtime/mlp_runtime.h b/Robust/src/Runtime/mlp_runtime.h index 1fb78a16..d5b51c8c 100644 --- a/Robust/src/Runtime/mlp_runtime.h +++ b/Robust/src/Runtime/mlp_runtime.h @@ -7,14 +7,11 @@ #include "psemaphore.h" -// forward delcarations -//struct SESErecord_t; - - -// note that this record is never used other than -// to cast a customized record and have easy access -// the common fields listed here -typedef struct SESErecord_t { +// 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 +// customized SESE record +typedef struct SESEcommon_t { // the identifier for the class of sese's that // are instances of one particular static code block @@ -30,7 +27,7 @@ typedef struct SESErecord_t { struct Queue* forwardList; int doneExecuting; -} SESErecord; +} SESEcommon; /* diff --git a/Robust/src/Runtime/workschedule.c b/Robust/src/Runtime/workschedule.c index 01aeab37..65928071 100644 --- a/Robust/src/Runtime/workschedule.c +++ b/Robust/src/Runtime/workschedule.c @@ -231,7 +231,7 @@ void workScheduleInit( int numProcessors, void(*func)(void*) ) { int i, status; - numWorkers = numProcessors; + numWorkers = numProcessors*5; workFunc = func; dequeWorkUnits = createQueue(); -- 2.34.1