[Patch][LoopVectorize] Late evaluate of runtime pointer check's threshold

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 10 17:02:45 PDT 2015


----- Original Message -----
> From: "Tyler Nowicki" <tnowicki at apple.com>
> To: "Hal Finkel" <hfinkel at anl.gov>
> Cc: "Gerolf Hoflehner" <ghoflehner at apple.com>, "Commit Messages and Patches for LLVM" <llvm-commits at lists.llvm.org>,
> "llvm cfe" <cfe-commits at lists.llvm.org>
> Sent: Monday, August 10, 2015 6:06:24 PM
> Subject: Re: [Patch][LoopVectorize] Late evaluate of runtime pointer check's threshold
> 
> Hi Hal,
> 
> 
> Thanks, the patches are committed in r 244523 and r 244526 .
> 
> There are two possibilities to give the user control over pointer
> checking. We could add a loop hint option like
> vectorize(check_safety) that would be a safe version of
> ‘assume_safety’ or we could simply make it always emit the necessary
> pointer checks, no matter how many of them there are, when the loop
> hint vectorize(enable) is specified?
> 
> What do you think?
> 

I think that we should just emit the checks when the user specifies 'vectorize(enable)' regardless of the number. In a sense, the user is already instructing us to override our cost model and vectorize anyway, and this is just another aspect of that cost model that we should override.

That having been said, as with unrolling, we should have a large internal limit to prevent running out of memory, etc. when compiling.

 -Hal

> 
> Tyler
> 
> 
> 
> 
> 
> On Aug 9, 2015, at 9:41 PM, Hal Finkel < hfinkel at anl.gov > wrote:
> 
> Hi Tyler,
> 
> This looks very useful.
> 
> Please don't mention '-mllvm -runtime-memory-check-threshold=' in the
> error message. We should add some clause to #pragma clang loop to
> control this feature with some associated metadata. '-mllvm' things
> should not be part of the advertised interface to end users (but
> that should be a separate set of patches regardless).
> 
> Otherwise, LGTM.
> 
> Thanks again,
> Hal
> 
> ----- Original Message -----
> 
> 
> From: "Tyler Nowicki" < tnowicki at apple.com >
> To: "Hal J. Finkel" < hfinkel at anl.gov >, "Commit Messages and Patches
> for LLVM" < llvm-commits at lists.llvm.org >, "llvm
> cfe" < cfe-commits at lists.llvm.org >
> Cc: "Gerolf Hoflehner" < ghoflehner at apple.com >
> Sent: Thursday, August 6, 2015 3:25:26 PM
> Subject: [Patch][LoopVectorize] Late evaluate of runtime pointer
> check's threshold
> 
> 
> Hi,
> 
> 
> This patch extends the patches in ' Late evaluation of vectorization
> requirements’ (still in review). This makes the num runtime pointer
> checks test into a late diagnostic so we can give the user a better
> diagnostic message. Clang appends the diagnostic with options for
> getting the loop vectorized. Here is an example of the diagnostic
> the user will see:
> 
> 
> "remark: loop not vectorized: cannot prove pointers refer to
> independent arrays in memory. The loop requires 9 runtime
> independence checks to safely vectorize the loop, but that would
> exceed the limit of 8 checks; increase the number of runtime pointer
> checks with the compiler option ‘-mllvm
> -runtime-memory-check-threshold=’. To avoid runtime pointer checking
> when you know the arrays will always be independent specify ‘#pragma
> clang loop vectorize(assume_safety)’ before the loop or specify
> ‘restrict’ on the array arguments. Erroneous results will occur if
> these options are incorrectly applied."
> 
> 
> The diagnostic is produced when the command line option
> -Rpass-analysis=loop-vectorize is provided.
> 
> 
> Reviews/comments are much appreciated!
> 
> 
> Tyler
> 
> 
> 
> 
> 
> 
> 
> 
> --
> Hal Finkel
> Assistant Computational Scientist
> Leadership Computing Facility
> Argonne National Laboratory
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory


More information about the llvm-commits mailing list