This patch unlocks the "--offload-device-only", "--offload-host-only" and
"--offload-host-device" options available in Clang for use by the Flang driver.
These can be used to modify the behavior of the driver to select which
compilation invocations are triggered during OpenMP offloading.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thank you for the quick review! These options just modify which flang-new -fc1 invocations are produced by the driver when compiling for device offloading. I have added tests that check that only the expected invocations are present, but if these tests are not what you'd expect I'd gladly make some more if you can explain a bit further what you had in mind.
Cheers!
These can be used to modify the behavior of the driver to select which compilation passes are triggered during OpenMP offloading.
In the context of LLVM, I would normally associate "pass" with something else. I'm not that familiar with offloading, so perhaps that's the language that people use? Personally, in the context of the driver I'd normally use the term "phase" rather than "pass".
This patch makes sense, though I'd like the following to be addressed before landing this:
- Where's the logic that implements what --offload-host-device? It looks like this is already implemented elsewhere and this patch simply "unlocks" (rather than "implements") this option for Flang.
- The name of "omp-frontend-forwarding.f90" is very misleading. "Forwarding" would mean flang-new --offload-host-only %s --> flang-new -fc1 --offload-host-only %s, but that's not what's happening here, is it?
For 1. you could just update the summary, and for 2. I suggest renaming "omp-frontend-forwarding.f90" as e.g. "omp-compiler-flag-expansion.f90". WDYT?
clang/include/clang/Driver/Options.td | ||
---|---|---|
2738 | Why is CoreOption needed here? Wouldn't FlangOption be sufficient? | |
flang/test/Driver/omp-driver-offload.f90 | ||
14 | [nit] You can reduce noise by using OFFLOAD-HOST-DEVICE instead of CHECK-OFFLOAD-HOST-DEVICE. I think that most people understand that these are CHECK prefixes anyway. | |
19 | [nit] No harm in being a bit more verbose to communicate the intent a bit clearer :) | |
30 | Shouldn't there be 2 driver invocation for the host, as in the the CHECK-OFFLOAD-HOST-DEVICE case? |
I updated the patch title and summary, and renamed the test file to something that I think represents better the contents of the test. Thank you again for the suggestions, let me know if there are any other improvements to make before landing this patch.
clang/include/clang/Driver/Options.td | ||
---|---|---|
2738 | You're right, thanks for the comment. | |
flang/test/Driver/omp-driver-offload.f90 | ||
30 | In this case only the first invocation would remain, but I added an additional OFFLOAD-HOST-NOT to make this behavior explicit |
LGTM, thanks for addressing my comments. I'd wait a day before landing this - just in case other reviewers have comments.
Why is CoreOption needed here? Wouldn't FlangOption be sufficient?