about to make lots of changes to system, just committing this stable compilation...
authorjjenista <jjenista>
Mon, 1 Jun 2009 23:09:53 +0000 (23:09 +0000)
committerjjenista <jjenista>
Mon, 1 Jun 2009 23:09:53 +0000 (23:09 +0000)
Robust/src/Analysis/MLP/MLPAnalysis.java
Robust/src/IR/Flat/BuildCode.java
Robust/src/IR/Flat/FlatSESEEnterNode.java
Robust/src/Runtime/mlp_runtime.c
Robust/src/Runtime/mlp_runtime.h
Robust/src/Tests/mlp/tinyTest/makefile
Robust/src/Tests/mlp/tinyTest/test.java
Robust/src/buildscript

index 1848d470889da562caeb06d55573e385cff91273..3c6a3819b1de94f2db69c54b75ad8d8d2502849a 100644 (file)
@@ -30,12 +30,21 @@ public class MLPAnalysis {
   private Hashtable< FlatNode, Set<TempDescriptor>      > notAvailableResults;
   private Hashtable< FlatNode, CodePlan                 > codePlans;
 
+  private static final int maxSESEage = 2;
 
   // use these methods in BuildCode to have access to analysis results
   public Set<FlatSESEEnterNode> getAllSESEs() {
     return allSESEs;
   }
 
+  public FlatSESEEnterNode getRootSESE() {
+    return rootSESE;
+  }
+
+  public int getMaxSESEage() {
+    return maxSESEage;
+  }
+
   public CodePlan getCodePlan( FlatNode fn ) {
     CodePlan cp = codePlans.get( fn );
     assert cp != null;
index 9c75c336316ec8f48f4c55904f53a1a0fb3b73a6..6bf05f0afed1e4da7822ea33587022f78fdf795d 100644 (file)
@@ -196,6 +196,11 @@ public class BuildCode {
     }
 
     /* Build the actual methods */
+    if( state.MLP ) {
+      outmethod.println("/* GET RID OF THIS LATER */");
+      outmethod.println("struct SESErecord* tempSESE;");
+      outmethod.println("struct SESErecord* tempParentSESE;");
+    }
     outputMethods(outmethod);
 
     // Output function prototypes and structures for SESE's and code
@@ -292,6 +297,10 @@ public class BuildCode {
 
     if (state.MLP) {
       outmethod.println("  mlpInit();");
+
+      FlatSESEEnterNode rootSESE = mlpa.getRootSESE();
+      
+      outmethod.println("  ");
     }
 
     MethodDescriptor md=typeutil.getMain();
@@ -1550,10 +1559,7 @@ public class BuildCode {
     ParamsObject objectparams = (ParamsObject)paramstable.get(bogusmd);
 
     // first copy SESE record into param structure
-    output.println("      if( parentIsRoot ) {");
-    output.println("        ");
-    output.println("        ");
-    output.println("      } else {");
+    output.println("      if( parentIsRoot ) {");    
     output.println("        ");
     output.println("      }");
 
@@ -2269,12 +2275,26 @@ public class BuildCode {
       return;
     }
     
+    output.println("  tempSESE       = (struct SESErecord*) malloc( sizeof( struct SESErecord ) );");
+    output.println("  tempSESE->vars = (struct SESEvar*)    malloc( sizeof( struct SESEvar    ) * "+
+                   +fsen.numParameters()+
+                   ");");
+
+    for( int i = 0; i < fsen.numParameters(); ++i ) {
+      TempDescriptor td   = fsen.getParameter( i );
+      TypeDescriptor type = td.getType();
+      output.println("  tempSESE->vars["+i+"].sesetype_"+type.toString()+" = "+td+";");
+    }
+
+    output.println("  mlpIssue( tempSESE );");
+    output.println("  tempSESE       = mlpSchedule();");
+    output.println("  tempParentSESE = mlpGetCurrent();");
     output.println("  invokeSESEmethod("+
                    fsen.getIdentifier()+", "+
-                   "malloc( sizeof( struct SESErecord ) ), "+
-                   "NULL"+
+                   "tempSESE, "+
+                   "tempParentSESE"+
                    ");"
-                   );
+                   );    
   }
 
   public void generateFlatSESEExitNode(FlatMethod fm,  LocalityBinding lb, FlatSESEExitNode fsen, PrintWriter output) {
index 4d8968d4805d14e813a48bf20393b45a51b94a6e..524ea973ac5291e799d72bc47c50c1a29180c668 100644 (file)
@@ -4,7 +4,11 @@ import IR.Tree.SESENode;
 import java.util.*;
 
 public class FlatSESEEnterNode extends FlatNode {
+  
+  // SESE class identifiers should be numbered
+  // sequentially from 0 to 1-(total # SESE's)
   private static int identifier=0;
+
   private int id;
   protected FlatSESEExitNode exit;
   protected SESENode treeNode;
index 0a42e27df20a67f237baf7fdcb9d768b590bff7a..a28fef8913b9f7ed289010c80759cdd800174714 100644 (file)
@@ -1,19 +1,40 @@
 #include <stdlib.h>
 #include <stdio.h>
+#include <assert.h>
 #include "mlp_runtime.h"
 #include "Queue.h"
 
 
-static struct Queue* issued;
+// the root sese is accessible globally so
+// buildcode can generate references to it
+struct SESErecord* rootsese;
+
+
+// the issuedQ, in this simple version, spits
+// out SESErecord's in the order they were issued
+static struct Queue* issuedQ;
+
+
+// the class_age2instance maps an SESE class id and
+// age value to a particular SESErecord instance
+static struct SESErecord** class_age2instance;
 
 
 // each core should have a current SESE
 static struct SESErecord* current;
 
 
-void mlpInit() {
-  issued  = createQueue();
-  current = NULL;
+void mlpInit( int totalNumSESEs, int maxSESEage ) {  
+  rootsese = (struct SESErecord*) malloc( sizeof( struct SESErecord ) );
+
+  issuedQ = createQueue();
+
+  class_age2instance = (struct SESErecord**) malloc( sizeof( struct SESErecord* ) *
+                                                     maxSESEage *
+                                                     totalNumSESEs
+                                                   );
+   
+  current = rootsese;
 }
 
 
@@ -23,18 +44,21 @@ struct SESErecord* mlpGetCurrent() {
 
 
 void mlpIssue( struct SESErecord* sese ) {
-  addNewItem( issued, (void*) sese );
+  addNewItem( issuedQ, (void*) sese );
 }
 
+
+struct SESErecord* mlpSchedule() {
+  assert( !isEmpty( issuedQ ) );
+  return (struct SESErecord*) getItem( issuedQ );  
+}
+
+
 void mlpStall( struct SESErecord* sese ) {
   
 }
 
+
 void mlpNotifyExit( struct SESErecord* sese ) {
   
 }
-
-/*
-isEmpty(queue)
-void* getItem(queue)
-*/
index 2830fd2c8b089729747c148cf507e1bd7e2bbadc..d7f929af8f26a4bf9b4e30524cde956f51268abd 100644 (file)
@@ -2,6 +2,10 @@
 #define __MLP_RUNTIME__
 
 
+#include <pthread.h>
+#include "Queue.h"
+
+
 // value mode means the variable's value
 // is present in the SESEvar struct
 #define SESEvar_MODE_VALUE   3001
@@ -27,14 +31,15 @@ struct SESEvar {
   // in this location, which can be accessed
   // as a variety of types
   union {
-    char   sesetype_byte;
-    char   sesetype_boolean;
-    short  sesetype_short;
-    int    sesetype_int;
-    long   sesetype_long;
-    char   sesetype_char;
-    float  sesetype_float;
-    double sesetype_double;
+    char      sesetype_byte;
+    int       sesetype_boolean;
+    short     sesetype_short;
+    int       sesetype_int;
+    long long sesetype_long;
+    short     sesetype_char;
+    float     sesetype_float;
+    double    sesetype_double;
+    void*     sesetype_object;
   };
   
   // a statically or dynamically known SESE
@@ -65,16 +70,26 @@ struct SESErecord {
   // the primitives will be passed out of the
   // above var array at the call site
   void* paramStruct;
+
+  // use a list of SESErecords and a lock to let
+  // consumers tell this SESE who wants values
+  // forwarded to it
+  pthread_mutex_t forwardListLock;// = PTHREAD_MUTUX_INITIALIZER;
+  struct Queue* forwardList;
 };
 
 
 void mlpInit();
 
 struct SESErecord* mlpGetCurrent();
+struct SESErecord* mlpSchedule();
 
 void mlpIssue     ( struct SESErecord* sese );
 void mlpStall     ( struct SESErecord* sese );
 void mlpNotifyExit( struct SESErecord* sese );
 
 
+extern struct SESErecord* rootsese;
+
+
 #endif /* __MLP_RUNTIME__ */
index 88d02d0ed140ec45059b72aaebf01f32db6be0cd..aba20a39d011919106793c29223f3ef008de84b9 100644 (file)
@@ -3,8 +3,8 @@ PROGRAM=test
 SOURCE_FILES=$(PROGRAM).java
 
 BUILDSCRIPT=~/research/Robust/src/buildscript
-#BSFLAGS= -mlpdebug  -mainclass Test -ownership -ownallocdepth 1 -ownwritedots final -enable-assertions -flatirusermethods -ownaliasfile aliases.txt
-BSFLAGS= -mainclass Test -ownership -ownallocdepth 1 -ownwritedots final -enable-assertions -flatirusermethods -ownaliasfile aliases.txt
+BSFLAGS= -mlpdebug -nooptimize -debug -mainclass Test -ownership -ownallocdepth 1 -ownwritedots final -enable-assertions -flatirusermethods -ownaliasfile aliases.txt
+#BSFLAGS= -mainclass Test -ownership -ownallocdepth 1 -ownwritedots final -enable-assertions -flatirusermethods -ownaliasfile aliases.txt
 
 
 all: $(PROGRAM).bin
index 93a7a37dc188feb0f3a9d75267e7abd192eaf998..b2883db6f64fb06a7737190d889e8f3d71cb0e66 100644 (file)
@@ -1,32 +1,6 @@
 public class Test {
 
   public static void main( String args[] ) {
-    /*
-    int n = 10;
-      
-    sese top {     
-      int x = 0;
-      
-      for( int i = 0; i < 3; ++i ) {
-       sese iter {
-         x = x + i;
-       }
-      }        
-      
-      int j = x + n;
-    }
-    
-    int z = n + j;
-    */
-
-
-
-
-
-
-
-
-
     
     int x = 1;
     int y = 1;
@@ -38,7 +12,7 @@ public class Test {
       }      
     }
 
-    /*
+    /*  ADD BACK IN LATER, TO TEST STALLS
     // shouldn't cause a stall
     int z = x;
 
@@ -51,8 +25,12 @@ public class Test {
     z = z + 1;
     */
 
-    // expecting x=3, y=3
-    System.out.println( "x="+x+", y="+y );
+    // see that values from sese fi are
+    // forwarded to this sibling
+    sese fo {
+      // expecting x=3, y=3
+      System.out.println( "x="+x+", y="+y );
+    }
 
 
 
@@ -62,7 +40,9 @@ public class Test {
     //afunc( i );
   }
 
+  /*
   public static void afunc( Integer i ) {
     i = null;
   }
+  */
 }
index 9236c4ab2c9978a03b9e464bf5ca05e0ccdeedf6..020807fb953b5de291fa4d814e12e0981624179e 100755 (executable)
@@ -267,9 +267,11 @@ JAVAOPTS="$JAVAOPTS -dcopts"
 elif [[ $1 = '-mlp' ]]
 then
 JAVAOPTS="$JAVAOPTS -mlp"
+EXTRAOPTIONS="$EXTRAOPTIONS -lpthread"
 elif [[ $1 = '-mlpdebug' ]]
 then
 JAVAOPTS="$JAVAOPTS -mlpdebug"
+EXTRAOPTIONS="$EXTRAOPTIONS -lpthread"
 elif [[ $1 = '-check' ]]
 then
 CHECKFLAG=true