Commit Graph

91 Commits

Author SHA1 Message Date
Valentin Clement
e939dbc314 [flang][openacc] Add lowering for multiply operator
Add support for the * operation in OpenACC lowering. Support is added
for the types currently supported.

Depends on D151564

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D151565
2023-06-01 22:17:04 +09:00
Valentin Clement
59ceb7dd9a [flang][openacc] Initial reduction clause lowering
Add initial support to lower reduction clause to its representation in MLIR.

This patch adds support for addition of integer and real scalar types. Other
operators and types will be added with follow up patches.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D151564
2023-06-01 22:15:28 +09:00
Valentin Clement
b4b9ed75d3 [flang][openacc][NFC] Remove unused function
Now that operands have moved to the new data operands lowering, this
function is not used anymore.

Reviewed By: vzakhari

Differential Revision: https://reviews.llvm.org/D151357
2023-05-24 14:00:46 -07:00
Valentin Clement
99e880b672 [flang][openacc][NFC] Add API to create acc.private.recipe from FIR type
Simply make the creation of acc.private.recipe accesible through an API.
This will be useful when we will implement passes like the implicit
privatization.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D151230
2023-05-23 15:08:44 -07:00
Valentin Clement
d2fddaef53 [mlir][flang][openacc] Use new private representation for acc.loop
Update acc.loop private operands list to use the new design
introduced in D150622.

Depends on D150975

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D150984
2023-05-22 09:52:43 -07:00
Valentin Clement
580c31f446 [flang][openacc] Add initial support to lower private clause to the new design
This patch adds the initial infrastructure to lower the private clause to the
new design introduced in D150622. The init region is not implemented yet
and currently only yield the input argument (semantic is then similar with the previous
design currently). Implementation will come in a follow up patch to keep patch.

This patch also re-enable test commented out for `acc serial`, `acc serial loop`,
`acc parallel` and `acc parallel loop` with private clause.

Depends on D150972, D150973

Reviewed By: razvanlupusoru, jeanPerier

Differential Revision: https://reviews.llvm.org/D150975
2023-05-22 09:52:11 -07:00
Valentin Clement
38423349ce [flang][openacc] Lower host_data construct
Lower host_data construct to the acc.host_data operation.

Depends on D150289

Reviewed By: razvanlupusoru, jeanPerier

Differential Revision: https://reviews.llvm.org/D150290
2023-05-15 11:22:39 -07:00
Valentin Clement
1e463942f4 [mlir][openacc] Cleanup acc.kernels from old data clause operands
Remove old clause operands from acc.kernels operation since
the new dataOperands is now in place.
private and firstprivate will receive some redesign but are
not part of the new dataOperands.

Depends on D150224

Reviewed By: vzakhari

Differential Revision: https://reviews.llvm.org/D150225
2023-05-10 08:38:03 -07:00
Valentin Clement
3484745a5f [mlir][openacc] Cleanup acc.serial from old data clause operands
Remove old clause operands from acc.serial operation since
the new dataOperands is now in place.
private and firstprivate will receive some redesign but are
not part of the new dataOperands.

Depends on D150207

Reviewed By: vzakhari

Differential Revision: https://reviews.llvm.org/D150224
2023-05-10 08:34:25 -07:00
Valentin Clement
b60e49165e [flang][openacc] Preserve user order for entry data operand on compute construct
The order of operand in clauses that are decomposed was not
preserved. This patch change how operands are handled and preserve
the user ordering for the entry data operation on the acc.parallel
operation.

Reviewed By: vzakhari

Differential Revision: https://reviews.llvm.org/D150214
2023-05-10 08:31:53 -07:00
Valentin Clement
63d79eb331 [flang][openacc] Preserve user order for entry data operand on data construct
The order of operand in clauses that are decomposed was not
preserved. This patch change how operands are handled and preserve
the user ordering for the entry data operation on the acc.data
operation.

Reviewed By: vzakhari

Differential Revision: https://reviews.llvm.org/D150213
2023-05-10 08:22:38 -07:00
Valentin Clement
5e983942d5 [mlir][openacc] Cleanup acc.parallel from old data clause operands
Remove old clause operands from acc.parallel operation since
the new dataOperands is now in place.
private, firstprivate and reductions will receive some redesign but are
not part of the new dataOperands.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D150207
2023-05-09 14:57:50 -07:00
Valentin Clement
a6055edbe3 [flang][openacc] Fix lowerbound when there is no subscripts
The lowerbound was not correctly normalized to 0 when the bound
are generated for an array without subscripts.

```
integer :: a(11:20)
!$acc enter data create(a)
```

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D150208
2023-05-09 14:27:27 -07:00
Valentin Clement
46e1b095c9 [mlir][openacc] Cleanup acc.data from old data clause operands
Since the new data operand operations have been added in D148389 and
adopted on acc.data in D149673, the old clause operands are no longer
needed.

The LegalizeDataOpForLLVMTranslation will become obsolete when all
operations will be cleaned. For the time being only the appropriate
part are being removed.

processOperands will also receive some updates once all the operands
will be coming from an acc data operand operation.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D150155
2023-05-09 13:21:37 -07:00
Valentin Clement
bb6a1eb003 Revert "[flang][openacc] Fix lowerbound when there is no subscripts"
This reverts commit 626aa8518d.
2023-05-09 12:59:14 -07:00
Valentin Clement
626aa8518d [flang][openacc] Fix lowerbound when there is no subscripts
The lowerbound was not correctly normalized to 0 when the bound
are generated for an array without subscripts.

```
integer :: a(11:20)
!$acc enter data create(a)
```

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D150208
2023-05-09 12:22:07 -07:00
Valentin Clement
15a480c05e [mlir][openacc] Cleanup acc.exit_data from old data clause operands
Since the new data operand operations have been added in D148389 and
adopted on acc.exit_data in D149601, the old clause operands are no longer
needed.

The LegalizeDataOpForLLVMTranslation will become obsolete when all
operations will be cleaned. For the time being only the appropriate
part are being removed.

processOperands will also receive some updates once all the operands
will be coming from an acc data operand operation.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D150145
2023-05-09 11:36:48 -07:00
Valentin Clement
ee1557f865 [flang][openacc] Lower self clause on acc update as host clause
Self clause is the same same as the host clause. Lower it
in a simmilar way.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D150174
2023-05-09 10:33:57 -07:00
Valentin Clement
9dec07f44a [mlir][openacc] Cleanup acc.enter_data from old data clause operands
Since the new data operand operations have been added in D148389 and
adopted on acc.enter_data in D148721, the old clause operands are no longer
needed.

The LegalizeDataOpForLLVMTranslation will become obsolete when all
operations will be cleaned. For the time being only the appropriate
part are being removed.

processOperands will also receive some updates once all the operands
will be coming from an acc data operand operation.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D150132
2023-05-09 09:01:30 -07:00
Valentin Clement
f2031ac90e [flang][openacc] Lower if_present clause correctly on acc update
The `if_present` clause is modeled as an attribute on the
acc.update operation. The lowering was not adding correctly the attribute
when the clause was present. This patch update the lowering to add
the attribute when needed.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D150171
2023-05-09 08:59:50 -07:00
Valentin Clement
689afa88ae [mlir][openacc] Cleanup acc.update from old data clause operands
Since the new data operand operations have been added in D148389 and
adopted on acc.update in D149909, the old clause operands are no longer
needed. This is a first patch to start cleaning the OpenACC operations
with data clause operands.

The `LegalizeDataOpForLLVMTranslation` will become obsolete when all
operations will be cleaned. For the time being only the appropriate
part are being removed.

`processOperands` will also receive some updates once all the operands
will be coming from an acc data operand operation.

Reviewed By: razvanlupusoru, jeanPerier

Differential Revision: https://reviews.llvm.org/D150053
2023-05-08 10:03:28 -07:00
Valentin Clement
d9d06d11ca [flang][openacc] Lower host and device clauses to data operand ops
Update OpenACC update construct lowering to create
the data operand operations for host and device clauses.

Depends on D149909

Reviewed By: razvanlupusoru, jeanPerier

Differential Revision: https://reviews.llvm.org/D149910
2023-05-05 12:02:06 -07:00
Valentin Clement
437bc5640f [mlir][openacc] Switch host/device clauses to data operand operations
Introduce acc.update_host and acc.update_device as data
operands operation to be used by the acc.update op.

Reviewed By: razvanlupusoru, jeanPerier

Differential Revision: https://reviews.llvm.org/D149909
2023-05-05 12:01:27 -07:00
Valentin Clement
ac8c032c85 [flang][openacc] Lower data clause on compute construct to data operand ops
This patch lowers the data clause on the OpenACC compute construct
to their corresponding acc data operand operation.
The decomposition is the same as in D149673.

Note that `private` and `firstprivate` are not lowered to data operand operation as they do not have one and will likely have dedicated design/process.

Depends on D149673

Reviewed By: razvanlupusoru, jeanPerier

Differential Revision: https://reviews.llvm.org/D149785
2023-05-04 11:15:25 -07:00
Valentin Clement
3bcc28becd [flang][openacc] Lower data construct operand to data operand operations
This patch lowers the data clause on the OpenACC data construct
to their corresponding acc data operand operation.
The copy clause is decomposed into acc.copyin before and acc.copyout after
the acc.data operation.
The copyout close is decomposed into acc.create before and acc.copyout after
the acc.data operation.
The attach clause is decomposed into acc.attach before and acc.detach after
the acc.data operation.

Depends on D149601

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D149673
2023-05-04 10:37:06 -07:00
Valentin Clement
734adda353 [flang][openacc] Lower copyout, detach and delete to data exit operations
Add support to lower data exit operations and use it for the
copyout, detach and delete clause on the `!$acc exit data` construct.

This patch refactor the data entry op creation so most part of the code
can be shared with the data exit op.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D149601
2023-05-04 09:39:25 -07:00
Valentin Clement
83478a1e52 [flang][openacc] Add proper TODO for reduction lowering
Reduction clause on loop or compute constructs
is not currently lowered but no TODO message was issued.
Add a proper TODO so the user is informed.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D149789
2023-05-03 15:43:57 -07:00
Valentin Clement
be093277bb [flang][openacc] Always lower bounds with lb, ub and stride information
Since we have all the information while lowering, always
add the lowerbound, upperbound and stride information for acc.bounds
create from the Flang frontend.

Reviewed By: razvanlupusoru, jeanPerier

Differential Revision: https://reviews.llvm.org/D149704
2023-05-03 09:44:10 -07:00
Valentin Clement
d756f8a38a [flang][openacc] Remove unused variable
Fix buildbot failure after landing D149385
2023-05-01 16:24:22 -07:00
Valentin Clement
2a333e9104 [flang][openacc] Add basic support for derived type component in data operand
Add lowering support for derived type component appearing
in a data clause to the newly added data operand operations.

Depends on D149297

Reviewed By: razvanlupusoru, jeanPerier

Differential Revision: https://reviews.llvm.org/D149385
2023-05-01 16:16:20 -07:00
Valentin Clement
0f1a8b458d [flang][openacc][NFC] Fix typos segement -> segment 2023-05-01 11:28:20 -07:00
Valentin Clement
4b80a8c72d [flang][openacc][NFC] Cleanup enter data lowering
Remove copyinOperands, createOperands, createZeroOperands, attachOperands
SmallVectors as they are not used anymore.
The op itself cannot be cleanup yet because
`mlir/lib/Target/LLVMIR/Dialect/OpenACC/OpenACCToLLVMIRTranslation.cpp`
still depends on it. The final clean up on the op will be down once
the translation uses the new data operand operations.

Reviewed By: vzakhari

Differential Revision: https://reviews.llvm.org/D149467
2023-04-28 11:51:14 -07:00
Valentin Clement
03ad9d1be3 [flang][openacc] Generate acc.bound op when local array is passed without subscript
Add support to generate the acc.bound operation when the array is passed without
any subscripts. Without this patch, no bound is generated.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D149297
2023-04-27 21:03:52 -07:00
Valentin Clement
1b7c6cc688 [flang][openacc] Add support for allocatable and pointer in data operand
Add lowering support for allocatable and pointer array sections
to acc.bounds and acc data operations.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D149189
2023-04-25 21:06:26 -07:00
Valentin Clement
6e711b951c [flang][openacc] Add initial support to lower assumed size array in data operand
Add lowering for assumed size array in data clause to the newly
added data operand operations.

Depends on D148840

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D148969
2023-04-25 13:27:11 -07:00
Valentin Clement
9f548c1824 [flang][openacc] Support array section with non constant bounds
Add lowering for non constant lower and upper bounds
in array section.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D148840
2023-04-24 10:12:40 -07:00
Valentin Clement
f38d8be41a [flang][openacc] Fix the value of lower bound, upper bound and extent
Update the lowering to match the intent of the newly added operation
as described here D148860.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D148932
2023-04-21 13:22:48 -07:00
Valentin Clement
dc55d47683 [flang][openacc] Support array section with constant lb or ub for data operand
Add support for array section with constant lower or upper bound.
The current lowering will trigger a TODO when the array is assumed size
or if the lower or upper bound is a variable.

Depends on D148721

Reviewed By: razvanlupusoru, jeanPerier

Differential Revision: https://reviews.llvm.org/D148748
2023-04-20 10:53:47 -07:00
Valentin Clement
376402bef1 [flang][openacc] Add basic lowering to new data operations for acc.enter_data
This is an initial patch that lowers acc.enter_data copyin/create/attach
clauses to the newly added data operand operations. Follow up patches will
add support for array section and derived type and derived type component
as well as support in other data operation.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D148721
2023-04-19 15:52:46 -07:00
Razvan Lupusoru
c184dcb458 [mlir][openacc] Add separate acc data operations for OpenACC data clauses
As outlined in [1], data clauses are now implemented as separate operations
from the constructs that they belong to. Some of the highlighted benefits:
- Correctly represent dataflow of data operations
- Easier to track debugging information
- Friendlier to add attributes and to optimize operations

For now, all of the other operand lists are being kept until all references
to them in LLVM can be removed (such as those in flang lowering)

[1] https://discourse.llvm.org/t/rfc-openacc-dialect-data-operation-improvements/69825

Reviewed By: clementval, vzakhari

Differential Revision: https://reviews.llvm.org/D148389
2023-04-18 15:36:38 -07:00
Valentin Clement
b6c1930d56 [mlir][openacc][NFC] Use assembly format for acc.loop
Use the assembly format with custom parser/printer
for specific clauses instead of a full custom parser/printer.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D148391
2023-04-17 12:45:04 -07:00
Valentin Clement
e1d1da71cb Revert "[mlir][openacc][NFC] Use assembly format for acc.loop"
This reverts commit 7960993e46.
2023-04-17 08:05:51 -07:00
Valentin Clement
7960993e46 [mlir][openacc][NFC] Use assembly format for acc.loop
Use the assembly format with custom parser/printer
for specific clauses instead of a full custom parser/printer.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D148391
2023-04-17 07:53:19 -07:00
Valentin Clement
3163f7ade2 [flang][openacc] Add kernels construct lowering
Lower the parse tree to acc dialects operations. Make use
of the compute construct lowering.

Depends on D148277

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D148278
2023-04-14 09:44:07 -07:00
Valentin Clement
d30b4e515a [flang][openacc] Lower serial and serial loop construct
Lower the parse tree to acc dialects operations. Make use
of the parallel construct lowering and make it suitable
for all compute constructs lowering.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D148273
2023-04-13 15:36:11 -07:00
Valentin Clement
bc7c9be7b1 [flang][openacc] Add proper TODO for the block construct
Trigger the not yet implemented message for
block constructs that are not lowered.

Reviewed By: PeteSteinfeld, razvanlupusoru

Differential Revision: https://reviews.llvm.org/D148253
2023-04-13 11:33:16 -07:00
Valentin Clement
3d683cb9f1 [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
2023-04-13 10:15:08 -07:00
River Riddle
c692a11e69 [mlir] Flip Async/GPU/MemRef/OpenACC/OpenMP/PDL dialects to prefixed
This flips all of the remaining dialects to prefixed except for linalg, which
will be done in a followup.

Differential Revision: https://reviews.llvm.org/D134995
2022-09-30 16:55:30 -07:00
River Riddle
986b5c56ea [mlir] Flip Async/GPU/OpenACC/OpenMP to use Both accessors
This allows for incrementally updating the old API usages without
needing to update everything at once. These will be left on Both
for a little bit and then flipped to prefixed when all APIs have been
updated.

Differential Revision: https://reviews.llvm.org/D134386
2022-09-21 17:36:13 -07:00
Valentin Clement
83fa975679 [flang][openacc] Handle array section and derived-type components operands
This patch lowers correctly operands with array section
and derived-type component.

Depends on D131764

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D131765
2022-08-13 20:40:31 +02:00