[Patch][LoopVectorize]Late evaluation of vectorization requirements

Hal Finkel hfinkel at anl.gov
Thu Jul 9 19:09:19 PDT 2015


----- Original Message -----
> From: "Tyler Nowicki" <tnowicki at apple.com>
> To: "Commit Messages and Patches for LLVM" <llvm-commits at cs.uiuc.edu>
> Cc: "Gerolf Hoflehner" <ghoflehner at apple.com>, "Hal J. Finkel" <hfinkel at anl.gov>
> Sent: Sunday, June 28, 2015 3:17:01 PM
> Subject: Re: [Patch][LoopVectorize]Late evaluation of vectorization requirements
> 
> 
> 
> Improved patch with clang-format.
> 
> 
> Tyler
> 
> 
> On Jun 28, 2015, at 1:09 PM, Tyler Nowicki < tnowicki at apple.com >
> wrote:
> 
> 
> Hi,
> 
> 
> 
> To vectorize fp reductions fast-math is required, but this check is
> done while identifying the reduction causing a very cryptical
> analysis message. Also it should be possible to provide a loop hint
> rather than specifying fast-math for the whole module.
> 
> 
> 
> For float reductions the current analysis message reads:
> - value that could not be identified as reduction is used outside the
> loop
> 
> 
> This patch moves the verification of fast-math, adds a check for a
> loop hint, and improves the analysis message.
> 
> 
> The improved message reads:
> - vectorization requires changes in the order of operations, however
> IEEE 754 floating-point operations are not commutative; allow
> commutativity by specifying ‘#pragma clang loop vectorize(enable)’
> before the loop or by providing the compiler option ‘-ffast-math’


+                "commutative; allow commutativity by specifying ‘#pragma clang "
+                "loop vectorize(enable)’ before the loop or by providing the "
+                "compiler option ‘-ffast-math’";
+    }
+    llvm_unreachable("Unknown requirement error");

I agree that this is the best kind of message, but Clang is not the only LLVM frontend, and we should not talk about Clang options here. When we designed the diagnostic system, we specifically gave it a class hierarchy so that the frontend could treat some messages specially, and this seems like a perfect example of where we should do so (by having a special subclass for these kinds of vectorizer messages, and having Clang do special things with them).

 -Hal

> 
> 
> In the future I will extend this to include pointer aliasing checks
> and perhaps cost-model checks.
> 
> 
> This patch builds off of my other diagnostic changes that are
> currently in review ( http://reviews.llvm.org/D10714 ) and “Renaming
> and Diagnostics for Loop Interleaving". Please make sure to apply
> patches 0002 and 0003 if you want to try this patch.
> 
> 
> Comments are much appreciated!
> 
> 
> Tyler
> 
> 
> <0004-Late-evaluation-of-vectorization-requirements.patch>
> 
> 
> 

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




More information about the llvm-commits mailing list