Changes:
authorbdemsky <bdemsky>
Sat, 3 May 2008 22:05:57 +0000 (22:05 +0000)
committerbdemsky <bdemsky>
Sat, 3 May 2008 22:05:57 +0000 (22:05 +0000)
1) nojava option to the buildscript to built the executable in tmpbuilddir
2) fixed prefetch analysis

Robust/src/Analysis/Locality/LocalityAnalysis.java
Robust/src/Analysis/Prefetch/PrefetchAnalysis.java
Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3dN.java
Robust/src/Benchmarks/Prefetch/Em3d/dsm/makefile
Robust/src/Benchmarks/Prefetch/LUFact/dsm/LinpackRunner.java
Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiply.java
Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiplyN.java
Robust/src/Benchmarks/Prefetch/MatrixMultiply/makefile
Robust/src/Main/Main.java
Robust/src/buildscript

index 7cec933f555f9c5611daa3a1be68771d1214a5f6..adac83f89e7079dd898ee64bb95e61856b00994c 100644 (file)
@@ -91,6 +91,10 @@ public class LocalityAnalysis {
        return methodtolb.get(md);
     }
 
+    public Set<MethodDescriptor> getMethods() {
+       return methodtolb.keySet();
+    }
+
     /** This method returns a set of LocalityBindings.  A
      * LocalityBinding specifies a context a method can be invoked in.
      * It specifies whether the method is in a transaction and whether
index 196ecc9c143a538223055d83c9903f7d0003c9ae..d6b5df3ebdc14eea94a72e3c9d0d3b2ee122a9c9 100644 (file)
@@ -2,6 +2,7 @@ package Analysis.Prefetch;
 
 import java.util.*;
 import Analysis.CallGraph.CallGraph;
+import Analysis.Locality.LocalityAnalysis;
 import Analysis.Prefetch.PrefetchPair;
 import Analysis.Prefetch.PairMap;
 import Analysis.Prefetch.IndexDescriptor;
@@ -25,11 +26,13 @@ public class PrefetchAnalysis {
     public static final double PROB_DIFF = 0.05;       //threshold for difference in probabilities during first phase of analysis
     public static final double ANALYSIS_THRESHOLD_PROB = 0.10; //threshold for prefetches to stop propagating during first phase of analysis
     public static final double PREFETCH_THRESHOLD_PROB = 0.30;//threshold for prefetches to stop propagating while applying prefetch rules during second phase of analysis
-    
-    public PrefetchAnalysis(State state, CallGraph callgraph, TypeUtil typeutil) {
+    LocalityAnalysis locality;
+
+    public PrefetchAnalysis(State state, CallGraph callgraph, TypeUtil typeutil, LocalityAnalysis locality) {
        this.typeutil=typeutil;
        this.state=state;
        this.callgraph=callgraph;
+       this.locality=locality;
        prefetch_hash = new Hashtable<FlatNode, Hashtable<PrefetchPair,Double>>();
        pmap_hash = new Hashtable<FlatNode, Hashtable<FlatNode, PairMap>>();
        this.loop=new LoopExit(state);
@@ -39,15 +42,7 @@ public class PrefetchAnalysis {
     
     /** This function starts the prefetch analysis */
     private void DoPrefetch() {
-       for(Iterator classit=state.getClassSymbolTable().getDescriptorsIterator();classit.hasNext();) {
-           ClassDescriptor cn=(ClassDescriptor)classit.next();
-           doMethodAnalysis(cn);
-       }
-    }
-
-    /** This function calls analysis for every method in a class */
-    private void doMethodAnalysis(ClassDescriptor cn) {
-       for (Iterator methodit=cn.getMethods();methodit.hasNext();) {
+       for (Iterator methodit=locality.getMethods().iterator();methodit.hasNext();) {
            MethodDescriptor md=(MethodDescriptor)methodit.next();
            if (state.excprefetch.contains(md.getClassMethodName()))
                continue; //Skip this method
@@ -98,6 +93,7 @@ public class PrefetchAnalysis {
                if(prefetch_hash.containsKey(child_node)) {
                    child_prefetch_set_copy = (Hashtable<PrefetchPair,Double>) prefetch_hash.get(child_node).clone();
                }
+
            }
            switch(curr.kind()) {
            case FKind.FlatCall:
@@ -212,7 +208,7 @@ public class PrefetchAnalysis {
        if (currffn_field.getType().isPtr()) {
            PrefetchPair pp = new PrefetchPair(currffn_src, (Descriptor) currffn_field);
            Double prob = new Double(1.0);
-           currcopy.put(pp, prob);
+           tocompare.put(pp, prob);
        }
        
        /* Get each prefetch pair of the child and match it with the destination temp descriptor of curr FlatFieldNode */
@@ -226,56 +222,35 @@ public class PrefetchAnalysis {
                    newdesc.addAll(childpp.desc);
                    PrefetchPair newpp =  new PrefetchPair(currffn.getSrc(), newdesc);
                    Double newprob = child_prefetch_set_copy.get(childpp).doubleValue();
+                   if (tocompare.containsKey(newpp)) {
+                       Double oldprob=tocompare.get(newpp);
+                       newprob=1.0-(1.0-oldprob)*(1.0-newprob);
+                   }
                    tocompare.put(newpp, newprob); 
                    pm.addPair(childpp, newpp);
-                   child_prefetch_set_copy.remove(childpp);
-                   /* Check for independence of prefetch pairs to compute new probability */
-                   if(child_prefetch_set_copy.containsKey(newpp)) {
-                       newprob = (1.0 - ((1.0 - child_prefetch_set_copy.get(newpp).doubleValue()) * (1.0 - tocompare.get(newpp).doubleValue())));
-                       if(newprob < ANALYSIS_THRESHOLD_PROB) {
-                           tocompare.remove(newpp);
-                       } else {
-                           tocompare.put(newpp, newprob); 
-                           pm.addPair(newpp, newpp);
-                       }
-                       child_prefetch_set_copy.remove(newpp);
-                   }
                }
+               //drop if not ptr
            } else if(childpp.base == currffn.getDst() && (childpp.getDesc() == null)) {
+               //covered by current prefetch
                child_prefetch_set_copy.remove(childpp);
            } else if(childpp.containsTemp(currffn.getDst())) {
                child_prefetch_set_copy.remove(childpp);
            } else {
-               continue;
-           }
-       }
-       /* Check if curr prefetch set and the child prefetch set have same prefetch pairs
-        * if so, calculate the new probability */ 
-       for (Enumeration ecld = child_prefetch_set_copy.keys();ecld.hasMoreElements();) {
-           PrefetchPair childpp = (PrefetchPair) ecld.nextElement();
-           for(Enumeration e = currcopy.keys(); e.hasMoreElements();) {
-               PrefetchPair currpp = (PrefetchPair) e.nextElement();
-               if(currpp.equals(childpp)) {
-                   pm.addPair(childpp, currpp);
-                   child_prefetch_set_copy.remove(childpp);
-                   break;
-               } 
+               Double newprob = child_prefetch_set_copy.get(childpp).doubleValue();
+               if (tocompare.containsKey(childpp)) {
+                   Double oldprob=tocompare.get(childpp);
+                   newprob=1.0-(1.0-oldprob)*(1.0-newprob);
+               }
+               tocompare.put(childpp, newprob); 
+               pm.addPair(childpp, childpp);
            }
        }
-       
-       /* Merge child prefetch pairs */
-       for (Enumeration ecld = child_prefetch_set_copy.keys();ecld.hasMoreElements();) {
-           PrefetchPair childpp = (PrefetchPair) ecld.nextElement();
-           tocompare.put(childpp, child_prefetch_set_copy.get(childpp).doubleValue());
-           pm.addPair(childpp, childpp);
-           child_prefetch_set_copy.remove(childpp);
-       }
-       
-       /* Merge curr prefetch pairs */
-       for (Enumeration e = currcopy.keys();e.hasMoreElements();) {
-           PrefetchPair currpp = (PrefetchPair) e.nextElement();
-           tocompare.put(currpp, currcopy.get(currpp).doubleValue());  
-           currcopy.remove(currpp);
+
+       for(Iterator<PrefetchPair> it=tocompare.keySet().iterator();it.hasNext();) {
+           PrefetchPair pp=it.next();
+           if (tocompare.get(pp)<ANALYSIS_THRESHOLD_PROB)
+               it.remove();
+           
        }
        
        updatePairMap(curr, pm, 0);
@@ -779,6 +754,7 @@ public class PrefetchAnalysis {
     
     /** This function prints the Prefetch pairs of a given flatnode */
     private void printPrefetchPairs(FlatNode fn) {
+       System.out.println(fn);
        if(prefetch_hash.containsKey(fn)) {
            System.out.print("Prefetch" + "(");
            Hashtable<PrefetchPair, Double> currhash = (Hashtable) prefetch_hash.get(fn);
@@ -812,57 +788,41 @@ public class PrefetchAnalysis {
            }
        }
        
-       /* Delete redundant and subset prefetch pairs */
-       delSubsetPPairs();
-       
        /* Start with a top down sorted order of nodes */
        while(!newvisited.isEmpty()) {
            applyPrefetchInsertRules((FlatNode) newvisited.getFirst(), newvisited, pset1_hash, newprefetchset);
            newvisited.remove(0);
        }
+       delSubsetPPairs(newprefetchset);
     }
     
     /** This function deletes the smaller prefetch pair subset from a list of prefetch pairs 
      * for e.g. if there are 2 prefetch pairs a.b.c.d and a.b.c for a given flatnode
      * then this function drops a.b.c from the prefetch set of the flatnode */
-    private void delSubsetPPairs() {
-       for (Enumeration e = prefetch_hash.keys();e.hasMoreElements();) {
+    private void delSubsetPPairs(Hashtable<FlatNode, HashSet<PrefetchPair>> newprefetchset) {
+       for (Enumeration e = newprefetchset.keys();e.hasMoreElements();) {
            FlatNode fn = (FlatNode) e.nextElement();
-           Hashtable ppairs = prefetch_hash.get(fn);
-           Vector<PrefetchPair> pplist = new Vector<PrefetchPair>();
-           Vector pplength = new Vector();
-           Vector ppisMod = new Vector();
-           for(Enumeration epp = ((Hashtable)(prefetch_hash.get(fn))).keys();epp.hasMoreElements();) {
-               PrefetchPair pp = (PrefetchPair) epp.nextElement();
-               pplist.add(pp);
-               int length = pp.desc.size()+ 1;
-               pplength.add(length);
-               ppisMod.add(0);
-           }
-           int numpp = ((Hashtable)(prefetch_hash.get(fn))).size();
-           for (int i = 0; i < numpp; i++) {
-               for (int j = i+1; j < numpp; j++) {
-                   boolean ret;
-                   int x = ((Integer) (pplength.get(i))).intValue();
-                   if (((Integer) (pplength.get(i))).intValue() < ((Integer)( pplength.get(j))).intValue()) {
-                       ret = isSubSet(pplist.get(i), pplist.get(j));
-                       if (ret) {
-                           ppisMod.set(i, 1);
-                       }
-                   } else {
-                       ret = isSubSet(pplist.get(j), pplist.get(i));
-                       if (ret) {
-                           ppisMod.set(j, 1);
-                       }
-                   }
-               }
-           }
-           for (int i = 0; i < numpp; i++) {
-               if (((Integer)(ppisMod.get(i))).intValue() == 1) {
-                   PrefetchPair pp = (PrefetchPair) pplist.get(i);
-                   ppairs.remove(pp);
+           Set<PrefetchPair> ppairs = newprefetchset.get(fn);
+           Set<PrefetchPair> toremove=new HashSet<PrefetchPair>();
+
+           for(Iterator<PrefetchPair> it1=ppairs.iterator();it1.hasNext();) {
+               PrefetchPair pp1=it1.next();
+               if (toremove.contains(pp1))
+                   continue;
+               int l1=pp1.desc.size()+1;
+               for(Iterator<PrefetchPair> it2=ppairs.iterator();it2.hasNext();) {
+                   PrefetchPair pp2=it2.next();
+                   int l2=pp2.desc.size()+1;
+
+                   if (l1<l2&&isSubSet(pp1,pp2))
+                       toremove.add(pp1);
+                   else
+                       if (l2>l1&&isSubSet(pp2,pp1))
+                           toremove.add(pp2);
                }
            }
+           
+           ppairs.removeAll(toremove);
        }
     }
     
@@ -916,78 +876,65 @@ public class PrefetchAnalysis {
      * this function creates pset1 such that it contains prefetch pairs that have been prefetched at
      * the previous nodes */
     
-    private void applyPrefetchInsertRules(FlatNode fn, LinkedList<FlatNode> newvisited, Hashtable<FlatNode, HashSet<PrefetchPair>> pset1_hash, Hashtable<FlatNode, HashSet<PrefetchPair>> newprefetchset) {
-       
+    private void applyPrefetchInsertRules(FlatNode fn, LinkedList<FlatNode> newvisited, Hashtable<FlatNode, HashSet<PrefetchPair>> pset1_hash, Hashtable<FlatNode, HashSet<PrefetchPair>> newprefetchset) {    
        if(fn.kind() == FKind.FlatMethod) {
            HashSet<PrefetchPair> pset1 = new HashSet<PrefetchPair>();
-           if(prefetch_hash.containsKey(fn)) {
-               Hashtable<PrefetchPair, Double> prefetchset = prefetch_hash.get(fn);
-               for(Enumeration e = prefetchset.keys();e.hasMoreElements();) {
-                   PrefetchPair pp = (PrefetchPair) e.nextElement();
-                   /* Apply initial rule */
-                   if(prefetchset.get(pp).doubleValue() >= PREFETCH_THRESHOLD_PROB) {
-                       pset1.add(pp);
-                   }
+           Hashtable<PrefetchPair, Double> prefetchset = prefetch_hash.get(fn);
+           for(Enumeration e = prefetchset.keys();e.hasMoreElements();) {
+               PrefetchPair pp = (PrefetchPair) e.nextElement();
+               /* Apply initial rule */
+               if(prefetchset.get(pp).doubleValue() >= PREFETCH_THRESHOLD_PROB) {
+                   pset1.add(pp);
                }
-               /* Enqueue child node if Pset1 has changed */
-               if (comparePSet1(pset1_hash.get(fn), pset1)) {
-                   for(int j=0; j<fn.numNext(); j++) {
-                       FlatNode nn = fn.getNext(j);
-                       newvisited.addLast((FlatNode)nn);
-                   }
-                   pset1_hash.put(fn, pset1);
+           }
+           /* Enqueue child node if Pset1 has changed */
+           if (comparePSet1(pset1_hash.get(fn), pset1)) {
+               for(int j=0; j<fn.numNext(); j++) {
+                   FlatNode nn = fn.getNext(j);
+                   newvisited.addLast((FlatNode)nn);
                }
-               newprefetchset.put(fn, pset1); 
+               pset1_hash.put(fn, pset1);
            }
+           newprefetchset.put(fn, pset1); 
        } else { /* Nodes other than Flat Method Node */
            HashSet<PrefetchPair> pset2 = new HashSet<PrefetchPair>();
            HashSet<PrefetchPair> newpset = new HashSet<PrefetchPair>();
-           if(prefetch_hash.containsKey(fn)) {
-               Hashtable<PrefetchPair, Double> prefetchset = prefetch_hash.get(fn);
-               Hashtable<FlatNode, PairMap> ppairmaphash = pmap_hash.get(fn);
-               for(Enumeration epset = prefetchset.keys(); epset.hasMoreElements();) {
-                   PrefetchPair pp = (PrefetchPair) epset.nextElement();
-                   boolean pprobIsGreater = (prefetchset.get(pp).doubleValue() >= PREFETCH_THRESHOLD_PROB);
-                   boolean mapprobIsLess=false;
-                   boolean mapIsPresent=true;
-                   for(int i=0;i<fn.numPrev();i++) {
-                       FlatNode parentnode=fn.getPrev(i);
-                       PairMap pm = (PairMap) ppairmaphash.get(parentnode);
-                       /* Build newpset */
-                       if(pm!=null&&pm.getPair(pp) != null) {
-                           PrefetchPair mappedpp = pm.getPair(pp);
-                           if(prefetch_hash.get(parentnode).containsKey(mappedpp)) {
-                               double prob = prefetch_hash.get(parentnode).get(mappedpp).doubleValue();
-                               if(prob < PREFETCH_THRESHOLD_PROB)
-                                   mapprobIsLess = true;
-                           }
-                       } else {
+           Hashtable<PrefetchPair, Double> prefetchset = prefetch_hash.get(fn);
+           Hashtable<FlatNode, PairMap> ppairmaphash = pmap_hash.get(fn);
+           for(Enumeration epset = prefetchset.keys(); epset.hasMoreElements();) {
+               PrefetchPair pp = (PrefetchPair) epset.nextElement();
+               boolean pprobIsGreater = (prefetchset.get(pp).doubleValue() >= PREFETCH_THRESHOLD_PROB);
+               boolean mapprobIsLess=false;
+               boolean mapIsPresent=true;
+               for(int i=0;i<fn.numPrev();i++) {
+                   FlatNode parentnode=fn.getPrev(i);
+                   PairMap pm = (PairMap) ppairmaphash.get(parentnode);
+                   //Find if probability is less for previous node
+                   if(pm!=null&&pm.getPair(pp) != null) {
+                       PrefetchPair mappedpp = pm.getPair(pp);
+                       if(prefetch_hash.get(parentnode).containsKey(mappedpp)) {
+                           double prob = prefetch_hash.get(parentnode).get(mappedpp).doubleValue();
+                           if(prob < PREFETCH_THRESHOLD_PROB)
+                               mapprobIsLess = true;
+                       } else
                            mapprobIsLess = true;
-                       }
-                       /* Build pset2 */
-                       if(pset1_hash.containsKey(parentnode)) {
-                           if(pm !=null) {
-                               HashSet pset = pset1_hash.get(parentnode);
-                               if(pset.isEmpty()) {
-                                   continue;
-                               } else {
-                                   if(!pset.contains((PrefetchPair) pm.getPair(pp)))
-                                       mapIsPresent = false;
-                               }
-                           }
-                       } else {
-                           throw new Error("applyPrefetchInsertRules() Parent node not present in pset1_hash: Not Possible");
-                       }
+                   } else {
+                       mapprobIsLess = true;
                    }
-                   
-                   if(mapIsPresent)
-                       pset2.add(pp);
-                   
-                   if(pprobIsGreater && mapprobIsLess)
-                       newpset.add(pp);
+                   /* Build pset2 */
+                   if(pm !=null) {
+                       HashSet pset = pset1_hash.get(parentnode);
+                       if(pset.isEmpty()||!pset.contains((PrefetchPair) pm.getPair(pp)))
+                           mapIsPresent = false;
+                   } else
+                       mapIsPresent=false;
                }
-           } else {
-               throw new Error("applyPrefetchInsertRules() fn: " +fn+ "not found");
+               
+               if(mapIsPresent)
+                   pset2.add(pp);
+               
+               if(pprobIsGreater && mapprobIsLess)
+                   newpset.add(pp);
            }
            
            HashSet<PrefetchPair> pset1 = new HashSet<PrefetchPair>();
@@ -1004,14 +951,10 @@ public class PrefetchAnalysis {
            
            /* To insert prefetch, apply rule: if the newpset minus pset2 is nonempty
             * then insert a new prefetch node here*/
-           
+
            HashSet<PrefetchPair> s = new HashSet<PrefetchPair>();
-           for(Iterator it = newpset.iterator(); it.hasNext();) {
-               PrefetchPair pp = (PrefetchPair) it.next();
-               if(!pset2.contains(pp)) {
-                   s.add(pp);
-               }
-           }
+           s.addAll(newpset);
+           s.removeAll(pset2);
            newprefetchset.put(fn, s); 
        }
     }
index e9355cce81bc6abe074050085b00b2523ef01024..daf334efc863110c1bfac67124a83b79f0202ab8 100644 (file)
@@ -112,10 +112,10 @@ public class Em3d extends Thread
     long start0 = System.currentTimeMillis();
     int numThreads = em.numThreads;
     int[] mid = new int[4];
-    mid[0] = (128<<24)|(195<<16)|(175<<8)|80;
-    mid[1] = (128<<24)|(195<<16)|(175<<8)|78;
+    mid[0] = (128<<24)|(195<<16)|(175<<8)|69;
+    mid[1] = (128<<24)|(195<<16)|(175<<8)|80;
     mid[2] = (128<<24)|(195<<16)|(175<<8)|73;
-    mid[3] = (128<<24)|(195<<16)|(175<<8)|79;
+    mid[3] = (128<<24)|(195<<16)|(175<<8)|78;
     System.printString("DEBUG -> numThreads = " + numThreads+"\n");
     Barrier mybarr;
     BiGraph graph;
index f7031ad3c45eb9eca3e0287973367997e5a9ce32..f5ec498ff7dcb3d8ee019dbabbc85fe3f910012d 100644 (file)
@@ -8,14 +8,12 @@ SRC1=${MAINCLASS}N.java \
        Node.java \
        Barrier.java
 
-FLAGS=-dsm -prefetch -excprefetch Em3d.main -excprefetch BiGraph.create -excprefetch Node.Node -excprefetch Node.fillTable -excprefetch Node.makeUniqueNeighbors -excprefetch Node.makeFromNodes -excprefetch Node.updateFromNodes -nooptimize -profile -debug -mainclass ${MAINCLASS}
-FLAGS2=-dsm -nooptimize -profile -debug -mainclass ${MAINCLASS}
+FLAGS=-dsm -prefetch -excprefetch Em3d.main -excprefetch BiGraph.create -excprefetch Node.Node -excprefetch Node.fillTable -excprefetch Node.makeUniqueNeighbors -excprefetch Node.makeFromNodes -excprefetch Node.updateFromNodes -nooptimize -debug -mainclass ${MAINCLASS}
+FLAGS2=-dsm -nooptimize -debug -mainclass ${MAINCLASS}
 
 default:
-#      ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}NP ${SRC}
-#      ../../../../buildscript ${FLAGS} -o ${MAINCLASS} ${SRC}
-       ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}NNP ${SRC1}
-       ../../../../buildscript ${FLAGS} -o ${MAINCLASS}N ${SRC1}
+       ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}NP ${SRC1}
+       ../../../../buildscript ${FLAGS} -o ${MAINCLASS}P ${SRC1}
 
 clean:
        rm -rf tmpbuilddirectory
index e3d3f8805aad1111890230971b35f7721379098b..6e499d1c4a072bf5c100fcded94b75f85e3459ae 100644 (file)
@@ -70,8 +70,8 @@ class LinpackRunner extends Thread {
              }
              // synchronise threads
              Barrier.enterBarrier(tmpbr);
-          System.clearPrefetchCache();
-
+             System.clearPrefetchCache();
+             
              // zero pivot implies this column already triangularized
              boolean b;
              atomic {
@@ -79,7 +79,7 @@ class LinpackRunner extends Thread {
              }
              if (b) {
                  Barrier.enterBarrier(tmpbr);
-          System.clearPrefetchCache();
+                 System.clearPrefetchCache();
                  // interchange if necessary
                  atomic {
                      if(lid == 0 ) {
@@ -92,7 +92,7 @@ class LinpackRunner extends Thread {
                  }
                  // synchronise threads
                  Barrier.enterBarrier(tmpbr);
-          System.clearPrefetchCache();
+                 System.clearPrefetchCache();
                  // compute multipliers
                  atomic {
                      t = -1.0/col_k[k];
@@ -102,7 +102,7 @@ class LinpackRunner extends Thread {
                  }
                  // synchronise threads
                  Barrier.enterBarrier(tmpbr);
-       System.clearPrefetchCache();
+                 System.clearPrefetchCache();
                  // row elimination with column indexing
                  atomic {
                      slice = ((nlocal-kp1) + nthreads-1)/nthreads;
@@ -123,12 +123,12 @@ class LinpackRunner extends Thread {
                  }
                  // synchronise threads
                  Barrier.enterBarrier(tmpbr);
-          System.clearPrefetchCache();
+                 System.clearPrefetchCache();
              } else {
                  info = k;
              }
              Barrier.enterBarrier(tmpbr);
-          System.clearPrefetchCache();
+             System.clearPrefetchCache();
          }
       }
       
index 6a75c0f694948adb1cb282cf26f5cdca50dcbc8c..e56a6faa60d9bf9e3e154bd47def0a08e327dc2d 100644 (file)
@@ -16,14 +16,17 @@ public class MatrixMultiply extends Thread{
                atomic {
                    //compute the results
                    localresults=new double[1+x1-x0][1+y1-y0];
-               
+                   double la[][]=mmul.a;
+                   double lbtranspose[][]=mmul.b;
+                   double lc[][]=mmul.c;
+                   int M=mmul.M;
+
                    //Use b transpose for cache performance
                    for(int i = x0; i<= x1; i++){
-                       double a[]=mmul.a[i];
-                       int M=mmul.M;
+                       double a[]=la[i];
                        for (int j = y0; j <= y1; j++) {
                            double innerProduct=0;
-                           double b[] = mmul.btranspose[j];
+                           double b[] = lbtranspose[j];
                            for(int k = 0; k < M; k++) {
                                innerProduct += a[k] *b[k];
                            }
@@ -44,6 +47,12 @@ public class MatrixMultiply extends Thread{
        }
 
        public static void main(String[] args) {
+<<<<<<< MatrixMultiply.java
+               int mid1 = (128<<24)|(195<<16)|(175<<8)|69;
+               int mid2 = (128<<24)|(195<<16)|(175<<8)|69;
+               int mid3 = (128<<24)|(195<<16)|(175<<8)|71;
+               int NUM_THREADS = 1;
+=======
       int NUM_THREADS = 4;
       int[] mid = new int[NUM_THREADS];
       mid[0] = (128<<24)|(195<<16)|(175<<8)|69;
@@ -52,6 +61,7 @@ public class MatrixMultiply extends Thread{
       mid[3] = (128<<24)|(195<<16)|(175<<8)|79;
                //int mid1 = (128<<24)|(195<<16)|(175<<8)|69;
                //int mid2 = (128<<24)|(195<<16)|(175<<8)|73;
+>>>>>>> 1.19
                int p, q, r;
                MatrixMultiply[] mm;
                MatrixMultiply tmp;
index f0314b30a3bf21867acfbf828d8ca50624d99cd0..93a003165d25a7fdf8fde3303a3f96334b94b35b 100644 (file)
@@ -12,14 +12,18 @@ public class MatrixMultiply extends Thread{
     
     public void run() {
        atomic {
+           double la[][]=mmul.a;
+           double lc[][]=mmul.c;
+           double lb[][]=mmul.btranspose;
+           int M=mmul.M;
+           
            //Use btranspose for cache performance
            for(int i = x0; i< x1; i++){
-               double a[]=mmul.a[i];
-               double c[]=mmul.c[i];
-               int M=mmul.M;
+               double a[]=la[i];
+               double c[]=lc[i];
                for (int j = y0; j < y1; j++) {
                    double innerProduct=0;
-                   double b[] = mmul.btranspose[j];
+                   double b[] = lb[j];
                    for(int k = 0; k < M; k++) {
                        innerProduct += a[k] *b[k];
                    }
@@ -39,9 +43,9 @@ public class MatrixMultiply extends Thread{
        }
        
        int[] mid = new int[4];
-       mid[0] = (128<<24)|(195<<16)|(175<<8)|80;
-       mid[1] = (128<<24)|(195<<16)|(175<<8)|73;
-       mid[2] = (128<<24)|(195<<16)|(175<<8)|78;
+       mid[0] = (128<<24)|(195<<16)|(175<<8)|69;
+       mid[1] = (128<<24)|(195<<16)|(175<<8)|70;
+       mid[2] = (128<<24)|(195<<16)|(175<<8)|71;
        mid[3] = (128<<24)|(195<<16)|(175<<8)|79;
        int p, q, r;
        MatrixMultiply[] mm;
index 6281f4ce0aa21bbebe6be28418dcc7b536d6670f..69a49b3a2b33e5d1d7651846579a4a272ac16754 100644 (file)
@@ -1,10 +1,10 @@
 MAINCLASS=MatrixMultiply
 SRC1=${MAINCLASS}N.java
-FLAGS=-dsm -prefetch -optimize -profile -debug -excprefetch MatrixMultiply.main -excprefetch MMul.setValues -excprefetch MMul.transpose -mainclass ${MAINCLASS} -trueprob 0.8
-FLAGS2=-dsm -optimize -profile -debug -excprefetch MatrixMultiply.main -excprefetch MMul.setValues -excprefetch MMul.transpose -mainclass ${MAINCLASS}
+FLAGS=-dsm -prefetch -optimize -debug -excprefetch MatrixMultiply.main -excprefetch MMul.setValues -excprefetch MMul.transpose -mainclass ${MAINCLASS} -trueprob 0.7
+FLAGS2=-dsm -optimize -debug -excprefetch MatrixMultiply.main -excprefetch MMul.setValues -excprefetch MMul.transpose -mainclass ${MAINCLASS}
 default:
-       ../../../buildscript ${FLAGS2} -o ${MAINCLASS}NNP ${SRC1}
-       ../../../buildscript ${FLAGS} -o ${MAINCLASS}N ${SRC1}
+       ../../../buildscript ${FLAGS2} -o ${MAINCLASS}NP ${SRC1}
+       ../../../buildscript ${FLAGS} -o ${MAINCLASS}P ${SRC1}
 
 clean:
        rm *.bin
index d3bc0def83807f114ca6eab2ec6f395f9afc7d6d..a46cca8253f35ac80d147011014c73325ee38ee4 100644 (file)
@@ -417,8 +417,11 @@ public class Main {
          if (state.DSM) {
              CallGraph callgraph=new CallGraph(state);
              if (state.PREFETCH) {
-                 PrefetchAnalysis pa=new PrefetchAnalysis(state, callgraph, tu);
+                 //speed up prefetch generation using locality analysis results
+                 LocalityAnalysis la=new LocalityAnalysis(state, callgraph, tu);
+                 PrefetchAnalysis pa=new PrefetchAnalysis(state, callgraph, tu, la);
              }
+
              LocalityAnalysis la=new LocalityAnalysis(state, callgraph, tu);
              GenerateConversions gc=new GenerateConversions(la, state);
              BuildCode bc=new BuildCode(state, bf.getMap(), tu, la);
index f0140385447c82b405a247c7319bbee2baf5d5de..e0c07fd4b865a82c9a155de3ffe6f265873079ec 100755 (executable)
@@ -30,6 +30,7 @@ echo "-nooptimize call gcc with -O0 (do not optimize)"
 echo -curdir directory 
 echo -mainclass class with main method
 echo -o binary
+echo -nojava do not run bristlecone compiler
 echo -instructionfailures inject code for instructionfailures
 echo -profile build with profile options
 echo "-enable-assertions execute assert statements during compilation"
@@ -41,6 +42,7 @@ DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
 REPAIRROOT=~/research/Repair/RepairCompiler/
 CURDIR=`pwd`
 DSMFLAG=false
+NOJAVA=false
 CHECKFLAG=false
 RECOVERFLAG=false
 MULTICOREFLAG=false
@@ -72,6 +74,9 @@ elif [[ $1 = '-robustroot' ]]
 then
 ROBUSTROOT="$2"
 shift
+elif [[ $1 = '-nojava' ]]
+then
+NOJAVA=true
 elif [[ $1 = '-o' ]]
 then
 MAINFILE="$2"
@@ -213,12 +218,15 @@ then exit $?
 fi
 else
 #if ! java -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
+if ! $NOJAVA
+then
 if ! java -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
 $ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR -precise \
 $JAVAOPTS $SRCFILES
 then exit $?
 fi
 fi
+fi
 
 # Build all of the consistency specs