[openacc] Add dialect definition for acc declare
authorRazvan Lupusoru <rlupusoru@nvidia.com>
Fri, 14 Jul 2023 17:40:57 +0000 (10:40 -0700)
committerRazvan Lupusoru <rlupusoru@nvidia.com>
Tue, 18 Jul 2023 15:11:06 +0000 (08:11 -0700)
commit7496177d983265974a0705d583e61e00d004fc5e
treef5d15089da6eb23b946ba7b978bf8e1a64842975
parentcde72af3dbb68dd3cc3b1012225551ccf3879713
[openacc] Add dialect definition for acc declare

A declare directive is used to specify the creation of a visible device
copy of a variable for the duration of the implicit data region as it
relates to the scope in which the variable is declared.

In order to support this, the following new operations were added:
1) `acc.global_ctor` and `acc.global_dtor`. These are used whenever the
declare directive applies to a global.
2) `acc.declare_enter` and `acc.declare_exit`. These operations are
modeled similarly to `acc.enter_data` and `acc.exit_data`. The reason
they are not modeled like `acc.data` is so that these operations can be
used both for globals and regions like functions.
3) `acc.declare_device_resident` and `acc.declare_link`. These
operations are modeled in a manner consistent with previously defined
data entry operation model.

The `acc.getdeviceptr` was generalized so that it can be used with
acc.declare_exit.

Reviewed By: clementval, vzakhari

Differential Revision: https://reviews.llvm.org/D155322
mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
mlir/test/Dialect/OpenACC/ops.mlir