Bug 105662 - [RFC][OpenMP][OpenMP] - permit disabling host-fallback mode?
Summary: [RFC][OpenMP][OpenMP] - permit disabling host-fallback mode?
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 13.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: openacc, openmp
Depends on:
Blocks:
 
Reported: 2022-05-19 15:13 UTC by Tobias Burnus
Modified: 2022-05-20 06:31 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2022-05-19 15:13:30 UTC
The following issue came up / was mentioned elsewhere:

   It can be useful do disable host fallback
   and generate only device/nonhost versions
   for (OpenMP) target / (OpenACC) compute regions.

Some other closed-source compilers have this feature and Clang recently got that
feature.

Some users seem to interested in this to avoid creating separate functions – and
then using 'omp declare variant' / OpenACC's 'bind' clause for them.

Additionally, some might prefer it to effectively force mandatory on-device calculation and to save some bytes from the generated binary.


However, I note that the (main) reason that Clang got it was a different one
according to the reasoning given in the commit:

https://github.com/llvm/llvm-project/commit/47d66255701a5cfeab6c05e3642a2cccf7a4c09f
    Date:   Thu Apr 21 20:13:33 2022 -0400

    [OpenMP] Add options to only compile the host or device when offloading
    
    OpenMP recently moved to the new offloading driver, this had the effect
    of making it more difficult to inspect intermediate code for the device.
    This patch adds `-foffload-host-only` and `-foffload-device-only` to
    control which sides get compiled. This will allow users to more easily
    inspect output without needing the temp files.
    
    Reviewed By: tra
    
    Differential Revision: https://reviews.llvm.org/D124220

It uses:

def offload_device_only : Flag<["--"], "offload-device-only">,
  HelpText<"Only compile for the offloading device.">;

def offload_host_only : Flag<["--"], "offload-host-only">,
  HelpText<"Only compile for the offloading host.">;

def offload_host_device : Flag<["--"], "offload-host-device">,
  HelpText<"Only compile for the offloading host.">;
Comment 1 Richard Biener 2022-05-20 06:31:29 UTC
I think that first of all controlling this per OMP/OACC region would be more useful (as for the "mandatory on-device" case).  Shouldn't there be sth in the respective specs for this?