From f125e8e0102a2093ee67a61ea75cdc2e6cc0ca01 Mon Sep 17 00:00:00 2001 From: adash Date: Mon, 9 Feb 2009 02:38:27 +0000 Subject: [PATCH] 1. Added new 2DConv 15 X 15 kernel size 2. Added new Moldyn sizes B and C 3. tabbing 4. Fixed Lookup service benchmarks 5. Fixed compiler to allow Object.getType native method call inside transactions --- .../Analysis/Locality/LocalityAnalysis.java | 5 +- .../LookUpService/LookUpService.java | 23 +- .../Distributed/LookUpService/makefile | 8 +- .../Prefetch/2DConv/dsm/ConvolutionSizeB.java | 4 + .../Prefetch/2DConv/dsm/ConvolutionSizeC.java | 413 ++++++++++++++++++ .../Benchmarks/Prefetch/2DConv/dsm/Makefile | 9 +- .../2DConv/javasingle/ConvolutionSizeB.java | 2 +- .../2DConv/javasingle/ConvolutionSizeC.java | 385 ++++++++++++++++ .../Prefetch/2DConv/javasingle/makefile | 4 +- Robust/src/Benchmarks/Prefetch/Array/makefile | 2 +- .../src/Benchmarks/Prefetch/Chase/Chase.java | 16 +- Robust/src/Benchmarks/Prefetch/Chase/makefile | 16 +- .../MatrixMultiply/MatrixMultiplyN.java | 10 +- .../ManualPrefetch/MatrixMultiply/makefile | 4 +- .../Prefetch/MatrixMultiply/dsm/makefile | 4 +- .../Prefetch/Moldyn/dsm/JGFMolDynBench.java | 3 +- .../Moldyn/dsm/JGFMolDynBenchSizeB.java | 85 ++++ .../Moldyn/dsm/JGFMolDynBenchSizeC.java | 87 ++++ .../Benchmarks/Prefetch/Moldyn/dsm/makefile | 2 +- .../Moldyn/javasingle/JGFMolDynBench.java | 3 +- .../javasingle/JGFMolDynBenchSizeB.java | 74 ++++ .../javasingle/JGFMolDynBenchSizeC.java | 77 ++++ .../Prefetch/Moldyn/javasingle/makefile | 2 +- .../src/ClassLibrary/DistributedHashMap.java | 8 +- Robust/src/IR/Tree/SemanticCheck.java | 6 +- Robust/src/Lex/Keyword.java | 2 +- Robust/src/Lex/Lexer.java | 6 +- Robust/src/Main/Main.java | 28 +- Robust/src/Runtime/DSTM/interface/dsmlock.h | 10 +- Robust/src/Runtime/garbage.c | 8 +- 30 files changed, 1225 insertions(+), 81 deletions(-) create mode 100644 Robust/src/Benchmarks/Prefetch/2DConv/dsm/ConvolutionSizeC.java create mode 100644 Robust/src/Benchmarks/Prefetch/2DConv/javasingle/ConvolutionSizeC.java create mode 100644 Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBenchSizeB.java create mode 100644 Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBenchSizeC.java create mode 100644 Robust/src/Benchmarks/Prefetch/Moldyn/javasingle/JGFMolDynBenchSizeB.java create mode 100644 Robust/src/Benchmarks/Prefetch/Moldyn/javasingle/JGFMolDynBenchSizeC.java diff --git a/Robust/src/Analysis/Locality/LocalityAnalysis.java b/Robust/src/Analysis/Locality/LocalityAnalysis.java index 289f7e88..56c23f61 100644 --- a/Robust/src/Analysis/Locality/LocalityAnalysis.java +++ b/Robust/src/Analysis/Locality/LocalityAnalysis.java @@ -359,7 +359,6 @@ public class LocalityAnalysis { case FKind.FlatMethod: case FKind.FlatOffsetNode: - //System.out.println("In FKind.FlatOffsetNode\n"); processOffsetNode((FlatOffsetNode)fn, currtable); break; @@ -428,6 +427,8 @@ public class LocalityAnalysis { boolean isnative=md.getModifiers().isNative(); boolean isjoin = md.getClassDesc().getSymbol().equals(TypeUtil.ThreadClass)&&!nodemd.getModifiers().isStatic()&&nodemd.numParameters()==0&&md.getSymbol().equals("join"); + boolean isObjectgetType = md.getClassDesc().getSymbol().equals("Object") && md.getSymbol().equals("getType"); + boolean isObjecthashCode = md.getClassDesc().getSymbol().equals("Object") && md.getSymbol().equals("nativehashCode"); LocalityBinding lb=new LocalityBinding(md, isatomic); if (isnative&&isatomic) { @@ -458,7 +459,7 @@ public class LocalityAnalysis { throw new Error("Using type that can be either local or global in context:\n"+currlb.getExplanation()); if(runmethodset==null&&thistype.equals(GLOBAL)&&!isatomic && !isjoin) throw new Error("Using global object outside of transaction in context:\n"+currlb.getExplanation()); - if (runmethodset==null&&isnative&&thistype.equals(GLOBAL) && !isjoin) + if (runmethodset==null&&isnative&&thistype.equals(GLOBAL) && !isjoin && !isObjectgetType && !isObjecthashCode) throw new Error("Potential call to native method "+md+" on global objects:\n"+currlb.getExplanation()); lb.setGlobalThis(thistype); } diff --git a/Robust/src/Benchmarks/Distributed/LookUpService/LookUpService.java b/Robust/src/Benchmarks/Distributed/LookUpService/LookUpService.java index 1680c5d6..dfde7ceb 100644 --- a/Robust/src/Benchmarks/Distributed/LookUpService/LookUpService.java +++ b/Robust/src/Benchmarks/Distributed/LookUpService/LookUpService.java @@ -26,15 +26,20 @@ public class LookUpService extends Thread { } } for (int i = 0; i < numtrans; i++) { - Random rand = new Random(i); - int rdwr = rand.nextInt(100); - int rwkey = rand.nextInt(nobjs*numthreads); - Integer k = new Integer(rwkey); - if (rdwr < rdprob) { - Integer tmp = mydhmap.get(k); - } else { - Integer val = global new Integer(i); - mydhmap.put(k, val); + atomic { + Random rand = new Random(i); + int rdwr = rand.nextInt(100); + int rwkey = rand.nextInt(nobjs*numthreads); + Integer key = global new Integer(rwkey); + Object o1 = key; + if (rdwr < rdprob) { + Object o3 = mydhmap.get(key); + } else { + Integer val = global new Integer(i); + Object o2 = val; + mydhmap.put(key, val); + mydhmap.put(o1, o2); + } } } } diff --git a/Robust/src/Benchmarks/Distributed/LookUpService/makefile b/Robust/src/Benchmarks/Distributed/LookUpService/makefile index b31cf2b4..36145173 100644 --- a/Robust/src/Benchmarks/Distributed/LookUpService/makefile +++ b/Robust/src/Benchmarks/Distributed/LookUpService/makefile @@ -2,10 +2,12 @@ MAINCLASS=LookUpService SRC1=${MAINCLASS}.java \ ../../../ClassLibrary/DistributedHashMap.java FLAGS1=-dsm -dsmcaching -rangeprefetch -optimize -mainclass ${MAINCLASS} -trueprob 0.90 -FLAGS2=-dsm -optimize -mainclass ${MAINCLASS} +FLAGS2=-dsm -dsmcaching -prefetch -optimize -mainclass ${MAINCLASS} -trueprob 0.90 +FLAGS3=-dsm -optimize -mainclass ${MAINCLASS} default: -# ../../../buildscript ${FLAGS2} -o ${MAINCLASS}NPNC ${SRC1} - ../../../buildscript ${FLAGS1} -o ${MAINCLASS}RangePN ${SRC1} + ../../../buildscript ${FLAGS3} -o ${MAINCLASS}NPNC ${SRC1} + ../../../buildscript ${FLAGS2} -o ${MAINCLASS}RangePN ${SRC1} + ../../../buildscript ${FLAGS1} -o ${MAINCLASS}N ${SRC1} clean: rm -rf tmpbuilddirectory diff --git a/Robust/src/Benchmarks/Prefetch/2DConv/dsm/ConvolutionSizeB.java b/Robust/src/Benchmarks/Prefetch/2DConv/dsm/ConvolutionSizeB.java index 01fb1ac1..d5968239 100644 --- a/Robust/src/Benchmarks/Prefetch/2DConv/dsm/ConvolutionSizeB.java +++ b/Robust/src/Benchmarks/Prefetch/2DConv/dsm/ConvolutionSizeB.java @@ -93,10 +93,12 @@ public class Convolution extends Thread { } } + /* atomic{ System.printString("img.outputImage[10][20] = " +(int) img.outputImage[10][20] + "\n"); System.printString("img.outputImage[256][890] = " +(int) img.outputImage[256][890] + "\n"); } + */ System.printString("Convolution: Size="); System.printInt(SIZE); @@ -118,10 +120,12 @@ public class Convolution extends Thread { System.printString("2DConv Done!\n"); + /* atomic{ System.printString("img.outputImage[10][20] = " +(int) img.outputImage[10][20] + "\n"); System.printString("img.outputImage[256][890] = " +(int) img.outputImage[256][890] + "\n"); } + */ } //define 5X5 Gaussian kernel diff --git a/Robust/src/Benchmarks/Prefetch/2DConv/dsm/ConvolutionSizeC.java b/Robust/src/Benchmarks/Prefetch/2DConv/dsm/ConvolutionSizeC.java new file mode 100644 index 00000000..38a6c39b --- /dev/null +++ b/Robust/src/Benchmarks/Prefetch/2DConv/dsm/ConvolutionSizeC.java @@ -0,0 +1,413 @@ +public class Convolution extends Thread { + Image img; + int x0,x1,y0,y1; + + public Convolution(Image img, int x0, int x1, int y0, int y1) { + this.img = img; + this.x0 = x0; + this.x1 = x1; + this.y0 = y0; + this.y1 = y1; + } + + public void run() { + int kernelHeight=15; + int kernelWidth=15; + + double[][] kernel = new double[kernelHeight][kernelWidth]; + initKernel15(kernel); + + atomic { + double tempinput[][] = img.inputImage; + double tempout[][] = img.outputImage; + + double tinput1[] = tempinput[x0]; + double tinput2[] = tempinput[x0+1]; + double tinput3[] = tempinput[x0+2]; + double tinput4[] = tempinput[x0+3]; + double tinput5[] = tempinput[x0+4]; + double tinput6[] = tempinput[x0+5]; + double tinput7[] = tempinput[x0+6]; + double tinput8[] = tempinput[x0+7]; + double tinput9[] = tempinput[x0+8]; + double tinput10[] = tempinput[x0+9]; + double tinput11[] = tempinput[x0+10]; + double tinput12[] = tempinput[x0+11]; + double tinput13[] = tempinput[x0+12]; + double tinput14[] = tempinput[x0+13]; + double tinput0[] = tinput1; + + int l=x0+14; + for(int i=x0;i0) { + NUM_THREADS = Integer.parseInt(args[0]); + if(args.length>1) { + SIZE = Integer.parseInt(args[1]); + } + } + + int[] mid = new int[8]; + mid[0] = (128<<24)|(195<<16)|(136<<8)|162; //dw-10 + mid[1] = (128<<24)|(195<<16)|(136<<8)|163; //dw-11 + mid[2] = (128<<24)|(195<<16)|(136<<8)|164; //dw-12 + mid[3] = (128<<24)|(195<<16)|(136<<8)|165; //dw-13 + mid[4] = (128<<24)|(195<<16)|(136<<8)|166; //dw-14 + mid[5] = (128<<24)|(195<<16)|(136<<8)|167; //dw-15 + mid[6] = (128<<24)|(195<<16)|(136<<8)|168; //dw-16 + mid[7] = (128<<24)|(195<<16)|(136<<8)|169; //dw-17 + + Image img; + Convolution[] conv; + Convolution tmp; + + atomic { + img = global new Image(SIZE,SIZE,kernelHeight,kernelWidth); + img.setValues(); + conv = global new Convolution[NUM_THREADS]; + int increment=SIZE/NUM_THREADS; + int base = 0; + for(int i = 0; i0) { + NUM_THREADS = Integer.parseInt(args[0]); + if(args.length>1) { + SIZE = Integer.parseInt(args[1]); + } + } + + Image img; + Convolution[] conv; + Convolution tmp; + + img = new Image(SIZE,SIZE,kernelHeight,kernelWidth); + img.setValues(); + conv = new Convolution[NUM_THREADS]; + int increment=SIZE/NUM_THREADS; + int base = 0; + for(int i = 0; i> schedulings = scheduleAnalysis.getSchedulings(); Vector selectedScheduling = scheduleSimulator.simulate(schedulings); if(state.MULTICORE) { Vector scheduling = scheduleAnalysis.getSchedulings().elementAt(selectedScheduling.firstElement()); - BuildCodeMultiCore bcm=new BuildCodeMultiCore(state, - bf.getMap(), - tu, - sa, - scheduling, - scheduleAnalysis.getCoreNum(), - pa); + BuildCodeMultiCore bcm=new BuildCodeMultiCore(state, + bf.getMap(), + tu, + sa, + scheduling, + scheduleAnalysis.getCoreNum(), + pa); bcm.setOwnershipAnalysis(oa); bcm.buildCode(); scheduling = null; diff --git a/Robust/src/Runtime/DSTM/interface/dsmlock.h b/Robust/src/Runtime/DSTM/interface/dsmlock.h index 7e10dc38..2ea3cdb6 100644 --- a/Robust/src/Runtime/DSTM/interface/dsmlock.h +++ b/Robust/src/Runtime/DSTM/interface/dsmlock.h @@ -6,11 +6,11 @@ #define RW_LOCK_UNLOCKED { RW_LOCK_BIAS } //#define LOCK_PREFIX "" #define LOCK_PREFIX \ - ".section .smp_locks,\"a\"\n" \ - " .align 4\n" \ - " .long 661f\n" /* address */ \ - ".previous\n" \ - "661:\n\tlock; " + ".section .smp_locks,\"a\"\n" \ + " .align 4\n" \ + " .long 661f\n" /* address */\ + ".previous\n" \ + "661:\n\tlock; " diff --git a/Robust/src/Runtime/garbage.c b/Robust/src/Runtime/garbage.c index ee0c37e1..74a8bdd8 100644 --- a/Robust/src/Runtime/garbage.c +++ b/Robust/src/Runtime/garbage.c @@ -57,10 +57,10 @@ int listcount=0; #elif defined(FASTCHECK) #define ENQUEUE(orig, dst) \ if (((unsigned int)orig)!=1) { \ - void *copy; \ - if (gc_createcopy(orig,©)) \ - enqueue(orig);\ - dst=copy; } + void *copy; \ + if (gc_createcopy(orig,©)) \ + enqueue(orig);\ + dst=copy; } #else #define ENQUEUE(orig, dst) \ void *copy; \ -- 2.34.1