[cfe-dev] clang auto-vectorization feedback is confusing

Sean McBride via cfe-dev cfe-dev at lists.llvm.org
Fri Jul 8 15:35:24 PDT 2016


On Thu, 30 Jun 2016 16:55:47 -0700, Adam Nemet said:

>> Well, difficulties aside, from my perspective, it'd be nice if, for
>every loop in a compiled file, if clang could tell me:
>> - this loop _was_ vectorized
>> - this loop was _not_ vectorized because xyz
>> - this loop was removed/optimized away/transformed/whatever
>> 
>> As it stands, one is left guessing in the last case.
>
>I think that’s fair.  Can you please file a bug with the loop removal as
>well?  Loop removal could check for these pragmas and issue diagnostics.

Done:
<https://llvm.org/bugs/show_bug.cgi?id=28415>

>> Thanks for the suggestion.  Relatedly, when faced with a diagnostic
>like "Loop not vectorized: unsafe dependent memory operations in loop",
>is there any reference that can help a layman understand what this is
>telling me exactly?  I STFW without many results.
>
>On trunk we now emit:
>
>"unsafe dependent memory operations in loop. Use #pragma loop
>distribute(enable) to allow loop distribution to attempt to isolate the
>offending operations into a separate loop”
>
>And then the pragma is documented with an example under http://
>clang.llvm.org/docs/LanguageExtensions.html#loop-distribution

Thanks for pointing that stuff out, I had not seen it before.

>That said, it still does not really explain what unsafe dependences
>mean.  Feel free to file another bug for this.

Done:
<https://llvm.org/bugs/show_bug.cgi?id=28475>

Having something like this would be nice:
<https://blogs.msdn.microsoft.com/nativeconcurrency/2012/05/22/auto-vectorizer-in-visual-studio-2012-did-it-work/>

Another question if I may: sometimes clang will output something pretty clear like:

"remark: loop not vectorized: loop control flow is not understood by vectorizer [-Rpass-analysis=loop-vectorize]"

Other times I'll see:

"remark: the cost-model indicates that interleaving is not beneficial [-Rpass-analysis=loop-vectorize]"

From the sounds of it, that's telling me that the loop was *not* vectorized, right?  If so, I find it odd that the "loop not vectorized:" prefix is not present.

Cheers,

Sean


More information about the cfe-dev mailing list