Hi, Newer OpenMP versions include a construct for loop unrolling, but, however, I was wondering if the regular clang pragma for loop unrolling can be safely mixed with an OpenMP loop,without using the new OpenMP feature. I mean, is this guaranteed to work? #pragma omp parallel for #pragma clang loop unroll_count(N) for(i=0;i<n;i++) { whatever(); } Thanks a lot!
Johannes Doerfert via llvm-dev
2021-May-24 14:22 UTC
[llvm-dev] Loop unrolling pragma and OpenMP
Michael implements the new features and knows :) On 5/24/21 3:01 AM, ardi via llvm-dev wrote:> Hi, > > Newer OpenMP versions include a construct for loop unrolling, but, > however, I was wondering if the regular clang pragma for loop > unrolling can be safely mixed with an OpenMP loop,without using the > new OpenMP feature. > > I mean, is this guaranteed to work? > > #pragma omp parallel for > #pragma clang loop unroll_count(N) > for(i=0;i<n;i++) { > whatever(); > } > > Thanks a lot! > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Michael Kruse via llvm-dev
2021-May-24 20:45 UTC
[llvm-dev] Loop unrolling pragma and OpenMP
Unfortunately, this does not work, by design. In the compiler pipeline "#pragma omp parallel for" is lowered in the front-end, while "#pragma clang loop unroll_count(N)" is in the LoopUnroll mid-end-pass. "#pragma omp parallel for" cannot be applied on a loop that has not yet been unrolled in the front-end. In practice, the #pragma clang loop will just be ignored. Michael Am Mo., 24. Mai 2021 um 03:02 Uhr schrieb ardi via llvm-dev <llvm-dev at lists.llvm.org>:> > Hi, > > Newer OpenMP versions include a construct for loop unrolling, but, > however, I was wondering if the regular clang pragma for loop > unrolling can be safely mixed with an OpenMP loop,without using the > new OpenMP feature. > > I mean, is this guaranteed to work? > > #pragma omp parallel for > #pragma clang loop unroll_count(N) > for(i=0;i<n;i++) { > whatever(); > } > > Thanks a lot! > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev