[Openmp-commits] [clang] [llvm] [openmp] [Clang][OpenMP] Add `#pragma omp flatten` loop directive + `depth` clause (PR #206977)
Michael Kruse via Openmp-commits
openmp-commits at lists.llvm.org
Wed Aug 12 03:28:48 PDT 2026
================
----------------
Meinersbur wrote:
Could you add tests where what `flatten` does changes the output?
For instance:
```
#pragma omp parallel for schedule(static,1) num_threads(2)
#pragma omp flatten
for (int i = 0; i < 2; i += 1)
for (int j = 0; j < 2; j += 1)
printf("i=%d j=%d tid=%d\n", i, j, omp_get_thread_num());
```
Output with flatten should be:
```
i=0 j=0 tid=0
i=0 j=1 tid=1
i=1 j=0 tid=0
i=1 j=1 tid=0
```
without flatten:
```
i=0 j=0 tid=0
i=0 j=1 tid=0
i=1 j=0 tid=1
i=1 j=1 tid=1
```
Generally, add test that check the composability with other directives, that's what its intended use it
https://github.com/llvm/llvm-project/pull/206977
More information about the Openmp-commits
mailing list