-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding parsing and semantic check support for omp masked (#91432)
omp masked directive in OpenMP 5.2 allows to specify code regions which are expected to be executed by thread ids specified by the programmer. Filter clause of the directive allows to specify the thread id. This change adds the parsing support for the directive
- Loading branch information
Showing
8 changed files
with
158 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
! This test checks lowering of OpenMP masked Directive. | ||
|
||
! RUN: %not_todo_cmd bbc -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s | ||
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s | ||
|
||
! CHECK: not yet implemented: Unhandled directive masked | ||
subroutine test_masked() | ||
integer :: c = 1 | ||
!$omp masked | ||
c = c + 1 | ||
!$omp end masked | ||
end subroutine | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
! RUN: %flang_fc1 -fdebug-unparse -fopenmp %s | FileCheck --ignore-case %s | ||
! RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp %s | FileCheck --check-prefix="PARSE-TREE" %s | ||
|
||
! Check for parsing of masked directive with filter clause. | ||
|
||
|
||
subroutine test_masked() | ||
integer :: c = 1 | ||
!PARSE-TREE: OmpBeginBlockDirective | ||
!PARSE-TREE-NEXT: OmpBlockDirective -> llvm::omp::Directive = masked | ||
!CHECK: !$omp masked | ||
!$omp masked | ||
c = c + 1 | ||
!$omp end masked | ||
!PARSE-TREE: OmpBeginBlockDirective | ||
!PARSE-TREE-NEXT: OmpBlockDirective -> llvm::omp::Directive = masked | ||
!PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> Filter -> Scalar -> Integer -> Expr = '1_4' | ||
!PARSE-TREE-NEXT: LiteralConstant -> IntLiteralConstant = '1' | ||
!CHECK: !$omp masked filter(1_4) | ||
!$omp masked filter(1) | ||
c = c + 2 | ||
!$omp end masked | ||
end subroutine | ||
|
||
subroutine test_masked_taskloop_simd() | ||
integer :: i, j = 1 | ||
!PARSE-TREE: OmpBeginLoopDirective | ||
!PARSE-TREE-NEXT: OmpLoopDirective -> llvm::omp::Directive = masked taskloop simd | ||
!CHECK: !$omp masked taskloop simd | ||
!$omp masked taskloop simd | ||
do i=1,10 | ||
j = j + 1 | ||
end do | ||
!$omp end masked taskloop simd | ||
end subroutine | ||
|
||
subroutine test_masked_taskloop | ||
integer :: i, j = 1 | ||
!PARSE-TREE: OmpBeginLoopDirective | ||
!PARSE-TREE-NEXT: OmpLoopDirective -> llvm::omp::Directive = masked taskloop | ||
!PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> Filter -> Scalar -> Integer -> Expr = '2_4' | ||
!PARSE-TREE-NEXT: LiteralConstant -> IntLiteralConstant = '2' | ||
!CHECK: !$omp masked taskloop filter(2_4) | ||
!$omp masked taskloop filter(2) | ||
do i=1,10 | ||
j = j + 1 | ||
end do | ||
!$omp end masked taskloop | ||
end subroutine | ||
|
||
subroutine test_parallel_masked | ||
integer, parameter :: i = 1, j = 1 | ||
integer :: c = 2 | ||
!PARSE-TREE: OmpBeginBlockDirective | ||
!PARSE-TREE-NEXT: OmpBlockDirective -> llvm::omp::Directive = parallel masked | ||
!PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> Filter -> Scalar -> Integer -> Expr = '2_4' | ||
!PARSE-TREE-NEXT: Add | ||
!PARSE-TREE-NEXT: Expr = '1_4' | ||
!PARSE-TREE-NEXT: Designator -> DataRef -> Name = 'i' | ||
!PARSE-TREE-NEXT: Expr = '1_4' | ||
!PARSE-TREE-NEXT: Designator -> DataRef -> Name = 'j' | ||
!CHECK: !$omp parallel masked filter(2_4) | ||
!$omp parallel masked filter(i+j) | ||
c = c + 2 | ||
!$omp end parallel masked | ||
end subroutine | ||
|
||
subroutine test_parallel_masked_taskloop_simd | ||
integer :: i, j = 1 | ||
!PARSE-TREE: OmpBeginLoopDirective | ||
!PARSE-TREE-NEXT: OmpLoopDirective -> llvm::omp::Directive = parallel masked taskloop simd | ||
!CHECK: !$omp parallel masked taskloop simd | ||
!$omp parallel masked taskloop simd | ||
do i=1,10 | ||
j = j + 1 | ||
end do | ||
!$omp end parallel masked taskloop simd | ||
end subroutine | ||
|
||
subroutine test_parallel_masked_taskloop | ||
integer :: i, j = 1 | ||
!PARSE-TREE: OmpBeginLoopDirective | ||
!PARSE-TREE-NEXT: OmpLoopDirective -> llvm::omp::Directive = parallel masked taskloop | ||
!PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> Filter -> Scalar -> Integer -> Expr = '2_4' | ||
!PARSE-TREE-NEXT: LiteralConstant -> IntLiteralConstant = '2' | ||
!CHECK: !$omp parallel masked taskloop filter(2_4) | ||
!$omp parallel masked taskloop filter(2) | ||
do i=1,10 | ||
j = j + 1 | ||
end do | ||
!$omp end parallel masked taskloop | ||
end subroutine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp | ||
|
||
subroutine test_masked() | ||
integer :: c = 1 | ||
!ERROR: At most one FILTER clause can appear on the MASKED directive | ||
!$omp masked filter(1) filter(2) | ||
c = c + 1 | ||
!$omp end masked | ||
!ERROR: NOWAIT clause is not allowed on the MASKED directive | ||
!$omp masked nowait | ||
c = c + 2 | ||
!$omp end masked | ||
end subroutine |