Changeset: be4bbbbd38e7 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=be4bbbbd38e7 Modified Files: MonetDB5/ChangeLog MonetDB5/conf/monetdb5.conf.in MonetDB5/src/mal/Tests/All MonetDB5/src/mal/mal_resolve.mx MonetDB5/src/modules/mal/mdb.mx MonetDB5/src/optimizer/opt_accessmode.mx MonetDB5/src/optimizer/opt_accumulators.mx MonetDB5/src/optimizer/opt_aliases.mx MonetDB5/src/optimizer/opt_cluster.mx MonetDB5/src/optimizer/opt_coercion.mx MonetDB5/src/optimizer/opt_commonTerms.mx MonetDB5/src/optimizer/opt_compression.mx MonetDB5/src/optimizer/opt_constants.mx MonetDB5/src/optimizer/opt_costModel.mx MonetDB5/src/optimizer/opt_crack.mx MonetDB5/src/optimizer/opt_datacell.mx MonetDB5/src/optimizer/opt_datacyclotron.mx MonetDB5/src/optimizer/opt_dataflow.mx MonetDB5/src/optimizer/opt_deadcode.mx MonetDB5/src/optimizer/opt_derivepath.mx MonetDB5/src/optimizer/opt_dictionary.mx MonetDB5/src/optimizer/opt_emptySet.mx MonetDB5/src/optimizer/opt_evaluate.mx MonetDB5/src/optimizer/opt_factorize.mx MonetDB5/src/optimizer/opt_garbageCollector.mx MonetDB5/src/optimizer/opt_heuristics.mx MonetDB5/src/optimizer/opt_history.mx MonetDB5/src/optimizer/opt_inline.mx MonetDB5/src/optimizer/opt_joinpath.mx MonetDB5/src/optimizer/opt_joinselect.mx MonetDB5/src/optimizer/opt_macro.mx MonetDB5/src/optimizer/opt_mapreduce.mx MonetDB5/src/optimizer/opt_mergetable.mx MonetDB5/src/optimizer/opt_mitosis.mx MonetDB5/src/optimizer/opt_multiplex.mx MonetDB5/src/optimizer/opt_octopus.mx MonetDB5/src/optimizer/opt_partitions.mx MonetDB5/src/optimizer/opt_peephole.mx MonetDB5/src/optimizer/opt_prejoin.mx MonetDB5/src/optimizer/opt_prelude.mx MonetDB5/src/optimizer/opt_pushranges.mx MonetDB5/src/optimizer/opt_qep.mx MonetDB5/src/optimizer/opt_recycler.mx MonetDB5/src/optimizer/opt_reduce.mx MonetDB5/src/optimizer/opt_remap.mx MonetDB5/src/optimizer/opt_remoteQueries.mx MonetDB5/src/optimizer/opt_reorder.mx MonetDB5/src/optimizer/opt_replication.mx MonetDB5/src/optimizer/opt_selcrack.mx MonetDB5/src/optimizer/opt_sidcrack.mx MonetDB5/src/optimizer/opt_singleton.mx MonetDB5/src/optimizer/opt_strengthReduction.mx MonetDB5/src/optimizer/opt_support.mx MonetDB5/src/optimizer/opt_trace.mx MonetDB5/src/optimizer/optimizerWrapper.mx Branch: default Log Message:
The new optimizer control bitvector Debugging the optimizer pipeline The best way is to use mdb.traceOptimizer(str) and inspect the information gathered during the optimization phase. Several optimizers produce more intermediate information, which may shed light on the details. The optDebug bitvector controls their output. It can be set to a pipeline or a comma separated list of optimizers you would like to trace. It is a server wide property and can not be set dynamically, as it is intended for internal use. diffs (truncated from 3579 to 300 lines): diff -r c902704ffc86 -r be4bbbbd38e7 MonetDB5/ChangeLog --- a/MonetDB5/ChangeLog Sat Jul 17 21:16:49 2010 +0200 +++ b/MonetDB5/ChangeLog Sun Jul 18 10:34:03 2010 +0200 @@ -1,6 +1,15 @@ # ChangeLog file for MonetDB5 # This file is updated with Maddlog +* Sat Jul 17 2010 [email protected] +- Debugging the optimizer pipeline The best way is to use mdb.traceOptimizer(str) + and inspect the information gathered during the optimization phase. + Several optimizers produce more intermediate information, which may + shed light on the details. The optDebug bitvector controls their + output. It can be set to a pipeline or a comma separated list of + optimizers you would like to trace. It is a server wide property and + can not be set dynamically, as it is intended for internal use. + * Tue Jul 13 2010 Stefan Manegold <[email protected]> - Added "sequential_pipe" SQL optimizer pipeline that is (and should be kept!) identical to the default pipeline, except that optimizers mitosis & dataflow diff -r c902704ffc86 -r be4bbbbd38e7 MonetDB5/conf/monetdb5.conf.in --- a/MonetDB5/conf/monetdb5.conf.in Sat Jul 17 21:16:49 2010 +0200 +++ b/MonetDB5/conf/monetdb5.conf.in Sun Jul 18 10:34:03 2010 +0200 @@ -250,3 +250,11 @@ # The default + compression compression_pipe=inline,remap,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,constants,commonTerms,joinPath,deadcode,reduce,dataflow,compression,dataflow,history,multiplex,garbageCollector + +#Debugging the optimizer pipeline +# The best way is to use mdb and inspect the information gathered during the optimization phase. +# Several optimizers produce more intermediate information, which may shed light on the details. +# The opt_debug bitvector controls their output. It can be set to a pipeline or a comma separated +# list of optimizers you would like to trace. It is a server wide property and can not be set +# dynamically, as it is intended for internal use. +opt_debug= diff -r c902704ffc86 -r be4bbbbd38e7 MonetDB5/src/mal/Tests/All --- a/MonetDB5/src/mal/Tests/All Sat Jul 17 21:16:49 2010 +0200 +++ b/MonetDB5/src/mal/Tests/All Sun Jul 18 10:34:03 2010 +0200 @@ -163,7 +163,7 @@ #tst380 tst400 tst401 -tst450 +#tst450 it served its purpose tst500 tst501 tst550 diff -r c902704ffc86 -r be4bbbbd38e7 MonetDB5/src/mal/mal_resolve.mx --- a/MonetDB5/src/mal/mal_resolve.mx Sat Jul 17 21:16:49 2010 +0200 +++ b/MonetDB5/src/mal/mal_resolve.mx Sun Jul 18 10:34:03 2010 +0200 @@ -388,6 +388,12 @@ p->typechk= TYPE_RESOLVED; for(i=0;i<p->retc;i++) { int ts= returntype[i]; + if( isVarConstant(mb, getArg(p,i)) ){ + showScriptException( mb, getPC(mb,p), TYPE, "Assignment to constant"); + p->typechk= TYPE_UNKNOWN; + mb->errors++; + return -3; + } if( !isVarFixed(mb,getArg(p,i)) && ts>=0) { setVarType(mb, getArg(p,i),ts); setVarFixed(mb, getArg(p,i)); diff -r c902704ffc86 -r be4bbbbd38e7 MonetDB5/src/modules/mal/mdb.mx --- a/MonetDB5/src/modules/mal/mdb.mx Sat Jul 17 21:16:49 2010 +0200 +++ b/MonetDB5/src/modules/mal/mdb.mx Sun Jul 18 10:34:03 2010 +0200 @@ -129,7 +129,7 @@ address MDBsetDebugStr comment "Set the kernel debugging bit-set and return its previous value. The recognized options are: threads, memory, properties, -io, transactions, modules, algorithms, estimates, xproperties"; +io, transactions, modules, algorithms, estimates, xproperties."; command setDebug(flg:int):int address MDBsetDebug comment "Set the kernel debugging bit-set and return its previous value."; @@ -414,7 +414,7 @@ str MDBsetDebugStr(int *ret, str *flg) { - *ret = GDKdebug; + *ret = GDKdebug; if( strcmp("threads",*flg)==0) GDKdebug |= GRPthreads; if( strcmp("memory",*flg)==0) diff -r c902704ffc86 -r be4bbbbd38e7 MonetDB5/src/optimizer/opt_accessmode.mx --- a/MonetDB5/src/optimizer/opt_accessmode.mx Sat Jul 17 21:16:49 2010 +0200 +++ b/MonetDB5/src/optimizer/opt_accessmode.mx Sun Jul 18 10:34:03 2010 +0200 @@ -41,8 +41,11 @@ #include "opt_prelude.h" #include "opt_support.h" -/* #define DEBUG_OPT_MODES show partial result */ +@:exportOptimizer(accessmode)@ +#define OPTDEBUGaccessmode if ( optDebug & (1 <<DEBUG_OPT_ACCESSMODE) ) + +#endif @- The implementation strategy is currently quite simple. We make a scan to identify all setWriteModes and see if @@ -107,20 +110,12 @@ p->fcn= NULL; actions++; } -#ifdef DEBUG_OPT_MODES - stream_printf(cntxt->fdout,"OPTIMIZE MODES\n"); - printFunction(cntxt->fdout,mb,0,LIST_MAL_ALL); -#else (void) cntxt; -#endif GDKfree(candidate); GDKfree(writeable); return actions; } @include optimizerWrapper.mx -...@h -@:exportOptimizer(accessmode)@ -#endif @c #include "opt_statistics.h" @:wrapOptimizer(accessmode,OPT_CHECK_ALL)@ diff -r c902704ffc86 -r be4bbbbd38e7 MonetDB5/src/optimizer/opt_accumulators.mx --- a/MonetDB5/src/optimizer/opt_accumulators.mx Sat Jul 17 21:16:49 2010 +0200 +++ b/MonetDB5/src/optimizer/opt_accumulators.mx Sun Jul 18 10:34:03 2010 +0200 @@ -61,8 +61,11 @@ #include "opt_support.h" #include "mal_interpreter.h" -/* #define DEBUG_OPT_OPTIMIZER show partial result */ +@:exportOptimizer(accumulators)@ +#define OPTDEBUGaccumulators if ( optDebug & ((lng)1 <<DEBUG_OPT_ACCUMULATORS) ) + +#endif @c #include "mal_config.h" #include "opt_accumulators.h" @@ -95,9 +98,8 @@ pushInstruction(mb,p); continue; } -#ifdef DEBUG_OPT_OPTIMIZER - printInstruction(cntxt->fdout, mb, 0, p, LIST_MAL_ALL); -#endif + OPTDEBUGaccumulators + printInstruction(cntxt->fdout, mb, 0, p, LIST_MAL_ALL); if (p->retc==1 && p->argc == 2) { /* unary operation, avoid clash with binary */ pushInstruction(mb,p); @@ -123,27 +125,26 @@ typeChecker(scope, mb, p, TRUE); if (mb->errors || p->typechk == TYPE_UNKNOWN) { -#ifdef DEBUG_OPT_OPTIMIZER - stream_printf(cntxt->fdout,"Failed typecheck"); - printInstruction(cntxt->fdout, mb, 0, p, LIST_MAL_ALL); -#endif + OPTDEBUGaccumulators{ + stream_printf(cntxt->fdout,"# Failed typecheck"); + printInstruction(cntxt->fdout, mb, 0, p, LIST_MAL_ALL); + } /* reset instruction error buffer */ cntxt->errbuf[0]=0; mb->errors = 0; freeInstruction(p); p=q; /* restore */ } else { -#ifdef DEBUG_OPT_OPTIMIZER - stream_printf(cntxt->fdout, "Found accumulation candidate "); - stream_printf(cntxt->fdout, "%d: %d(%d)\n", i, getArg(p,0),getArg(p,2)); - printInstruction(cntxt->fdout, mb, 0, p, LIST_MAL_ALL); -#endif + OPTDEBUGaccumulators{ + stream_printf(cntxt->fdout, "#Found accumulation candidate "); + stream_printf(cntxt->fdout, "%d: %d(%d)\n", i, getArg(p,0),getArg(p,2)); + printInstruction(cntxt->fdout, mb, 0, p, LIST_MAL_ALL); + } freeInstruction(q); actions++; } -#ifdef DEBUG_OPT_OPTIMIZER - printInstruction(cntxt->fdout, mb, 0, p, LIST_MAL_ALL); -#endif + OPTDEBUGaccumulators + printInstruction(cntxt->fdout, mb, 0, p, LIST_MAL_ALL); } pushInstruction(mb,p); } @@ -152,16 +153,12 @@ freeInstruction(old[i]); GDKfree(old); GDKfree(span); - OPTDEBUG - if ( actions) + DEBUGoptimizers stream_printf(cntxt->fdout,"#opt_accumulators:%d accumulations\n",actions); return actions; } @include optimizerWrapper.mx -...@h -@:exportOptimizer(accumulators)@ -#endif @c #include "opt_statistics.h" @:wrapOptimizer(accumulators,OPT_CHECK_ALL)@ diff -r c902704ffc86 -r be4bbbbd38e7 MonetDB5/src/optimizer/opt_aliases.mx --- a/MonetDB5/src/optimizer/opt_aliases.mx Sat Jul 17 21:16:49 2010 +0200 +++ b/MonetDB5/src/optimizer/opt_aliases.mx Sun Jul 18 10:34:03 2010 +0200 @@ -86,10 +86,11 @@ #include "opt_support.h" #include "mal_exception.h" -/* #define DEBUG_OPT_ALIASES show partial result */ - opt_export int OPTisAlias(InstrPtr p); opt_export void OPTaliasRemap(InstrPtr p, int *alias); + +#define OPTDEBUGaliases if ( optDebug & (1 <<DEBUG_OPT_ALIASES) ) + @- When you propagate an alias through the program, the properties maintained should also be updated. In particular, the lifespan @@ -166,8 +167,7 @@ @c GDKfree(span); GDKfree(alias); - OPTDEBUG - if (actions) + DEBUGoptimizers stream_printf(cntxt->fdout,"#opt_aliases: %d removed\n",actions); return actions; } diff -r c902704ffc86 -r be4bbbbd38e7 MonetDB5/src/optimizer/opt_cluster.mx --- a/MonetDB5/src/optimizer/opt_cluster.mx Sat Jul 17 21:16:49 2010 +0200 +++ b/MonetDB5/src/optimizer/opt_cluster.mx Sun Jul 18 10:34:03 2010 +0200 @@ -42,9 +42,10 @@ #include "opt_prelude.h" #include "opt_support.h" -/*#define _DEBUG_OPT_CLUSTER*/ #define CLUSTER_THRESHOLD (BUN)(64*1024) +#define OPTDEBUGcluster if ( optDebug & ((lng)1 <<DEBUG_OPT_CLUSTER) ) + @c #include "mal_config.h" #include "opt_cluster.h" @@ -151,9 +152,6 @@ //if (lcnt && rcnt) { /* lets cluster */ //} -#ifdef _DEBUG_OPT_CLUSTER - printFunction(cntxt->fdout,mb,0,LIST_MAL_ALL); -#endif return 1; } #endif @@ -666,9 +664,6 @@ actions += cluster_join(mb); (void)cntxt; (void)stk; (void)p; -#ifdef _DEBUG_OPT_CLUSTER - printFunction(cntxt->fdout,mb,0,LIST_MAL_ALL); -#endif return actions; } diff -r c902704ffc86 -r be4bbbbd38e7 MonetDB5/src/optimizer/opt_coercion.mx --- a/MonetDB5/src/optimizer/opt_coercion.mx Sat Jul 17 21:16:49 2010 +0200 +++ b/MonetDB5/src/optimizer/opt_coercion.mx Sun Jul 18 10:34:03 2010 +0200 @@ -49,7 +49,9 @@ #include "mal_interpreter.h" #include "opt_support.h" -/* #define DEBUG_OPT_REDUCE show partial result */ +@:exportOptimizer(coercion)@ +#define OPTDEBUGcoercion if ( optDebug & ((lng)1 << DEBUG_OPT_COERCION) ) +#endif @c #include "mal_config.h" @@ -103,15 +105,11 @@ This optimizer affects the flow, but not the type and declaration structure. A cheaper optimizer is sufficient. @c - OPTDEBUG - if ( actions) + DEBUGoptimizers stream_printf(cntxt->fdout,"#opt_coercion: %d coersions applied\n",actions); return actions; } @include optimizerWrapper.mx -...@h -@:exportOptimizer(coercion)@ -#endif @c #include "opt_statistics.h" @:wrapOptimizer(coercion,OPT_CHECK_FLOW)@ diff -r c902704ffc86 -r be4bbbbd38e7 MonetDB5/src/optimizer/opt_commonTerms.mx --- a/MonetDB5/src/optimizer/opt_commonTerms.mx Sat Jul 17 21:16:49 2010 +0200 _______________________________________________ Checkin-list mailing list [email protected] http://mail.monetdb.org/mailman/listinfo/checkin-list
