mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-15 04:00:56 +00:00
[flang][openacc] Fix gang-argument parsing and add validity tests for !$acc loop
This patch fix the prasing for the gang-arg values for the gang clause. It also adds some clause validity tests for the loop construct. Reviewed By: klausler Differential Revision: https://reviews.llvm.org/D86584
This commit is contained in:
parent
1d3ef5f122
commit
832c8a7298
@ -145,13 +145,11 @@ TYPE_PARSER(construct<AccTileExpr>(scalarIntConstantExpr) ||
|
||||
"*" >> construct<std::optional<ScalarIntConstantExpr>>()))
|
||||
TYPE_PARSER(construct<AccTileExprList>(nonemptyList(Parser<AccTileExpr>{})))
|
||||
|
||||
// 2.9 (1607) gang-arg is one of:
|
||||
// [num:]int-expr
|
||||
// static:size-expr
|
||||
TYPE_PARSER(construct<AccGangArgument>(maybe(scalarIntExpr),
|
||||
maybe(","_tok / "STATIC:" >> Parser<AccSizeExpr>{})) ||
|
||||
construct<AccGangArgument>(maybe("NUM:" >> scalarIntExpr),
|
||||
maybe(","_tok / "STATIC:" >> Parser<AccSizeExpr>{})))
|
||||
// 2.9 (1607) gang-arg is:
|
||||
// [[num:]int-expr][[,]static:size-expr]
|
||||
TYPE_PARSER(construct<AccGangArgument>(
|
||||
maybe(("NUM:"_tok >> scalarIntExpr || scalarIntExpr)),
|
||||
maybe(", STATIC:" >> Parser<AccSizeExpr>{})))
|
||||
|
||||
// 2.5.13 Reduction
|
||||
// Operator for reduction
|
||||
|
@ -18,7 +18,7 @@ program openacc_clause_validity
|
||||
|
||||
implicit none
|
||||
|
||||
integer :: i, j, b
|
||||
integer :: i, j, b, gang_size, vector_size, worker_size
|
||||
integer, parameter :: N = 256
|
||||
integer, dimension(N) :: c
|
||||
logical, dimension(N) :: d, e
|
||||
@ -28,7 +28,7 @@ program openacc_clause_validity
|
||||
|
||||
!ERROR: At least one clause is required on the DECLARE directive
|
||||
!$acc declare
|
||||
real(8) :: a(256)
|
||||
real(8), dimension(N) :: a
|
||||
|
||||
!ERROR: At least one of ATTACH, COPYIN, CREATE clause must appear on the ENTER DATA directive
|
||||
!$acc enter data
|
||||
@ -110,6 +110,141 @@ program openacc_clause_validity
|
||||
end do
|
||||
!$acc end parallel
|
||||
|
||||
!$acc parallel
|
||||
!$acc loop seq
|
||||
do i = 1, N
|
||||
a(i) = 3.14
|
||||
end do
|
||||
!$acc end parallel
|
||||
|
||||
!$acc parallel
|
||||
!$acc loop independent
|
||||
do i = 1, N
|
||||
a(i) = 3.14
|
||||
end do
|
||||
!$acc end parallel
|
||||
|
||||
!$acc parallel
|
||||
!$acc loop auto
|
||||
do i = 1, N
|
||||
a(i) = 3.14
|
||||
end do
|
||||
!$acc end parallel
|
||||
|
||||
!$acc parallel
|
||||
!$acc loop vector
|
||||
do i = 1, N
|
||||
a(i) = 3.14
|
||||
end do
|
||||
!$acc end parallel
|
||||
|
||||
!$acc parallel
|
||||
!$acc loop vector(10)
|
||||
do i = 1, N
|
||||
a(i) = 3.14
|
||||
end do
|
||||
!$acc end parallel
|
||||
|
||||
!$acc parallel
|
||||
!$acc loop vector(vector_size)
|
||||
do i = 1, N
|
||||
a(i) = 3.14
|
||||
end do
|
||||
!$acc end parallel
|
||||
|
||||
!$acc parallel
|
||||
!$acc loop vector(length: vector_size)
|
||||
do i = 1, N
|
||||
a(i) = 3.14
|
||||
end do
|
||||
!$acc end parallel
|
||||
|
||||
!$acc parallel
|
||||
!$acc loop worker
|
||||
do i = 1, N
|
||||
a(i) = 3.14
|
||||
end do
|
||||
!$acc end parallel
|
||||
|
||||
!$acc parallel
|
||||
!$acc loop worker(10)
|
||||
do i = 1, N
|
||||
a(i) = 3.14
|
||||
end do
|
||||
!$acc end parallel
|
||||
|
||||
!$acc parallel
|
||||
!$acc loop worker(worker_size)
|
||||
do i = 1, N
|
||||
a(i) = 3.14
|
||||
end do
|
||||
!$acc end parallel
|
||||
|
||||
!$acc parallel
|
||||
!$acc loop worker(num: worker_size)
|
||||
do i = 1, N
|
||||
a(i) = 3.14
|
||||
end do
|
||||
!$acc end parallel
|
||||
|
||||
!$acc parallel
|
||||
!$acc loop gang(gang_size)
|
||||
do i = 1, N
|
||||
a(i) = 3.14
|
||||
end do
|
||||
!$acc end parallel
|
||||
|
||||
!$acc parallel
|
||||
!$acc loop gang(num: gang_size)
|
||||
do i = 1, N
|
||||
a(i) = 3.14
|
||||
end do
|
||||
!$acc end parallel
|
||||
|
||||
!$acc parallel
|
||||
!$acc loop gang(gang_size, static:*)
|
||||
do i = 1, N
|
||||
a(i) = 3.14
|
||||
end do
|
||||
!$acc end parallel
|
||||
|
||||
!$acc parallel
|
||||
!$acc loop gang(num: gang_size, static:*)
|
||||
do i = 1, N
|
||||
a(i) = 3.14
|
||||
end do
|
||||
!$acc end parallel
|
||||
|
||||
!$acc parallel
|
||||
!$acc loop gang(num: gang_size, static: gang_size)
|
||||
do i = 1, N
|
||||
a(i) = 3.14
|
||||
end do
|
||||
!$acc end parallel
|
||||
|
||||
!$acc parallel
|
||||
!$acc loop private(b, a(:))
|
||||
do i = 1, N
|
||||
a(i) = b
|
||||
end do
|
||||
!$acc end parallel
|
||||
|
||||
!$acc parallel
|
||||
!$acc loop tile(*)
|
||||
do i = 1, N
|
||||
a(i) = b
|
||||
end do
|
||||
!$acc end parallel
|
||||
|
||||
!$acc parallel
|
||||
!$acc loop tile(2, 2)
|
||||
do i = 1, N
|
||||
do j = 1, N
|
||||
a(i) = b
|
||||
end do
|
||||
end do
|
||||
!$acc end parallel
|
||||
|
||||
!$acc parallel
|
||||
!ERROR: The parameter of the COLLAPSE clause must be a constant positive integer expression
|
||||
!$acc loop collapse(-1)
|
||||
|
Loading…
Reference in New Issue
Block a user