[PATCH] D144864: [Flang][Driver][MLIR] Add -fopenmp-is-device to Flang and link to an omp.is_device attribute
Andrew Gozillon via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 3 09:03:16 PST 2023
agozillon added a comment.
The new update adds the suggested new tests! Thank you very much @awarzynski for suggesting them that was a great help. Hopefully the new additions cover what you have requested, if not I am of course happy to change or add more tests as needed.
================
Comment at: clang/lib/Driver/ToolChains/Flang.cpp:121-125
+ if (IsOpenMPDevice) {
+ // -fopenmp-is-device is passed along to tell the frontend that it is
+ // generating code for a device, so that only the relevant declarations are
+ // emitted.
+ CmdArgs.push_back("-fopenmp-is-device");
----------------
awarzynski wrote:
> Can you add a test for this section?
I have added a new test file flang-omp.f90 which aims to test that the appropriate flags are generated when openmp related flags are used it currently checks for -fopenmp/fopenmp-is-device
================
Comment at: flang/test/Lower/OpenMP/omp-is-device.f90:1
+!RUN: %flang_fc1 -emit-fir -fopenmp -fopenmp-is-device %s -o - | FileCheck %s --check-prefix=DEVICE
+!RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s --check-prefix=HOST
----------------
awarzynski wrote:
> What happens if `-fopenmp-is-device` is used without `-fopnemp`?
I think I now cover this in the test with the *-DEVICE-FLAG-ONLY tests, currently it is silently ignored and nothing is applied to the module.
================
Comment at: flang/tools/bbc/bbc.cpp:127
+static llvm::cl::opt<bool>
+ enableOpenMPDevice("fopenmp-is-device",
+ llvm::cl::desc("enable openmp device compilation"),
----------------
awarzynski wrote:
> This option is not tested
I believe I now test this in the omp-is-device.f90 test!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144864/new/
https://reviews.llvm.org/D144864
More information about the cfe-commits
mailing list