[Openmp-commits] [PATCH] D61380: [OPENMP][NVPTX]Fix behavior of omp_in_parallel() function.

Alexey Bataev via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed May 1 09:52:38 PDT 2019


ABataev added a comment.

In D61380#1486150 <https://reviews.llvm.org/D61380#1486150>, @Hahnfeld wrote:

> My understanding of `enclosed` is that its meaning is recursive. So `omp_in_parallel` is to return true iff (at least) one of the surrounding parallel regions is active. That also matches the summary in OpenMP 5.0 which says
>
> > The omp_in_parallel routine returns true if the active-levels-var ICV is greater than zero; otherwise, it returns false.
>
> and
>
> > active-levels-var - the number of nested active parallel regions that enclose the current task such that all of the parallel regions are enclosed by the outermost initial task region on the current device. There is one copy of this ICV per data environment.
>
> In that sense I think the test is currently right and the change is not compliant with the standard.


Hmm, the current implementation also does not look correct in this case. It does not take into account if the enclosing parallel region is active or not. If number of threads is 1, this regions is not active. Currently, it just checks if the innermost region is a parallel region regardless the number of threads in it (plus, i does not work correctly if we have outer parallel + inner task region)


Repository:
  rOMP OpenMP

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

https://reviews.llvm.org/D61380





More information about the Openmp-commits mailing list