Skip to content

Commit 2e9e552

Browse files
committed
Updated the testfile, rebased and added a test on Todo Lower side for interop construct.
1 parent dfd08b7 commit 2e9e552

File tree

4 files changed

+58
-47
lines changed

4 files changed

+58
-47
lines changed

flang/lib/Lower/OpenMP/OpenMP.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,9 @@ extractOmpDirective(const parser::OpenMPConstruct &ompConstruct) {
424424
},
425425
[](const parser::OpenMPDepobjConstruct &c) {
426426
return llvm::omp::OMPD_depobj;
427+
},
428+
[](const parser::OpenMPInteropConstruct &c) {
429+
return llvm::omp::OMPD_interop;
427430
}},
428431
c.u);
429432
},
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -fopenmp-version=52 -o - %s 2>&1 | FileCheck %s
2+
3+
! CHECK: not yet implemented: OpenMPInteropConstruct
4+
program interop_test
5+
use omp_lib
6+
integer(omp_interop_kind) :: obj
7+
!$omp interop init(targetsync,target: obj)
8+
end program interop_test

flang/test/Parser/OpenMP/interop-construct.f90

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
! RUN: %flang_fc1 -fdebug-unparse -fopenmp-version=52 -fopenmp %s | FileCheck --ignore-case --check-prefix="UNPARSE" %s
22
! RUN: %flang_fc1 -fdebug-dump-parse-tree-no-sema -fopenmp-version=52 -fopenmp %s | FileCheck --check-prefix="PARSE-TREE" %s
33

4-
subroutine test_interop_01()
5-
!$omp interop device(1)
6-
print *,'pass'
7-
end subroutine test_interop_01
4+
SUBROUTINE test_interop_01()
5+
!$OMP INTEROP DEVICE(1)
6+
PRINT *,'pass'
7+
END SUBROUTINE test_interop_01
88

99
!UNPARSE: SUBROUTINE test_interop_01
1010
!UNPARSE: !$OMP INTEROP DEVICE(1_4)
@@ -26,12 +26,12 @@ end subroutine test_interop_01
2626
!PARSE-TREE: | | | | string = 'pass'
2727
!PARSE-TREE: | EndSubroutineStmt -> Name = 'test_interop_01'
2828

29-
subroutine test_interop_02()
30-
use omp_lib
31-
integer(omp_interop_kind) :: obj1, obj2, obj3
32-
!$omp interop init(targetsync: obj) use(obj1) destroy(obj3)
33-
print *,'pass'
34-
end subroutine test_interop_02
29+
SUBROUTINE test_interop_02()
30+
USE omp_lib
31+
INTEGER(OMP_INTEROP_KIND) :: obj1, obj2, obj3
32+
!$OMP INTEROP INIT(TARGETSYNC: obj) USE(obj1) DESTROY(obj3)
33+
PRINT *,'pass'
34+
END SUBROUTINE test_interop_02
3535

3636
!UNPARSE: SUBROUTINE test_interop_02
3737
!UNPARSE: USE :: omp_lib
@@ -68,12 +68,12 @@ end subroutine test_interop_02
6868
!PARSE-TREE: | | | | string = 'pass'
6969
!PARSE-TREE: | EndSubroutineStmt -> Name = 'test_interop_02'
7070

71-
subroutine test_interop_03()
72-
use omp_lib
73-
Integer(omp_interop_kind) :: obj
74-
!$omp interop init(targetsync: obj) depend(inout: obj)
75-
print *,'pass'
76-
end subroutine test_interop_03
71+
SUBROUTINE test_interop_03()
72+
USE omp_lib
73+
INTEGER(OMP_INTEROP_KIND) :: obj
74+
!$OMP INTEROP INIT(TARGETSYNC: obj) DEPEND(INOUT: obj)
75+
PRINT *,'pass'
76+
END SUBROUTINE test_interop_03
7777

7878
!UNPARSE: SUBROUTINE test_interop_03
7979
!UNPARSE: USE :: omp_lib
@@ -107,13 +107,13 @@ end subroutine test_interop_03
107107
!PARSE-TREE: | | | | string = 'pass'
108108
!PARSE-TREE: | EndSubroutineStmt -> Name = 'test_interop_03'
109109

110-
subroutine test_interop_04()
111-
use omp_lib
112-
integer(omp_interop_kind) :: obj
113-
integer, dimension(1,10) :: arr
114-
!$omp interop init(prefer_type("cuda"),targetsync,target: obj) depend(inout: arr) nowait
115-
print *,'pass'
116-
end subroutine test_interop_04
110+
SUBROUTINE test_interop_04()
111+
USE omp_lib
112+
INTEGER(OMP_INTEROP_KIND) :: obj
113+
INTEGER, DIMENSION(1,10) :: arr
114+
!$OMP INTEROP INIT(PREFER_TYPE("cuda"),TARGETSYNC,TARGET: obj) DEPEND(INOUT: arr) NOWAIT
115+
PRINT *,'pass'
116+
END SUBROUTINE test_interop_04
117117

118118
!UNPARSE: SUBROUTINE test_interop_04
119119
!UNPARSE: USE :: omp_lib
@@ -161,12 +161,12 @@ end subroutine test_interop_04
161161
!PARSE-TREE: | | | | string = 'pass'
162162
!PARSE-TREE: | EndSubroutineStmt -> Name = 'test_interop_04'
163163

164-
subroutine test_interop_05()
165-
use omp_lib
166-
integer(omp_interop_kind) :: obj
167-
!$omp interop init(prefer_type(omp_ifr_sycl), targetsync: obj) device(device_num:0)
168-
print *,'pass'
169-
end subroutine test_interop_05
164+
SUBROUTINE test_interop_05()
165+
USE omp_lib
166+
INTEGER(OMP_INTEROP_KIND) :: obj
167+
!$OMP INTEROP INIT(PREFER_TYPE(omp_ifr_sycl), TARGETSYNC: obj) DEVICE(DEVICE_NUM:0)
168+
PRINT *,'pass'
169+
END SUBROUTINE test_interop_05
170170

171171
!UNPARSE: SUBROUTINE test_interop_05
172172
!UNPARSE: USE :: omp_lib

flang/test/Semantics/OpenMP/interop-construct.f90

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@
55
! 14.1 Interop construct
66
! To check various semantic errors for inteorp construct.
77

8-
subroutine test_interop_01()
9-
use omp_lib
10-
integer(omp_interop_kind) :: obj
8+
SUBROUTINE test_interop_01()
9+
USE omp_lib
10+
INTEGER(OMP_INTEROP_KIND) :: obj
1111
!ERROR: Each interop-var may be specified for at most one action-clause of each interop construct.
12-
!$omp interop init(targetsync,target: obj) use(obj)
13-
print *, 'pass'
14-
end subroutine test_interop_01
12+
!$OMP INTEROP INIT(TARGETSYNC,TARGET: obj) USE(obj)
13+
PRINT *, 'pass'
14+
END SUBROUTINE test_interop_01
1515

16-
subroutine test_interop_02()
17-
use omp_lib
18-
integer(omp_interop_kind) :: obj
16+
SUBROUTINE test_interop_02()
17+
USE omp_lib
18+
INTEGER(OMP_INTEROP_KIND) :: obj
1919
!ERROR: Each interop-type may be specified at most once.
20-
!$omp interop init(targetsync,target,targetsync: obj)
21-
print *, 'pass'
22-
end subroutine test_interop_02
20+
!$OMP INTEROP INIT(TARGETSYNC,TARGET,TARGETSYNC: obj)
21+
PRINT *, 'pass'
22+
END SUBROUTINE test_interop_02
2323

24-
subroutine test_interop_03()
25-
use omp_lib
26-
integer(omp_interop_kind) :: obj
24+
SUBROUTINE test_interop_03()
25+
USE omp_lib
26+
INTEGER(OMP_INTEROP_KIND) :: obj
2727
!ERROR: A depend clause can only appear on the directive if the interop-type includes targetsync
28-
!$omp interop init(target: obj) depend(inout: obj)
29-
print *, 'pass'
30-
end subroutine test_interop_03
28+
!$OMP INTEROP INIT(TARGET: obj) DEPEND(INOUT: obj)
29+
PRINT *, 'pass'
30+
END SUBROUTINE test_interop_03

0 commit comments

Comments
 (0)