[PATCH] D108904: [flang][OpenMP] Added semantic checks for sections (associated section(s) should be structured block(s)) and simd constructs (associated loop(s) should be structured block(s))

Nimish Mishra via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 29 09:49:47 PDT 2021


NimishMishra added a comment.

In D108904#3096461 <https://reviews.llvm.org/D108904#3096461>, @josh.mottley.arm wrote:

> @NimishMishra I believe this patch is causing a false semantic error with SNAP <https://github.com/lanl/SNAP>. The error being:
>
>   error: Semantic errors in inner.f90
>   ./inner.f90:152:7: error: CYCLE to construct outside of PARALLEL DO construct is not allowed
>           IF ( g == 0 ) CYCLE
>
> The code in snap it is erroring at in inner.f90 is:
>
>   !$OMP PARALLEL DO NUM_THREADS(nnstd_used) IF(nnstd_used>1)           &
>   !$OMP& SCHEDULE(STATIC,1) DEFAULT(SHARED) PRIVATE(n,g)               &
>   !$OMP& PROC_BIND(CLOSE)
>     DO n = 1, ng_per_thrd
>       g = grp_act(n,t)
>       IF ( g == 0 ) CYCLE
>       CALL inner_df_calc ( inno, iits(g), flux0pi(:,:,:,g),            &
>                         flux0(:,:,:,g), dfmxi(g) )
>     END DO
>   !$OMP END PARALLEL DO
>
> AFAIK this should be valid code, and I know that @Leporacanthicus is also experiencing this issue (although it looks like there could be a secondary issue as well).
> I've tried reverting this patch, and managed to stop getting this error when using the flang-omp-report plugin.

@josh.mottley.arm  Thanks for reporting. I triaged this. It turns out the particular class that is enforcing the semantic checks assumes the OpenMP constructs to be passed to it. In case of looping constructs however, a `parser::Walk` is called //within// OpenMP constructs rather than //on// them. I have provided a fix in https://github.com/llvm/llvm-project/commit/9faed889cfebf5d77faf1fab1ef8f0a2f0255e5c. Please see if this resolves your problems. I also edited a relevant test file to reflect this CYCLE condition. It wasn't there before.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108904/new/

https://reviews.llvm.org/D108904



More information about the llvm-commits mailing list