[mlir][openacc] Add OpenACC translation to LLVM IR (enter_data op create/copyin)
authorValentin Clement <clementval@gmail.com>
Wed, 12 May 2021 15:41:03 +0000 (11:41 -0400)
committerclementval <clementval@gmail.com>
Wed, 12 May 2021 17:41:14 +0000 (13:41 -0400)
commit113b807017847f7d9e79db724f09968b51459cf0
tree927a0f8efac1eb5535bdf997c1e44fe196b149d2
parent81f56a2eb3797eb5be61d65a8f7d7e19456e67d1
[mlir][openacc] Add OpenACC translation to LLVM IR (enter_data op create/copyin)

This patch begins to translate acc.enter_data operation to call to tgt runtime call.
It currently only translate create/copyin operands of memref type. This acts as a basis to add support
for FIR types in the Flang/OpenACC support. It follows more or less a similar path than clang
with `omp target enter data map` directives.
This patch is taking a different approach than D100678 and perform a translation to LLVM IR
and make use of the OpenMPIRBuilder instead of doing a conversion to the LLVMIR dialect.

OpenACC support in Flang will rely on the current OpenMP runtime where 1:1 lowering can be
applied. Some extension will be added where features are not available yet.

Big part of this code will be shared for other standalone data operations in the OpenACC
dialect such as acc.exit_data and acc.update.

It is likely that parts of the lowering can also be shared later with the ops for
standalone data directives in the OpenMP dialect when they are introduced.

This is an initial translation and it probably needs more work.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D101504
mlir/include/mlir/Target/LLVMIR/Dialect/All.h
mlir/include/mlir/Target/LLVMIR/Dialect/OpenACC/OpenACCToLLVMIRTranslation.h [new file with mode: 0644]
mlir/lib/Target/LLVMIR/CMakeLists.txt
mlir/lib/Target/LLVMIR/Dialect/CMakeLists.txt
mlir/lib/Target/LLVMIR/Dialect/OpenACC/CMakeLists.txt [new file with mode: 0644]
mlir/lib/Target/LLVMIR/Dialect/OpenACC/OpenACCToLLVMIRTranslation.cpp [new file with mode: 0644]
mlir/test/Target/LLVMIR/openacc-llvm.mlir [new file with mode: 0644]