[Flang][OpenMP] Support for non-rectangular collapsed loops
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
This was introduced in OpenMP 5.0.[^1]
```fortran
program test_openmp_5
implicit none
integer, parameter :: N = 10
integer :: i, j
!$omp parallel do collapse(2) private(i, j)
do i = 1, N
do j = i, N
write(*,*) i, j
end do
end do
!$omp end parallel do
end program
```
Currently it errors with
```
error: Semantic errors in /app/example.f90
/app/example.f90:5:9: error: Trip count must be computable and invariant
!$omp parallel do collapse(2) private(i, j)
^^^^^^^^^^^
```
Live example: https://godbolt.org/z/jbro4es9h
[^1]: https://developers.redhat.com/blog/2021/05/03/new-features-in-openmp-5-0-and-5-1
Contributor guide
Research direction
Start with the example.f90 reproducer in the issue and run it through Flang, or use the linked Godbolt example, to confirm the current trip-count error. Compare the behavior with the OpenMP 5.0 non-rectangular collapse requirement; done means the sample is accepted and produces the expected collapsed-loop iterations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fortran
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100