[flang] [llvm] [flang][OpenMP] Parse `bind` clause for `loop` direcitve. (PR #113662)
Kareem Ergawy via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 27 22:28:33 PDT 2024
ergawy wrote:
@kparzysz @mjklemm there is an error emitted by lowering already: https://github.com/llvm/llvm-project/blob/main/flang/lib/Lower/OpenMP/OpenMP.cpp#L2461.
> Also, we will need to add semantic checks to check for the right nesting of bind, where the compiler can check it.
I need some help interpreting the spec here. Here are the restrictions on `bind` according to 5.2:
```md
Restrictions to the bind clause are as follows:
• If teams is specified as binding then the corresponding loop region must be strictly nested inside a teams region.
• If teams is specified as binding and the corresponding loop region executes on a non-host device then the behavior of a
reduction clause that appears on the corresponding loop construct is unspecified if the construct is not nested inside a teams
construct.
• If parallel is specified as binding, the behavior is unspecified if the corresponding loop region is closely nested inside a simd
region.
```
For the first restriction, the nesting is defined on regions, so I think we cannot check that at compile time. The second restriction also cannot be checked statically since the corresponding `teams` construct might not be strictly nested inside a `target` region. The third restriction is about unspecified behavior.
Also, in semantics description section, the nesting relation is defined between regions not constructs.
But I am sure I missed something here. Any clarifications of what semantic checks need to be performed would be great.
https://github.com/llvm/llvm-project/pull/113662
More information about the llvm-commits
mailing list