[polly] r269045 - Prevent complex access ranges with low number of pieces.

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Sat May 14 03:53:59 PDT 2016


On 05/14, Michael Kruse wrote:
> 2016-05-10 13:46 GMT+02:00 Johannes Doerfert via llvm-commits
> <llvm-commits at lists.llvm.org>:
> > Author: jdoerfert
> > Date: Tue May 10 06:46:57 2016
> > New Revision: 269045
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=269045&view=rev
> > Log:
> > Prevent complex access ranges with low number of pieces.
> >
> >   Previously we checked the number of pieces to decide whether or not a
> >   invariant load was to complex to be generated. However, there are
> >   cases when e.g., divisions cause the complexity to spike regardless of
> >   the number of pieces. To this end we now check the number of totally
> >   involved dimensions which will increase with the number of pieces but
> >   also the number of divisions.
> >
> >
> > Modified:
> >     polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
> >
> > Modified: polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
> > URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslNodeBuilder.cpp?rev=269045&r1=269044&r2=269045&view=diff
> > ==============================================================================
> > --- polly/trunk/lib/CodeGen/IslNodeBuilder.cpp (original)
> > +++ polly/trunk/lib/CodeGen/IslNodeBuilder.cpp Tue May 10 06:46:57 2016
> > @@ -48,11 +48,11 @@
> >  using namespace polly;
> >  using namespace llvm;
> >
> > -// The maximal number of basic sets we allow during invariant load construction.
> > +// The maximal number of dimensions we allow during invariant load construction.
> >  // More complex access ranges will result in very high compile time and are also
> >  // unlikely to result in good code. This value is very high and should only
> >  // trigger for corner cases (e.g., the "dct_luma" function in h264, SPEC2006).
> > -static int const MaxDisjunctionsInAccessRange = 80;
> > +static int const MaxDimensionsInAccessRange = 9;
> >
> >  __isl_give isl_ast_expr *
> >  IslNodeBuilder::getUpperBound(__isl_keep isl_ast_node *For,
> > @@ -922,10 +922,22 @@ bool IslNodeBuilder::materializeParamete
> >    return true;
> >  }
> >
> > +/// @brief Add the number of dimensions in @p BS to @p U.
> > +static isl_stat countTotalDims(isl_basic_set *BS, void *U) {
> > +  unsigned *NumTotalDim = static_cast<unsigned *>(U);
> > +  *NumTotalDim += isl_basic_set_total_dim(BS);
> 
> The total number of dimensions doesn't look like a useful metric for
> complexity. The number of parameters and domain contribute to it even
> if there are no constraints on it. With the current threshold, the
> test will fail eg. with 2 basic sets in a space of 5 parameters or
> even unconditionally with 10 parameters.
I didn't see any problems so far but if there is one I encourage you to
change it. If you want me to file a bug and I will circle back to it.

> I suggest to use total number of constraints and/or
> isl_basic_set_dim(BS, isl_dim_div).
> 
> Michael
> 
> > +  isl_basic_set_free(BS);
> > +  return isl_stat_ok;
> > +}
> > +
> >  Value *IslNodeBuilder::preloadUnconditionally(isl_set *AccessRange,
> >                                                isl_ast_build *Build,
> >                                                Instruction *AccInst) {
> > -  if (isl_set_n_basic_set(AccessRange) > MaxDisjunctionsInAccessRange) {
> > +
> > +  // TODO: This check could be performed in the ScopInfo already.
> > +  unsigned NumTotalDim = 0;
> > +  isl_set_foreach_basic_set(AccessRange, countTotalDims, &NumTotalDim);
> > +  if (NumTotalDim > MaxDimensionsInAccessRange) {
> >      isl_set_free(AccessRange);
> >      return nullptr;
> >    }
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits

-- 

Johannes Doerfert
Researcher / PhD Student

Compiler Design Lab (Prof. Hack)
Saarland University, Computer Science
Building E1.3, Room 4.31

Tel. +49 (0)681 302-57521 : doerfert at cs.uni-saarland.de
Fax. +49 (0)681 302-3065  : http://www.cdl.uni-saarland.de/people/doerfert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: Digital signature
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160514/ceee5d0e/attachment.sig>


More information about the llvm-commits mailing list