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

Remove all the leftover of OmpAttribute #130

Open
ouankou opened this issue Nov 30, 2022 · 8 comments
Open

Remove all the leftover of OmpAttribute #130

ouankou opened this issue Nov 30, 2022 · 8 comments
Assignees

Comments

@ouankou
Copy link
Contributor

ouankou commented Nov 30, 2022

OmpAttribute is the original IR of the ROSE OpenMP parser. We don't need that anymore since we use ompparser, whose IR is OpenMPIR. Besides the OpenMP AST constructor, we also need to clean up all the code of OmpAttribute in other locations.

@ouankou
Copy link
Contributor Author

ouankou commented Nov 30, 2022

According to the failure of a recent CI test, the EDG submodule also depends on OmpAgttribute.h. We need to investigate whether this dependency can be removed and how to remove it from the EDG source code.

@yanyh15
Copy link
Member

yanyh15 commented Nov 30, 2022

I have renamed the OmpAttribute.h/C file to ompSupport.h/C, and removed OmpAttribute class and its member functions, but leaving the enum definition there. I also removed OmpSupport.h file in ompLowering folder since it is just a header that include other headers. I am fixing this and will push.

@yanyh15
Copy link
Member

yanyh15 commented Nov 30, 2022

@ouankou I have a fix in EDG repo and now it is pushed to the master branch. Which branch is used for REX? Could you update the rex gitmodule to make sure that REX pull the needed EDG?

@yanyh15
Copy link
Member

yanyh15 commented Nov 30, 2022

@ouankou I have pushed latest fix for REX and CI is running, let us see whether it will pass.

@ouankou
Copy link
Contributor Author

ouankou commented Nov 30, 2022

@ouankou I have pushed latest fix for REX and CI is running, let us see whether it will pass.

Thanks, Dr. Yan. The submodule is tied to a specific commit, regardless of which branch the commit is on.

@yanyh15
Copy link
Member

yanyh15 commented Dec 13, 2022

@ouankou what is the status of this issue? are you fixing it along with reverting upir?

@ouankou
Copy link
Contributor Author

ouankou commented Dec 13, 2022

Yes, I'm also cleaning up the code while reverting UPIR. All the code used OmpAttribute has been removed by your previous commits except one:

AstAttribute* att = stmt->getAttribute("OmpAttributeList"); //TODO: we removed OmpAttribute and this need to be changed

There are several other leftover comments related to OmpAttribute, I've removed them.

I fixed this by determining whether the leading keyword is omp. However, it triggered a bug that unparsing omp parallel produces two omp end parallel. I'm still working on this. and it should be done this week.

@ouankou
Copy link
Contributor Author

ouankou commented Dec 13, 2022

This unparsing bug was caused by some other unknown problem instead of OmpAttributeList here.

Given input:

      program main
      include 'omp_lib.h'
      integer i
      integer item(10)
      external process
      do i = 1, 10
        item(i) = 11-i
      enddo  

!$omp parallel
!$omp single
      print *, 'using ', omp_get_num_threads(), ' threads' 
      do i = 1, 10
!$omp task 
      call process(i,item)
!$omp end task
      enddo  
!$omp end single
!$omp end parallel
      end 

******************************************
      subroutine process(input,item)
      include 'omp_lib.h'
      integer input
      integer item(10)
      print *, 'idx ', input,'-> ', item(input)
      print *, 'by thread ', omp_get_thread_num()
      end

!pragma omp end parallel or !$omp omp end parallel will be inserted right above !$omp end single. Neither should happen.

The output from code above:

      PROGRAM main
      include "omp_lib.h"
      INTEGER :: i
      INTEGER, DIMENSION(10) :: item
      external :: process
      DO i = 1, 10
      item(i) = 11 - i
      END DO
      
!$omp parallel 
      
!$omp single 
      PRINT *, 'using ',omp_get_num_threads(),' threads'
      DO i = 1, 10
      
!$omp task 
      CALL process(i,item)
!$omp end task 
      END DO
      !pragma omp end parallel 
!$omp end single 
******************************************
!$omp end parallel
      END PROGRAM 

      SUBROUTINE process(input,item)
      include "omp_lib.h"
      INTEGER :: input
      INTEGER, DIMENSION(10) :: item
      PRINT *, 'idx ',input,'-> ',item(input)
      PRINT *, 'by thread ',omp_get_thread_num()
      END SUBROUTINE

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

No branches or pull requests

2 participants