Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MLIR][OpenMP] More robust support for target SPMD #161

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

skatrak
Copy link

@skatrak skatrak commented Sep 23, 2024

This patch fixes TargetOp::getInnermostCapturedOmpOp() to avoid detecting as captured by the top target construct other constructs nested inside of a loop. This prevents the omp.target verifier from incorrectly flagging valid SPMD loops, like in the following example:

subroutine foo(n)
  implicit none
  integer, intent(in) :: n
  integer :: i, j

  !$omp target teams distribute parallel do
  do i=1,n
    !$omp simd
    do j=1,n
      call bar()
    enddo
  enddo
end subroutine foo

It's an improvement over the workaround implemented in #98, hopefully covering all cases.

This patch fixes `TargetOp::getInnermostCapturedOmpOp()` to avoid detecting as
captured by the top target construct other constructs nested inside of a loop.
This prevents the `omp.target` verifier from incorrectly flagging valid SPMD
loops, like in the following example:

```f90
subroutine foo(n)
  implicit none
  integer, intent(in) :: n
  integer :: i, j

  !$omp target teams distribute parallel do
  do i=1,n
    !$omp simd
    do j=1,n
      call bar()
    enddo
  enddo
end subroutine foo
```
Copy link

@dpalermo dpalermo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing (smoke & SPEC hpc/accel) looks good to me.

@dpalermo dpalermo merged commit 6d8995a into ROCm:amd-trunk-dev Sep 24, 2024
3 of 5 checks passed
@dpalermo
Copy link

Merged to get more coverage in tonight's build/testing.

@skatrak skatrak deleted the fix-spmd-nested-construct branch September 25, 2024 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants