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

[Flang][OpenMP] Preliminary support for teams reductions #143

Closed
wants to merge 2 commits into from

Conversation

skatrak
Copy link

@skatrak skatrak commented Aug 16, 2024

This PR enables Flang lowering and some preliminary MLIR to LLVM IR translation support for teams reductions.

Translation to LLVM IR is limited at the moment: it has only been tested to work for a simple host-only program.

! test.f90
program main
  integer :: sum
  sum = 0
  !$omp teams reduction(+:sum) num_teams(10)
  !$omp parallel reduction(+:sum) num_threads(2)
  sum = sum + 1
  !$omp end parallel
  !$omp end teams
  print *, sum
end program main

! flang-new -fopenmp test.f90 && ./a.out
! 20

Need to investigate incorrect loop reductions (and most likely target SPMD reductions are broken too).

! test.f90
program main
  integer :: sum
  sum = 0
  !$omp teams distribute parallel do reduction(+:sum) num_teams(2)
  do i = 1, 10
    sum = sum + 1
  end do
  !$omp end teams distribute parallel do
  print *, sum
end program main

! flang-new -fopenmp test.f90 && ./a.out
! 20 (should be 10)

@skatrak skatrak requested a review from jsjodin August 16, 2024 12:06
@skatrak skatrak force-pushed the users/skatrak/teams-reduction branch from da27467 to 3643fc4 Compare August 16, 2024 12:14
@skatrak skatrak force-pushed the users/skatrak/teams-reduction branch from 3643fc4 to b996d13 Compare August 22, 2024 15:57
@skatrak
Copy link
Author

skatrak commented Oct 1, 2024

Closing as it's already merged as part of #159.

@skatrak skatrak closed this Oct 1, 2024
@skatrak skatrak deleted the users/skatrak/teams-reduction branch October 2, 2024 13:17
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.

1 participant