[llvm-dev] LAA behavior on Incorrect #pragma omp simd.

Doerfert, Johannes via llvm-dev llvm-dev at lists.llvm.org
Wed Jun 26 08:09:54 PDT 2019

Hi Rajasekhar,

thanks for reporting this.

On 06/26, Raja Sekhar Bhetala via llvm-dev wrote:
> The specification on this loop is incorrect as the parallel_accesses
> metadata indicate that there is no loop carried memory dependence, which is
> not true in this case.

First, I think the lowering is actually broken if a simdlen is given.
Since we use parallel_accesses metadata it indicates the loop is free of
dependences but #pragma simd simdlen(4) means we are allowed to assume
there are no loop carried dependences of length smaller than 4.

> Shouldn't the compiler not Vectorize if it can prove that there is a loop
> carried dependence and the Vectorizer will generate an incorrect code ?
> Or Should it blindly follow the user directive (without a warning) ?

I'm always on the fence when it comes to these questions. I think we
should blindly follow the directives but offer a flag that globally
turns on warning for such odd situations.

> It is very difficult for the user to identify the real source of the
> problem if the compiler vectorizes the loop silently. I agree its hard to
> detect incorrect specifications. But for cases, where it is easy to detect
> we should atleast dump a warning.

No default warning, that will clutter the output. On second though,
maybe if the we determine the given information is plain wrong.



Johannes Doerfert

Argonne National Laboratory
Lemont, IL 60439, USA

jdoerfert at anl.gov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190626/801706fe/attachment.sig>

More information about the llvm-dev mailing list