mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-04 20:20:54 +00:00
[mlir][openacc][NFC] Use assembly format for acc.parallel
Remove the custoom parser and printer for the acc.parallel operation and use the assembly format directly. Reviewed By: PeteSteinfeld, razvanlupusoru Differential Revision: https://reviews.llvm.org/D148183
This commit is contained in:
parent
48fca4b6f3
commit
3d683cb9f1
@ -575,14 +575,11 @@ createParallelOp(Fortran::lower::AbstractConverter &converter,
|
||||
firOpBuilder, currentLocation, operands, operandSegments);
|
||||
|
||||
if (addAsyncAttr)
|
||||
parallelOp->setAttr(mlir::acc::ParallelOp::getAsyncAttrName(),
|
||||
firOpBuilder.getUnitAttr());
|
||||
parallelOp.setAsyncAttrAttr(firOpBuilder.getUnitAttr());
|
||||
if (addWaitAttr)
|
||||
parallelOp->setAttr(mlir::acc::ParallelOp::getWaitAttrName(),
|
||||
firOpBuilder.getUnitAttr());
|
||||
parallelOp.setWaitAttrAttr(firOpBuilder.getUnitAttr());
|
||||
if (addSelfAttr)
|
||||
parallelOp->setAttr(mlir::acc::ParallelOp::getSelfAttrName(),
|
||||
firOpBuilder.getUnitAttr());
|
||||
parallelOp.setSelfAttrAttr(firOpBuilder.getUnitAttr());
|
||||
|
||||
return parallelOp;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ subroutine acc_parallel_loop
|
||||
END DO
|
||||
|
||||
!CHECK: [[ASYNC1:%.*]] = arith.constant 1 : i32
|
||||
!CHECK: acc.parallel async([[ASYNC1]]: i32) {
|
||||
!CHECK: acc.parallel async([[ASYNC1]] : i32) {
|
||||
!CHECK: acc.loop {
|
||||
!CHECK: fir.do_loop
|
||||
!CHECK: acc.yield
|
||||
@ -76,7 +76,7 @@ subroutine acc_parallel_loop
|
||||
END DO
|
||||
|
||||
!CHECK: [[ASYNC2:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
|
||||
!CHECK: acc.parallel async([[ASYNC2]]: i32) {
|
||||
!CHECK: acc.parallel async([[ASYNC2]] : i32) {
|
||||
!CHECK: acc.loop {
|
||||
!CHECK: fir.do_loop
|
||||
!CHECK: acc.yield
|
||||
@ -103,7 +103,7 @@ subroutine acc_parallel_loop
|
||||
END DO
|
||||
|
||||
!CHECK: [[WAIT1:%.*]] = arith.constant 1 : i32
|
||||
!CHECK: acc.parallel wait([[WAIT1]]: i32) {
|
||||
!CHECK: acc.parallel wait([[WAIT1]] : i32) {
|
||||
!CHECK: acc.loop {
|
||||
!CHECK: fir.do_loop
|
||||
!CHECK: acc.yield
|
||||
@ -118,7 +118,7 @@ subroutine acc_parallel_loop
|
||||
|
||||
!CHECK: [[WAIT2:%.*]] = arith.constant 1 : i32
|
||||
!CHECK: [[WAIT3:%.*]] = arith.constant 2 : i32
|
||||
!CHECK: acc.parallel wait([[WAIT2]]: i32, [[WAIT3]]: i32) {
|
||||
!CHECK: acc.parallel wait([[WAIT2]], [[WAIT3]] : i32, i32) {
|
||||
!CHECK: acc.loop {
|
||||
!CHECK: fir.do_loop
|
||||
!CHECK: acc.yield
|
||||
@ -133,7 +133,7 @@ subroutine acc_parallel_loop
|
||||
|
||||
!CHECK: [[WAIT4:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
|
||||
!CHECK: [[WAIT5:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
|
||||
!CHECK: acc.parallel wait([[WAIT4]]: i32, [[WAIT5]]: i32) {
|
||||
!CHECK: acc.parallel wait([[WAIT4]], [[WAIT5]] : i32, i32) {
|
||||
!CHECK: acc.loop {
|
||||
!CHECK: fir.do_loop
|
||||
!CHECK: acc.yield
|
||||
@ -147,7 +147,7 @@ subroutine acc_parallel_loop
|
||||
END DO
|
||||
|
||||
!CHECK: [[NUMGANGS1:%.*]] = arith.constant 1 : i32
|
||||
!CHECK: acc.parallel num_gangs([[NUMGANGS1]]: i32) {
|
||||
!CHECK: acc.parallel num_gangs([[NUMGANGS1]] : i32) {
|
||||
!CHECK: acc.loop {
|
||||
!CHECK: fir.do_loop
|
||||
!CHECK: acc.yield
|
||||
@ -161,7 +161,7 @@ subroutine acc_parallel_loop
|
||||
END DO
|
||||
|
||||
!CHECK: [[NUMGANGS2:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
|
||||
!CHECK: acc.parallel num_gangs([[NUMGANGS2]]: i32) {
|
||||
!CHECK: acc.parallel num_gangs([[NUMGANGS2]] : i32) {
|
||||
!CHECK: acc.loop {
|
||||
!CHECK: fir.do_loop
|
||||
!CHECK: acc.yield
|
||||
@ -175,7 +175,7 @@ subroutine acc_parallel_loop
|
||||
END DO
|
||||
|
||||
!CHECK: [[NUMWORKERS1:%.*]] = arith.constant 10 : i32
|
||||
!CHECK: acc.parallel num_workers([[NUMWORKERS1]]: i32) {
|
||||
!CHECK: acc.parallel num_workers([[NUMWORKERS1]] : i32) {
|
||||
!CHECK: acc.loop {
|
||||
!CHECK: fir.do_loop
|
||||
!CHECK: acc.yield
|
||||
@ -189,7 +189,7 @@ subroutine acc_parallel_loop
|
||||
END DO
|
||||
|
||||
!CHECK: [[NUMWORKERS2:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
|
||||
!CHECK: acc.parallel num_workers([[NUMWORKERS2]]: i32) {
|
||||
!CHECK: acc.parallel num_workers([[NUMWORKERS2]] : i32) {
|
||||
!CHECK: acc.loop {
|
||||
!CHECK: fir.do_loop
|
||||
!CHECK: acc.yield
|
||||
@ -203,7 +203,7 @@ subroutine acc_parallel_loop
|
||||
END DO
|
||||
|
||||
!CHECK: [[VECTORLENGTH1:%.*]] = arith.constant 128 : i32
|
||||
!CHECK: acc.parallel vector_length([[VECTORLENGTH1]]: i32) {
|
||||
!CHECK: acc.parallel vector_length([[VECTORLENGTH1]] : i32) {
|
||||
!CHECK: acc.loop {
|
||||
!CHECK: fir.do_loop
|
||||
!CHECK: acc.yield
|
||||
@ -217,7 +217,7 @@ subroutine acc_parallel_loop
|
||||
END DO
|
||||
|
||||
!CHECK: [[VECTORLENGTH2:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
|
||||
!CHECK: acc.parallel vector_length([[VECTORLENGTH2]]: i32) {
|
||||
!CHECK: acc.parallel vector_length([[VECTORLENGTH2]] : i32) {
|
||||
!CHECK: acc.loop {
|
||||
!CHECK: fir.do_loop
|
||||
!CHECK: acc.yield
|
||||
@ -300,7 +300,7 @@ subroutine acc_parallel_loop
|
||||
a(i) = b(i)
|
||||
END DO
|
||||
|
||||
!CHECK: acc.parallel copy([[A]]: !fir.ref<!fir.array<10xf32>>, [[B]]: !fir.ref<!fir.array<10xf32>>) {
|
||||
!CHECK: acc.parallel copy([[A]], [[B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
|
||||
!CHECK: acc.loop {
|
||||
!CHECK: fir.do_loop
|
||||
!CHECK: acc.yield
|
||||
@ -313,7 +313,7 @@ subroutine acc_parallel_loop
|
||||
a(i) = b(i)
|
||||
END DO
|
||||
|
||||
!CHECK: acc.parallel copy([[A]]: !fir.ref<!fir.array<10xf32>>, [[B]]: !fir.ref<!fir.array<10xf32>>) {
|
||||
!CHECK: acc.parallel copy([[A]], [[B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
|
||||
!CHECK: acc.loop {
|
||||
!CHECK: fir.do_loop
|
||||
!CHECK: acc.yield
|
||||
@ -326,7 +326,7 @@ subroutine acc_parallel_loop
|
||||
a(i) = b(i)
|
||||
END DO
|
||||
|
||||
!CHECK: acc.parallel copyin([[A]]: !fir.ref<!fir.array<10xf32>>) copyin_readonly([[B]]: !fir.ref<!fir.array<10xf32>>) {
|
||||
!CHECK: acc.parallel copyin([[A]] : !fir.ref<!fir.array<10xf32>>) copyin_readonly([[B]] : !fir.ref<!fir.array<10xf32>>) {
|
||||
!CHECK: acc.loop {
|
||||
!CHECK: fir.do_loop
|
||||
!CHECK: acc.yield
|
||||
@ -339,7 +339,7 @@ subroutine acc_parallel_loop
|
||||
a(i) = b(i)
|
||||
END DO
|
||||
|
||||
!CHECK: acc.parallel copyout([[A]]: !fir.ref<!fir.array<10xf32>>) copyout_zero([[B]]: !fir.ref<!fir.array<10xf32>>) {
|
||||
!CHECK: acc.parallel copyout([[A]] : !fir.ref<!fir.array<10xf32>>) copyout_zero([[B]] : !fir.ref<!fir.array<10xf32>>) {
|
||||
!CHECK: acc.loop {
|
||||
!CHECK: fir.do_loop
|
||||
!CHECK: acc.yield
|
||||
@ -352,7 +352,7 @@ subroutine acc_parallel_loop
|
||||
a(i) = b(i)
|
||||
END DO
|
||||
|
||||
!CHECK: acc.parallel create([[B]]: !fir.ref<!fir.array<10xf32>>) create_zero([[A]]: !fir.ref<!fir.array<10xf32>>) {
|
||||
!CHECK: acc.parallel create([[B]] : !fir.ref<!fir.array<10xf32>>) create_zero([[A]] : !fir.ref<!fir.array<10xf32>>) {
|
||||
!CHECK: acc.loop {
|
||||
!CHECK: fir.do_loop
|
||||
!CHECK: acc.yield
|
||||
@ -365,7 +365,7 @@ subroutine acc_parallel_loop
|
||||
a(i) = b(i)
|
||||
END DO
|
||||
|
||||
!CHECK: acc.parallel no_create([[A]]: !fir.ref<!fir.array<10xf32>>, [[B]]: !fir.ref<!fir.array<10xf32>>) {
|
||||
!CHECK: acc.parallel no_create([[A]], [[B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
|
||||
!CHECK: acc.loop {
|
||||
!CHECK: fir.do_loop
|
||||
!CHECK: acc.yield
|
||||
@ -378,7 +378,7 @@ subroutine acc_parallel_loop
|
||||
a(i) = b(i)
|
||||
END DO
|
||||
|
||||
!CHECK: acc.parallel present([[A]]: !fir.ref<!fir.array<10xf32>>, [[B]]: !fir.ref<!fir.array<10xf32>>) {
|
||||
!CHECK: acc.parallel present([[A]], [[B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
|
||||
!CHECK: acc.loop {
|
||||
!CHECK: fir.do_loop
|
||||
!CHECK: acc.yield
|
||||
@ -391,7 +391,7 @@ subroutine acc_parallel_loop
|
||||
a(i) = b(i)
|
||||
END DO
|
||||
|
||||
!CHECK: acc.parallel deviceptr([[A]]: !fir.ref<!fir.array<10xf32>>, [[B]]: !fir.ref<!fir.array<10xf32>>) {
|
||||
!CHECK: acc.parallel deviceptr([[A]], [[B]] : !fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) {
|
||||
!CHECK: acc.loop {
|
||||
!CHECK: fir.do_loop
|
||||
!CHECK: acc.yield
|
||||
@ -404,7 +404,7 @@ subroutine acc_parallel_loop
|
||||
a(i) = b(i)
|
||||
END DO
|
||||
|
||||
!CHECK: acc.parallel attach([[F]]: !fir.ref<!fir.box<!fir.ptr<f32>>>, [[G]]: !fir.ref<!fir.box<!fir.ptr<f32>>>) {
|
||||
!CHECK: acc.parallel attach([[F]], [[G]] : !fir.ref<!fir.box<!fir.ptr<f32>>>, !fir.ref<!fir.box<!fir.ptr<f32>>>) {
|
||||
!CHECK: acc.loop {
|
||||
!CHECK: fir.do_loop
|
||||
!CHECK: acc.yield
|
||||
@ -417,7 +417,7 @@ subroutine acc_parallel_loop
|
||||
a(i) = b(i)
|
||||
END DO
|
||||
|
||||
!CHECK: acc.parallel private([[A]]: !fir.ref<!fir.array<10xf32>>) firstprivate([[B]]: !fir.ref<!fir.array<10xf32>>) {
|
||||
!CHECK: acc.parallel firstprivate([[B]] : !fir.ref<!fir.array<10xf32>>) private([[A]] : !fir.ref<!fir.array<10xf32>>) {
|
||||
!CHECK: acc.loop private([[A]]: !fir.ref<!fir.array<10xf32>>) {
|
||||
!CHECK: fir.do_loop
|
||||
!CHECK: acc.yield
|
||||
|
@ -40,7 +40,7 @@ subroutine acc_parallel
|
||||
!$acc end parallel
|
||||
|
||||
!CHECK: [[ASYNC1:%.*]] = arith.constant 1 : i32
|
||||
!CHECK: acc.parallel async([[ASYNC1]]: i32) {
|
||||
!CHECK: acc.parallel async([[ASYNC1]] : i32) {
|
||||
!CHECK: acc.yield
|
||||
!CHECK-NEXT: }{{$}}
|
||||
|
||||
@ -48,7 +48,7 @@ subroutine acc_parallel
|
||||
!$acc end parallel
|
||||
|
||||
!CHECK: [[ASYNC2:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
|
||||
!CHECK: acc.parallel async([[ASYNC2]]: i32) {
|
||||
!CHECK: acc.parallel async([[ASYNC2]] : i32) {
|
||||
!CHECK: acc.yield
|
||||
!CHECK-NEXT: }{{$}}
|
||||
|
||||
@ -63,7 +63,7 @@ subroutine acc_parallel
|
||||
!$acc end parallel
|
||||
|
||||
!CHECK: [[WAIT1:%.*]] = arith.constant 1 : i32
|
||||
!CHECK: acc.parallel wait([[WAIT1]]: i32) {
|
||||
!CHECK: acc.parallel wait([[WAIT1]] : i32) {
|
||||
!CHECK: acc.yield
|
||||
!CHECK-NEXT: }{{$}}
|
||||
|
||||
@ -72,7 +72,7 @@ subroutine acc_parallel
|
||||
|
||||
!CHECK: [[WAIT2:%.*]] = arith.constant 1 : i32
|
||||
!CHECK: [[WAIT3:%.*]] = arith.constant 2 : i32
|
||||
!CHECK: acc.parallel wait([[WAIT2]]: i32, [[WAIT3]]: i32) {
|
||||
!CHECK: acc.parallel wait([[WAIT2]], [[WAIT3]] : i32, i32) {
|
||||
!CHECK: acc.yield
|
||||
!CHECK-NEXT: }{{$}}
|
||||
|
||||
@ -81,7 +81,7 @@ subroutine acc_parallel
|
||||
|
||||
!CHECK: [[WAIT4:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
|
||||
!CHECK: [[WAIT5:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
|
||||
!CHECK: acc.parallel wait([[WAIT4]]: i32, [[WAIT5]]: i32) {
|
||||
!CHECK: acc.parallel wait([[WAIT4]], [[WAIT5]] : i32, i32) {
|
||||
!CHECK: acc.yield
|
||||
!CHECK-NEXT: }{{$}}
|
||||
|
||||
@ -89,7 +89,7 @@ subroutine acc_parallel
|
||||
!$acc end parallel
|
||||
|
||||
!CHECK: [[NUMGANGS1:%.*]] = arith.constant 1 : i32
|
||||
!CHECK: acc.parallel num_gangs([[NUMGANGS1]]: i32) {
|
||||
!CHECK: acc.parallel num_gangs([[NUMGANGS1]] : i32) {
|
||||
!CHECK: acc.yield
|
||||
!CHECK-NEXT: }{{$}}
|
||||
|
||||
@ -97,7 +97,7 @@ subroutine acc_parallel
|
||||
!$acc end parallel
|
||||
|
||||
!CHECK: [[NUMGANGS2:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
|
||||
!CHECK: acc.parallel num_gangs([[NUMGANGS2]]: i32) {
|
||||
!CHECK: acc.parallel num_gangs([[NUMGANGS2]] : i32) {
|
||||
!CHECK: acc.yield
|
||||
!CHECK-NEXT: }{{$}}
|
||||
|
||||
@ -105,7 +105,7 @@ subroutine acc_parallel
|
||||
!$acc end parallel
|
||||
|
||||
!CHECK: [[NUMWORKERS1:%.*]] = arith.constant 10 : i32
|
||||
!CHECK: acc.parallel num_workers([[NUMWORKERS1]]: i32) {
|
||||
!CHECK: acc.parallel num_workers([[NUMWORKERS1]] : i32) {
|
||||
!CHECK: acc.yield
|
||||
!CHECK-NEXT: }{{$}}
|
||||
|
||||
@ -113,7 +113,7 @@ subroutine acc_parallel
|
||||
!$acc end parallel
|
||||
|
||||
!CHECK: [[NUMWORKERS2:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
|
||||
!CHECK: acc.parallel num_workers([[NUMWORKERS2]]: i32) {
|
||||
!CHECK: acc.parallel num_workers([[NUMWORKERS2]] : i32) {
|
||||
!CHECK: acc.yield
|
||||
!CHECK-NEXT: }{{$}}
|
||||
|
||||
@ -121,7 +121,7 @@ subroutine acc_parallel
|
||||
!$acc end parallel
|
||||
|
||||
!CHECK: [[VECTORLENGTH1:%.*]] = arith.constant 128 : i32
|
||||
!CHECK: acc.parallel vector_length([[VECTORLENGTH1]]: i32) {
|
||||
!CHECK: acc.parallel vector_length([[VECTORLENGTH1]] : i32) {
|
||||
!CHECK: acc.yield
|
||||
!CHECK-NEXT: }{{$}}
|
||||
|
||||
@ -129,7 +129,7 @@ subroutine acc_parallel
|
||||
!$acc end parallel
|
||||
|
||||
!CHECK: [[VECTORLENGTH2:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
|
||||
!CHECK: acc.parallel vector_length([[VECTORLENGTH2]]: i32) {
|
||||
!CHECK: acc.parallel vector_length([[VECTORLENGTH2]] : i32) {
|
||||
!CHECK: acc.yield
|
||||
!CHECK-NEXT: }{{$}}
|
||||
|
||||
@ -176,70 +176,70 @@ subroutine acc_parallel
|
||||
!$acc parallel copy(a, b, c)
|
||||
!$acc end parallel
|
||||
|
||||
!CHECK: acc.parallel copy([[A]]: !fir.ref<!fir.array<10x10xf32>>, [[B]]: !fir.ref<!fir.array<10x10xf32>>, [[C]]: !fir.ref<!fir.array<10x10xf32>>) {
|
||||
!CHECK: acc.parallel copy([[A]], [[B]], [[C]] : !fir.ref<!fir.array<10x10xf32>>, !fir.ref<!fir.array<10x10xf32>>, !fir.ref<!fir.array<10x10xf32>>) {
|
||||
!CHECK: acc.yield
|
||||
!CHECK-NEXT: }{{$}}
|
||||
|
||||
!$acc parallel copy(a) copy(b) copy(c)
|
||||
!$acc end parallel
|
||||
|
||||
!CHECK: acc.parallel copy([[A]]: !fir.ref<!fir.array<10x10xf32>>, [[B]]: !fir.ref<!fir.array<10x10xf32>>, [[C]]: !fir.ref<!fir.array<10x10xf32>>) {
|
||||
!CHECK: acc.parallel copy([[A]], [[B]], [[C]] : !fir.ref<!fir.array<10x10xf32>>, !fir.ref<!fir.array<10x10xf32>>, !fir.ref<!fir.array<10x10xf32>>) {
|
||||
!CHECK: acc.yield
|
||||
!CHECK-NEXT: }{{$}}
|
||||
|
||||
!$acc parallel copyin(a) copyin(readonly: b, c)
|
||||
!$acc end parallel
|
||||
|
||||
!CHECK: acc.parallel copyin([[A]]: !fir.ref<!fir.array<10x10xf32>>) copyin_readonly([[B]]: !fir.ref<!fir.array<10x10xf32>>, [[C]]: !fir.ref<!fir.array<10x10xf32>>) {
|
||||
!CHECK: acc.parallel copyin([[A]] : !fir.ref<!fir.array<10x10xf32>>) copyin_readonly([[B]], [[C]] : !fir.ref<!fir.array<10x10xf32>>, !fir.ref<!fir.array<10x10xf32>>) {
|
||||
!CHECK: acc.yield
|
||||
!CHECK-NEXT: }{{$}}
|
||||
|
||||
!$acc parallel copyout(a) copyout(zero: b) copyout(c)
|
||||
!$acc end parallel
|
||||
|
||||
!CHECK: acc.parallel copyout([[A]]: !fir.ref<!fir.array<10x10xf32>>, [[C]]: !fir.ref<!fir.array<10x10xf32>>) copyout_zero([[B]]: !fir.ref<!fir.array<10x10xf32>>) {
|
||||
!CHECK: acc.parallel copyout([[A]], [[C]] : !fir.ref<!fir.array<10x10xf32>>, !fir.ref<!fir.array<10x10xf32>>) copyout_zero([[B]] : !fir.ref<!fir.array<10x10xf32>>) {
|
||||
!CHECK: acc.yield
|
||||
!CHECK-NEXT: }{{$}}
|
||||
|
||||
!$acc parallel create(a, b) create(zero: c)
|
||||
!$acc end parallel
|
||||
|
||||
!CHECK: acc.parallel create([[A]]: !fir.ref<!fir.array<10x10xf32>>, [[B]]: !fir.ref<!fir.array<10x10xf32>>) create_zero([[C]]: !fir.ref<!fir.array<10x10xf32>>) {
|
||||
!CHECK: acc.parallel create([[A]], [[B]] : !fir.ref<!fir.array<10x10xf32>>, !fir.ref<!fir.array<10x10xf32>>) create_zero([[C]] : !fir.ref<!fir.array<10x10xf32>>) {
|
||||
!CHECK: acc.yield
|
||||
!CHECK-NEXT: }{{$}}
|
||||
|
||||
!$acc parallel no_create(a, b) create(zero: c)
|
||||
!$acc end parallel
|
||||
|
||||
!CHECK: acc.parallel create_zero([[C]]: !fir.ref<!fir.array<10x10xf32>>) no_create([[A]]: !fir.ref<!fir.array<10x10xf32>>, [[B]]: !fir.ref<!fir.array<10x10xf32>>) {
|
||||
!CHECK: acc.parallel create_zero([[C]] : !fir.ref<!fir.array<10x10xf32>>) no_create([[A]], [[B]] : !fir.ref<!fir.array<10x10xf32>>, !fir.ref<!fir.array<10x10xf32>>) {
|
||||
!CHECK: acc.yield
|
||||
!CHECK-NEXT: }{{$}}
|
||||
|
||||
!$acc parallel present(a, b, c)
|
||||
!$acc end parallel
|
||||
|
||||
!CHECK: acc.parallel present([[A]]: !fir.ref<!fir.array<10x10xf32>>, [[B]]: !fir.ref<!fir.array<10x10xf32>>, [[C]]: !fir.ref<!fir.array<10x10xf32>>) {
|
||||
!CHECK: acc.parallel present([[A]], [[B]], [[C]] : !fir.ref<!fir.array<10x10xf32>>, !fir.ref<!fir.array<10x10xf32>>, !fir.ref<!fir.array<10x10xf32>>) {
|
||||
!CHECK: acc.yield
|
||||
!CHECK-NEXT: }{{$}}
|
||||
|
||||
!$acc parallel deviceptr(a) deviceptr(c)
|
||||
!$acc end parallel
|
||||
|
||||
!CHECK: acc.parallel deviceptr([[A]]: !fir.ref<!fir.array<10x10xf32>>, [[C]]: !fir.ref<!fir.array<10x10xf32>>) {
|
||||
!CHECK: acc.parallel deviceptr([[A]], [[C]] : !fir.ref<!fir.array<10x10xf32>>, !fir.ref<!fir.array<10x10xf32>>) {
|
||||
!CHECK: acc.yield
|
||||
!CHECK-NEXT: }{{$}}
|
||||
|
||||
!$acc parallel attach(d, e)
|
||||
!$acc end parallel
|
||||
|
||||
!CHECK: acc.parallel attach([[D]]: !fir.ref<!fir.box<!fir.ptr<f32>>>, [[E]]: !fir.ref<!fir.box<!fir.ptr<f32>>>) {
|
||||
!CHECK: acc.parallel attach([[D]], [[E]] : !fir.ref<!fir.box<!fir.ptr<f32>>>, !fir.ref<!fir.box<!fir.ptr<f32>>>) {
|
||||
!CHECK: acc.yield
|
||||
!CHECK-NEXT: }{{$}}
|
||||
|
||||
!$acc parallel private(a) firstprivate(b) private(c)
|
||||
!$acc end parallel
|
||||
|
||||
!CHECK: acc.parallel private([[A]]: !fir.ref<!fir.array<10x10xf32>>, [[C]]: !fir.ref<!fir.array<10x10xf32>>) firstprivate([[B]]: !fir.ref<!fir.array<10x10xf32>>) {
|
||||
!CHECK: acc.parallel firstprivate([[B]] : !fir.ref<!fir.array<10x10xf32>>) private([[A]], [[C]] : !fir.ref<!fir.array<10x10xf32>>, !fir.ref<!fir.array<10x10xf32>>) {
|
||||
!CHECK: acc.yield
|
||||
!CHECK-NEXT: }{{$}}
|
||||
|
||||
|
@ -93,9 +93,9 @@ func.func @_QQsub_parallel() attributes {fir.bindc_name = "test"} {
|
||||
// CHECK-LABEL: func.func @_QQsub_parallel() attributes {fir.bindc_name = "test"} {
|
||||
// CHECK: %[[ADDR:.*]] = fir.address_of(@_QFEa) : !fir.ref<!fir.array<10xf32>>
|
||||
// CHECK: %[[CAST:.*]] = builtin.unrealized_conversion_cast %[[ADDR]] : !fir.ref<!fir.array<10xf32>> to !llvm.ptr<array<10 x f32>>
|
||||
// CHECK: acc.parallel copyin(%[[CAST]]: !llvm.ptr<array<10 x f32>>) {
|
||||
// CHECK: acc.parallel copyin(%[[CAST]] : !llvm.ptr<array<10 x f32>>) {
|
||||
// CHECK: acc.loop
|
||||
|
||||
// LLVMIR-LABEL: llvm.func @_QQsub_parallel() attributes {fir.bindc_name = "test"} {
|
||||
// LLVMIR: %[[ADDR:.*]] = llvm.mlir.addressof @_QFEa : !llvm.ptr<array<10 x f32>>
|
||||
// LLVMIR: acc.parallel copyin(%[[ADDR]]: !llvm.ptr<array<10 x f32>>) {
|
||||
// LLVMIR: acc.parallel copyin(%[[ADDR]] : !llvm.ptr<array<10 x f32>>) {
|
||||
|
@ -117,38 +117,43 @@ def OpenACC_ParallelOp : OpenACC_Op<"parallel",
|
||||
let regions = (region AnyRegion:$region);
|
||||
|
||||
let extraClassDeclaration = [{
|
||||
static StringRef getAsyncKeyword() { return "async"; }
|
||||
static StringRef getAsyncAttrName() { return "asyncAttr"; }
|
||||
static StringRef getWaitKeyword() { return "wait"; }
|
||||
static StringRef getWaitAttrName() { return "waitAttr"; }
|
||||
static StringRef getNumGangsKeyword() { return "num_gangs"; }
|
||||
static StringRef getNumWorkersKeyword() { return "num_workers"; }
|
||||
static StringRef getVectorLengthKeyword() { return "vector_length"; }
|
||||
static StringRef getIfKeyword() { return "if"; }
|
||||
static StringRef getSelfKeyword() { return "self"; }
|
||||
static StringRef getSelfAttrName() { return "selfAttr"; }
|
||||
static StringRef getReductionKeyword() { return "reduction"; }
|
||||
static StringRef getCopyKeyword() { return "copy"; }
|
||||
static StringRef getCopyinKeyword() { return "copyin"; }
|
||||
static StringRef getCopyinReadonlyKeyword() { return "copyin_readonly"; }
|
||||
static StringRef getCopyoutKeyword() { return "copyout"; }
|
||||
static StringRef getCopyoutZeroKeyword() { return "copyout_zero"; }
|
||||
static StringRef getCreateKeyword() { return "create"; }
|
||||
static StringRef getCreateZeroKeyword() { return "create_zero"; }
|
||||
static StringRef getNoCreateKeyword() { return "no_create"; }
|
||||
static StringRef getPresentKeyword() { return "present"; }
|
||||
static StringRef getDevicePtrKeyword() { return "deviceptr"; }
|
||||
static StringRef getAttachKeyword() { return "attach"; }
|
||||
static StringRef getPrivateKeyword() { return "private"; }
|
||||
static StringRef getFirstPrivateKeyword() { return "firstprivate"; }
|
||||
|
||||
/// The number of data operands.
|
||||
unsigned getNumDataOperands();
|
||||
|
||||
/// The i-th data operand passed.
|
||||
Value getDataOperand(unsigned i);
|
||||
}];
|
||||
let hasCustomAssemblyFormat = 1;
|
||||
|
||||
let assemblyFormat = [{
|
||||
oilist(
|
||||
`attach` `(` $attachOperands `:` type($attachOperands) `)`
|
||||
| `async` `(` $async `:` type($async) `)`
|
||||
| `copy` `(` $copyOperands `:` type($copyOperands) `)`
|
||||
| `copyin` `(` $copyinOperands `:` type($copyinOperands) `)`
|
||||
| `copyin_readonly` `(` $copyinReadonlyOperands `:`
|
||||
type($copyinReadonlyOperands) `)`
|
||||
| `copyout` `(` $copyoutOperands `:` type($copyoutOperands) `)`
|
||||
| `copyout_zero` `(` $copyoutZeroOperands `:`
|
||||
type($copyoutZeroOperands) `)`
|
||||
| `create` `(` $createOperands `:` type($createOperands) `)`
|
||||
| `create_zero` `(` $createZeroOperands `:`
|
||||
type($createZeroOperands) `)`
|
||||
| `deviceptr` `(` $devicePtrOperands `:` type($devicePtrOperands) `)`
|
||||
| `firstprivate` `(` $gangFirstPrivateOperands `:`
|
||||
type($gangFirstPrivateOperands) `)`
|
||||
| `no_create` `(` $noCreateOperands `:` type($noCreateOperands) `)`
|
||||
| `num_gangs` `(` $numGangs `:` type($numGangs) `)`
|
||||
| `num_workers` `(` $numWorkers `:` type($numWorkers) `)`
|
||||
| `private` `(` $gangPrivateOperands `:` type($gangPrivateOperands) `)`
|
||||
| `present` `(` $presentOperands `:` type($presentOperands) `)`
|
||||
| `vector_length` `(` $vectorLength `:` type($vectorLength) `)`
|
||||
| `wait` `(` $waitOperands `:` type($waitOperands) `)`
|
||||
| `self` `(` $selfCond `)`
|
||||
| `if` `(` $ifCond `)`
|
||||
| `reduction` `(` $reductionOperands `:` type($reductionOperands) `)`
|
||||
)
|
||||
$region attr-dict-with-keyword
|
||||
}];
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -97,21 +97,6 @@ static void printOperandList(Operation::operand_range operands,
|
||||
}
|
||||
}
|
||||
|
||||
static ParseResult parseOptionalOperand(OpAsmParser &parser, StringRef keyword,
|
||||
OpAsmParser::UnresolvedOperand &operand,
|
||||
Type type, bool &hasOptional,
|
||||
OperationState &result) {
|
||||
hasOptional = false;
|
||||
if (succeeded(parser.parseOptionalKeyword(keyword))) {
|
||||
hasOptional = true;
|
||||
if (parser.parseLParen() || parser.parseOperand(operand) ||
|
||||
parser.resolveOperand(operand, type, result.operands) ||
|
||||
parser.parseRParen())
|
||||
return failure();
|
||||
}
|
||||
return success();
|
||||
}
|
||||
|
||||
static ParseResult parseOperandAndType(OpAsmParser &parser,
|
||||
OperationState &result) {
|
||||
OpAsmParser::UnresolvedOperand operand;
|
||||
@ -122,21 +107,6 @@ static ParseResult parseOperandAndType(OpAsmParser &parser,
|
||||
return success();
|
||||
}
|
||||
|
||||
/// Parse optional operand and its type wrapped in parenthesis prefixed with
|
||||
/// a keyword.
|
||||
/// Example:
|
||||
/// keyword `(` %vectorLength: i64 `)`
|
||||
static OptionalParseResult parseOptionalOperandAndType(OpAsmParser &parser,
|
||||
StringRef keyword,
|
||||
OperationState &result) {
|
||||
OpAsmParser::UnresolvedOperand operand;
|
||||
if (succeeded(parser.parseOptionalKeyword(keyword))) {
|
||||
return failure(parser.parseLParen() ||
|
||||
parseOperandAndType(parser, result) || parser.parseRParen());
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/// Parse optional operand and its type wrapped in parenthesis.
|
||||
/// Example:
|
||||
/// `(` %vectorLength: i64 `)`
|
||||
@ -197,295 +167,6 @@ struct RemoveConstantIfCondition : public OpRewritePattern<OpTy> {
|
||||
// ParallelOp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// Parse acc.parallel operation
|
||||
/// operation := `acc.parallel` `async` `(` index `)`?
|
||||
/// `wait` `(` index-list `)`?
|
||||
/// `num_gangs` `(` value `)`?
|
||||
/// `num_workers` `(` value `)`?
|
||||
/// `vector_length` `(` value `)`?
|
||||
/// `if` `(` value `)`?
|
||||
/// `self` `(` value `)`?
|
||||
/// `reduction` `(` value-list `)`?
|
||||
/// `copy` `(` value-list `)`?
|
||||
/// `copyin` `(` value-list `)`?
|
||||
/// `copyin_readonly` `(` value-list `)`?
|
||||
/// `copyout` `(` value-list `)`?
|
||||
/// `copyout_zero` `(` value-list `)`?
|
||||
/// `create` `(` value-list `)`?
|
||||
/// `create_zero` `(` value-list `)`?
|
||||
/// `no_create` `(` value-list `)`?
|
||||
/// `present` `(` value-list `)`?
|
||||
/// `deviceptr` `(` value-list `)`?
|
||||
/// `attach` `(` value-list `)`?
|
||||
/// `private` `(` value-list `)`?
|
||||
/// `firstprivate` `(` value-list `)`?
|
||||
/// region attr-dict?
|
||||
ParseResult ParallelOp::parse(OpAsmParser &parser, OperationState &result) {
|
||||
Builder &builder = parser.getBuilder();
|
||||
SmallVector<OpAsmParser::UnresolvedOperand, 8> privateOperands,
|
||||
firstprivateOperands, copyOperands, copyinOperands,
|
||||
copyinReadonlyOperands, copyoutOperands, copyoutZeroOperands,
|
||||
createOperands, createZeroOperands, noCreateOperands, presentOperands,
|
||||
devicePtrOperands, attachOperands, waitOperands, reductionOperands;
|
||||
SmallVector<Type, 8> waitOperandTypes, reductionOperandTypes,
|
||||
copyOperandTypes, copyinOperandTypes, copyinReadonlyOperandTypes,
|
||||
copyoutOperandTypes, copyoutZeroOperandTypes, createOperandTypes,
|
||||
createZeroOperandTypes, noCreateOperandTypes, presentOperandTypes,
|
||||
deviceptrOperandTypes, attachOperandTypes, privateOperandTypes,
|
||||
firstprivateOperandTypes;
|
||||
|
||||
SmallVector<Type, 8> operandTypes;
|
||||
OpAsmParser::UnresolvedOperand ifCond, selfCond;
|
||||
bool hasIfCond = false, hasSelfCond = false;
|
||||
OptionalParseResult async, numGangs, numWorkers, vectorLength;
|
||||
Type i1Type = builder.getI1Type();
|
||||
|
||||
// getAsync()?
|
||||
async = parseOptionalOperandAndType(parser, ParallelOp::getAsyncKeyword(),
|
||||
result);
|
||||
if (async.has_value() && failed(*async))
|
||||
return failure();
|
||||
|
||||
// getWait()?
|
||||
if (failed(parseOperandList(parser, ParallelOp::getWaitKeyword(),
|
||||
waitOperands, waitOperandTypes, result)))
|
||||
return failure();
|
||||
|
||||
// num_gangs(value)?
|
||||
numGangs = parseOptionalOperandAndType(
|
||||
parser, ParallelOp::getNumGangsKeyword(), result);
|
||||
if (numGangs.has_value() && failed(*numGangs))
|
||||
return failure();
|
||||
|
||||
// num_workers(value)?
|
||||
numWorkers = parseOptionalOperandAndType(
|
||||
parser, ParallelOp::getNumWorkersKeyword(), result);
|
||||
if (numWorkers.has_value() && failed(*numWorkers))
|
||||
return failure();
|
||||
|
||||
// vector_length(value)?
|
||||
vectorLength = parseOptionalOperandAndType(
|
||||
parser, ParallelOp::getVectorLengthKeyword(), result);
|
||||
if (vectorLength.has_value() && failed(*vectorLength))
|
||||
return failure();
|
||||
|
||||
// if()?
|
||||
if (failed(parseOptionalOperand(parser, ParallelOp::getIfKeyword(), ifCond,
|
||||
i1Type, hasIfCond, result)))
|
||||
return failure();
|
||||
|
||||
// self()?
|
||||
if (failed(parseOptionalOperand(parser, ParallelOp::getSelfKeyword(),
|
||||
selfCond, i1Type, hasSelfCond, result)))
|
||||
return failure();
|
||||
|
||||
// reduction()?
|
||||
if (failed(parseOperandList(parser, ParallelOp::getReductionKeyword(),
|
||||
reductionOperands, reductionOperandTypes,
|
||||
result)))
|
||||
return failure();
|
||||
|
||||
// copy()?
|
||||
if (failed(parseOperandList(parser, ParallelOp::getCopyKeyword(),
|
||||
copyOperands, copyOperandTypes, result)))
|
||||
return failure();
|
||||
|
||||
// copyin()?
|
||||
if (failed(parseOperandList(parser, ParallelOp::getCopyinKeyword(),
|
||||
copyinOperands, copyinOperandTypes, result)))
|
||||
return failure();
|
||||
|
||||
// copyin_readonly()?
|
||||
if (failed(parseOperandList(parser, ParallelOp::getCopyinReadonlyKeyword(),
|
||||
copyinReadonlyOperands,
|
||||
copyinReadonlyOperandTypes, result)))
|
||||
return failure();
|
||||
|
||||
// copyout()?
|
||||
if (failed(parseOperandList(parser, ParallelOp::getCopyoutKeyword(),
|
||||
copyoutOperands, copyoutOperandTypes, result)))
|
||||
return failure();
|
||||
|
||||
// copyout_zero()?
|
||||
if (failed(parseOperandList(parser, ParallelOp::getCopyoutZeroKeyword(),
|
||||
copyoutZeroOperands, copyoutZeroOperandTypes,
|
||||
result)))
|
||||
return failure();
|
||||
|
||||
// create()?
|
||||
if (failed(parseOperandList(parser, ParallelOp::getCreateKeyword(),
|
||||
createOperands, createOperandTypes, result)))
|
||||
return failure();
|
||||
|
||||
// create_zero()?
|
||||
if (failed(parseOperandList(parser, ParallelOp::getCreateZeroKeyword(),
|
||||
createZeroOperands, createZeroOperandTypes,
|
||||
result)))
|
||||
return failure();
|
||||
|
||||
// no_create()?
|
||||
if (failed(parseOperandList(parser, ParallelOp::getNoCreateKeyword(),
|
||||
noCreateOperands, noCreateOperandTypes, result)))
|
||||
return failure();
|
||||
|
||||
// present()?
|
||||
if (failed(parseOperandList(parser, ParallelOp::getPresentKeyword(),
|
||||
presentOperands, presentOperandTypes, result)))
|
||||
return failure();
|
||||
|
||||
// deviceptr()?
|
||||
if (failed(parseOperandList(parser, ParallelOp::getDevicePtrKeyword(),
|
||||
devicePtrOperands, deviceptrOperandTypes,
|
||||
result)))
|
||||
return failure();
|
||||
|
||||
// attach()?
|
||||
if (failed(parseOperandList(parser, ParallelOp::getAttachKeyword(),
|
||||
attachOperands, attachOperandTypes, result)))
|
||||
return failure();
|
||||
|
||||
// private()?
|
||||
if (failed(parseOperandList(parser, ParallelOp::getPrivateKeyword(),
|
||||
privateOperands, privateOperandTypes, result)))
|
||||
return failure();
|
||||
|
||||
// firstprivate()?
|
||||
if (failed(parseOperandList(parser, ParallelOp::getFirstPrivateKeyword(),
|
||||
firstprivateOperands, firstprivateOperandTypes,
|
||||
result)))
|
||||
return failure();
|
||||
|
||||
// Parallel op region
|
||||
if (failed(parseRegions<ParallelOp>(parser, result)))
|
||||
return failure();
|
||||
|
||||
result.addAttribute(
|
||||
ParallelOp::getOperandSegmentSizeAttr(),
|
||||
builder.getDenseI32ArrayAttr(
|
||||
{static_cast<int32_t>(async.has_value() ? 1 : 0),
|
||||
static_cast<int32_t>(waitOperands.size()),
|
||||
static_cast<int32_t>(numGangs.has_value() ? 1 : 0),
|
||||
static_cast<int32_t>(numWorkers.has_value() ? 1 : 0),
|
||||
static_cast<int32_t>(vectorLength.has_value() ? 1 : 0),
|
||||
static_cast<int32_t>(hasIfCond ? 1 : 0),
|
||||
static_cast<int32_t>(hasSelfCond ? 1 : 0),
|
||||
static_cast<int32_t>(reductionOperands.size()),
|
||||
static_cast<int32_t>(copyOperands.size()),
|
||||
static_cast<int32_t>(copyinOperands.size()),
|
||||
static_cast<int32_t>(copyinReadonlyOperands.size()),
|
||||
static_cast<int32_t>(copyoutOperands.size()),
|
||||
static_cast<int32_t>(copyoutZeroOperands.size()),
|
||||
static_cast<int32_t>(createOperands.size()),
|
||||
static_cast<int32_t>(createZeroOperands.size()),
|
||||
static_cast<int32_t>(noCreateOperands.size()),
|
||||
static_cast<int32_t>(presentOperands.size()),
|
||||
static_cast<int32_t>(devicePtrOperands.size()),
|
||||
static_cast<int32_t>(attachOperands.size()),
|
||||
static_cast<int32_t>(privateOperands.size()),
|
||||
static_cast<int32_t>(firstprivateOperands.size())}));
|
||||
|
||||
// Additional attributes
|
||||
if (failed(parser.parseOptionalAttrDictWithKeyword(result.attributes)))
|
||||
return failure();
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
void ParallelOp::print(OpAsmPrinter &printer) {
|
||||
// getAsync()?
|
||||
if (Value async = getAsync())
|
||||
printer << " " << ParallelOp::getAsyncKeyword() << "(" << async << ": "
|
||||
<< async.getType() << ")";
|
||||
|
||||
// getWait()?
|
||||
printOperandList(getWaitOperands(), ParallelOp::getWaitKeyword(), printer);
|
||||
|
||||
// num_gangs()?
|
||||
if (Value numGangs = getNumGangs())
|
||||
printer << " " << ParallelOp::getNumGangsKeyword() << "(" << numGangs
|
||||
<< ": " << numGangs.getType() << ")";
|
||||
|
||||
// num_workers()?
|
||||
if (Value numWorkers = getNumWorkers())
|
||||
printer << " " << ParallelOp::getNumWorkersKeyword() << "(" << numWorkers
|
||||
<< ": " << numWorkers.getType() << ")";
|
||||
|
||||
// vector_length()?
|
||||
if (Value vectorLength = getVectorLength())
|
||||
printer << " " << ParallelOp::getVectorLengthKeyword() << "("
|
||||
<< vectorLength << ": " << vectorLength.getType() << ")";
|
||||
|
||||
// if()?
|
||||
if (Value ifCond = getIfCond())
|
||||
printer << " " << ParallelOp::getIfKeyword() << "(" << ifCond << ")";
|
||||
|
||||
// self()?
|
||||
if (Value selfCond = getSelfCond())
|
||||
printer << " " << ParallelOp::getSelfKeyword() << "(" << selfCond << ")";
|
||||
|
||||
// reduction()?
|
||||
printOperandList(getReductionOperands(), ParallelOp::getReductionKeyword(),
|
||||
printer);
|
||||
|
||||
// copy()?
|
||||
printOperandList(getCopyOperands(), ParallelOp::getCopyKeyword(), printer);
|
||||
|
||||
// copyin()?
|
||||
printOperandList(getCopyinOperands(), ParallelOp::getCopyinKeyword(),
|
||||
printer);
|
||||
|
||||
// copyin_readonly()?
|
||||
printOperandList(getCopyinReadonlyOperands(),
|
||||
ParallelOp::getCopyinReadonlyKeyword(), printer);
|
||||
|
||||
// copyout()?
|
||||
printOperandList(getCopyoutOperands(), ParallelOp::getCopyoutKeyword(),
|
||||
printer);
|
||||
|
||||
// copyout_zero()?
|
||||
printOperandList(getCopyoutZeroOperands(),
|
||||
ParallelOp::getCopyoutZeroKeyword(), printer);
|
||||
|
||||
// create()?
|
||||
printOperandList(getCreateOperands(), ParallelOp::getCreateKeyword(),
|
||||
printer);
|
||||
|
||||
// create_zero()?
|
||||
printOperandList(getCreateZeroOperands(), ParallelOp::getCreateZeroKeyword(),
|
||||
printer);
|
||||
|
||||
// no_create()?
|
||||
printOperandList(getNoCreateOperands(), ParallelOp::getNoCreateKeyword(),
|
||||
printer);
|
||||
|
||||
// present()?
|
||||
printOperandList(getPresentOperands(), ParallelOp::getPresentKeyword(),
|
||||
printer);
|
||||
|
||||
// deviceptr()?
|
||||
printOperandList(getDevicePtrOperands(), ParallelOp::getDevicePtrKeyword(),
|
||||
printer);
|
||||
|
||||
// attach()?
|
||||
printOperandList(getAttachOperands(), ParallelOp::getAttachKeyword(),
|
||||
printer);
|
||||
|
||||
// private()?
|
||||
printOperandList(getGangPrivateOperands(), ParallelOp::getPrivateKeyword(),
|
||||
printer);
|
||||
|
||||
// firstprivate()?
|
||||
printOperandList(getGangFirstPrivateOperands(),
|
||||
ParallelOp::getFirstPrivateKeyword(), printer);
|
||||
|
||||
printer << ' ';
|
||||
printer.printRegion(getRegion(),
|
||||
/*printEntryBlockArgs=*/false,
|
||||
/*printBlockTerminators=*/true);
|
||||
printer.printOptionalAttrDictWithKeyword(
|
||||
(*this)->getAttrs(), ParallelOp::getOperandSegmentSizeAttr());
|
||||
}
|
||||
|
||||
unsigned ParallelOp::getNumDataOperands() {
|
||||
return getReductionOperands().size() + getCopyOperands().size() +
|
||||
getCopyinOperands().size() + getCopyinReadonlyOperands().size() +
|
||||
|
@ -178,7 +178,7 @@ func.func @testparallelop(%a: !llvm.ptr, %b: memref<10xf32>, %c: !llvm.ptr) -> (
|
||||
return
|
||||
}
|
||||
|
||||
// CHECK: acc.parallel copyin(%{{.*}}: !llvm.struct<"openacc_data", (struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>, ptr, i64)>) deviceptr(%{{.*}}: !llvm.ptr) attach(%{{.*}}: !llvm.ptr)
|
||||
// CHECK: acc.parallel attach(%{{.*}}: !llvm.ptr) copyin(%{{.*}}: !llvm.struct<"openacc_data", (struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>, ptr, i64)>) deviceptr(%{{.*}} : !llvm.ptr)
|
||||
|
||||
// -----
|
||||
|
||||
@ -189,7 +189,7 @@ func.func @testparallelop(%a: memref<10xf32>, %b: memref<10xf32>) -> () {
|
||||
return
|
||||
}
|
||||
|
||||
// CHECK: acc.parallel if(%{{.*}}) copyin_readonly(%{{.*}}: !llvm.struct<"openacc_data", (struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>, ptr, i64)>) copyout_zero(%{{.*}}: !llvm.struct<"openacc_data.1", (struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>, ptr, i64)>)
|
||||
// CHECK: acc.parallel copyin_readonly(%{{.*}}: !llvm.struct<"openacc_data", (struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>, ptr, i64)>) copyout_zero(%{{.*}}: !llvm.struct<"openacc_data.1", (struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>, ptr, i64)>) if(%{{.*}})
|
||||
|
||||
// -----
|
||||
|
||||
@ -204,20 +204,20 @@ func.func @testparallelop(%a: !llvm.ptr, %b: memref<10xf32>, %c: !llvm.ptr) -> (
|
||||
// -----
|
||||
|
||||
func.func @testparallelop(%a: memref<10xf32>, %b: memref<10xf32>) -> () {
|
||||
acc.parallel present(%a: memref<10xf32>, %b: memref<10xf32>) {
|
||||
acc.parallel present(%a, %b : memref<10xf32>, memref<10xf32>) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// CHECK: acc.parallel present(%{{.*}}: !llvm.struct<"openacc_data", (struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>, ptr, i64)>, %{{.*}}: !llvm.struct<"openacc_data.1", (struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>, ptr, i64)>)
|
||||
// CHECK: acc.parallel present(%{{.*}}, %{{.*}} : !llvm.struct<"openacc_data", (struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>, ptr, i64)>, !llvm.struct<"openacc_data.1", (struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>, ptr, i64)>)
|
||||
|
||||
// -----
|
||||
|
||||
func.func @testparallelop(%i: i64, %a: memref<10xf32>, %b: memref<10xf32>) -> () {
|
||||
acc.parallel num_gangs(%i: i64) present(%a: memref<10xf32>, %b: memref<10xf32>) {
|
||||
acc.parallel num_gangs(%i: i64) present(%a, %b : memref<10xf32>, memref<10xf32>) {
|
||||
} attributes {async}
|
||||
return
|
||||
}
|
||||
|
||||
// CHECK: acc.parallel num_gangs(%{{.*}}: i64) present(%{{.*}}: !llvm.struct<"openacc_data", (struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>, ptr, i64)>, %{{.*}}: !llvm.struct<"openacc_data.1", (struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>, ptr, i64)>)
|
||||
// CHECK: acc.parallel num_gangs(%{{.*}}: i64) present(%{{.*}}, %{{.*}} : !llvm.struct<"openacc_data", (struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>, ptr, i64)>, !llvm.struct<"openacc_data.1", (struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>, ptr, i64)>)
|
||||
// CHECK-NEXT: } attributes {async}
|
||||
|
@ -37,7 +37,7 @@ func.func @compute1(%A: memref<10x10xf32>, %B: memref<10x10xf32>, %C: memref<10x
|
||||
// CHECK-NEXT: %{{.*}} = arith.constant 10 : index
|
||||
// CHECK-NEXT: %{{.*}} = arith.constant 1 : index
|
||||
// CHECK-NEXT: [[ASYNC:%.*]] = arith.constant 1 : i64
|
||||
// CHECK-NEXT: acc.parallel async([[ASYNC]]: i64) {
|
||||
// CHECK-NEXT: acc.parallel async([[ASYNC]] : i64) {
|
||||
// CHECK-NEXT: acc.loop gang vector {
|
||||
// CHECK-NEXT: scf.for %{{.*}} = %{{.*}} to %{{.*}} step %{{.*}} {
|
||||
// CHECK-NEXT: scf.for %{{.*}} = %{{.*}} to %{{.*}} step %{{.*}} {
|
||||
@ -164,7 +164,7 @@ func.func @compute3(%a: memref<10x10xf32>, %b: memref<10x10xf32>, %c: memref<10x
|
||||
// CHECK-NEXT: [[NUMGANG:%.*]] = arith.constant 10 : i64
|
||||
// CHECK-NEXT: [[NUMWORKERS:%.*]] = arith.constant 10 : i64
|
||||
// CHECK-NEXT: acc.data present(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : memref<10x10xf32>, memref<10x10xf32>, memref<10xf32>, memref<10xf32>) {
|
||||
// CHECK-NEXT: acc.parallel num_gangs([[NUMGANG]]: i64) num_workers([[NUMWORKERS]]: i64) private([[ARG2]]: memref<10xf32>) {
|
||||
// CHECK-NEXT: acc.parallel num_gangs([[NUMGANG]] : i64) num_workers([[NUMWORKERS]] : i64) private([[ARG2]] : memref<10xf32>) {
|
||||
// CHECK-NEXT: acc.loop gang {
|
||||
// CHECK-NEXT: scf.for %{{.*}} = [[C0]] to [[C10]] step [[C1]] {
|
||||
// CHECK-NEXT: acc.loop worker {
|
||||
@ -370,7 +370,7 @@ func.func @testparallelop(%a: memref<10xf32>, %b: memref<10xf32>, %c: memref<10x
|
||||
}
|
||||
acc.parallel wait(%idxValue: index) {
|
||||
}
|
||||
acc.parallel wait(%i64value: i64, %i32value: i32, %idxValue: index) {
|
||||
acc.parallel wait(%i64value, %i32value, %idxValue : i64, i32, index) {
|
||||
}
|
||||
acc.parallel num_gangs(%i64value: i64) {
|
||||
}
|
||||
@ -390,21 +390,21 @@ func.func @testparallelop(%a: memref<10xf32>, %b: memref<10xf32>, %c: memref<10x
|
||||
}
|
||||
acc.parallel vector_length(%idxValue: index) {
|
||||
}
|
||||
acc.parallel copyin(%a: memref<10xf32>, %b: memref<10xf32>) {
|
||||
acc.parallel copyin(%a, %b : memref<10xf32>, memref<10xf32>) {
|
||||
}
|
||||
acc.parallel copyin_readonly(%a: memref<10xf32>, %b: memref<10xf32>) {
|
||||
acc.parallel copyin_readonly(%a, %b : memref<10xf32>, memref<10xf32>) {
|
||||
}
|
||||
acc.parallel copyin(%a: memref<10xf32>) copyout_zero(%b: memref<10xf32>, %c: memref<10x10xf32>) {
|
||||
acc.parallel copyin(%a: memref<10xf32>) copyout_zero(%b, %c : memref<10xf32>, memref<10x10xf32>) {
|
||||
}
|
||||
acc.parallel copyout(%b: memref<10xf32>, %c: memref<10x10xf32>) create(%a: memref<10xf32>) {
|
||||
acc.parallel copyout(%b, %c : memref<10xf32>, memref<10x10xf32>) create(%a: memref<10xf32>) {
|
||||
}
|
||||
acc.parallel copyout_zero(%b: memref<10xf32>, %c: memref<10x10xf32>) create_zero(%a: memref<10xf32>) {
|
||||
acc.parallel copyout_zero(%b, %c : memref<10xf32>, memref<10x10xf32>) create_zero(%a: memref<10xf32>) {
|
||||
}
|
||||
acc.parallel no_create(%a: memref<10xf32>) present(%b: memref<10xf32>, %c: memref<10x10xf32>) {
|
||||
acc.parallel no_create(%a: memref<10xf32>) present(%b, %c : memref<10xf32>, memref<10x10xf32>) {
|
||||
}
|
||||
acc.parallel deviceptr(%a: memref<10xf32>) attach(%b: memref<10xf32>, %c: memref<10x10xf32>) {
|
||||
acc.parallel deviceptr(%a: memref<10xf32>) attach(%b, %c : memref<10xf32>, memref<10x10xf32>) {
|
||||
}
|
||||
acc.parallel private(%a: memref<10xf32>, %c: memref<10x10xf32>) firstprivate(%b: memref<10xf32>) {
|
||||
acc.parallel private(%a, %c : memref<10xf32>, memref<10x10xf32>) firstprivate(%b: memref<10xf32>) {
|
||||
}
|
||||
acc.parallel {
|
||||
} attributes {defaultAttr = #acc<defaultvalue none>}
|
||||
@ -423,53 +423,53 @@ func.func @testparallelop(%a: memref<10xf32>, %b: memref<10xf32>, %c: memref<10x
|
||||
// CHECK: [[I64VALUE:%.*]] = arith.constant 1 : i64
|
||||
// CHECK: [[I32VALUE:%.*]] = arith.constant 1 : i32
|
||||
// CHECK: [[IDXVALUE:%.*]] = arith.constant 1 : index
|
||||
// CHECK: acc.parallel async([[I64VALUE]]: i64) {
|
||||
// CHECK: acc.parallel async([[I64VALUE]] : i64) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel async([[I32VALUE]]: i32) {
|
||||
// CHECK: acc.parallel async([[I32VALUE]] : i32) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel async([[IDXVALUE]]: index) {
|
||||
// CHECK: acc.parallel async([[IDXVALUE]] : index) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel wait([[I64VALUE]]: i64) {
|
||||
// CHECK: acc.parallel wait([[I64VALUE]] : i64) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel wait([[I32VALUE]]: i32) {
|
||||
// CHECK: acc.parallel wait([[I32VALUE]] : i32) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel wait([[IDXVALUE]]: index) {
|
||||
// CHECK: acc.parallel wait([[IDXVALUE]] : index) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel wait([[I64VALUE]]: i64, [[I32VALUE]]: i32, [[IDXVALUE]]: index) {
|
||||
// CHECK: acc.parallel wait([[I64VALUE]], [[I32VALUE]], [[IDXVALUE]] : i64, i32, index) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel num_gangs([[I64VALUE]]: i64) {
|
||||
// CHECK: acc.parallel num_gangs([[I64VALUE]] : i64) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel num_gangs([[I32VALUE]]: i32) {
|
||||
// CHECK: acc.parallel num_gangs([[I32VALUE]] : i32) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel num_gangs([[IDXVALUE]]: index) {
|
||||
// CHECK: acc.parallel num_gangs([[IDXVALUE]] : index) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel num_workers([[I64VALUE]]: i64) {
|
||||
// CHECK: acc.parallel num_workers([[I64VALUE]] : i64) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel num_workers([[I32VALUE]]: i32) {
|
||||
// CHECK: acc.parallel num_workers([[I32VALUE]] : i32) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel num_workers([[IDXVALUE]]: index) {
|
||||
// CHECK: acc.parallel num_workers([[IDXVALUE]] : index) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel vector_length([[I64VALUE]]: i64) {
|
||||
// CHECK: acc.parallel vector_length([[I64VALUE]] : i64) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel vector_length([[I32VALUE]]: i32) {
|
||||
// CHECK: acc.parallel vector_length([[I32VALUE]] : i32) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel vector_length([[IDXVALUE]]: index) {
|
||||
// CHECK: acc.parallel vector_length([[IDXVALUE]] : index) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel copyin([[ARGA]]: memref<10xf32>, [[ARGB]]: memref<10xf32>) {
|
||||
// CHECK: acc.parallel copyin([[ARGA]], [[ARGB]] : memref<10xf32>, memref<10xf32>) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel copyin_readonly([[ARGA]]: memref<10xf32>, [[ARGB]]: memref<10xf32>) {
|
||||
// CHECK: acc.parallel copyin_readonly([[ARGA]], [[ARGB]] : memref<10xf32>, memref<10xf32>) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel copyin([[ARGA]]: memref<10xf32>) copyout_zero([[ARGB]]: memref<10xf32>, [[ARGC]]: memref<10x10xf32>) {
|
||||
// CHECK: acc.parallel copyin([[ARGA]] : memref<10xf32>) copyout_zero([[ARGB]], [[ARGC]] : memref<10xf32>, memref<10x10xf32>) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel copyout([[ARGB]]: memref<10xf32>, [[ARGC]]: memref<10x10xf32>) create([[ARGA]]: memref<10xf32>) {
|
||||
// CHECK: acc.parallel copyout([[ARGB]], [[ARGC]] : memref<10xf32>, memref<10x10xf32>) create([[ARGA]] : memref<10xf32>) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel copyout_zero([[ARGB]]: memref<10xf32>, [[ARGC]]: memref<10x10xf32>) create_zero([[ARGA]]: memref<10xf32>) {
|
||||
// CHECK: acc.parallel copyout_zero([[ARGB]], [[ARGC]] : memref<10xf32>, memref<10x10xf32>) create_zero([[ARGA]] : memref<10xf32>) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel no_create([[ARGA]]: memref<10xf32>) present([[ARGB]]: memref<10xf32>, [[ARGC]]: memref<10x10xf32>) {
|
||||
// CHECK: acc.parallel no_create([[ARGA]] : memref<10xf32>) present([[ARGB]], [[ARGC]] : memref<10xf32>, memref<10x10xf32>) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel deviceptr([[ARGA]]: memref<10xf32>) attach([[ARGB]]: memref<10xf32>, [[ARGC]]: memref<10x10xf32>) {
|
||||
// CHECK: acc.parallel attach([[ARGB]], [[ARGC]] : memref<10xf32>, memref<10x10xf32>) deviceptr([[ARGA]] : memref<10xf32>) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel private([[ARGA]]: memref<10xf32>, [[ARGC]]: memref<10x10xf32>) firstprivate([[ARGB]]: memref<10xf32>) {
|
||||
// CHECK: acc.parallel firstprivate([[ARGB]] : memref<10xf32>) private([[ARGA]], [[ARGC]] : memref<10xf32>, memref<10x10xf32>) {
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: acc.parallel {
|
||||
// CHECK-NEXT: } attributes {defaultAttr = #acc<defaultvalue none>}
|
||||
|
Loading…
Reference in New Issue
Block a user