From: jjenista Date: Mon, 31 Aug 2009 23:21:49 +0000 (+0000) Subject: Variable result table pruning is buggy, remove for now, also adding improved tests... X-Git-Url: http://plrg.eecs.uci.edu/git/?p=IRC.git;a=commitdiff_plain;h=c571510350713909c0b9d2b1fdc403dd9e377637 Variable result table pruning is buggy, remove for now, also adding improved tests. However, for larger test cases inconsistencies appear --- diff --git a/Robust/src/Analysis/MLP/MLPAnalysis.java b/Robust/src/Analysis/MLP/MLPAnalysis.java index 153a258e..1dbb8d14 100644 --- a/Robust/src/Analysis/MLP/MLPAnalysis.java +++ b/Robust/src/Analysis/MLP/MLPAnalysis.java @@ -146,7 +146,6 @@ public class MLPAnalysis { variableAnalysisForward( fm ); } - // 4th pass, compute liveness contribution from // virtual reads discovered in variable pass rootItr = rootSESEs.iterator(); @@ -158,6 +157,9 @@ public class MLPAnalysis { } + /* + SOMETHING IS WRONG WITH THIS, DON'T USE IT UNTIL IT CAN BE FIXED + // 5th pass methItr = ownAnalysis.descriptorsToAnalyze.iterator(); while( methItr.hasNext() ) { @@ -168,7 +170,8 @@ public class MLPAnalysis { // by removing reference variables that are not live pruneVariableResultsWithLiveness( fm ); } - + */ + // 6th pass methItr = ownAnalysis.descriptorsToAnalyze.iterator(); @@ -623,7 +626,6 @@ public class MLPAnalysis { Set rootLiveSet = livenessRootView.get( fn ); VarSrcTokTable vstTable = variableResults.get( fn ); - // fix later, not working, only wanted it to make tables easier to read vstTable.pruneByLiveness( rootLiveSet ); for( int i = 0; i < fn.numNext(); i++ ) { @@ -950,7 +952,7 @@ public class MLPAnalysis { // along various control paths, and therefore when we stall, // just stall for the exact thing we need and move on plan.addDynamicStall( readtmp ); - currentSESE.addDynamicVar( readtmp ); + currentSESE.addDynamicVar( readtmp ); } else if( srcType.equals( VarSrcTokTable.SrcType_STATIC ) ) { // 2) Single token/age pair: Stall for token/age pair, and copy diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index fbecf44a..f17905a5 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -2889,11 +2889,18 @@ public class BuildCode { FlatSESEEnterNode fsen, PrintWriter output ) { + + // if MLP flag is off, okay that SESE nodes are in IR graph, + // just skip over them and code generates exactly the same if( !state.MLP ) { - // SESE nodes can be parsed for normal compilation, just skip over them return; } + // there may be an SESE in an unreachable method, skip over + if( !mlpa.getAllSESEs().contains( fsen ) ) { + return; + } + // also, if we have encountered a placeholder, just skip it if( fsen.getIsCallerSESEplaceholder() ) { return; @@ -3081,8 +3088,15 @@ public class BuildCode { FlatSESEExitNode fsexn, PrintWriter output ) { + + // if MLP flag is off, okay that SESE nodes are in IR graph, + // just skip over them and code generates exactly the same if( !state.MLP ) { - // SESE nodes can be parsed for normal compilation, just skip over them + return; + } + + // there may be an SESE in an unreachable method, skip over + if( !mlpa.getAllSESEs().contains( fsexn.getFlatEnter() ) ) { return; } @@ -3095,18 +3109,6 @@ public class BuildCode { String com = paramsprefix+"->common"; - /* - // take yourself off the thread-local sese call stack - output.println(" if( isEmpty( seseCallStack ) ) {"); - output.println(" printf( \"Error, sese call stack is empty.\\n\" );"); - output.println(" exit( -1 );"); - output.println(" }"); - output.println(" if( (void*)"+paramsprefix+" != getItem( seseCallStack ) ) {"); - output.println(" printf( \"Error, sese call stack mismatch.\\n\" );"); - output.println(" exit( -1 );"); - output.println(" }"); - */ - // this SESE cannot be done until all of its children are done // so grab your own lock with the condition variable for watching // that the number of your running children is greater than zero diff --git a/Robust/src/Tests/mlp/regression/runTests b/Robust/src/Tests/mlp/regression/runTests index 0af7eee9..efe1a65a 100755 --- a/Robust/src/Tests/mlp/regression/runTests +++ b/Robust/src/Tests/mlp/regression/runTests @@ -3,17 +3,15 @@ echo 'Each single/multi output line pair should be identical' echo '' > resultsSingle.txt echo '' > resultsMulti.txt -for i in $(seq 5) +for i in $(seq 20) do echo 'running...' -./testSingle.bin 10 >> resultsSingle.txt -./testMulti.bin 10 >> resultsMulti.txt -./testSingle.bin 25 >> resultsSingle.txt -./testMulti.bin 25 >> resultsMulti.txt -./testSingle.bin 125 >> resultsSingle.txt -./testMulti.bin 125 >> resultsMulti.txt -./testSingle.bin 1255 >> resultsSingle.txt -./testMulti.bin 1255 >> resultsMulti.txt +./testSingle.bin $[ i ] >> resultsSingle.txt +./testMulti.bin $[ i ] >> resultsMulti.txt +./testSingle.bin $[ i*7 ] >> resultsSingle.txt +./testMulti.bin $[ i*7 ] >> resultsMulti.txt +./testSingle.bin $[ 50+i*7 ] >> resultsSingle.txt +./testMulti.bin $[ 50+i*7 ] >> resultsMulti.txt done echo 'Diffing results' diff --git a/Robust/src/Tests/mlp/regression/test.java b/Robust/src/Tests/mlp/regression/test.java index aaed0336..4318fed0 100644 --- a/Robust/src/Tests/mlp/regression/test.java +++ b/Robust/src/Tests/mlp/regression/test.java @@ -40,6 +40,10 @@ public class Test { public static int calculateStuff( int sum, int num, int mode ) { int answer = sum; + sese makePlaceholderStallAfter { + sum = sum + 1; + } + sum = sum + 1; if( mode == 0 ) { sese mode1 { answer = sum + num; diff --git a/Robust/src/Tests/mlp/tinyTest/test.java b/Robust/src/Tests/mlp/tinyTest/test.java index aaed0336..3c779968 100644 --- a/Robust/src/Tests/mlp/tinyTest/test.java +++ b/Robust/src/Tests/mlp/tinyTest/test.java @@ -4,22 +4,21 @@ public class Test { public static void main( String args[] ) { int x = Integer.parseInt( args[0] ); doSomeWork( x ); - nullMethodBodyFinalNode(); } public static void doSomeWork( int x ) { for( int i = 0; i < x; ++i ) { sese calc { - int sum = 0; + int sum = 0; for( int j = 0; j <= i; ++j ) { sum = calculateStuff( sum, 1, 0 ); - } - } + } + } sese forceVirtualReal { if( i % 3 == 0 ) { sum = sum + (i % 20); } - } + } if( i % 2 == 0 ) { sese change { for( int k = 0; k < i*2; ++k ) { @@ -31,7 +30,7 @@ public class Test { for( int l = 0; l < 3; ++l ) { sum = calculateStuff( sum, 2, 2 ); } - } + } sese prnt { mightPrint( x, i, sum ); } @@ -39,7 +38,11 @@ public class Test { } public static int calculateStuff( int sum, int num, int mode ) { - int answer = sum; + int answer = sum; + sese makePlaceholderStallAfter { + sum = sum + 1; + } + sum = sum + 1; if( mode == 0 ) { sese mode1 { answer = sum + num; @@ -48,25 +51,13 @@ public class Test { sese mode2 { answer = sum + (num/2); } - } else { + } else if( mode == 2 ) { sese mode3 { - answer = sum / num; + answer = sum + (num/2); } } - return answer; - } - public static void nullMethodBodyFinalNode() { - int y = 1; - sese nothing { - int x = 0; - } - y = x; - if( x > y ) { - return; - } else { - return; - } + return answer; } public static void mightPrint( int x, int i, int sum ) {