[PATCH] D124220: [OpenMP] Add options to only compile the host or device when offloading

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 26 13:48:45 PDT 2022

tra added inline comments.

Comment at: clang/include/clang/Driver/Options.td:2535-2538
+def foffload_device_only : Flag<["-"], "foffload-device-only">,
+  HelpText<"Only compile for the offloading device.">;
+def foffload_host_only : Flag<["-"], "foffload-host-only">,
+  HelpText<"Only compile for the offloading host.">;
jhuber6 wrote:
> tra wrote:
> > We should probably alias `--cuda-host-only`/`--cuda-device-only` to these.
> Unfortunately I can't make these a strict alias for `-foffload-host-only`/`-foffload-device-only` without breaking their current usage. I could just check them along with these new versions, but that makes it a little cluttered.
Could you give me an example why we can use just one set of options to control host-only and device-only compilation?

Is that because we also have `--cuda-compile-host-device`?
Or is it because `-f` options have `-fno-` variants to override them, while `--cuda-host/device-only` don't, so we can't just mark them as an alias in Options.td?
To think of it, those are just facets of the same issue -- difference in the options syntax.
I do not see semantic differences between the existing options and -foffload-*-only.

E.g. I believe you could've used --cuda-host-only and --cuda-device-only  instead of -foffload-*-only without the loss of functionality of your patch.

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list